@@ -107,31 +107,33 @@ void WCSimWCDigitizerBase::Digitize()
107
107
108
108
bool WCSimWCDigitizerBase::AddNewDigit (int tube, int gate, float digihittime, float peSmeared, std::vector<int > digi_comp)
109
109
{
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
+
110
115
// gate is not a trigger, but just the position of the digit in the array
111
116
// inside the WCSimWCDigi object
112
117
#ifdef WCSIMWCDIGITIZER_VERBOSE
113
118
if (tube < NPMTS_VERBOSE) {
114
119
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 << " )"
116
122
<< " (made of " << digi_comp.size () << " raw hits with IDs " ;
117
123
for (unsigned int iv = 0 ; iv < digi_comp.size (); iv++)
118
124
G4cout << " " << digi_comp[iv] << " ," ;
119
125
G4cout << " )" ;
120
126
}
121
127
#endif
122
128
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
128
130
if (peSmeared > 0.0 ) {
129
131
if ( DigiStoreHitMap[tube] == 0 ) {
130
132
WCSimWCDigi* Digi = new WCSimWCDigi ();
131
133
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 );
135
137
Digi->AddDigiCompositionInfo (digi_comp);
136
138
DigiStoreHitMap[tube] = DigiStore->insert (Digi);
137
139
#ifdef WCSIMWCDIGITIZER_VERBOSE
@@ -140,9 +142,9 @@ bool WCSimWCDigitizerBase::AddNewDigit(int tube, int gate, float digihittime, fl
140
142
#endif
141
143
}
142
144
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 );
146
148
(*DigiStore)[DigiStoreHitMap[tube]-1 ]->AddDigiCompositionInfo (digi_comp);
147
149
#ifdef WCSIMWCDIGITIZER_VERBOSE
148
150
if (tube < NPMTS_VERBOSE)
@@ -154,8 +156,8 @@ bool WCSimWCDigitizerBase::AddNewDigit(int tube, int gate, float digihittime, fl
154
156
else {
155
157
#ifdef WCSIMWCDIGITIZER_VERBOSE
156
158
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;
159
161
#endif
160
162
return false ;
161
163
}
@@ -166,6 +168,8 @@ void WCSimWCDigitizerBase::SaveOptionsToOutput(WCSimRootOptions * wcopt)
166
168
wcopt->SetDigitizerClassName (DigitizerClassName);
167
169
wcopt->SetDigitizerDeadTime (DigitizerDeadTime);
168
170
wcopt->SetDigitizerIntegrationWindow (DigitizerIntegrationWindow);
171
+ wcopt->SetDigitizerTimingPrecision (DigitizerTimingPrecision);
172
+ wcopt->SetDigitizerPEPrecision (DigitizerPEPrecision);
169
173
}
170
174
171
175
0 commit comments