94{
95 hdata.clear();
96 LArG4Identifier identifier2;
97
98
99 G4double thisStepEnergyDeposit = a_step->GetTotalEnergyDeposit() * a_step->GetTrack()->GetWeight();
100 G4double thisStepLength = a_step->GetStepLength() / Units::mm;
101 G4double dstep = .1*Units::mm;
102
103#ifdef DEBUGSTEP
104 ATH_MSG_DEBUG(
"****** LArBarrelPresamplerCalculator: Step energy,length "
105 << thisStepEnergyDeposit << " " << thisStepLength);
106#endif
107 if(thisStepEnergyDeposit <= 0. || thisStepLength <= 0.)
108 {
109 return false;
110 }
111
112
113 G4StepPoint *thisStepPoint = a_step->GetPreStepPoint();
114 G4StepPoint *thisStepBackPoint = a_step->GetPostStepPoint();
115 G4ThreeVector startPoint = thisStepPoint->GetPosition();
116 G4ThreeVector endPoint = thisStepBackPoint->GetPosition();
117
118#ifdef DEBUGSTEP
120 << startPoint.x() << " " << startPoint.y() << " "
121 << startPoint.z());
123 << endPoint.x() << " " << endPoint.y() << " "
124 << endPoint.z());
125#endif
126
127
128
129
130 const G4NavigationHistory* g4navigation = thisStepPoint->GetTouchable()->GetHistory();
131 G4int ndep = g4navigation->GetDepth();
132 G4int idep = -999;
133
134#ifdef DEBUGSTEP
136#endif
137
138 const G4String presamplerName((
m_detectorName.empty()) ?
"LAr::Barrel::Presampler" :
140 for (G4int ii=0;ii<=ndep;ii++) {
141 G4VPhysicalVolume* v1 = g4navigation->GetVolume(ii);
142#ifdef DEBUGSTEP
143 ATH_MSG_DEBUG(
" Level,VolumeName " << ii <<
" " << v1->GetName());
144#endif
145
146 if (v1->GetName()==presamplerName) idep=ii;
147 }
148
149#ifdef DEBUGSTEP
151#endif
152
153 if (idep<0) {
154 ATH_MSG_WARNING(
" LArBarrelPresamplerCalculator::Process Presampler volume not found !!");
155 return false;
156 }
157
158
159 const G4AffineTransform transformation = g4navigation->GetTransform(idep);
160
161
162 G4ThreeVector startPointinLocal =
163 transformation.TransformPoint(startPoint);
164 G4ThreeVector endPointinLocal =
165 transformation.TransformPoint (endPoint);
166
167#ifdef DEBUGSTEP
169 << startPointinLocal.x() << " " << startPointinLocal.y() << " "
170 << startPointinLocal.z());
172 << endPointinLocal.x() << " " << endPointinLocal.y() << " "
173 << endPointinLocal.z());
174#endif
175
176
177
178
179
180 G4int nsub_step=1;
181 if (
m_IflCur) nsub_step=(
int) (thisStepLength*(1./dstep)) + 1;
182
183 G4double delta=1./((
double) nsub_step);
184#ifdef DEBUGSTEP
185 ATH_MSG_DEBUG(
" nsub_step,delta " << nsub_step <<
" " << delta);
186#endif
187
188 G4double
energy = a_step->GetTotalEnergyDeposit() * a_step->GetTrack()->GetWeight();
190 const double EField = 10. ;
191 const double wholeStepLengthCm = a_step->GetStepLength() / CLHEP::cm;
192 energy = (*m_birksLaw)(
energy, wholeStepLengthCm, EField);
193 }
194
195
196
197
198
200 for (G4int i=0;
i<nsub_step;
i++) {
201
202#ifdef DEBUGSTEP
204#endif
205
206
207 G4double fraction=(((G4double)
i)+0.5)*delta;
208 G4ThreeVector subinLocal=startPointinLocal*(1-fraction) + endPointinLocal*fraction;
209 G4double xloc = subinLocal.x();
210 G4double yloc = subinLocal.y();
211 G4double zloc = subinLocal.z();
212
213
214
215 LArG4::BarrelPresampler::CalcData currentCellData;
217
218
219 if (status) {
220
221
222 G4int zSide;
224 zSide = 1;
225 else
226 zSide = ( startPoint.z() > 0.) ? 1 : -1;
227
228 G4int region = currentCellData.
region;
231 G4int sampling = currentCellData.
sampling;
232
233 if( zSide == -1 )
234 {
235
237 if(phiBin < 0 )
phiBin += 64;
238 }
239
240
241 if (sampling !=0 || region != 0 ||
242 etaBin <0 || etaBin > 60 || phiBin <0 || phiBin>63) continue;
243
244
246 identifier2 << 4
247 << 1
248 << zSide
249 << sampling
250 << region
253
254
257 {
259 }
260 else
261 {
262 G4double tof;
263 tof = thisStepPoint->GetGlobalTime() / Units::ns;
264 time = tof - thisStepPoint->GetPosition().mag() * (1. / (CLHEP::c_light * CLHEP::ns));
265 }
266
267 G4double Current;
269
271 }
272 else {
273
274 G4int imodule = currentCellData.module;
275 G4double x0 = currentCellData.
distElec;
276 G4double y0 = currentCellData.
xElec;
277
278 if (imodule>1) {
279 x0=std::fabs(x0);
280 y0=std::fabs(y0);
281 }
282
283 if (imodule==0 || imodule ==1) {
284 if (x0<0) {
285 x0=-1.*x0;
286 y0=-1.*y0;
287 }
288 }
289#ifdef DEBUGSTEP
291#endif
292 const CurrMap*
cm =
m_psmap->GetMap(imodule);
294 ATH_MSG_WARNING(
" LArBarrelPresamplerCalculator: cannot get map for module " << imodule);
295 continue;
296 }
297 double current0,current1,current2,
gap;
298
299
300 cm->GetAll(x0,y0,&gap,¤t0,¤t1,¤t2);
301#ifdef DEBUGSTEP
302 ATH_MSG_DEBUG(
" module,x0,y0,current0 from map " << imodule <<
" " << x0 <<
" " << y0 <<
" " << current0);
303#endif
304
305
306 Current =
energy*current0;
307
308 }
309
310
311
313 for (unsigned int j=0; j<hdata.size(); j++) {
314 if (hdata[j].id==identifier2) {
315 hdata[j].energy += Current;
316 hdata[j].time +=
time*Current;
318 break;
319 }
320 }
321 if (!found) {
322 hdata.emplace_back(LArHitData{identifier2,
time*Current, Current});
323 }
324
325
326 }
327 }
328
329#ifdef DEBUGSTEP
330 ATH_MSG_DEBUG(
"Number of hits for this step " << m_nhits <<
" " << hdata.size());
331#endif
332
333
334 for (
unsigned int i=0;
i<hdata.size();
i++) {
335 if (std::fabs(hdata[i].energy)>1e-6) hdata[
i].time=hdata[
i].time/hdata[
i].energy;
336 else hdata[
i].time=0.;
337#ifdef DEBUGSTEP
338 ATH_MSG_DEBUG(
"Hit Energy/Time " << hdata[i].energy <<
" " << hdata[i].time);
339#endif
340 }
341
342 if (!hdata.empty()) return true;
343 else return false;
344
345}
#define ATH_MSG_WARNING(x)
Gaudi::Property< bool > m_testbeam
gap(flags, cells_name, *args, **kw)
time(flags, cells_name, *args, **kw)
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin