Skip to content

Commit

Permalink
added DETECTOR_INEFFICIENCY and APPLY_THRESHOLDS options
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurizio Ungaro committed Feb 13, 2023
1 parent d67ae2f commit f6053fb
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 19 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.sconsign.dblite
*.o
gui/src/moc_camera_control.cc
gui/src/moc_detector_editor.cc
Expand Down
5 changes: 5 additions & 0 deletions hitprocess/HPS/ECAL_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ map<string, double> ECAL_HitProcess :: integrateDgt(MHit* aHit, int hitn)
dgtz["adc"] = adc;
dgtz["tdc"] = tdc;

// define conditions to reject hit
if(rejectHitConditions) {
writeHit = false;
}

return dgtz;
}

Expand Down
5 changes: 5 additions & 0 deletions hitprocess/HPS/SVT_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ map<string, double> SVT_HitProcess :: integrateDgt(MHit* aHit, int hitn)
dgtz["module"] = module;
dgtz["strip"] = strip;

// define conditions to reject hit
if(rejectHitConditions) {
writeHit = false;
}

return dgtz;
}

Expand Down
5 changes: 5 additions & 0 deletions hitprocess/HPS/muon_hodo_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ map<string, double> muon_hodo_HitProcess :: integrateDgt(MHit* aHit, int hitn)
dgtz["tdcl"] = tdcl;
dgtz["tdcr"] = tdcr;

// define conditions to reject hit
if(rejectHitConditions) {
writeHit = false;
}

return dgtz;
}

Expand Down
5 changes: 5 additions & 0 deletions hitprocess/bdx/cormo_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ map<string, double> cormo_HitProcess :: integrateDgt(MHit* aHit, int hitn)
dgtz["tdcb"] = TDCB;
dgtz["tdcf"] = TDCF;

// define conditions to reject hit
if (rejectHitConditions) {
writeHit = false;
}

return dgtz;
}

Expand Down
5 changes: 5 additions & 0 deletions hitprocess/bdx/crs_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ map<string, double> crs_HitProcess :: integrateDgt(MHit* aHit, int hitn)
dgtz["tdcb"] = TDCB*1000.;//original time in ps
dgtz["tdcf"] = 0;

// define conditions to reject hit
if (rejectHitConditions) {
writeHit = false;
}

return dgtz;
}

