CbmRoot
CbmLitGlobalElectronId.cxx
Go to the documentation of this file.
1 
8 #include "CbmGlobalTrack.h"
9 #include "CbmRichElectronIdAnn.h"
10 #include "CbmRichRing.h"
11 #include "CbmTofHit.h"
12 #include "CbmTrdTrack.h"
13 #include "FairRootManager.h"
14 
15 #include "TClonesArray.h"
16 #include "TMath.h"
17 #include "TString.h"
18 #include "TSystem.h"
19 #include "utils/CbmRichUtil.h"
20 
21 #include <cmath>
22 
24  : fTrdAnnCut(0.85)
25  , fRichAnnCut(-0.4)
26  , fRichUseAnn(true)
27  , fRichMeanA(-1.)
28  , fRichMeanB(-1.)
29  , fRichRmsA(-1.)
30  , fRichRmsB(-1.)
31  , fRichRmsCoeff(-1.)
32  , fRichDistCut(-1.)
33  , fGlobalTracks(NULL)
34  , fRichRings(NULL)
35  , fTrdTracks(NULL)
36  , fTofHits(NULL) {
37  Init();
38 }
39 
41 
43  FairRootManager* ioman = FairRootManager::Instance();
44  if (ioman != nullptr) {
45  fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
46  fRichRings = (TClonesArray*) ioman->GetObject("RichRing");
47  fTrdTracks = (TClonesArray*) ioman->GetObject("TrdTrack");
48  fTofHits = (TClonesArray*) ioman->GetObject("TofHit");
49  }
50 }
51 
52 Bool_t CbmLitGlobalElectronId::IsRichElectron(Int_t globalTrackIndex,
53  Double_t momentum) {
54  if (fRichUseAnn == false) {
55  if (NULL == fGlobalTracks || NULL == fRichRings) return false;
56  const CbmGlobalTrack* globalTrack =
57  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
58  Int_t richId = globalTrack->GetRichRingIndex();
59  if (richId < 0) return false;
60  CbmRichRing* ring = static_cast<CbmRichRing*>(fRichRings->At(richId));
61  if (NULL == ring) return false;
62  Double_t axisA = ring->GetAaxis();
63  Double_t axisB = ring->GetBaxis();
64  Double_t dist = CbmRichUtil::GetRingTrackDistance(globalTrackIndex);
65  if (fabs(axisA - fRichMeanA) < fRichRmsCoeff * fRichRmsA
66  && fabs(axisB - fRichMeanB) < fRichRmsCoeff * fRichRmsB
67  && dist < fRichDistCut) {
68  return true;
69  } else {
70  return false;
71  }
72  } else {
74  globalTrackIndex, momentum);
75  if (ann > fRichAnnCut)
76  return true;
77  else
78  return false;
79  }
80 }
81 
82 Bool_t CbmLitGlobalElectronId::IsTrdElectron(Int_t globalTrackIndex,
83  Double_t momentum) {
84  if (NULL == fGlobalTracks || NULL == fTrdTracks) return false;
85  const CbmGlobalTrack* globalTrack =
86  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
87  Int_t trdId = globalTrack->GetTrdTrackIndex();
88  if (trdId < 0) return false;
89  CbmTrdTrack* trdTrack = static_cast<CbmTrdTrack*>(fTrdTracks->At(trdId));
90  if (NULL == trdTrack) return false;
91 
92  Double_t ann = trdTrack->GetPidANN();
93  if (ann > fTrdAnnCut)
94  return true;
95  else
96  return false;
97 }
98 
99 Bool_t CbmLitGlobalElectronId::IsTofElectron(Int_t globalTrackIndex,
100  Double_t momentum) {
101  if (NULL == fGlobalTracks || NULL == fTofHits) return false;
102  const CbmGlobalTrack* globalTrack =
103  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
104  Double_t trackLength = globalTrack->GetLength() / 100.;
105  Int_t tofId = globalTrack->GetTofHitIndex();
106  if (tofId < 0) return false;
107  CbmTofHit* tofHit = (CbmTofHit*) fTofHits->At(tofId);
108  if (NULL == tofHit) return false;
109 
110  Double_t time =
111  0.2998 * tofHit->GetTime(); // time in ns -> transfrom to ct in m
112  Double_t mass2 =
113  TMath::Power(momentum, 2.) * (TMath::Power(time / trackLength, 2) - 1);
114 
115  if (momentum >= 1.) {
116  if (mass2 < (0.013 * momentum - 0.003)) { return true; }
117  } else {
118  if (mass2 < 0.01) {
119  return true; //fTofM2
120  }
121  }
122  return false;
123 }
124 
125 Double_t CbmLitGlobalElectronId::GetRichAnn(Int_t globalTrackIndex,
126  Double_t momentum) {
127  return CbmRichElectronIdAnn::GetInstance().CalculateAnnValue(globalTrackIndex,
128  momentum);
129 }
130 
131 Double_t CbmLitGlobalElectronId::GetTrdAnn(Int_t globalTrackIndex,
132  Double_t momentum) {
133  if (NULL == fGlobalTracks || NULL == fTrdTracks) return -1.;
134  const CbmGlobalTrack* globalTrack =
135  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
136  Int_t trdId = globalTrack->GetTrdTrackIndex();
137  if (trdId < 0) return -1.;
138  CbmTrdTrack* trdTrack = static_cast<CbmTrdTrack*>(fTrdTracks->At(trdId));
139  if (NULL == trdTrack) return -1.;
140 
141  return trdTrack->GetPidANN();
142 }
143 
CbmLitGlobalElectronId::fTrdTracks
TClonesArray * fTrdTracks
Definition: CbmLitGlobalElectronId.h:149
CbmLitGlobalElectronId::fTrdAnnCut
Double_t fTrdAnnCut
Definition: CbmLitGlobalElectronId.h:145
CbmLitGlobalElectronId::fTofHits
TClonesArray * fTofHits
Definition: CbmLitGlobalElectronId.h:150
CbmLitGlobalElectronId::fGlobalTracks
TClonesArray * fGlobalTracks
Definition: CbmLitGlobalElectronId.h:147
CbmLitGlobalElectronId::Init
void Init()
Initialize TClonesArrays.
Definition: CbmLitGlobalElectronId.cxx:42
CbmRichUtil.h
CbmGlobalTrack::GetRichRingIndex
Int_t GetRichRingIndex() const
Definition: CbmGlobalTrack.h:41
CbmLitGlobalElectronId::GetRichAnn
Double_t GetRichAnn(Int_t globalTrackIndex, Double_t momentum)
Identify electron in RICH detector.
Definition: CbmLitGlobalElectronId.cxx:125
CbmGlobalTrack.h
CbmLitGlobalElectronId::IsTrdElectron
Bool_t IsTrdElectron(Int_t globalTrackindex, Double_t momentum)
Identify electron in RICH detector.
Definition: CbmLitGlobalElectronId.cxx:82
CbmRichRing
Definition: CbmRichRing.h:17
CbmGlobalTrack::GetLength
Double_t GetLength() const
Definition: CbmGlobalTrack.h:50
CbmLitGlobalElectronId::GetTrdAnn
Double_t GetTrdAnn(Int_t globalTrackindex, Double_t momentum)
Return ANN value for electron Identification in the TRD detector.
Definition: CbmLitGlobalElectronId.cxx:131
ClassImp
ClassImp(CbmLitGlobalElectronId)
CbmRichRing.h
CbmLitGlobalElectronId::fRichRmsCoeff
Double_t fRichRmsCoeff
Definition: CbmLitGlobalElectronId.h:143
CbmLitGlobalElectronId::IsRichElectron
Bool_t IsRichElectron(Int_t globalTrackIndex, Double_t momentum)
Identify electron in RICH detector.
Definition: CbmLitGlobalElectronId.cxx:52
CbmRichUtil::GetRingTrackDistance
static Double_t GetRingTrackDistance(Int_t globalTrackId)
Definition: alignment/CbmRichUtil.h:20
CbmLitGlobalElectronId::fRichAnnCut
Double_t fRichAnnCut
Definition: CbmLitGlobalElectronId.h:137
CbmTrdTrack::GetPidANN
Double_t GetPidANN() const
Definition: CbmTrdTrack.h:32
CbmHit::GetTime
Double_t GetTime() const
Definition: CbmHit.h:75
CbmGlobalTrack::GetTrdTrackIndex
Int_t GetTrdTrackIndex() const
Definition: CbmGlobalTrack.h:39
CbmLitGlobalElectronId::CbmLitGlobalElectronId
CbmLitGlobalElectronId()
Constructor.
Definition: CbmLitGlobalElectronId.cxx:23
CbmRichRing::GetAaxis
Double_t GetAaxis() const
Definition: CbmRichRing.h:83
CbmLitGlobalElectronId::IsTofElectron
Bool_t IsTofElectron(Int_t globalTrackIndex, Double_t momentum)
Identify electron in RICH detector.
Definition: CbmLitGlobalElectronId.cxx:99
CbmTrdTrack
Definition: CbmTrdTrack.h:22
CbmLitGlobalElectronId::fRichRmsA
Double_t fRichRmsA
Definition: CbmLitGlobalElectronId.h:141
CbmRichRing::GetBaxis
Double_t GetBaxis() const
Definition: CbmRichRing.h:84
CbmLitGlobalElectronId::~CbmLitGlobalElectronId
virtual ~CbmLitGlobalElectronId()
Destructor.
Definition: CbmLitGlobalElectronId.cxx:40
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
CbmRichElectronIdAnn::GetInstance
static CbmRichElectronIdAnn & GetInstance()
Definition: CbmRichElectronIdAnn.h:43
CbmLitGlobalElectronId::fRichDistCut
Double_t fRichDistCut
Definition: CbmLitGlobalElectronId.h:144
CbmLitGlobalElectronId::fRichMeanB
Double_t fRichMeanB
Definition: CbmLitGlobalElectronId.h:140
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
CbmLitGlobalElectronId
Definition: CbmLitGlobalElectronId.h:15
CbmRichElectronIdAnn::CalculateAnnValue
double CalculateAnnValue(int globalTrackIndex, double momentum)
Calculate output value of the ANN.
Definition: CbmRichElectronIdAnn.cxx:84
CbmLitGlobalElectronId::fRichMeanA
Double_t fRichMeanA
Definition: CbmLitGlobalElectronId.h:139
CbmRichElectronIdAnn.h
Implementation of the electron identification algorithm in the RICH detector using Artificial Neural ...
CbmTofHit
Definition: core/data/tof/CbmTofHit.h:26
CbmLitGlobalElectronId.h
CbmGlobalTrack::GetTofHitIndex
Int_t GetTofHitIndex() const
Definition: CbmGlobalTrack.h:42
CbmLitGlobalElectronId::fRichRings
TClonesArray * fRichRings
Definition: CbmLitGlobalElectronId.h:148
CbmTrdTrack.h
CbmLitGlobalElectronId::fRichRmsB
Double_t fRichRmsB
Definition: CbmLitGlobalElectronId.h:142
CbmLitGlobalElectronId::fRichUseAnn
Bool_t fRichUseAnn
Definition: CbmLitGlobalElectronId.h:138