StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoMcTrack.cxx
1 //
2 // StPicoMcTrack holds information about tracks from Monte Carlo (generator + GEANT)
3 //
4 
5 // C++ headers
6 #include <limits>
7 
8 // ROOT headers
9 #include "TString.h"
10 
11 // PicoDst headers
12 #include "StPicoMessMgr.h"
13 #include "StPicoMcTrack.h"
14 
15 ClassImp(StPicoMcTrack)
16 
17 //________________
19  mId(0), mGePid(0), mCharge(0), mPx(0), mPy(0), mPz(0), mE(0),
20  mIsFromShower(kFALSE), mIdVtxStart(-1), mIdVtxStop(-1), mIdVtxItrmd(-1) {
21  // Default constructor
22  for (Int_t i=ktpc; i<ktot; i++) mHits[i] = 0;
23 }
24 
25 //________________
27  // Copy constructor
28  mId = t.mId;
29  mGePid = t.mGePid;
30  mCharge = t.mCharge;
31  for (Int_t i=ktpc; i<ktot; i++) mHits[i] = t.mHits[i];
32  mPx = t.mPx;
33  mPy = t.mPy;
34  mPz = t.mPz;
35  mE = t.mE;
36  mIsFromShower = t.mIsFromShower;
37  mIdVtxStart = t.mIdVtxStart;
38  mIdVtxStop = t.mIdVtxStop;
39  mIdVtxItrmd = t.mIdVtxItrmd;
40 }
41 
42 //________________
44  // Destructor
45  /* empty */
46 }
47 
48 //________________
49 Int_t StPicoMcTrack::pdgId() const {
50  // Return PDG ID
51  Int_t id = 0;
52  // Not implemented yet
53  return id;
54 }
55 
56 //________________
57 void StPicoMcTrack::setId(Int_t id) {
58  mId = ( ( id<0 || id>std::numeric_limits<UShort_t>::max() ) ?
59  std::numeric_limits<UShort_t>::max() : (UShort_t)id );
60 }
61 
62 //________________
63 Int_t StPicoMcTrack::correctGePid(Int_t gePid) {
64  // By pass embedding particle redefinition
65  if (gePid == 99) gePid = 11151;
66  if (gePid == 207) gePid = 41;
67  if (gePid == 40001) gePid = 24;
68  if (gePid == 98) gePid = 18;
69  if (gePid == 40002) gePid = 32;
70  if (gePid == 97) gePid = 26;
71  if (gePid == 40003) gePid = 23;
72  if (gePid == 40004) gePid = 31;
73  if (gePid == 40005) gePid = 22;
74  if (gePid == 40006) gePid = 30;
75  if (gePid == 10150) gePid = 150;
76  if (gePid == 10151) gePid = 151;
77  if (gePid == 11151) gePid = 10151;
78  if (gePid == 10018) gePid = 98;
79  if (gePid == 10026) gePid = 97;
80  if (gePid == 10017) gePid = 17;
81  if (gePid == 10039) gePid = 39;
82  if (gePid == 10040) gePid = 40;
83  if (gePid == 98) gePid = 18;
84  if (gePid == 97) gePid = 26;
85  if (gePid < 0 || gePid > 50) {
86  // cout << "Illegal gePid " << gePid << endl;
87  gePid = 51;
88  }
89  return gePid;
90 }
91 
92 //________________
93 const Char_t *StPicoMcTrack::geName() {
94  static const Char_t *geNames[52] = {
95  // 1 2 3 4 5 6 7 8 9 10
96  "",
97  "gamma" ,"e+" ,"e-" ,"nu" ,"mu+" ,"mu-" ,"pi0" ,"pi+" ,"pi-" ,"K0L",
98  "K+" ,"K-" ,"N" ,"P" ,"Pbar" ,"K0S" ,"eta" ,"Lambda","Sigma+" ,"Sigma0",
99  "S-" ,"Xi0" ,"Xi-" ,"Omega","Nbar" ,"LamBar","SBar-","SBar0" ,"SBar+" ,"XiBar0",
100  "XiBar+" ,"OmBar","tau+","tau-" ,"D+" ,"D-" ,"D0" ,"Dbar0" ,"Ds+" ,"Ds-" ,
101  "LambC+" ,"W+" ,"W-" ,"Z0" ,"H2" ,"H3" ,"alpha","geanti","He3" ,"Cerenk",
102  "??????"};
103 
104  static TString name;
105  Int_t iGe = correctGePid( geantId() );
106  name = geNames[iGe];
107  return name.Data();
108 }
109 
110 //________________
111 void StPicoMcTrack::Print(const Char_t* option __attribute__((unused))) const {
112  LOG_INFO << "id: " << id() << " GePid: " << geantId() << " charge: " << charge()
113  << Form(" vtx start/stop/itrm: %3d/%3d/%3d \n", idVtxStart(), idVtxStop(), idVtxItrmd() )
114  << Form(" px/py/pz/E: %4.3f/%4.3f/%4.3f/%4.3f", p().X(), p().Y(), p().Z(), energy() )
115  << " isFromShower: " << isFromShower() << "\n" << endm;
116 }
StPicoMcTrack()
Default constructor.
Int_t geantId() const
Return particle ID defined by GEANT (accordingly to GPART)
Definition: StPicoMcTrack.h:61
Int_t pdgId() const
Return particle ID defined by PDG.
const Char_t * geName()
Return particle names (GEANT ID according to GPART)
Int_t id() const
Return MC track ID (GEANT track ID)
Definition: StPicoMcTrack.h:57
Int_t idVtxStop() const
ID of stop MC vertex.
Definition: StPicoMcTrack.h:83
void setId(Int_t id)
Set MC track ID (primary key/GEANT track ID)
Int_t correctGePid(Int_t id)
Return corrected GePid (to take embedding into account)
Int_t idVtxItrmd() const
ID of intermediate MC vertex.
Definition: StPicoMcTrack.h:85
Int_t idVtxStart() const
ID of start MC vertex.
Definition: StPicoMcTrack.h:81
Holds information about Monte Carlo track parameters.
Definition: StPicoMcTrack.h:32
virtual void Print(const Char_t *option="") const
Print MC track parameters.
Bool_t isFromShower() const
Check if track is from shower.
Definition: StPicoMcTrack.h:79
Float_t energy() const
Energy of the track.
Definition: StPicoMcTrack.h:75
TVector3 p() const
Return track three-momentum.
Definition: StPicoMcTrack.h:65
Int_t charge() const
Return charge of the particle.
Definition: StPicoMcTrack.h:63
virtual ~StPicoMcTrack()
Destructor.