er  dev
ERNeuRadStep.cxx
1 // -------------------------------------------------------------------------
2 // ----- ERNeuRadStep source file -----
3 // -------------------------------------------------------------------------
4 
5 #include "ERNeuRadStep.h"
6 
7 #include "TVirtualMC.h"
8 
9 #include "FairLogger.h"
10 
11 // ----- Default constructor -------------------------------------------
13  : fX(0.), fY(0.), fZ(0.),
14  fPx(0.), fPy(0.), fPz(0.)
15 {
16 }
17 // -------------------------------------------------------------------------
18 
19 // ----- Standard constructor ------------------------------------------
20 ERNeuRadStep::ERNeuRadStep(Int_t eventID, Int_t stepNr,Int_t trackID,
21  Int_t mot0trackID,
22  Int_t fiberNb, Int_t pixelNb, Int_t moduleNb,
23  TVector3 pos,
24  TVector3 mom,
25  Double_t tof,
26  Double_t length,
27  Int_t pid,
28  Double_t mass,
29  ExpertTrackingStatus trackStatus,
30  Double_t eLoss,
31  Double_t charge,
32  TArrayI processID)
33  : fEventID(eventID), fStepNr(stepNr), fTrackID(trackID), fMot0TrackID(mot0trackID),
34  fFiberNb(fiberNb),fPixelNb(pixelNb),fModuleNb(moduleNb),
35  fX(pos.X()), fY(pos.Y()), fZ(pos.Z()),
36  fPx(mom.X()), fPy(mom.Y()), fPz(mom.Z()),
37  fTOF(tof), fLength(length), fPID(pid), fMass(mass),
38  fTrackStatus(trackStatus),
39  fEloss(eLoss),
40  fCharge(charge),
41  fProcessID(processID)
42 {
43 }
44 // -------------------------------------------------------------------------
45 
46 // -------------------------------------------------------------------------
48  : fEventID(right.fEventID), fStepNr(right.fStepNr), fTrackID(right.fTrackID),
49  fMot0TrackID(right.fMot0TrackID), fFiberNb(right.fFiberNb),fPixelNb(right.fPixelNb),
50  fModuleNb(right.fModuleNb),fX(right.fX), fY(right.fY), fZ(right.fZ),
51  fPx(right.fPx), fPy(right.fPy), fPz(right.fPz),
52  fTOF(right.fTOF), fLength(right.fLength), fPID(right.fPID),fMass(right.fMass),
53  fTrackStatus(right.fTrackStatus),
54  fEloss(right.fEloss), fCharge(right.fCharge), fProcessID(right.fProcessID)
55 {
56 }
57 // -------------------------------------------------------------------------
58 
59 // ----- Destructor ----------------------------------------------------
61 {
62 }
63 // -------------------------------------------------------------------------
64 
65 // ----- Public method Print ---------------------------------------
66 void ERNeuRadStep::Print()
67 {
68  // Particle being tracked
69  const char *sParticle;
70 
71  switch(fPID){
72  case 2212: sParticle="proton" ;break;
73  case 2112: sParticle="neutron" ;break;
74  case 22: sParticle="gamma" ;break;
75  case 50000050: sParticle="ckov" ;break;
76  case 111: sParticle="pi0" ;break;
77  case 211: sParticle="pi+" ;break;
78  case -211: sParticle="Pi-" ;break;
79  case 1000010020: sParticle="deuteron" ;break;
80  case 1000010030: sParticle="triton" ;break;
81  case 1000020030: sParticle="he3" ;break;
82  case 1000020040: sParticle="alpha" ;break;
83  default: sParticle="not known" ;break;
84  }
85 
86  std::cout << "-I- STEPINFO:" << std::endl;
87  TString flag;
88  switch (fTrackStatus) {
89  case Entering : flag="enters to"; break;
90  case Exiting : flag="exits from"; break;
91  case Inside : flag="inside"; break;
92  case Stop : flag="stopped in"; break;
93  default: flag="unknown tracking status"; break;
94  }
95 
96  LOG(INFO) << "STEP = " << fStepNr << " particle="<< sParticle << "(" << fPID << ") Edep = "
97  << fEloss << "[KeV]" << FairLogger::endl;
98  LOG(INFO) << "track_status = " << flag.Data() << " track_charge = " << fCharge
99  << "track_nb = " << fTrackID << FairLogger::endl;
100  LOG(INFO) << "track_pos = " << fX << " " << fY << " " << fZ << FairLogger::endl;
101  LOG(INFO) << "track_mom = " << fPx << " " << fPy << " " << fPz << FairLogger::endl;
102 
103  for ( int i = 0 ; i < fProcessID.GetSize(); i++){
104  //if(proc.At(i)!=22 && proc.At(i)!=23 && proc.At(i)!=31 && proc.At(i)!=43 && proc.At(i)!=13){
105  LOG(INFO) << "process: " << fProcessID.At(i) <<" "<< TMCProcessName[fProcessID.At(i)]
106  << FairLogger::endl;
107  }
108 }
109 // ----------------------------------------------------------------------------
110 
111 // ----------------------------------------------------------------------------
112 ExpertTrackingStatus ERNeuRadStep::GetTrackStatus() {
113  if(gMC->IsTrackAlive()) {
114  if(gMC->IsTrackEntering())
115  return Entering;
116  else if(gMC->IsTrackExiting())
117  return Exiting;
118  else if(gMC->IsTrackInside())
119  return Inside;
120  } else {
121  return Stop;
122  }
123 
124 }
125 // ----------------------------------------------------------------------------
126 
127 ClassImp(ERNeuRadStep)
virtual ~ERNeuRadStep()