CbmRoot
CbmLmvmUtils.h
Go to the documentation of this file.
1 
8 #ifndef CBM_LMVM_UTILS_H
9 #define CBM_LMVM_UTILS_H
10 
11 #include "CbmKFVertex.h"
12 #include "CbmL1PFFitter.h"
13 #include "CbmLmvmCandidate.h"
14 #include "CbmMCTrack.h"
15 #include "CbmStsTrack.h"
16 #include "TMCProcess.h"
17 
18 class CbmLmvmUtils {
19 public:
20  /*
21  * Calculates and set track parameters to CbmLmvmCandidate.
22  * The following parameters are set: fChi2sts, fChi2Prim, fPosition, fMomentum, fMass, fCharge, fEnergy, fRapidity
23  */
25  CbmStsTrack* stsTrack,
26  CbmKFVertex& kfVertex) {
27  CbmL1PFFitter fPFFitter;
28  vector<CbmStsTrack> stsTracks;
29  stsTracks.resize(1);
30  stsTracks[0] = *stsTrack;
31  vector<L1FieldRegion> vField;
32  vector<float> chiPrim;
33  fPFFitter.GetChiToVertex(stsTracks, vField, chiPrim, kfVertex, 3e6);
34  cand->fChi2sts = stsTracks[0].GetChiSq() / stsTracks[0].GetNDF();
35  cand->fChi2Prim = chiPrim[0];
36  const FairTrackParam* vtxTrack = stsTracks[0].GetParamFirst();
37 
38  vtxTrack->Position(cand->fPosition);
39  vtxTrack->Momentum(cand->fMomentum);
40 
41  cand->fMass = TDatabasePDG::Instance()->GetParticle(11)->Mass();
42  cand->fCharge = (vtxTrack->GetQp() > 0) ? 1 : -1;
43  cand->fEnergy = sqrt(cand->fMomentum.Mag2() + cand->fMass * cand->fMass);
44  cand->fRapidity = 0.5
45  * TMath::Log((cand->fEnergy + cand->fMomentum.Z())
46  / (cand->fEnergy - cand->fMomentum.Z()));
47  }
48 
49  /*
50  * Armenteros - Podolansky plot
51  */
53  CbmLmvmCandidate* cand2,
54  Double_t& alpha,
55  Double_t& ptt) {
56  alpha = ptt = 0.;
57  Double_t spx = cand1->fMomentum.X() + cand2->fMomentum.X();
58  Double_t spy = cand1->fMomentum.Y() + cand2->fMomentum.Y();
59  Double_t spz = cand1->fMomentum.Z() + cand2->fMomentum.Z();
60  Double_t sp = sqrt(spx * spx + spy * spy + spz * spz);
61 
62  if (sp == 0.0) return;
63  Double_t pn, /*pp,*/ pln, plp;
64  if (cand1->fCharge < 0.) {
65  pn = cand1->fMomentum.Mag();
66  //pp = cand2->fMomentum.Mag();
67  pln = (cand1->fMomentum.X() * spx + cand1->fMomentum.Y() * spy
68  + cand1->fMomentum.Z() * spz)
69  / sp;
70  plp = (cand2->fMomentum.X() * spx + cand2->fMomentum.Y() * spy
71  + cand2->fMomentum.Z() * spz)
72  / sp;
73  } else {
74  pn = cand2->fMomentum.Mag();
75  //pp = cand1->fMomentum.Mag();
76  pln = (cand2->fMomentum.X() * spx + cand2->fMomentum.Y() * spy
77  + cand2->fMomentum.Z() * spz)
78  / sp;
79  plp = (cand1->fMomentum.X() * spx + cand1->fMomentum.Y() * spy
80  + cand1->fMomentum.Z() * spz)
81  / sp;
82  }
83  if (pn == 0.0) return;
84  Double_t ptm = (1. - ((pln / pn) * (pln / pn)));
85  ptt = (ptm >= 0.) ? pn * sqrt(ptm) : 0;
86  alpha = (plp - pln) / (plp + pln);
87  }
88 
89  /*
90  * \brief Return true if MC track is signal primary electron.
91  */
92  static Bool_t IsMcSignalElectron(CbmMCTrack* mctrack) {
93  if (mctrack == NULL) return false;
94  Int_t pdg = TMath::Abs(mctrack->GetPdgCode());
95  if (mctrack->GetGeantProcessId() == kPPrimary && pdg == 11) return true;
96  return false;
97  }
98 
99  /*
100  * \brief Return true if MC track is electron from gamma conversion.
101  */
102  static Bool_t IsMcGammaElectron(CbmMCTrack* mctrack, TClonesArray* mcTracks) {
103  if (mctrack == NULL) return false;
104  Int_t pdg = TMath::Abs(mctrack->GetPdgCode());
105  if (pdg != 11) return false;
106  Int_t motherId = mctrack->GetMotherId();
107  if (motherId < 0) {
108  return false;
109  } else {
110  CbmMCTrack* mct1 = static_cast<CbmMCTrack*>(mcTracks->At(motherId));
111  Int_t motherPdg = mct1->GetPdgCode();
112  if (mct1 != NULL && motherPdg == 22 && pdg == 11) { return true; }
113  }
114  return false;
115  }
116 
117  /*
118  * \brief Return true if MC track is electron from Pi0 dalitz decay.
119  */
120  static Bool_t IsMcPi0Electron(CbmMCTrack* mctrack, TClonesArray* mcTracks) {
121  if (mctrack == NULL) return false;
122  Int_t pdg = TMath::Abs(mctrack->GetPdgCode());
123  if (pdg != 11) return false;
124  Int_t motherId = mctrack->GetMotherId();
125  if (motherId < 0) {
126  return false;
127  } else {
128  CbmMCTrack* mct1 = static_cast<CbmMCTrack*>(mcTracks->At(motherId));
129  Int_t motherPdg = mct1->GetPdgCode();
130  if (mct1 != NULL && motherPdg == 111 && pdg == 11
131  && mctrack->GetGeantProcessId() != kPPrimary) {
132  return true;
133  }
134  }
135  return false;
136  }
137 
138  /*
139  * \brief Return true if MC track is electron from Eta decay.
140  */
141  static Bool_t IsMcEtaElectron(CbmMCTrack* mctrack, TClonesArray* mcTracks) {
142  if (mctrack == NULL) return false;
143  Int_t pdg = TMath::Abs(mctrack->GetPdgCode());
144  if (pdg != 11) return false;
145  Int_t motherId = mctrack->GetMotherId();
146  if (motherId < 0) {
147  return false;
148  } else {
149  CbmMCTrack* mct1 = static_cast<CbmMCTrack*>(mcTracks->At(motherId));
150  Int_t motherPdg = mct1->GetPdgCode();
151  if (mct1 != NULL && motherPdg == 221 && pdg == 11) { return true; }
152  }
153  return false;
154  }
155 };
156 
157 #endif
CbmMCTrack::GetMotherId
Int_t GetMotherId() const
Definition: CbmMCTrack.h:71
CbmLmvmUtils::IsMcEtaElectron
static Bool_t IsMcEtaElectron(CbmMCTrack *mctrack, TClonesArray *mcTracks)
Definition: CbmLmvmUtils.h:141
CbmLmvmCandidate::fRapidity
Double_t fRapidity
Definition: CbmLmvmCandidate.h:65
CbmLmvmCandidate
Definition: CbmLmvmCandidate.h:11
CbmLmvmCandidate.h
CbmL1PFFitter
Definition: CbmL1PFFitter.h:31
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmLmvmCandidate::fEnergy
Double_t fEnergy
Definition: CbmLmvmCandidate.h:64
CbmLmvmUtils::CalculateAndSetTrackParamsToCandidate
static void CalculateAndSetTrackParamsToCandidate(CbmLmvmCandidate *cand, CbmStsTrack *stsTrack, CbmKFVertex &kfVertex)
Definition: CbmLmvmUtils.h:24
CbmMCTrack::GetPdgCode
Int_t GetPdgCode() const
Definition: CbmMCTrack.h:70
CbmLmvmUtils::IsMcGammaElectron
static Bool_t IsMcGammaElectron(CbmMCTrack *mctrack, TClonesArray *mcTracks)
Definition: CbmLmvmUtils.h:102
CbmStsTrack.h
Data class for STS tracks.
CbmL1PFFitter::GetChiToVertex
void GetChiToVertex(std::vector< CbmStsTrack > &Tracks, std::vector< L1FieldRegion > &field, std::vector< float > &chiToVtx, CbmKFVertex &primVtx, float chiPrim=-1)
Definition: CbmL1PFFitter.cxx:403
mcTracks
static vector< vector< QAMCTrack > > mcTracks
Definition: CbmTofHitFinderTBQA.cxx:112
CbmLmvmCandidate::fMass
Double_t fMass
Definition: CbmLmvmCandidate.h:63
CbmLmvmCandidate::fChi2sts
Double_t fChi2sts
Definition: CbmLmvmCandidate.h:68
CbmL1PFFitter.h
CbmMCTrack::GetGeantProcessId
UInt_t GetGeantProcessId() const
Definition: CbmMCTrack.h:69
CbmLmvmCandidate::fPosition
TVector3 fPosition
Definition: CbmLmvmCandidate.h:61
CbmLmvmCandidate::fChi2Prim
Double_t fChi2Prim
Definition: CbmLmvmCandidate.h:67
CbmLmvmCandidate::fMomentum
TVector3 fMomentum
Definition: CbmLmvmCandidate.h:62
CbmLmvmUtils
Definition: CbmLmvmUtils.h:18
CbmMCTrack.h
CbmMCTrack
Definition: CbmMCTrack.h:34
CbmLmvmUtils::IsMcSignalElectron
static Bool_t IsMcSignalElectron(CbmMCTrack *mctrack)
Definition: CbmLmvmUtils.h:92
CbmLmvmUtils::IsMcPi0Electron
static Bool_t IsMcPi0Electron(CbmMCTrack *mctrack, TClonesArray *mcTracks)
Definition: CbmLmvmUtils.h:120
CbmLmvmUtils::CalculateArmPodParams
static void CalculateArmPodParams(CbmLmvmCandidate *cand1, CbmLmvmCandidate *cand2, Double_t &alpha, Double_t &ptt)
Definition: CbmLmvmUtils.h:52
CbmLmvmCandidate::fCharge
Int_t fCharge
Definition: CbmLmvmCandidate.h:66
CbmStsTrack
Definition: CbmStsTrack.h:37
CbmKFVertex.h
CbmKFVertex
Definition: CbmKFVertex.h:6