CbmRoot
Loading...
Searching...
No Matches
CbmAnaConversionGlobalFunctions.h
Go to the documentation of this file.
1/* Copyright (C) 2016-2017 Fakultaet fuer Mathematik und Naturwissenschaften, Bergische Universitaet Wuppertal, Wuppertal
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sascha Reinecke [committer], Andrey Lebedev */
4
10#ifndef CBM_ANA_CONVERSION_GLOBAL_FUNCTIONS
11#define CBM_ANA_CONVERSION_GLOBAL_FUNCTIONS
12
13#include "CbmGlobalTrack.h"
14#include "CbmMCTrack.h"
16#include "CbmRichRing.h"
17
18#include "FairRootManager.h"
19
20#include "TClonesArray.h"
21#include "TLorentzVector.h"
22#include "TMath.h"
23
24#define M2E 2.6112004954086e-7
25
27public:
28 /*
29 * Calculate ANN response for a given globaltrack index and momentum
30 */
31 static Double_t ElectronANNvalue(Int_t globalTrackIndex, Double_t momentum)
32 {
33 FairRootManager* ioman = FairRootManager::Instance();
34 if (NULL == ioman) return -2;
35 TClonesArray* fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
36 if (NULL == fGlobalTracks) return -2;
37 TClonesArray* fRichRings = (TClonesArray*) ioman->GetObject("RichRing");
38 if (NULL == fRichRings) return -2;
39
40 //if (NULL == fGlobalTracks || NULL == fRichRings) return -2;
41 //CbmGlobalTrack* globalTrack = (CbmGlobalTrack*) fGlobalTracks->At(globalTrackIndex);
42 const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
43 Int_t richId = globalTrack->GetRichRingIndex();
44 if (richId < 0) return -2;
45 CbmRichRing* ring = static_cast<CbmRichRing*>(fRichRings->At(richId));
46 if (NULL == ring) return -2;
47
48 Double_t ann = CbmRichElectronIdAnn::GetInstance().CalculateAnnValue(globalTrackIndex, momentum);
49 return ann;
50 }
51
52 /*
53 * Checks, whether a track is an electron based on ANN output for a given globaltrack index and momentum, and for a given ANNcut value
54 */
55 static Double_t IsRICHElectronANN(Int_t globalTrackIndex, Double_t momentum, Double_t ANNcut)
56 {
57 FairRootManager* ioman = FairRootManager::Instance();
58 if (NULL == ioman) return -2;
59 TClonesArray* fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
60 if (NULL == fGlobalTracks) return -2;
61 TClonesArray* fRichRings = (TClonesArray*) ioman->GetObject("RichRing");
62 if (NULL == fRichRings) return -2;
63
64
65 //if (NULL == fGlobalTracks || NULL == fRichRings) return -2;
66 //CbmGlobalTrack* globalTrack = (CbmGlobalTrack*) fGlobalTracks->At(globalTrackIndex);
67 const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
68 Int_t richId = globalTrack->GetRichRingIndex();
69 if (richId < 0) return -2;
70 CbmRichRing* ring = static_cast<CbmRichRing*>(fRichRings->At(richId));
71 if (NULL == ring) return -2;
72
73 Double_t ann = CbmRichElectronIdAnn::GetInstance().CalculateAnnValue(globalTrackIndex, momentum);
74 if (ann > ANNcut) return true;
75 else
76 return false;
77 }
78
79
80 static Double_t OpeningAngleBetweenGamma(const TVector3 part11, const TVector3 part12, const TVector3 part21,
81 const TVector3 part22)
82 {
83 Double_t openingAngle = 0;
84
85 Double_t energy11 = TMath::Sqrt(part11.Mag2() + M2E);
86 TLorentzVector lorVec11(part11, energy11);
87
88 Double_t energy12 = TMath::Sqrt(part12.Mag2() + M2E);
89 TLorentzVector lorVec12(part12, energy12);
90
91 Double_t energy21 = TMath::Sqrt(part21.Mag2() + M2E);
92 TLorentzVector lorVec21(part21, energy21);
93
94 Double_t energy22 = TMath::Sqrt(part22.Mag2() + M2E);
95 TLorentzVector lorVec22(part22, energy22);
96
97 TLorentzVector gamma1 = lorVec11 + lorVec12;
98 TLorentzVector gamma2 = lorVec21 + lorVec22;
99
100 Double_t angle = gamma1.Angle(gamma2.Vect());
101 openingAngle = 180. * angle / TMath::Pi();
102
103 return openingAngle;
104 }
105};
106
107#endif
Implementation of the electron identification algorithm in the RICH detector using Artificial Neural ...
static Double_t ElectronANNvalue(Int_t globalTrackIndex, Double_t momentum)
static Double_t IsRICHElectronANN(Int_t globalTrackIndex, Double_t momentum, Double_t ANNcut)
static Double_t OpeningAngleBetweenGamma(const TVector3 part11, const TVector3 part12, const TVector3 part21, const TVector3 part22)
int32_t GetRichRingIndex() const
double CalculateAnnValue(int globalTrackIndex, double momentum)
Calculate output value of the ANN.
static CbmRichElectronIdAnn & GetInstance()