Skip to content

Commit

Permalink
merged changes from connor on MIE scattering, alert group on digitiza…
Browse files Browse the repository at this point in the history
…tion and YuchunHung for rtpc
  • Loading branch information
maureeungaro committed Jul 18, 2024
1 parent c70d5a1 commit c5f260d
Show file tree
Hide file tree
Showing 16 changed files with 576 additions and 345 deletions.
40 changes: 13 additions & 27 deletions diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@
# note: the script is meant to run one directory up from clas12tags
prompt="no"

next_release=$(ls release_notes | grep '.md' | grep -v all | sort -u | tail -1 | awk -F. '{print $1"."$2}')

next_release=$(ls release_notes | grep -v dev | grep '.md' | awk -F. '{print $1"."$2}' | sort -V | tail -1)

# if dev.md is different than $next_release.md, then copy dev.md to $next_release.md
if [[ -f release_notes/dev.md ]]; then
if [[ -f release_notes/$next_release.md ]]; then
if [[ $(diff release_notes/dev.md release_notes/$next_release.md) ]]; then
cp release_notes/dev.md release_notes/$next_release.md
fi
else
cp release_notes/dev.md release_notes/$next_release.md
fi
fi

# if argument is given, set prompt to yes
if [[ $# -gt 0 ]]; then
Expand Down Expand Up @@ -57,29 +69,3 @@ sed -i 's/const char.*/'$new_string'/' source/gemc.cc
printf "\n- Changing initializeBMTConstants and initializeFMTConstants to initialize before processID"
sed -i s/'initializeBMTConstants(-1)'/'initializeBMTConstants(1)'/ source/hitprocess/clas12/micromegas/BMT_hitprocess.cc
sed -i s/'initializeFMTConstants(-1)'/'initializeFMTConstants(1)'/ source/hitprocess/clas12/micromegas/FMT_hitprocess.cc

printf "\n- Removing evio support for clas12tags\n\n"
sed -i s/'env = init_environment("qt5 geant4 clhep evio xercesc ccdb mlibrary cadmesh hipo c12bfields")'/'env = init_environment("qt5 geant4 clhep xercesc ccdb mlibrary cadmesh hipo c12bfields")'/ source/SConstruct
sed -i s/'output\/evio_output.cc'/''/ source/SConstruct


sed -i s/'\/\/ EVIO'/''/ source/output/outputFactory.h
sed -i s/'#pragma GCC diagnostic push'/''/ source/output/outputFactory.h
sed -i s/'#pragma GCC diagnostic ignored "-Wdeprecated-declarations" '/''/ source/output/outputFactory.h
sed -i s/'#pragma GCC diagnostic ignored "-Wdeprecated"'/''/ source/output/outputFactory.h
sed -i s/'#include "evioUtil.hxx"'/''/ source/output/outputFactory.h
sed -i s/'#include "evioFileChannel.hxx"'/''/ source/output/outputFactory.h
sed -i s/'#pragma GCC diagnostic pop'/''/ source/output/outputFactory.h
sed -i s/'using namespace evio;'/''/ source/output/outputFactory.h
sed -i s/'evioFileChannel \*pchan;'/''/ source/output/outputFactory.h


sed -i s/'#include "evio_output.h"'/''/ source/output/outputFactory.cc
sed -i s/'\/\/ EVIO Buffer size set to 30M words'/''/ source/output/outputFactory.cc
sed -i s/'int evio_buffer = EVIO_BUFFER;'/''/ source/output/outputFactory.cc
sed -i s/'if(outType == "evio") {'/'{'/ source/output/outputFactory.cc
sed -i s/'pchan = new evioFileChannel(trimSpacesFromString(outFile).c_str(), "w", evio_buffer);'/''/ source/output/outputFactory.cc
sed -i s/'pchan->open();'/''/ source/output/outputFactory.cc
sed -i s/'outputMap\["evio"\] = &evio_output::createOutput;'/''/ source/output/outputFactory.cc
sed -i s/'pchan->close();'/''/ source/output/outputFactory.cc
sed -i s/'delete pchan;'/''/ source/output/outputFactory.cc
35 changes: 35 additions & 0 deletions release_notes/5.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# clas12_tags dev

- RG-D RG-D Flag Assembly geometry and variations (Lamiaa)
- added MIE scattering to api and source code (Connor)
- RICH hit process: PMT quantum efficiencies (Connor)
- Alert hit process improvements (M. Paolone and )
- RTPC hit process improvements (YuchunHung)

```
> gemc version: gemc dev
> Environment:
> FIELD_DIR: /opt/jlab_software/noarch/data/magfield
> GEMC_DATA_DIR: /opt/jlab_software/1.1/macosx14-clang15/clas12Tags/dev
> G4DATA_DIR: /opt/jlab_software/1.1/macosx14-clang15/geant4/10.7.4/data/Geant4-10.7.4/data
> G4_VERSION: 10.7.4
> G4INSTALL: /opt/jlab_software/1.1/macosx14-clang15/geant4/10.7.4
```

<br>

### To load production tag 5.10 at JLab, use the following commands:

```
source /group/clas12/packages/setup.[c]sh
module load clas12
module switch gemc/5.10
```



<br>

4 changes: 4 additions & 0 deletions release_notes/dev.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# clas12_tags dev

- RG-D RG-D Flag Assembly geometry and variations (Lamiaa)
- added MIE scattering to api and source code (Connor)
- RICH hit process: PMT quantum efficiencies (Connor)
- Alert hit process improvements (M. Paolone and fizikci0147)
- RTPC hit process improvements (YuchunHung)

```
> gemc version: gemc dev
Expand Down
3 changes: 1 addition & 2 deletions source/gemc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/// \author \n &copy; Maurizio Ungaro
/// \author e-mail: [email protected]\n\n\n

const char *GEMC_VERSION = "gemc dev.md" ;
const char *GEMC_VERSION = "gemc 5.11" ;

// G4 headers
#include "G4RunManager.hh"
Expand Down Expand Up @@ -415,4 +415,3 @@ int main( int argc, char **argv )
// introducing OPTICALPHOTONPID here to be semi-transparent to G4 changes
// this pid changed from 0 to -22 with geant4 10.7
int MHit::OPTICALPHOTONPID = -22;
// int MHit::OPTICALPHOTONPID = 0;
16 changes: 15 additions & 1 deletion source/hitprocess/clas12/alert/ahdc_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@ map<string, double> ahdc_HitProcess::integrateDgt(MHit* aHit, int hitn) {
// time calculation
// signal_t = stepTime[s] + (H_abh/driftVelocity);
// cout << "signal_t: " << signal_t << ", stepTime: " << stepTime[s] << endl;

// docasig is a fit to sigma vs distance plot. A second order pol used for the fit (p0+p1*x+p2*x*x).
// drift velocity as a function of distance. pol2 fitted to t vs x plot and drift velocity is derived from the fit (1/(dt/dx)).
// both sig vs dist and t vs dist plots are taken from Lucien Causse's PhD thesis ("Development of a stereo drift chamber for the Jefferson Laboratory ALERT Experiment.").
// plots were digitized and then fitted to a pol2.

double driftP1=-16.17;
double driftP2=24.81;
double docasig = 337.3-210.3*doca+34.7*pow(doca,2);
std::default_random_engine dseed(time(0)); //seed
std::normal_distribution<double> ddist(doca, docasig); //a resuolution affect is added to doca.
double doca_r =ddist(dseed);
driftVelocity = 1./(driftP1+2.*driftP2*doca_r); // mm/ns // drift velocity as a function of distance. pol2 fitted to t vs x plot and drift velocity is then extracted from dx/dt, d/dt(p0+p1*x+p2*x^2)=p1+2*p2*x.
signal_tTimesEdep = signal_tTimesEdep + (stepTime[s] + H_abh/driftVelocity) * E_wire;
// cout << "signal_tTimesEdep: " << signal_tTimesEdep << endl;

Expand All @@ -271,7 +284,8 @@ map<string, double> ahdc_HitProcess::integrateDgt(MHit* aHit, int hitn) {
// Just to test, time is linear with doca
double a = 5.0;
double b = 5.0;
double time = a*doca+b + signal_tTimesEdep/E_tot_wire;
//double time = a*doca+b + signal_tTimesEdep/E_tot_wire;
double time = signal_tTimesEdep/E_tot_wire;
// double signal = 0.0;
// signal = signal_tTimesEdep/E_tot_wire;

Expand Down
46 changes: 40 additions & 6 deletions source/hitprocess/clas12/rich_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,43 @@ map<string, double> rich_HitProcess :: integrateDgt(MHit* aHit, int hitn)

writeHit = true;
rejectHitConditions = false;


int pmtType = 12700;
// sector 4: mix of H12700 and H8500
if(idsector == 4){
pmtType = richc.pmtType[idpmt-1];
}
double energy = aHit->GetEs()[0]/electronvolt;
double qeff = 0;
for(int i = 0; i < richc.nQEbins; i++){
if(energy < richc.Ene[i] && energy > richc.Ene[i+1]){
qeff = richc.QE[i];
break;

if(pmtType == 8500){
for(int i = 0; i < richc.nQEbinsH8500; i++){
if(energy < richc.Ene_H8500[i] && energy > richc.Ene_H8500[i+1]){
if( std::abs(energy - richc.Ene_H8500[i]) < std::abs(energy - richc.Ene_H8500[i+1])){
qeff = richc.QE_H8500[i];
}
else{
qeff = richc.QE_H8500[i+1];
}
break;
}
}
}
else if(pmtType == 12700){
for(int i = 0; i < richc.nQEbinsH12700; i++){
if(energy < richc.Ene_H12700[i] && energy > richc.Ene_H12700[i+1]){
if( std::abs(energy - richc.Ene_H12700[i]) < std::abs(energy - richc.Ene_H12700[i+1])){
qeff = richc.QE_H12700[i];
}
else{
qeff = richc.QE_H12700[i+1];
}
break;
}
}
}



// applying quantum efficiency from thrown random value set in integrateDgt
if( identity[2].userInfos[3] > qeff && !aHit->isElectronicNoise) {
Expand Down Expand Up @@ -223,8 +251,14 @@ vector<identifier> rich_HitProcess :: processID(vector<identifier> id, G4Step* a
G4ThreeVector pixelCenterLocal = getPixelCenter(pixel);
G4ThreeVector pixelCenterGlobal = prestep->GetTouchableHandle()->GetHistory()->GetTopTransform().Inverse().TransformPoint(pixelCenterLocal);

int idsector = yid[0].id;
int pmt = yid[1].id;
RichPixel richPixel(richc.pmtType[pmt-1]);
int pmtType = 12700;
// sector 4: mix of H8500 and H12700
if(idsector==4){
pmtType = richc.pmtType[pmt-1];
}
RichPixel richPixel(pmtType);
richPixel.Clear();

int t1 = -1;
Expand Down
30 changes: 24 additions & 6 deletions source/hitprocess/clas12/rich_hitprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ class richConstants
1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2,
1, 2, 3, 1, 2, 3};

// quantum efficiency table
const static int nQEbins=87;
double Ene[nQEbins]={6.148, 5.387,
// quantum efficiency tables
const static int nQEbinsH8500=87;
double Ene_H8500[nQEbinsH8500]={6.148, 5.387,
4.624, 4.558, 4.510, 4.432, 4.372, 4.285, 4.201, 4.081, 3.980, 3.815,
3.726, 3.591, 3.503, 3.410, 3.314, 3.214, 3.128, 3.054, 2.983, 2.902,
2.845, 2.783, 2.724, 2.668, 2.624, 2.572, 2.531, 2.487, 2.454, 2.431,
Expand All @@ -267,7 +267,7 @@ class richConstants
1.919, 1.914, 1.908, 1.902, 1.897, 1.894, 1.888, 1.883, 1.877, 1.872,
1.867, 1.861, 1.858, 1.853, 1.848};

double QE[nQEbins]={0.000, 0.000,
double QE_H8500[nQEbinsH8500]={0.000, 0.000,
0.11241, 0.12738, 0.14272, 0.16358, 0.18120, 0.20301, 0.22234, 0.24351, 0.25775, 0.27282,
0.27594, 0.27594, 0.27594, 0.27282, 0.26974, 0.26669, 0.26070, 0.25484, 0.24629, 0.23534,
0.22745, 0.21489, 0.20301, 0.18963, 0.17713, 0.16358, 0.15279, 0.13951, 0.12738, 0.11500,
Expand All @@ -277,7 +277,25 @@ class richConstants
0.00317, 0.00276, 0.00247, 0.00215, 0.00192, 0.00169, 0.00150, 0.00130, 0.00118, 0.00103,
0.00093, 0.00082, 0.00072, 0.00063, 0.00056, 0.00050, 0.00043, 0.00039, 0.00035, 0.00030,
0.00027, 0.00023, 0.00021, 0.00018, 0.00016};


// QE from official Hamamatsu table
const static int nQEbinsH12700 = 46;
double Ene_H12700[nQEbinsH12700] = {4.59185185, 4.42785714, 4.27517241, 4.13266667, 3.99935484,
3.874375 , 3.7569697 , 3.64647059, 3.54228571, 3.44388889,
3.35081081, 3.26263158, 3.17897436, 3.0995 , 3.02390244,
2.95190476, 2.88325581, 2.81772727, 2.75511111, 2.69521739,
2.63787234, 2.58291667, 2.53020408, 2.4796 , 2.43098039,
2.38423077, 2.33924528, 2.29592593, 2.25418182, 2.21392857,
2.17508772, 2.13758621, 2.10135593, 2.06633333, 2.03245902,
1.99967742, 1.96793651, 1.9371875 , 1.90738462, 1.87848485,
1.85044776, 1.82323529, 1.79681159, 1.77114286, 1.74619718,
1.72194444};
double QE_H12700[nQEbinsH12700] = { 0.1351, 0.2071, 0.2698, 0.3092, 0.3333, 0.3458, 0.3512, 0.3512, 0.3491, 0.3431, 0.3420, 0.3434,
0.3348, 0.3284, 0.3198, 0.3112, 0.30, 0.2858, 0.2666, 0.2484, 0.2331, 0.2210, 0.2078,
0.1817, 0.1440, 0.1169, 0.1010, 0.0895, 0.0793, 0.0698, 0.0605, 0.0515, 0.0428,
0.0347, 0.0271, 0.0204, 0.0147, 0.01, 0.0065, 0.004, 0.0023, 0.0013, 0.0007, 0.0003, 0.0002, 0.0001};


// two types of pmts used in sector 4 rich
int pmtType[391] = {12700, 12700, 12700, 12700, 12700, 12700, 8500, 8500, 12700, 12700, 12700, 8500, 8500, 8500, 8500, 8500, 8500, 8500,
8500, 8500, 8500, 8500, 8500, 8500, 8500, 8500, 8500, 12700, 12700, 12700, 8500, 8500, 12700, 12700, 12700, 12700,
Expand Down Expand Up @@ -347,7 +365,7 @@ class rich_HitProcess : public HitProcess
G4ThreeVector getPixelCenter(int pixel);

// testing ccdb time paramters vs PMT simulation class
bool ccdbTiming = true;
bool ccdbTiming = false;

// just converting double tdc to int for 1ns tdc precision
double tdc_precision = 1.;
Expand Down
Loading

0 comments on commit c5f260d

Please sign in to comment.