er  dev
ERGadastStep.cxx
1 // -------------------------------------------------------------------------
2 // ----- ERGadastStep source file -----
3 // -------------------------------------------------------------------------
4 
5 
6 #include "ERGadastStep.h"
7 #include<iostream>
8 #include "TVirtualMC.h"
9 
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 ERGadastStep::ERGadastStep(Int_t eventID, Int_t stepNr,Int_t trackID,
21  Int_t mot0trackID,
22  Int_t fiberInBundleNb,
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  fFiberInBundleNb(fiberInBundleNb),
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 
47 
48 // -------------------------------------------------------------------------
50  : fEventID(right.fEventID), fStepNr(right.fStepNr), fTrackID(right.fTrackID),
51  fMot0TrackID(right.fMot0TrackID), fFiberInBundleNb(right.fFiberInBundleNb),
52  fX(right.fX), fY(right.fY), fZ(right.fZ),
53  fPx(right.fPx), fPy(right.fPy), fPz(right.fPz),
54  fTOF(right.fTOF), fLength(right.fLength), fPID(right.fPID),fMass(right.fMass),
55  fTrackStatus(right.fTrackStatus),
56  fEloss(right.fEloss), fCharge(right.fCharge), fProcessID(right.fProcessID)
57 {
58 }
59 // -------------------------------------------------------------------------
60 
61 
62 
63 // ----- Destructor ----------------------------------------------------
65 {
66 }
67 // -------------------------------------------------------------------------
68 
69 // ----- Public method Print ---------------------------------------
70 void ERGadastStep::Print()
71 {
72  // Particle being tracked
73  const char *sParticle;
74 
75  switch(fPID){
76  case 2212: sParticle="proton" ;break;
77  case 2112: sParticle="neutron" ;break;
78  case 22: sParticle="gamma" ;break;
79  case 50000050: sParticle="ckov" ;break;
80  case 111: sParticle="pi0" ;break;
81  case 211: sParticle="pi+" ;break;
82  case -211: sParticle="Pi-" ;break;
83  case 1000010020: sParticle="deuteron" ;break;
84  case 1000010030: sParticle="triton" ;break;
85  case 1000020030: sParticle="he3" ;break;
86  case 1000020040: sParticle="alpha" ;break;
87  default: sParticle="not known" ;break;
88  }
89 
90  std::cout << "-I- STEPINFO:" << std::endl;
91  TString flag;
92  switch (fTrackStatus) {
93  case Entering : flag="enters to"; break;
94  case Exiting : flag="exits from"; break;
95  case Inside : flag="inside"; break;
96  case Stop : flag="stopped in"; break;
97  default: flag="unknown tracking status"; break;
98  }
99 
100  std::cout << "STEP = " << fStepNr << " particle="<< sParticle << "(" << fPID << ") Edep = "
101  << fEloss << "[KeV]" << std::endl;
102  std::cout << "track_status = " << flag.Data() << " track_charge = " << fCharge
103  << "track_nb = " << fTrackID << std::endl;
104  std::cout << "track_pos = " << fX << " " << fY << " " << fZ << std::endl;
105  std::cout << "track_mom = " << fPx << " " << fPy << " " << fPz << std::endl;
106 
107  for ( int i = 0 ; i < fProcessID.GetSize(); i++){
108  //if(proc.At(i)!=22 && proc.At(i)!=23 && proc.At(i)!=31 && proc.At(i)!=43 && proc.At(i)!=13){
109  std::cout << "process: " << fProcessID.At(i) <<" "<< TMCProcessName[fProcessID.At(i)]
110  << std::endl;
111  }
112  std::cout << std::endl;
113 }
114 // ----------------------------------------------------------------------------
115 
116 // ----------------------------------------------------------------------------
117 ExpertTrackingStatus ERGadastStep::GetTrackStatus(){
118  if(gMC->IsTrackAlive()) {
119  if(gMC->IsTrackEntering())
120  return Entering;
121  else if(gMC->IsTrackExiting())
122  return Exiting;
123  else if(gMC->IsTrackInside())
124  return Inside;
125  } else {
126  return Stop;
127  }
128 
129 }
130 // ----------------------------------------------------------------------------
131 ClassImp(ERGadastStep)
virtual ~ERGadastStep()