CbmRoot
Loading...
Searching...
No Matches
CbmLitGlobalElectronId.cxx
Go to the documentation of this file.
1/* Copyright (C) 2011-2021 UGiessen/JINR-LIT, Giessen/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev [committer], Andrey Lebedev */
4
12
13#include "CbmGlobalTrack.h"
15#include "CbmRichRing.h"
16#include "CbmTofHit.h"
17#include "CbmTrdTrack.h"
18#include "FairRootManager.h"
19#include "TClonesArray.h"
20#include "TMath.h"
21#include "TString.h"
22#include "TSystem.h"
23#include "utils/CbmRichUtil.h"
24
25#include <Logger.h>
26
27#include <cmath>
28#include <iostream>
29
31 : fTrdAnnCut(
32 0.8) // TODO: at the moment, TrdAnn is Likelilhood value; change this if TrdAnn works again // values loose | strict: 0.2 | 0.8
33 , fRichAnnCut(-0.0) // values loose | strict: -0.4 | 0.0
34 , fRichUseAnn(true)
35 , fRichMeanA(-1.)
36 , fRichMeanB(-1.)
37 , fRichRmsA(-1.)
38 , fRichRmsB(-1.)
39 , fRichRmsCoeff(-1.)
40 , fRichDistCut(-1.)
41 , fGlobalTracks(NULL)
42 , fRichRings(NULL)
43 , fTrdTracks(NULL)
44 , fTofHits(NULL)
45{
46 Init();
47}
48
50
52{
53 FairRootManager* ioman = FairRootManager::Instance();
54 if (ioman != nullptr) {
55 fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
56 fRichRings = (TClonesArray*) ioman->GetObject("RichRing");
57 fTrdTracks = (TClonesArray*) ioman->GetObject("TrdTrack");
58 fTofHits = (TClonesArray*) ioman->GetObject("TofHit");
59 }
60 LOG(info) << "fRichAnnCut = " << fRichAnnCut;
61 LOG(info) << "fTrdAnnCut = " << fTrdAnnCut;
62}
63
64Bool_t CbmLitGlobalElectronId::IsRichElectron(Int_t globalTrackIndex, Double_t momentum)
65{
66 if (fRichUseAnn == false) {
67 if (NULL == fGlobalTracks || NULL == fRichRings) return false;
68 const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
69 Int_t richId = globalTrack->GetRichRingIndex();
70 if (richId < 0) return false;
71 CbmRichRing* ring = static_cast<CbmRichRing*>(fRichRings->At(richId));
72 if (NULL == ring) return false;
73 Double_t axisA = ring->GetAaxis();
74 Double_t axisB = ring->GetBaxis();
75 Double_t dist = CbmRichUtil::GetRingTrackDistance(globalTrackIndex);
76 if (fabs(axisA - fRichMeanA) < fRichRmsCoeff * fRichRmsA && fabs(axisB - fRichMeanB) < fRichRmsCoeff * fRichRmsB
77 && dist < fRichDistCut) {
78 return true;
79 }
80 else {
81 return false;
82 }
83 }
84 else {
85 Double_t ann = CbmRichElectronIdAnn::GetInstance().CalculateAnnValue(globalTrackIndex, momentum);
86 if (ann > fRichAnnCut)
87 return true;
88 else
89 return false;
90 }
91}
92
93Bool_t CbmLitGlobalElectronId::IsTrdElectron(Int_t globalTrackIndex, Double_t momentum)
94{
95 if (NULL == fGlobalTracks || NULL == fTrdTracks) return false;
96 const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
97 Int_t trdId = globalTrack->GetTrdTrackIndex();
98 if (trdId < 0) return false;
99 CbmTrdTrack* trdTrack = static_cast<CbmTrdTrack*>(fTrdTracks->At(trdId));
100 if (NULL == trdTrack) return false;
101
102 Double_t ann = trdTrack->GetPidLikeEL();
103
104 // TODO @Cornelius: remove following P<1GeV condition
105 if (momentum < 1.) return true;
106
107 if (ann > fTrdAnnCut)
108 return true;
109 else
110 return false;
111}
112
113Bool_t CbmLitGlobalElectronId::IsTofElectron(Int_t globalTrackIndex, Double_t momentum, Double_t eventTime)
114{
115 Double_t mass2 = GetTofM2(globalTrackIndex, momentum, eventTime);
116 if (mass2 == -1.) return false;
117
118 // loose cut
119 if (momentum >= 1.3) {
120 if (mass2 < (0.010 * momentum - 0.003)) {
121 return true;
122 }
123 }
124 else {
125 if (mass2 < 0.01) {
126 return true;
127 }
128 }
129
130 // stricter cut
131 /*if (momentum >= 0.8) {
132 if (mass2 < (- 0.020 * momentum + 0.026)) { return true; }
133 }
134 else {
135 if (mass2 < 0.01) { return true; }
136 }*/
137
138 // simple linear cut
139 //if (mass2 < 0.01) return true;
140
141 return false;
142}
143
144Double_t CbmLitGlobalElectronId::GetRichAnn(Int_t globalTrackIndex, Double_t momentum)
145{
146 return CbmRichElectronIdAnn::GetInstance().CalculateAnnValue(globalTrackIndex, momentum);
147}
148
149Double_t CbmLitGlobalElectronId::GetTrdAnn(Int_t globalTrackIndex, Double_t momentum)
150{
151 if (NULL == fGlobalTracks || NULL == fTrdTracks) return -1.;
152 const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
153 Int_t trdId = globalTrack->GetTrdTrackIndex();
154 if (trdId < 0) return -1.;
155 CbmTrdTrack* trdTrack = static_cast<CbmTrdTrack*>(fTrdTracks->At(trdId));
156 if (NULL == trdTrack) return -1.;
157
158 return trdTrack->GetPidLikeEL();
159}
160
161Double_t CbmLitGlobalElectronId::GetTofM2(Int_t globalTrackIndex, Double_t momentum, Double_t eventTime)
162{
163 if (NULL == fGlobalTracks || NULL == fTofHits) return -1.;
164 const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
165 Double_t trackLength = globalTrack->GetLength() / 100.;
166 Int_t tofId = globalTrack->GetTofHitIndex();
167 if (tofId < 0) return -1.;
168 CbmTofHit* tofHit = (CbmTofHit*) fTofHits->At(tofId);
169 if (NULL == tofHit) return -1.;
170
171 Double_t noOffsetTime = tofHit->GetTime() - eventTime;
172 Double_t time = 0.2998 * noOffsetTime; // time in ns -> transfrom to ct in m
173 Double_t mass2 = momentum * momentum * (TMath::Power(time / trackLength, 2) - 1);
174
175 return mass2;
176}
177
ClassImp(CbmLitGlobalElectronId)
Implementation of the electron identification algorithm in the RICH detector using Artificial Neural ...
int32_t GetRichRingIndex() const
int32_t GetTofHitIndex() const
double GetLength() const
int32_t GetTrdTrackIndex() const
double GetTime() const
Definition CbmHit.h:76
Bool_t IsTrdElectron(Int_t globalTrackindex, Double_t momentum)
Identify electron in RICH detector.
Double_t GetTrdAnn(Int_t globalTrackindex, Double_t momentum)
Return ANN value for electron Identification in the TRD detector.
Double_t GetTofM2(Int_t globalTrackIndex, Double_t momentum, Double_t eventTime=1000.)
Return TOF m2 value.
Double_t GetRichAnn(Int_t globalTrackIndex, Double_t momentum)
Identify electron in RICH detector.
Bool_t IsTofElectron(Int_t globalTrackIndex, Double_t momentum, Double_t eventTime=1000.)
Identify electron in RICH detector.
Bool_t IsRichElectron(Int_t globalTrackIndex, Double_t momentum)
Identify electron in RICH detector.
void Init()
Initialize TClonesArrays.
virtual ~CbmLitGlobalElectronId()
Destructor.
double CalculateAnnValue(int globalTrackIndex, double momentum)
Calculate output value of the ANN.
static CbmRichElectronIdAnn & GetInstance()
double GetAaxis() const
Definition CbmRichRing.h:80
double GetBaxis() const
Definition CbmRichRing.h:81
static double GetRingTrackDistance(int globalTrackId)
double GetPidLikeEL() const
Definition CbmTrdTrack.h:43