Skip to content

Commit f6053fb

Browse files
author
Maurizio Ungaro
committed
added DETECTOR_INEFFICIENCY and APPLY_THRESHOLDS options
1 parent d67ae2f commit f6053fb

18 files changed

+73
-19
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.sconsign.dblite
21
*.o
32
gui/src/moc_camera_control.cc
43
gui/src/moc_detector_editor.cc

hitprocess/HPS/ECAL_hitprocess.cc

+5
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ map<string, double> ECAL_HitProcess :: integrateDgt(MHit* aHit, int hitn)
8787
dgtz["adc"] = adc;
8888
dgtz["tdc"] = tdc;
8989

90+
// define conditions to reject hit
91+
if(rejectHitConditions) {
92+
writeHit = false;
93+
}
94+
9095
return dgtz;
9196
}
9297

hitprocess/HPS/SVT_hitprocess.cc

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ map<string, double> SVT_HitProcess :: integrateDgt(MHit* aHit, int hitn)
4242
dgtz["module"] = module;
4343
dgtz["strip"] = strip;
4444

45+
// define conditions to reject hit
46+
if(rejectHitConditions) {
47+
writeHit = false;
48+
}
49+
4550
return dgtz;
4651
}
4752

hitprocess/HPS/muon_hodo_hitprocess.cc

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ map<string, double> muon_hodo_HitProcess :: integrateDgt(MHit* aHit, int hitn)
4242
dgtz["tdcl"] = tdcl;
4343
dgtz["tdcr"] = tdcr;
4444

45+
// define conditions to reject hit
46+
if(rejectHitConditions) {
47+
writeHit = false;
48+
}
49+
4550
return dgtz;
4651
}
4752

hitprocess/bdx/cormo_hitprocess.cc

+5
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ map<string, double> cormo_HitProcess :: integrateDgt(MHit* aHit, int hitn)
199199
dgtz["tdcb"] = TDCB;
200200
dgtz["tdcf"] = TDCF;
201201

202+
// define conditions to reject hit
203+
if (rejectHitConditions) {
204+
writeHit = false;
205+
}
206+
202207
return dgtz;
203208
}
204209

hitprocess/bdx/crs_hitprocess.cc

+5
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,11 @@ map<string, double> crs_HitProcess :: integrateDgt(MHit* aHit, int hitn)
335335
dgtz["tdcb"] = TDCB*1000.;//original time in ps
336336
dgtz["tdcf"] = 0;
337337

338+
// define conditions to reject hit
339+
if (rejectHitConditions) {
340+
writeHit = false;
341+
}
342+
338343
return dgtz;
339344
}
340345

hitprocess/clas12/alert/ahdc_hitprocess.cc