Expand Down
3 changes: 0 additions & 3 deletions hitprocess/clas12/alert/ahdc_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,6 @@ map<string, double> ahdc_HitProcess::integrateDgt(MHit* aHit, int hitn) {
dgtz["ADC_ped"] = doca*1000;


// decide if write an hit or not
rejectHitConditions = false;
writeHit = true;
// define conditions to reject hit
if (rejectHitConditions) {
writeHit = false;
Expand Down
3 changes: 0 additions & 3 deletions hitprocess/clas12/alert/alertshell_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ map<string, double> alertshell_HitProcess::integrateDgt(MHit* aHit, int hitn) {
// cout << " value in hitn var: " << hitn << endl;
// cout << " ************** Hit ended! **************** " << endl;

// decide if write an hit or not
rejectHitConditions = false;
writeHit = true;
// define conditions to reject hit
if (rejectHitConditions) {
writeHit = false;
Expand Down
4 changes: 1 addition & 3 deletions hitprocess/clas12/alert/atof_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,7 @@ map<string, double> atof_HitProcess::integrateDgt(MHit* aHit, int hitn) {
dgtz["ADC_time"] = time;
dgtz["ADC_ped"] = 0;

// decide if write an hit or not
rejectHitConditions = false;
writeHit = true;

// define conditions to reject hit
if (rejectHitConditions) {
writeHit = false;
Expand Down
6 changes: 3 additions & 3 deletions hitprocess/clas12/band_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ map<string, double> band_HitProcess :: integrateDgt(MHit* aHit, int hitn)


// define conditions to reject hit
//if(rejectHitConditions) {
// writeHit = false;
//}
if(rejectHitConditions) {
writeHit = false;
}
//cout << "RETURNING DGTZ\n";
return dgtz;
}
Expand Down
2 changes: 1 addition & 1 deletion hitprocess/clas12/cnd_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ map<string, double> cnd_HitProcess :: integrateDgt(MHit* aHit, int hitn)
dgtz["TDC_TDC"] = TDC;

// reject hit if below threshold or efficiency
if ( eTotal < threshold ) {
if ( eTotal < threshold && applyThresholds) {
rejectHitConditions = true;
}

Expand Down
10 changes: 8 additions & 2 deletions hitprocess/clas12/ctof_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,20 @@ map<string, double> ctof_HitProcess::integrateDgt(MHit* aHit, int hitn)
dgtz["TDC_TDC"] = (int) tdc;

// reject hit if below threshold or efficiency
if ( energyDepositedAttenuated < ctc.threshold[sector - 1][layer - 1][side][paddle - 1] ) {
if ( energyDepositedAttenuated < ctc.threshold[sector - 1][layer - 1][side][paddle - 1] && applyThresholds ) {
rejectHitConditions = true;
}

double random = G4UniformRand();
if ( random > ctc.efficiency[sector - 1][layer - 1][side][paddle - 1] ) {
if ( random > ctc.efficiency[sector - 1][layer - 1][side][paddle - 1] && applyInefficiencies) {
rejectHitConditions = true;
}

// define conditions to reject hit
if(rejectHitConditions) {
writeHit = false;
}

return dgtz;
}

Expand Down
4 changes: 2 additions & 2 deletions hitprocess/clas12/ftof_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ map<string, double> ftof_HitProcess::integrateDgt(MHit* aHit, int hitn) {


// reject hit if below threshold or efficiency
if ( energyDepositedAttenuated < ftc.threshold[sector - 1][panel - 1][pmt][paddle - 1] ) {
if ( energyDepositedAttenuated < ftc.threshold[sector - 1][panel - 1][pmt][paddle - 1] && applyThresholds) {
rejectHitConditions = true;
}
double random = G4UniformRand();
Expand All @@ -418,7 +418,7 @@ map<string, double> ftof_HitProcess::integrateDgt(MHit* aHit, int hitn) {
// << ftc.threshold[sector - 1][panel - 1][pmt][paddle - 1] << " and efficiency " << ftc.efficiency[sector - 1][panel - 1][pmt][paddle - 1]
// << " random " << random << endl;

if ( random > ftc.efficiency[sector - 1][panel - 1][pmt][paddle - 1] ) {
if ( random > ftc.efficiency[sector - 1][panel - 1][pmt][paddle - 1] && applyInefficiencies) {
rejectHitConditions = true;
}

Expand Down
5 changes: 5 additions & 0 deletions hitprocess/clas12/rtpc_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ map<string, double> rtpc_HitProcess :: integrateDgt(MHit* aHit, int hitn)

}

// define conditions to reject hit
if(rejectHitConditions) {
writeHit = false;
}

return dgtz;
}

Expand Down
5 changes: 5 additions & 0 deletions hitprocess/clas12/uRwell/uRwell_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ map<string, double>uRwell_HitProcess :: integrateDgt(MHit* aHit, int hitn)

// cout<<dgtz["sector"]<<" "<< dgtz["layer"]<< " "<< dgtz["component"] << " "<< dgtz["ADC"]<< " "<< dgtz["time"]<<" "<< 1e6*tInfos.eTot<<endl;

// define conditions to reject hit
if (rejectHitConditions) {
writeHit = false;
}

return dgtz;

}
Expand Down
5 changes: 5 additions & 0 deletions hitprocess/injector/bubble_hitprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ map<string, double> bubble_HitProcess :: integrateDgt(MHit* aHit, int hitn)
dgtz["pid"] = thisPid;
dgtz["hitn"] = hitn;

// define conditions to reject hit
if(rejectHitConditions) {
writeHit = false;
}

return dgtz;
}

Expand Down
4 changes: 4 additions & 0 deletions sensitivity/HitProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class HitProcess
gpars = gp;
verbosity = gemcOpt.optMap["HIT_VERBOSITY"].arg;
accountForHardwareStatus = gemcOpt.optMap["HARDWARESTATUS"].arg;
applyInefficiencies = gemcOpt.optMap["DETECTOR_INEFFICIENCY"].arg;
applyThresholds = gemcOpt.optMap["APPLY_THRESHOLDS"].arg;

log_msg = " > " + HCname + " Hit Process ";
HCname = name;
Expand Down Expand Up @@ -145,6 +147,8 @@ class HitProcess
string log_msg;
bool rejectHitConditions;
bool accountForHardwareStatus;
bool applyInefficiencies;
bool applyThresholds;

inline double DGauss(double x, double *par, double Edep, double stepTime)
{
Expand Down
15 changes: 14 additions & 1 deletion src/gemc_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,20 @@ void goptions::setGoptions()
optMap["HARDWARESTATUS"].type = 0;
optMap["HARDWARESTATUS"].ctgr = "control";


optMap["DETECTOR_INEFFICIENCY"].arg = 0;
optMap["DETECTOR_INEFFICIENCY"].name = "Accounts for detector inefficiency";
optMap["DETECTOR_INEFFICIENCY"].help = "Accounts for detector inefficiency\n";
optMap["DETECTOR_INEFFICIENCY"].help += "This flag can be used by the digitization routines to account for hardware status\n";
optMap["DETECTOR_INEFFICIENCY"].type = 0;
optMap["DETECTOR_INEFFICIENCY"].ctgr = "control";

optMap["APPLY_THRESHOLDS"].arg = 0;
optMap["APPLY_THRESHOLDS"].name = "Accounts for detector thresholds";
optMap["APPLY_THRESHOLDS"].help = "Accounts for detector thresholds\n";
optMap["APPLY_THRESHOLDS"].help += "This flag can be used by the digitization routines to account for hardware status\n";
optMap["APPLY_THRESHOLDS"].type = 0;
optMap["APPLY_THRESHOLDS"].ctgr = "control";



// Output
Expand Down

0 comments on commit f6053fb

Please sign in to comment.