19 #include "StFtpcGeantReader.hh"
22 #include "StMessMgr.h"
24 StFtpcGeantReader::StFtpcGeantReader(St_g2t_vertex *
vertex,
28 vertexTable = vertex->GetTable();
29 nVertices = vertex->GetNRows();
30 trackTable = track->GetTable();
31 nTracks = track->GetNRows();
32 hitTable = hit->GetTable();
33 nHits = hit->GetNRows();
36 StFtpcGeantReader::~StFtpcGeantReader()
40 Int_t StFtpcGeantReader::nextTrackHit(Int_t i)
44 return hitTable[i].next_tr_hit_p-1;
48 LOG_WARN <<
"StFtpcGeantReader: nextTrackHit index out of range, using 0" << endm;
49 return hitTable[0].next_tr_hit_p-1;
53 Int_t StFtpcGeantReader::track(Int_t i)
57 return hitTable[i].track_p-1;
61 LOG_WARN <<
"StFtpcGeantReader: track index out of range, using 0" << endm;
62 return hitTable[0].track_p-1;
66 Int_t StFtpcGeantReader::geantVolume(Int_t i)
70 return hitTable[i].volume_id;
74 LOG_WARN <<
"StFtpcGeantReader: geantVolume index out of range, using 0" << endm;
75 return hitTable[0].volume_id;
78 Int_t StFtpcGeantReader::geantPlane(Int_t GeantVolume)
82 return (GeantVolume/1000 -1)*10 + GeantVolume/10 % 100;
84 Int_t StFtpcGeantReader::geantSector(Int_t GeantVolume)
87 return GeantVolume%10 ;
90 Float_t StFtpcGeantReader::energyLoss(Int_t i)
94 return hitTable[i].de;
98 LOG_WARN <<
"StFtpcGeantReader: energyLoss index out of range, using 0" << endm;
99 return hitTable[0].de;
103 Float_t StFtpcGeantReader::segmentLength(Int_t i)
107 return hitTable[i].ds;
111 LOG_WARN <<
"StFtpcGeantReader: segmentLength index out of range, using 0" << endm;
112 return hitTable[0].ds;
116 Float_t StFtpcGeantReader::pLocalX(Int_t i)
120 return hitTable[i].p[0];
124 LOG_WARN <<
"StFtpcGeantReader: pLocalX index out of range, using 0" << endm;
125 return hitTable[0].p[0];
129 Float_t StFtpcGeantReader::pLocalY(Int_t i)
133 return hitTable[i].p[1];
137 LOG_WARN <<
"StFtpcGeantReader: pLocalY index out of range, using 0" << endm;
138 return hitTable[0].p[1];
142 Float_t StFtpcGeantReader::pLocalZ(Int_t i)
146 return hitTable[i].p[2];
150 LOG_WARN <<
"StFtpcGeantReader: pLocalZ index out of range, using 0" << endm;
151 return hitTable[0].p[2];
155 Float_t StFtpcGeantReader::timeOfFlight(Int_t i)
159 return hitTable[i].tof;
163 LOG_WARN <<
"StFtpcGeantReader: timeOfFlight index out of range, using 0" << endm;
164 return hitTable[0].tof;
168 Float_t StFtpcGeantReader::x(Int_t i)
172 return hitTable[i].x[0];
176 LOG_WARN <<
"StFtpcGeantReader: x index out of range, using 0" << endm;
177 return hitTable[0].x[0];
181 Float_t StFtpcGeantReader::y(Int_t i)
185 return hitTable[i].x[1];
189 LOG_WARN <<
"StFtpcGeantReader: y index out of range, using 0" << endm;
190 return hitTable[0].x[1];
194 Float_t StFtpcGeantReader::z(Int_t i)
198 return hitTable[i].x[2];
202 LOG_WARN <<
"StFtpcGeantReader: z index out of range, using 0" << endm;
203 return hitTable[0].x[2];
207 Int_t StFtpcGeantReader::trackType(Int_t i)
211 return hitTable[i].track_type;
215 LOG_WARN <<
"StFtpcGeantReader: trackType index out of range, using 0" << endm;
216 return hitTable[0].track_type;
220 Int_t StFtpcGeantReader::trackPid(Int_t i)
222 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
224 return trackTable[hitTable[i].track_p-1].ge_pid;
228 LOG_WARN <<
"StFtpcGeantReader: geantPid index out of range, using 0" << endm;
229 return trackTable[0].ge_pid;
233 Int_t StFtpcGeantReader::hitsOnTrack(Int_t i)
235 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
237 return trackTable[hitTable[i].track_p-1].n_ftp_hit;
241 LOG_WARN <<
"StFtpcGeantReader: hitsOnTrack index out of range, using 0" << endm;
242 return trackTable[0].n_ftp_hit;
246 Int_t StFtpcGeantReader::firstHitOnTrack(Int_t i)
248 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
250 return trackTable[hitTable[i].track_p-1].hit_ftp_p-1;
254 LOG_WARN <<
"StFtpcGeantReader: firstHitOnTrack index out of range, using 0" << endm;
255 return trackTable[0].hit_ftp_p-1;
259 Int_t StFtpcGeantReader::isShower(Int_t i)
261 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
263 return trackTable[hitTable[i].track_p-1].is_shower;
267 LOG_WARN <<
"StFtpcGeantReader: isShower index out of range, using 0" << endm;
268 return trackTable[0].is_shower;
272 Int_t StFtpcGeantReader::trackVertex(Int_t i)
274 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
276 return trackTable[hitTable[i].track_p-1].start_vertex_p-1;
280 LOG_WARN <<
"StFtpcGeantReader: trackVertex index out of range, using 0" << endm;
281 return trackTable[0].start_vertex_p-1;
285 Float_t StFtpcGeantReader::trackCharge(Int_t i)
287 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
289 return trackTable[hitTable[i].track_p-1].charge;
293 LOG_WARN <<
"StFtpcGeantReader: trackCharge index out of range, using 0" << endm;
294 return trackTable[0].charge;
298 Float_t StFtpcGeantReader::trackEnergy(Int_t i)
300 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
302 return trackTable[hitTable[i].track_p-1].e;
306 LOG_WARN <<
"StFtpcGeantReader: trackEnergy index out of range, using 0" << endm;
307 return trackTable[0].e;
311 Float_t StFtpcGeantReader::trackEta(Int_t i)
313 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
315 return trackTable[hitTable[i].track_p-1].eta;
319 LOG_WARN <<
"StFtpcGeantReader: trackEta index out of range, using 0" << endm;
320 return trackTable[0].eta;
324 Float_t StFtpcGeantReader::pVertexX(Int_t i)
326 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
328 return trackTable[hitTable[i].track_p-1].p[0];
332 LOG_WARN <<
"StFtpcGeantReader: pVertexX index out of range, using 0" << endm;
333 return trackTable[0].p[0];
337 Float_t StFtpcGeantReader::pVertexY(Int_t i)
339 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
341 return trackTable[hitTable[i].track_p-1].p[1];
345 LOG_WARN <<
"StFtpcGeantReader: pVertexY index out of range, using 0" << endm;
346 return trackTable[0].p[1];
350 Float_t StFtpcGeantReader::pVertexZ(Int_t i)
352 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
354 return trackTable[hitTable[i].track_p-1].p[2];
358 LOG_WARN <<
"StFtpcGeantReader: pVertexZ index out of range, using 0" << endm;
359 return trackTable[0].p[2];
363 Float_t StFtpcGeantReader::pTVertex(Int_t i)
365 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
367 return trackTable[hitTable[i].track_p-1].pt;
371 LOG_WARN <<
"StFtpcGeantReader: pTVertex index out of range, using 0" << endm;
372 return trackTable[0].pt;
376 Float_t StFtpcGeantReader::pTotalVertex(Int_t i)
378 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
380 return trackTable[hitTable[i].track_p-1].ptot;
384 LOG_WARN <<
"StFtpcGeantReader: pTotalVertex index out of range, using 0" << endm;
385 return trackTable[0].ptot;
389 Float_t StFtpcGeantReader::rapidityVertex(Int_t i)
391 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks)
393 return trackTable[hitTable[i].track_p-1].rapidity;
397 LOG_WARN <<
"StFtpcGeantReader: rapidityVertex index out of range, using 0" << endm;
398 return trackTable[0].rapidity;
402 Int_t StFtpcGeantReader::productionProcess(Int_t i)
404 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks
405 && trackTable[hitTable[i].track_p-1].start_vertex_p>0
406 && trackTable[hitTable[i].track_p-1].start_vertex_p<=nVertices)
408 return vertexTable[trackTable[hitTable[i].track_p-1].start_vertex_p-1].ge_proc;
412 LOG_WARN <<
"StFtpcGeantReader: productionProcess index out of range, using 0" << endm;
413 return vertexTable[0].ge_proc;
417 Float_t StFtpcGeantReader::vertexX(Int_t i)
419 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks
420 && trackTable[hitTable[i].track_p-1].start_vertex_p>0
421 && trackTable[hitTable[i].track_p-1].start_vertex_p<=nVertices)
423 return vertexTable[trackTable[hitTable[i].track_p-1].start_vertex_p-1].ge_x[0];
427 LOG_WARN <<
"StFtpcGeantReader: vertexX index out of range, using 0" << endm;
428 return vertexTable[0].ge_x[0];
432 Float_t StFtpcGeantReader::vertexY(Int_t i)
434 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks
435 && trackTable[hitTable[i].track_p-1].start_vertex_p>0
436 && trackTable[hitTable[i].track_p-1].start_vertex_p<=nVertices)
438 return vertexTable[trackTable[hitTable[i].track_p-1].start_vertex_p-1].ge_x[1];
442 LOG_WARN <<
"StFtpcGeantReader: vertexY index out of range, using 0" << endm;
443 return vertexTable[0].ge_x[1];
447 Float_t StFtpcGeantReader::vertexZ(Int_t i)
449 if(i>=0 && i<nHits && hitTable[i].track_p>0 && hitTable[i].track_p<=nTracks
450 && trackTable[hitTable[i].track_p-1].start_vertex_p>0
451 && trackTable[hitTable[i].track_p-1].start_vertex_p<=nVertices)
453 return vertexTable[trackTable[hitTable[i].track_p-1].start_vertex_p-1].ge_x[2];
457 LOG_WARN <<
"StFtpcGeantReader: vertexZ index out of range, using 0" << endm;
458 return vertexTable[0].ge_x[2];