-3
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,6 @@ map<string, double> ahdc_HitProcess::integrateDgt(MHit* aHit, int hitn) {
316316
dgtz["ADC_ped"] = doca*1000;
317317

318318

319-
// decide if write an hit or not
320-
rejectHitConditions = false;
321-
writeHit = true;
322319
// define conditions to reject hit
323320
if (rejectHitConditions) {
324321
writeHit = false;

hitprocess/clas12/alert/alertshell_hitprocess.cc

-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ map<string, double> alertshell_HitProcess::integrateDgt(MHit* aHit, int hitn) {
148148
// cout << " value in hitn var: " << hitn << endl;
149149
// cout << " ************** Hit ended! **************** " << endl;
150150

151-
// decide if write an hit or not
152-
rejectHitConditions = false;
153-
writeHit = true;
154151
// define conditions to reject hit
155152
if (rejectHitConditions) {
156153
writeHit = false;

hitprocess/clas12/alert/atof_hitprocess.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,7 @@ map<string, double> atof_HitProcess::integrateDgt(MHit* aHit, int hitn) {
327327
dgtz["ADC_time"] = time;
328328
dgtz["ADC_ped"] = 0;
329329

330-
// decide if write an hit or not
331-
rejectHitConditions = false;
332-
writeHit = true;
330+
333331
// define conditions to reject hit
334332
if (rejectHitConditions) {
335333
writeHit = false;

hitprocess/clas12/band_hitprocess.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ map<string, double> band_HitProcess :: integrateDgt(MHit* aHit, int hitn)
325325

326326

327327
// define conditions to reject hit
328-
//if(rejectHitConditions) {
329-
// writeHit = false;
330-
//}
328+
if(rejectHitConditions) {
329+
writeHit = false;
330+
}
331331
//cout << "RETURNING DGTZ\n";
332332
return dgtz;
333333
}

hitprocess/clas12/cnd_hitprocess.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ map<string, double> cnd_HitProcess :: integrateDgt(MHit* aHit, int hitn)
588588
dgtz["TDC_TDC"] = TDC;
589589

590590
// reject hit if below threshold or efficiency
591-
if ( eTotal < threshold ) {
591+
if ( eTotal < threshold && applyThresholds) {
592592
rejectHitConditions = true;
593593
}
594594

hitprocess/clas12/ctof_hitprocess.cc

+8-2
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,20 @@ map<string, double> ctof_HitProcess::integrateDgt(MHit* aHit, int hitn)
400400
dgtz["TDC_TDC"] = (int) tdc;
401401

402402
// reject hit if below threshold or efficiency
403-
if ( energyDepositedAttenuated < ctc.threshold[sector - 1][layer - 1][side][paddle - 1] ) {
403+
if ( energyDepositedAttenuated < ctc.threshold[sector - 1][layer - 1][side][paddle - 1] && applyThresholds ) {
404404
rejectHitConditions = true;
405405
}
406+
406407
double random = G4UniformRand();
407-
if ( random > ctc.efficiency[sector - 1][layer - 1][side][paddle - 1] ) {
408+
if ( random > ctc.efficiency[sector - 1][layer - 1][side][paddle - 1] && applyInefficiencies) {
408409
rejectHitConditions = true;
409410
}
410411

412+
// define conditions to reject hit
413+
if(rejectHitConditions) {
414+
writeHit = false;
415+
}
416+
411417
return dgtz;
412418
}
413419

hitprocess/clas12/ftof_hitprocess.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ map<string, double> ftof_HitProcess::integrateDgt(MHit* aHit, int hitn) {
409409

410410

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

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

hitprocess/clas12/rtpc_hitprocess.cc

+5
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,11 @@ map<string, double> rtpc_HitProcess :: integrateDgt(MHit* aHit, int hitn)
306306

307307
}
308308

309+
// define conditions to reject hit
310+
if(rejectHitConditions) {
311+
writeHit = false;
312+
}
313+
309314
return dgtz;
310315
}
311316

hitprocess/clas12/uRwell/uRwell_hitprocess.cc

+5
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ map<string, double>uRwell_HitProcess :: integrateDgt(MHit* aHit, int hitn)
106106

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

109+
// define conditions to reject hit
110+
if (rejectHitConditions) {
111+
writeHit = false;
112+
}
113+
109114
return dgtz;
110115

111116
}

hitprocess/injector/bubble_hitprocess.cc

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ map<string, double> bubble_HitProcess :: integrateDgt(MHit* aHit, int hitn)
2323
dgtz["pid"] = thisPid;
2424
dgtz["hitn"] = hitn;
2525

26+
// define conditions to reject hit
27+
if(rejectHitConditions) {
28+
writeHit = false;
29+
}
30+
2631
return dgtz;
2732
}
2833

sensitivity/HitProcess.h

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class HitProcess
7171
gpars = gp;
7272
verbosity = gemcOpt.optMap["HIT_VERBOSITY"].arg;
7373
accountForHardwareStatus = gemcOpt.optMap["HARDWARESTATUS"].arg;
74+
applyInefficiencies = gemcOpt.optMap["DETECTOR_INEFFICIENCY"].arg;
75+
applyThresholds = gemcOpt.optMap["APPLY_THRESHOLDS"].arg;
7476

7577
log_msg = " > " + HCname + " Hit Process ";
7678
HCname = name;
@@ -145,6 +147,8 @@ class HitProcess
145147
string log_msg;
146148
bool rejectHitConditions;
147149
bool accountForHardwareStatus;
150+
bool applyInefficiencies;
151+
bool applyThresholds;
148152

149153
inline double DGauss(double x, double *par, double Edep, double stepTime)
150154
{

src/gemc_options.cc

+14-1
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,20 @@ void goptions::setGoptions()
762762
optMap["HARDWARESTATUS"].type = 0;
763763
optMap["HARDWARESTATUS"].ctgr = "control";
764764

765-
765+
optMap["DETECTOR_INEFFICIENCY"].arg = 0;
766+
optMap["DETECTOR_INEFFICIENCY"].name = "Accounts for detector inefficiency";
767+
optMap["DETECTOR_INEFFICIENCY"].help = "Accounts for detector inefficiency\n";
768+
optMap["DETECTOR_INEFFICIENCY"].help += "This flag can be used by the digitization routines to account for hardware status\n";
769+
optMap["DETECTOR_INEFFICIENCY"].type = 0;
770+
optMap["DETECTOR_INEFFICIENCY"].ctgr = "control";
771+
772+
optMap["APPLY_THRESHOLDS"].arg = 0;
773+
optMap["APPLY_THRESHOLDS"].name = "Accounts for detector thresholds";
774+
optMap["APPLY_THRESHOLDS"].help = "Accounts for detector thresholds\n";
775+
optMap["APPLY_THRESHOLDS"].help += "This flag can be used by the digitization routines to account for hardware status\n";
776+
optMap["APPLY_THRESHOLDS"].type = 0;
777+
optMap["APPLY_THRESHOLDS"].ctgr = "control";
778+
766779

767780

768781
// Output

0 commit comments

Comments
 (0)