Skip to content

Commit 34ca25b

Browse files
committed
Use the truncated times/charges for creating digits
Add Digitizer Precisions to WCSimRootOptions
1 parent c48e42f commit 34ca25b

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

include/WCSimRootOptions.hh

+6
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ public:
5555
void SetDigitizerClassName(string iDigitizerClassName) {DigitizerClassName = iDigitizerClassName;}
5656
void SetDigitizerDeadTime(int iDigitizerDeadTime) {DigitizerDeadTime = iDigitizerDeadTime;}
5757
void SetDigitizerIntegrationWindow(int iDigitizerIntegrationWindow) {DigitizerIntegrationWindow = iDigitizerIntegrationWindow;}
58+
void SetDigitizerTimingPrecision(double iDigitizerTimingPrecision) {DigitizerTimingPrecision = iDigitizerTimingPrecision;}
59+
void SetDigitizerPEPrecision(double iDigitizerPEPrecision) {DigitizerPEPrecision = iDigitizerPEPrecision;}
5860
//WCSimWCDigitizer* gets
5961
string GetDigitizerClassName() {return DigitizerClassName;}
6062
int GetDigitizerDeadTime() {return DigitizerDeadTime;}
6163
int GetDigitizerIntegrationWindow() {return DigitizerIntegrationWindow;}
64+
int GetDigitizerTimingPrecision() {return DigitizerTimingPrecision;}
65+
int GetDigitizerPEPrecision() {return DigitizerPEPrecision;}
6266
//WCSimWCTrigger* sets
6367
void SetTriggerClassName(string itriggerClassName) {TriggerClassName = itriggerClassName;};
6468
void SetMultiDigitsPerTrigger(bool imultiDigitsPerTrigger) {MultiDigitsPerTrigger = imultiDigitsPerTrigger;};
@@ -139,6 +143,8 @@ private:
139143
string DigitizerClassName;
140144
int DigitizerDeadTime; // ns
141145
int DigitizerIntegrationWindow; // ns
146+
int DigitizerTimingPrecision; //
147+
int DigitizerPEPrecision; //
142148

143149
//WCSimWCTrigger*
144150
string TriggerClassName;

src/WCSimRootOptions.cc

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ void WCSimRootOptions::Print(Option_t *) const
4444
<< "\tDigitizerClassName: " << DigitizerClassName << endl
4545
<< "\tDigitizerDeadTime: " << DigitizerDeadTime << " ns" << endl
4646
<< "\tDigitizerIntegrationWindow: " << DigitizerIntegrationWindow << " ns" << endl
47+
<< "\tDigitizerTimingPrecision: " << DigitizerTimingPrecision << " ns" << endl
48+
<< "\tDigitizerPEPrecision: " << DigitizerPEPrecision << " ns" << endl
4749
<< "Trigger options:" << endl
4850
<< "\tTriggerClassName: " << TriggerClassName << endl
4951
<< "\tMultiDigitsPerTrigger: " << MultiDigitsPerTrigger << endl

src/WCSimWCDigitizer.cc

+18-14
Original file line numberDiff line numberDiff line change
@@ -107,31 +107,33 @@ void WCSimWCDigitizerBase::Digitize()
107107

