AliPhysics  63e47e1 (63e47e1)
AliCaloTrackMatcher.h
Go to the documentation of this file.
1 #ifndef ALICALOTRACKMATCHER_H
2 #define ALICALOTRACKMATCHER_H
3 
4 #include "AliAnalysisTaskSE.h"
5 #include "AliEMCALGeometry.h"
6 #include "AliPHOSGeometry.h"
7 #include <vector>
8 #include <map>
9 #include <utility>
10 
11 class TF1;
12 
13 using namespace std;
14 
16 
17  public:
18  AliCaloTrackMatcher(const char *name="CaloTrackMatcher_0_0", Int_t clusterType = 0, Int_t runningMode = 0);
19  //Uncopyable & operator=(const Uncopyable&);
20 
21  virtual ~AliCaloTrackMatcher(); //virtual destructor
22  void UserCreateOutputObjects();
23 
24  virtual void UserExec(Option_t *option);
25  virtual void Terminate(Option_t *);
26 
27  TList* GetCaloTrackMatcherHistograms() {return fListHistos;}
28 
29  void SetV0ReaderName(TString name) {fV0ReaderName = name; return;}
30  void SetCorrectionTaskSetting(TString setting) {fCorrTaskSetting = setting;}
31  void SetAnalysisTrainMode(TString mode){fAnalysisTrainMode = mode; return;}
32  void SetMatchingResidual(Float_t res) {fMatchingResidual = res; return;}
33  void SetMatchingWindow(Float_t win) {fMatchingWindow = win; return;}
34 
35  // for cluster <-> primary matching
36  Bool_t GetTrackClusterMatchingResidual(Int_t trackID, Int_t clusterID, Float_t &dEta, Float_t &dPhi);
37 
38  Int_t GetNMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
39  Int_t GetNMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
40  Int_t GetNMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dR);
41 
42  Int_t GetNMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
43  Int_t GetNMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
44  Int_t GetNMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dR);
45 
46  vector<Int_t> GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
47  vector<Int_t> GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
48  vector<Int_t> GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dR);
49 
50  vector<Int_t> GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
51  vector<Int_t> GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
52  vector<Int_t> GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dR);
53 
54  // for cluster <-> V0-track matching
55  Bool_t PropagateV0TrackToClusterAndGetMatchingResidual(AliVTrack* inSecTrack, AliVCluster* cluster, AliVEvent* event, Float_t &dEta, Float_t &dPhi);
56  Bool_t IsSecTrackClusterAlreadyTried(Int_t trackID, Int_t clusterID);
57  Bool_t GetSecTrackClusterMatchingResidual(Int_t trackID, Int_t clusterID, Float_t &dEta, Float_t &dPhi);
58 
59  Int_t GetNMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
60  Int_t GetNMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
61  Int_t GetNMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t clusterID, Float_t dR);
62 
63  Int_t GetNMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
64  Int_t GetNMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
65  Int_t GetNMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t trackID, Float_t dR);
66 
67  vector<Int_t> GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
68  vector<Int_t> GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
69  vector<Int_t> GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dR);
70 
71  vector<Int_t> GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
72  vector<Int_t> GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
73  vector<Int_t> GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, Float_t dR);
74 
75  //general methods
76  Float_t SumTrackEtAroundCluster(AliVEvent* event, Int_t clusterID, Float_t dR);
77 
78  private:
79  //typedefs
80  typedef pair<Int_t, Int_t> pairInt;
81  typedef pair<Float_t, Float_t> pairFloat;
82  typedef map<pairInt, Int_t> mapT;
83 
84  AliCaloTrackMatcher (const AliCaloTrackMatcher&); // not implemented
85  AliCaloTrackMatcher & operator=(const AliCaloTrackMatcher&); // not implemented
86 
87  // private methods
88  void Initialize(Int_t runNumber);
89  void ProcessEvent(AliVEvent *event);
90  void SetLogBinningYTH2(TH2* histoRebin);
91 
92  // debug methods
93  void DebugMatching();
94  void DebugV0Matching();
95 
96  // basic variables/objects
97  Int_t fClusterType; // EMCal(1), PHOS(2) or not running (0)
98  Int_t fRunningMode; // running mode of track matcher
99  // (0) matching of primary tracks (dedicated for run 2), active since Feb 15, 2018
100  // (1) matching of all tracks (dedicated for run 1), was standard until Feb 15, 2018
101  // (2) ITS matching mode
102  // (5) testing mode, (1) + some more restrictions
103  // (6) testing mode, (5) + TrackCuts (primary+secondary)
104  TString fV0ReaderName; // Name of V0Reader
105  TString fCorrTaskSetting; // Name of Corr Task Setting
106  TString fAnalysisTrainMode; // AnalysisTrainMode: Grid or GSI //Grid by default
107  Double_t fMatchingWindow; // matching window to prevent unnecessary propagations
108  Float_t fMatchingResidual; // matching residual below which track <-> cluster associations should be stored
109  Int_t fRunNumber; // current run number
110 
111  AliEMCALGeometry* fGeomEMCAL; // pointer to EMCAL geometry
112  AliPHOSGeometry* fGeomPHOS; // pointer to PHOS geometry
113 
114  multimap<Int_t,Int_t> fMapTrackToCluster; // connects a given track ID with all associated cluster IDs
115  multimap<Int_t,Int_t> fMapClusterToTrack; // connects a given cluster ID with all associated track IDs
116 
117  Int_t fNEntries; // number of current TrackID/ClusterID -> Eta/Phi connections
118  vector<pairFloat> fVectorDeltaEtaDeltaPhi; // vector of all matching residuals for a specific TrackID/ClusterID
119  mapT fMap_TrID_ClID_ToIndex; // map tuple of (trackID,clusterID) to index in vector fVectorDeltaEtaDeltaPhi
120 
121  // for cluster <-> V0-track matching (running with different mass hypthesis)
122  multimap<Int_t,Int_t> fSecMapTrackToCluster; // connects a given secondary track ID with all associated cluster IDs
123  multimap<Int_t,Int_t> fSecMapClusterToTrack; // connects a given cluster ID with all associated secondary track IDs
124 
125  Int_t fSecNEntries; // number of current V0-trackIDs/clusterID -> Eta/Phi connections
126  vector<pairFloat> fSecVectorDeltaEtaDeltaPhi; // vector of all matching residuals for a specific V0-trackIDs/clusterID
127  mapT fSecMap_TrID_ClID_ToIndex; // map tuple of (V0-trackID,clusterID) to index in vector fSecVectorDeltaEtaDeltaPhi
128  mapT fSecMap_TrID_ClID_AlreadyTried; // map tuple of (V0-trackID,clusterID) to matching outcome, successful or not
129 
130  //histos
131  TList* fListHistos; // list with histogram(s)
132  TH2F* fHistControlMatches; // bookkeeping for processed tracks/clusters and succesful matches
133  TH2F* fSecHistControlMatches; // bookkeeping for processed V0-tracks/clusters and succesful matches
134 
135  ClassDef(AliCaloTrackMatcher,5)
136 };
137 
138 #endif
multimap< Int_t, Int_t > fMapClusterToTrack
multimap< Int_t, Int_t > fSecMapClusterToTrack
double Double_t
Definition: External.C:58
Definition: External.C:236
multimap< Int_t, Int_t > fMapTrackToCluster
AliEMCALGeometry * fGeomEMCAL
void SetMatchingResidual(Float_t res)
vector< pairFloat > fSecVectorDeltaEtaDeltaPhi
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
vector< pairFloat > fVectorDeltaEtaDeltaPhi
void SetMatchingWindow(Float_t win)
Int_t mode
Definition: anaM.C:41
void SetAnalysisTrainMode(TString mode)
void SetCorrectionTaskSetting(TString setting)
multimap< Int_t, Int_t > fSecMapTrackToCluster
TList * GetCaloTrackMatcherHistograms()
Definition: External.C:220
pair< Float_t, Float_t > pairFloat
void SetV0ReaderName(TString name)
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
pair< Int_t, Int_t > pairInt
AliPHOSGeometry * fGeomPHOS
map< pairInt, Int_t > mapT