AliPhysics  4646b6b (4646b6b)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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", Int_t clusterType=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 SetAnalysisTrainMode(TString mode){fAnalysisTrainMode = mode; return;}
31  void SetMatchingResidual(Float_t res) {fMatchingResidual = res; return;}
32  void SetMatchingWindow(Float_t win) {fMatchingWindow = win; return;}
33 
34  // for cluster <-> primary matching
35  Bool_t GetTrackClusterMatchingResidual(Int_t trackID, Int_t clusterID, Float_t &dEta, Float_t &dPhi);
36 
37  Int_t GetNMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
38  Int_t GetNMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
39  Int_t GetNMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dR);
40 
41  Int_t GetNMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
42  Int_t GetNMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
43  Int_t GetNMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dR);
44 
45  vector<Int_t> GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
46  vector<Int_t> GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
47  vector<Int_t> GetMatchedTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dR);
48 
49  vector<Int_t> GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
50  vector<Int_t> GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
51  vector<Int_t> GetMatchedClusterIDsForTrack(AliVEvent *event, Int_t trackID, Float_t dR);
52 
53  // for cluster <-> V0-track matching
54  Bool_t PropagateV0TrackToClusterAndGetMatchingResidual(AliVTrack* inSecTrack, AliVCluster* cluster, AliVEvent* event, Float_t &dEta, Float_t &dPhi);
55  Bool_t IsSecTrackClusterAlreadyTried(Int_t trackID, Int_t clusterID);
56  Bool_t GetSecTrackClusterMatchingResidual(Int_t trackID, Int_t clusterID, Float_t &dEta, Float_t &dPhi);
57 
58  Int_t GetNMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
59  Int_t GetNMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
60  Int_t GetNMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t clusterID, Float_t dR);
61 
62  Int_t GetNMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
63  Int_t GetNMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
64  Int_t GetNMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t trackID, Float_t dR);
65 
66  vector<Int_t> GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
67  vector<Int_t> GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
68  vector<Int_t> GetMatchedSecTrackIDsForCluster(AliVEvent *event, Int_t clusterID, Float_t dR);
69 
70  vector<Int_t> GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, Float_t dEtaMax, Float_t dEtaMin, Float_t dPhiMax, Float_t dPhiMin);
71  vector<Int_t> GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, TF1* fFuncPtDepEta, TF1* fFuncPtDepPhi);
72  vector<Int_t> GetMatchedClusterIDsForSecTrack(AliVEvent *event, Int_t trackID, Float_t dR);
73 
74  //general methods
75  Float_t SumTrackEtAroundCluster(AliVEvent* event, Int_t clusterID, Float_t dR);
76 
77  private:
78  //typedefs
79  typedef pair<Int_t, Int_t> pairInt;
80  typedef pair<Float_t, Float_t> pairFloat;
81  typedef map<pairInt, Int_t> mapT;
82 
83  AliCaloTrackMatcher (const AliCaloTrackMatcher&); // not implemented
84  AliCaloTrackMatcher & operator=(const AliCaloTrackMatcher&); // not implemented
85 
86  // private methods
87  void Initialize(Int_t runNumber);
88  void ProcessEvent(AliVEvent *event);
89  void SetLogBinningYTH2(TH2* histoRebin);
90 
91  // debug methods
92  void DebugMatching();
93  void DebugV0Matching();
94 
95  // basic variables/objects
96  Int_t fClusterType; // EMCal(1), PHOS(2) or not running (0)
97  TString fV0ReaderName; // Name of V0Reader
98  TString fAnalysisTrainMode; // AnalysisTrainMode: Grid or GSI //Grid by default
99  Double_t fMatchingWindow; // matching window to prevent unnecessary propagations
100  Float_t fMatchingResidual; // matching residual below which track <-> cluster associations should be stored
101  Int_t fRunNumber; // current run number
102 
103  AliEMCALGeometry* fGeomEMCAL; // pointer to EMCAL geometry
104  AliPHOSGeometry* fGeomPHOS; // pointer to PHOS geometry
105 
106  multimap<Int_t,Int_t> fMapTrackToCluster; // connects a given track ID with all associated cluster IDs
107  multimap<Int_t,Int_t> fMapClusterToTrack; // connects a given cluster ID with all associated track IDs
108 
109  Int_t fNEntries; // number of current TrackID/ClusterID -> Eta/Phi connections
110  vector<pairFloat> fVectorDeltaEtaDeltaPhi; // vector of all matching residuals for a specific TrackID/ClusterID
111  mapT fMap_TrID_ClID_ToIndex; // map tuple of (trackID,clusterID) to index in vector fVectorDeltaEtaDeltaPhi
112 
113  // for cluster <-> V0-track matching (running with different mass hypthesis)
114  multimap<Int_t,Int_t> fSecMapTrackToCluster; // connects a given secondary track ID with all associated cluster IDs
115  multimap<Int_t,Int_t> fSecMapClusterToTrack; // connects a given cluster ID with all associated secondary track IDs
116 
117  Int_t fSecNEntries; // number of current V0-trackIDs/clusterID -> Eta/Phi connections
118  vector<pairFloat> fSecVectorDeltaEtaDeltaPhi; // vector of all matching residuals for a specific V0-trackIDs/clusterID
119  mapT fSecMap_TrID_ClID_ToIndex; // map tuple of (V0-trackID,clusterID) to index in vector fSecVectorDeltaEtaDeltaPhi
120  mapT fSecMap_TrID_ClID_AlreadyTried; // map tuple of (V0-trackID,clusterID) to matching outcome, successful or not
121 
122  //histos
123  TList* fListHistos; // list with histogram(s)
124  TH2F* fHistControlMatches; // bookkeeping for processed tracks/clusters and succesful matches
125  TH2F* fSecHistControlMatches; // bookkeeping for processed V0-tracks/clusters and succesful matches
126 
127  ClassDef(AliCaloTrackMatcher,3)
128 };
129 
130 #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)
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