108108
bool WCSimWCDigitizerBase::AddNewDigit(int tube, int gate, float digihittime, float peSmeared, std::vector<int> digi_comp)
109109
{
110+
//digitised hit information does not have infinite precision
111+
//so need to round the charge and time information
112+
double digihittime_d = Truncate(digihittime, DigitizerTimingPrecision);
113+
double peSmeared_d = Truncate(peSmeared, DigitizerPEPrecision);
114+
110115
//gate is not a trigger, but just the position of the digit in the array
111116
//inside the WCSimWCDigi object
112117
#ifdef WCSIMWCDIGITIZER_VERBOSE
113118
if(tube < NPMTS_VERBOSE) {
114119
G4cout<<"Adding hit "<<gate<<" in tube "<<tube
115-
<< " with time " << digihittime << " charge " << peSmeared
120+
<< " with time " << digihittime_d << " charge " << peSmeared_d
121+
<< " (truncated from t: " << digihittime << " q: " << peSmeared << ")"
116122
<< " (made of " << digi_comp.size() << " raw hits with IDs ";
117123
for(unsigned int iv = 0; iv < digi_comp.size(); iv++)
118124
G4cout << " " << digi_comp[iv] << ",";
119125
G4cout << ")";
120126
}
121127
#endif
122128

123-
//digitised hit information does not have infinite precision
124-
//so need to round the charge and time information
125-
double digihittime_d = Truncate(digihittime, DigitizerTimingPrecision);
126-
double peSmeared_d = Truncate(peSmeared, DigitizerPEPrecision);
127-
129+
//use un-truncated peSmeared here, so that truncation does not affect the test
128130
if (peSmeared > 0.0) {
129131
if ( DigiStoreHitMap[tube] == 0) {
130132
WCSimWCDigi* Digi = new WCSimWCDigi();
131133
Digi->SetTubeID(tube);
132-
Digi->SetPe(gate,peSmeared);
133-
Digi->AddPe(digihittime);
134-
Digi->SetTime(gate,digihittime);
134+
Digi->SetPe(gate,peSmeared_d);
135+
Digi->AddPe(digihittime_d);
136+
Digi->SetTime(gate,digihittime_d);
135137
Digi->AddDigiCompositionInfo(digi_comp);
136138
DigiStoreHitMap[tube] = DigiStore->insert(Digi);
137139
#ifdef WCSIMWCDIGITIZER_VERBOSE
@@ -140,9 +142,9 @@ bool WCSimWCDigitizerBase::AddNewDigit(int tube, int gate, float digihittime, fl
140142
#endif
141143
}
142144
else {
143-
(*DigiStore)[DigiStoreHitMap[tube]-1]->SetPe(gate,peSmeared);
144-
(*DigiStore)[DigiStoreHitMap[tube]-1]->SetTime(gate,digihittime);
145-
(*DigiStore)[DigiStoreHitMap[tube]-1]->AddPe(digihittime);
145+
(*DigiStore)[DigiStoreHitMap[tube]-1]->SetPe(gate,peSmeared_d);
146+
(*DigiStore)[DigiStoreHitMap[tube]-1]->SetTime(gate,digihittime_d);
147+
(*DigiStore)[DigiStoreHitMap[tube]-1]->AddPe(digihittime_d);
146148
(*DigiStore)[DigiStoreHitMap[tube]-1]->AddDigiCompositionInfo(digi_comp);
147149
#ifdef WCSIMWCDIGITIZER_VERBOSE
148150
if(tube < NPMTS_VERBOSE)
@@ -154,8 +156,8 @@ bool WCSimWCDigitizerBase::AddNewDigit(int tube, int gate, float digihittime, fl
154156
else {
155157
#ifdef WCSIMWCDIGITIZER_VERBOSE
156158
if(tube < NPMTS_VERBOSE)
157-
G4cout << "DIGIT REJECTED with charge " << peSmeared
158-
<< " time " << digihittime << G4endl;
159+
G4cout << "DIGIT REJECTED with charge " << peSmeared_d
160+
<< " time " << digihittime_d << G4endl;
159161
#endif
160162
return false;
161163
}
@@ -166,6 +168,8 @@ void WCSimWCDigitizerBase::SaveOptionsToOutput(WCSimRootOptions * wcopt)
166168
wcopt->SetDigitizerClassName(DigitizerClassName);
167169
wcopt->SetDigitizerDeadTime(DigitizerDeadTime);
168170
wcopt->SetDigitizerIntegrationWindow(DigitizerIntegrationWindow);
171+
wcopt->SetDigitizerTimingPrecision(DigitizerTimingPrecision);
172+
wcopt->SetDigitizerPEPrecision(DigitizerPEPrecision);
169173
}
170174

171175

0 commit comments

Comments
 (0)