StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcBTofHit.cc
1 //
2 //
3 
4 #include "StMcBTofHit.hh"
5 #include "StMcTrack.hh"
6 #include "StParticleDefinition.hh"
7 
8 
9 ClassImp(StMcBTofHit);
10 StMcBTofHit::StMcBTofHit()
11  : mTray(0),mModule(0),mCell(0),mdE(0),mPathLength(0),mTime(0),mTof(0),mCharge(0),mPosition(0.,0.,0.),mParentTrack(0),mParentTrackId(0)
12 { /* noop */ }
13 
14 StMcBTofHit::StMcBTofHit(int t,int m,int c,float de,float pl,float time,float tof,float q)
15  :mTray(t),mModule(m),mCell(c),mdE(de),mPathLength(pl),mTime(time),mTof(tof),mCharge(q),mPosition(0.,0.,0.),mParentTrack(0),mParentTrackId(0)
16 { /* noop */ }
17 
18 StMcBTofHit::StMcBTofHit(int t,int m,int c,float de,float pl,float time,float tof,float q,StThreeVectorF& x,StMcTrack* parent)
19  :mTray(t),mModule(m),mCell(c),mdE(de),mPathLength(pl),mTime(time),mTof(tof),mCharge(q),mPosition(x),mParentTrack(parent),mParentTrackId(0)
20 { /* noop */ }
21 
22 StMcBTofHit::~StMcBTofHit() { /* noop */ }
23 
24 int StMcBTofHit::operator==(const StMcBTofHit& h) const
25 {
26  //we have some options here -- include 2nd line or no??
27  // Hits are from the same particle and the same tower(cell)
28  return h.mTray == mTray && h.mModule == mModule && h.mCell == mCell
29  && h.mPathLength == mPathLength && h.mTime == mTime
30  && h.mTof == mTof && h.mCharge == mCharge
31  && h.mPosition == mPosition
32  && ( (h.mParentTrack == mParentTrack) || (h.mParentTrackId == mParentTrackId) );
33 
34 }
35 
36 int StMcBTofHit::operator!=(const StMcBTofHit& h) const
37 {
38  return !(*this == h); // use operator==()
39 }
40 
41 void StMcBTofHit::operator+=(const StMcBTofHit& h)
42 {
43  //we have some options here
44  //if(*this == h) mdE += h.dE(); // use operator==()
45  //if(*this.sameCell(h)) mdE += h.dE();
46  mdE += h.dE();
47  mCharge += h.charge();
48 }
49 
50 bool StMcBTofHit::sameCell(const StMcBTofHit& h) const
51 {
52  // Hits are from the same cell(tower)
53  // For transition from MC hits to raw hits
54  return h.mTray == mTray && h.mModule == mModule && h.mCell == mCell;
55 }
56 
57 void StMcBTofHit::setTray(int val) { mTray = val; }
58 
59 void StMcBTofHit::setModule(int val) { mModule = val; }
60 
61 void StMcBTofHit::setCell(int val) { mCell = val; }
62 
63 void StMcBTofHit::setdE(float val) { mdE = val; }
64 
65 void StMcBTofHit::setPathLength(float val) { mPathLength = val; }
66 
67 void StMcBTofHit::setTime(float val) { mTime = val; }
68 
69 void StMcBTofHit::setTof(float val) { mTof = val; }
70 
71 void StMcBTofHit::setCharge(float val) { mCharge = val; }
72 
73 void StMcBTofHit::setPosition(StThreeVectorF& val) { mPosition = val; }
74 
75 void StMcBTofHit::setParentTrack(StMcTrack* val) { mParentTrack = val; }
76 
77 void StMcBTofHit::setParentTrackId(int val) { mParentTrackId = val; }
78 
79 
80 ostream& operator<<(ostream& os, const StMcBTofHit & h)
81 {
82  os << "BTofHit\t"
83  << " tray: " << h.tray()
84  << " mod: " << h.module()
85  << " cell: " << h.cell()
86  << " dE: " << h.dE()
87  << " pathL: " << h.pathLength()
88  << " time: " << h.time()
89  << " tof (simu): " << h.tof()
90  << " charge: " << h.charge()
91  << " position: " << h.position();
92  if(h.parentTrack()) {
93  StMcTrack* t=h.parentTrack();
94  if(t->particleDefinition()){
95  os << " | g2t key : " << t->key()
96  << " Name: "<<(t->particleDefinition()->name()).c_str();
97  }
98  }
99  else os <<" Parent track undefined ";
100  return os;
101 }
Definition: tof.h:15
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
Definition: StMcTrack.hh:144
virtual StThreeVectorF position() const
collected charge
Definition: StMcBTofHit.hh:84
virtual float charge() const
tof simulated
Definition: StMcBTofHit.hh:83
virtual float tof() const
time of flight geant
Definition: StMcBTofHit.hh:82