]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/muondep/AliAnalysisTaskMuonPerformance.h
New macro for efficiency computation of tracking chamber efficiencies. Commit of...
[u/mrichter/AliRoot.git] / PWG3 / muondep / AliAnalysisTaskMuonPerformance.h
CommitLineData
3c74311e 1#ifndef ALIANALYSISTASKMUONPERFORMANCE_H
2#define ALIANALYSISTASKMUONPERFORMANCE_H
3
4/// \ingroup "PWG3muon"
5/// \class AliAnalysisTaskMuonPerformance
6/// \brief Analysis task for
7///
8// Author D.Stocco and P.Pillot, Subatech, Nantes
9
10
11#include "AliAnalysisTaskSE.h"
12#include "AliLog.h"
13
14class TObjArray;
15class TH1;
16class TH2;
17class TGraphAsymmErrors;
18class TCanvas;
19class AliMUONRecoParam;
20class AliCFContainer;
21class AliMCParticle;
22class AliESDMuonTrack;
23class AliCFEffGrid;
24
25class AliAnalysisTaskMuonPerformance : public AliAnalysisTaskSE {
26 public:
27 AliAnalysisTaskMuonPerformance();
28 AliAnalysisTaskMuonPerformance(const char *name);
29 virtual ~AliAnalysisTaskMuonPerformance();
30
31 /// Set location of the default OCDB storage (if not set use "raw://")
32 void SetDefaultStorage(const char* ocdbPath) { fDefaultStorage = ocdbPath; }
33
34 // Set the binning to be used to study the detector resolution versus momentum
35 void SetPBins(Int_t nBins, Double_t min, Double_t max);
36
37 /// set the flag to add or not the systematic shifts of the residuals to the resolution
38 void CorrectClusterResForSystematics(Bool_t flag = kTRUE) { fCorrectForSystematics = flag; }
39
40 /// set the flag to fit or not the cluster residuals to extract means and sigmas
41 void FitClusterResiduals(Bool_t flag = kTRUE) { fFitResiduals = flag; }
42
43 virtual void UserCreateOutputObjects();
44 virtual void UserExec(Option_t *option);
45 virtual void Terminate(Option_t *option);
46 virtual void NotifyRun();
47
48 enum {
49 kVarPt, ///< Transverse momentum
50 kVarEta, ///< Pseudo-rapidity
51 kVarPhi, ///< Azimuthal angle
52 kVarThetaZones, ///< Theta at absorber end (4 zones)
53 kVarCharge, ///< Particle charge
54 kVarHasTracker, ///< Is tracker track
55 kVarTrigger, ///< Trigger info
56 kVarMotherType, ///< Mother type
57 kVarMatchMC, ///< MC matching flag
58 kNvars ///< THnSparse dimensions
59 };
60
61 enum {
62 kStepReconstructed, ///< Reconstructed tracks
63 kStepGeneratedMC, ///< Generated tracks (MC)
64 kNsteps ///< Number of steps
65 };
66
67 private:
68
69 AliAnalysisTaskMuonPerformance(const AliAnalysisTaskMuonPerformance&);
70 AliAnalysisTaskMuonPerformance& operator=(const AliAnalysisTaskMuonPerformance&);
71
72 Bool_t GetEfficiency(AliCFEffGrid* efficiency, Double_t& calcEff, Double_t& calcEffErr);
73 Int_t RecoTrackMother(AliMCParticle* mcParticle);
74 Float_t GetBinThetaAbsEnd(Float_t RAtAbsEnd, Bool_t isTheta = kFALSE);
75 void FillContainerInfo(Double_t* containerInput, AliESDMuonTrack* esdTrack, Int_t mcID);
76
77 void FitLandauGausResVsP(TH2* h, const char* fitting, TGraphAsymmErrors* gMean, TGraphAsymmErrors* gMostProb, TGraphAsymmErrors* gSigma);
78 void FitGausResVsMom(TH2* h, const Double_t mean0, const Double_t sigma0, const char* fitting, TGraphAsymmErrors* gMean, TGraphAsymmErrors* gSigma);
79 void FitPDCAVsMom(TH2* h, const char* fitting, TGraphAsymmErrors* gMean, TGraphAsymmErrors* gSigma);
80 void FitClusterResidual(TH1* h, Int_t i, Double_t& sigma, TGraphErrors* gMean, TGraphErrors* gSigma);
81
82 TCanvas* DrawVsAng(const char* name, const char* title, TH1* h1, TH2* h2);
83 TCanvas* DrawVsPos(const char* name, const char* title, TH2* h1, TH2* h2, TH2* h3);
84 TCanvas* DrawFitLandauGausResPVsP(const char* name, const char* title, TH2* h, const Int_t nBins, const char* fitting);
85 TCanvas* DrawResPVsP(const char* name, const char* title, TH2* h, const Int_t nBins);
86
87 void Zoom(TH1* h, Double_t fractionCut = 0.01);
88
89 enum {
90 kNoMatchTrig, ///< No match with trigger
91 kAllPtTrig, ///< Match All Pt
92 kLowPtTrig, ///< Match Low Pt
93 kHighPtTrig, ///< Match High Pt
94 kNtrigCuts ///< Total number of trigger types
95 };
96
97 enum {
98 kCharmMu, ///< Mu from charm
99 kBeautyMu, ///< Mu from beauty
100 kPrimaryMu, ///< Primary mu
101 kSecondaryMu, ///< Secondary mu
102 kRecoHadron, ///< Reconstructed hadron
103 kUnknownPart, ///< Particle that fails matching kine
104 kNtrackSources ///< Total number of track sources
105 };
106
107 enum {
108 kNoMatch, ///< not matched with either reconstructible track or triggerable track
109 kTrackerOnly, ///< matched with reconstructible track only
110 kMatchedSame, ///< matched with reconstructible track and triggerable track of same ID
111 kMatchedDiff, ///< matched with reconstructible track and triggerable track of different ID
112 kTriggerOnly, ///< matched with triggerable track only
113 kNMatchMC ///< Total number of MC matching flags
114 };
115
116 // Histograms for trigger resolution
117 enum {
118 kResTrigX11, ///< Residual of x position in first trigger chamber
119 kResTrigY11, ///< Residual of y position in first trigger chamber
120 kResTrigSlopeY ///< Residual of trigger track slope
121 };
122
123 // Histograms for tracker resolution
124 enum {
125 kResPAtVtx, ///< momentum residual at vertex
126 kResPAtVtxVsP, ///< momentum residual at vertex versus P
127 kResPAtVtxVsPIn23deg, ///< momentum residual at vertex versus P for tracks in ]2,3] degrees at absorber end
128 kResPAtVtxVsPIn310deg, ///< momentum residual at vertex versus P for tracks in ]3,10[ degrees at absorber end
129 kResPAtVtxVsPIn02degMC, ///< momentum residual at vertex versus P for tracks with MC angle < 2 degrees
130 kResPAtVtxVsPosAbsEndIn02degMC, ///< momentum residual at vertex versus position at absorber end for tracks with MC angle <= 2 degrees
131 kResPAtVtxVsPosAbsEndIn23degMC, ///< momentum residual at vertex versus position at absorber end for tracks with MC angle in ]2,3] degrees
132 kResPAtVtxVsPosAbsEndIn310degMC, ///< momentum residual at vertex versus position at absorber end for tracks with MC angle in ]3,10[ degrees
133 kResPAtVtxVsAngleAtAbsEnd, ///< momentum residual at vertex versus angle at absorber end
134 kResPAtVtxVsMCAngle, ///< momentum residual at vertex versus MC angle
135 kResPAtVtxVsAngleAtAbsEndVsP, ///< momentum residual at vertex versus angle at absorber end versus momentum
136 kResPtAtVtxVsPt, ///< transverse momentum residual at vertex versus pT
137
138 kResPAt1stCl, ///< momentum residual at first cluster
139 kResPAt1stClVsP, ///< momentum residual at first cluster versus P
140 kResPtAt1stClVsPt, ///< transverse momentum residual at first cluster versus pT
141
142 kResSlopeXAtVtx, ///< slope-X residual at vertex
143 kResSlopeYAtVtx, ///< slope-Y residual at vertex
144 kResSlopeXAtVtxVsP, ///< slope-X residual at vertex versus P
145 kResSlopeYAtVtxVsP, ///< slope-Y residual at vertex versus P
146 kResSlopeXAtVtxVsPosAbsEndIn02degMC, ///< slope-X residual at vertex versus position at absorber end for tracks with MC angle <= 2 degrees
147 kResSlopeYAtVtxVsPosAbsEndIn02degMC, ///< slope-Y residual at vertex versus position at absorber end for tracks with MC angle <= 2 degrees
148 kResSlopeXAtVtxVsPosAbsEndIn23degMC, ///< slope-X residual at vertex versus position at absorber end for tracks with MC angle in ]2,3] degrees
149 kResSlopeYAtVtxVsPosAbsEndIn23degMC, ///< slope-Y residual at vertex versus position at absorber end for tracks with MC angle in ]2,3] degrees
150 kResSlopeXAtVtxVsPosAbsEndIn310degMC, ///< slope-X residual at vertex versus position at absorber end for tracks with MC angle in ]3,10[ degrees
151 kResSlopeYAtVtxVsPosAbsEndIn310degMC, ///< slope-Y residual at vertex versus position at absorber end for tracks with MC angle in ]3,10[ degrees
152 kResSlopeXAtVtxVsAngleAtAbsEnd, ///< slope-X residual at vertex versus angle at absorber end
153 kResSlopeYAtVtxVsAngleAtAbsEnd, ///< slope-Y residual at vertex versus angle at absorber end
154 kResSlopeXAtVtxVsMCAngle, ///< slope-X residual at vertex versus MC angle
155 kResSlopeYAtVtxVsMCAngle, ///< slope-Y residual at vertex versus MC angle
156
157 kResSlopeXAt1stCl, ///< slope-X residual at first cluster
158 kResSlopeYAt1stCl, ///< slope-Y residual at first cluster
159 kResSlopeXAt1stClVsP, ///< slope-X residual at first cluster versus P
160 kResSlopeYAt1stClVsP, ///< slope-Y residual at first cluster versus P
161
162 kResEtaAtVtx, ///< eta residual at vertex
163 kResEtaAtVtxVsP, ///< eta residual at vertex versus P
164 kResEtaAtVtxVsPosAbsEndIn02degMC, ///< eta residual at vertex versus position at absorber end for tracks with MC angle <= 2 degrees
165 kResEtaAtVtxVsPosAbsEndIn23degMC, ///< eta residual at vertex versus position at absorber end for tracks with MC angle in ]2,3] degrees
166 kResEtaAtVtxVsPosAbsEndIn310degMC, ///< eta residual at vertex versus position at absorber end for tracks with MC angle in ]3,10[ degrees
167 kResEtaAtVtxVsAngleAtAbsEnd, ///< eta residual at vertex versus angle at absorber end
168 kResEtaAtVtxVsMCAngle, ///< eta residual at vertex versus MC angle
169
170 kResPhiAtVtx, ///< phi residual at vertex
171 kResPhiAtVtxVsP, ///< phi residual at vertex versus P
172 kResPhiAtVtxVsPosAbsEndIn02degMC, ///< phi residual at vertex versus position at absorber end for tracks with MC angle <= 2 degrees
173 kResPhiAtVtxVsPosAbsEndIn23degMC, ///< phi residual at vertex versus position at absorber end for tracks with MC angle in ]2,3] degrees
174 kResPhiAtVtxVsPosAbsEndIn310degMC, ///< phi residual at vertex versus position at absorber end for tracks with MC angle in ]3,10[ degrees
175 kResPhiAtVtxVsAngleAtAbsEnd, ///< phi residual at vertex versus angle at absorber end
176 kResPhiAtVtxVsMCAngle, ///< phi residual at vertex versus MC angle
177
178 kPDCA, ///< P*DCA distribution
179 kPDCAVsPIn23deg, ///< P * DCA distribution versus P for tracks in ]2,3] degrees at absorber end
180 kPDCAVsPIn310deg, ///< P * DCA distribution versus P for tracks in ]3,10[ degrees at absorber end
181 kPDCAVsPosAbsEndIn02degMC, ///< P * DCA distribution versus position at absorber end for tracks with MC angle <= 2 degrees
182 kPDCAVsPosAbsEndIn23degMC, ///< P * DCA distribution versus position at absorber end for tracks with MC angle in ]2,3] degrees
183 kPDCAVsPosAbsEndIn310degMC, ///< P * DCA distribution versus position at absorber end for tracks with MC angle in ]3,10[ degrees
184 kPDCAVsAngleAtAbsEnd, ///< P * DCA distribution versus angle at absorber end
185 kPDCAVsMCAngle, ///< P * DCA distribution versus MC angle
186
187 kPMCSAngVsPIn23deg, ///< P * MCS deviation angle distribution versus P for tracks in ]2,3] degrees at absorber end
188 kPMCSAngVsPIn310deg, ///< P * MCS deviation angle distribution versus P for tracks in ]3,10[ degrees at absorber end
189
190 kResClXVsCh, ///< cluster residual-X versus chamber
191 kResClYVsCh, ///< cluster residual-Y versus chamber
192 kResClXVsDE, ///< cluster residual-X versus DE
193 kResClYVsDE ///< cluster residual-Y versus DE
194 };
195
196 // Graphs and canvases for momentum resolution at vertex
197 enum {
198 kMeanResPAtVtxVsP, ///< mean momentum residual at vertex versus P
199 kMostProbResPAtVtxVsP, ///< most probable momentum residual at vertex versus P
200 kSigmaResPAtVtxVsP, ///< relative momentum resolution at vertex versus P
201 kcResPAtVtx, ///< momentum residual at vertex in 3 angular regions
202 kcResPAtVtxMC, ///< momentum residual at vertex in 3 MC angular regions
203 kcResPAtVtxVsPosAbsEndMC, ///< momentum residual at vertex versus position at absorber end in 3 MC angular regions
204 kcResPAtVtxVsPIn23deg, ///< momentum residual for tracks between 2 and 3 degrees
205 kcResPAtVtxVsPIn310deg, ///< momentum residual for tracks between 3 and 10 degrees
206 kcResPAtVtxVsPIn02degMC ///< momentum residuals for tracks with MC angle < 2 degrees
207 };
208
209 // Graphs for momentum resolution at first cluster
210 enum {
211 kMeanResPAt1stClVsP, ///< mean momentum residual at first cluster versus P
212 kSigmaResPAt1stClVsP ///< relative momentum resolution at first cluster versus P
213 };
214
215 // Graphs and canvases for slope resolution at vertex
216 enum {
217 kMeanResSlopeXAtVtxVsP, ///< mean slope-X residual at vertex versus P
218 kMeanResSlopeYAtVtxVsP, ///< mean slope-Y residual at vertex versus P
219 kSigmaResSlopeXAtVtxVsP, ///< slope-X resolution at vertex versus P
220 kSigmaResSlopeYAtVtxVsP, ///< slope-Y resolution at vertex versus P
221 kcResSlopeXAtVtx, ///< slope-X residual at vertex in 3 angular regions
222 kcResSlopeYAtVtx, ///< slope-Y residual at vertex in 3 angular regions
223 kcResSlopeXAtVtxMC, ///< slope-X residual at vertex in 3 MC angular regions
224 kcResSlopeYAtVtxMC, ///< slope-Y residual at vertex in 3 MC angular regions
225 kcResSlopeXAtVtxVsPosAbsEndMC, ///< slope-X residual at vertex versus position at absorber end in 3 MC angular regions
226 kcResSlopeYAtVtxVsPosAbsEndMC ///< slope-Y residual at vertex versus position at absorber end in 3 MC angular regions
227 };
228
229 // Graphs for slope resolution at first cluster
230 enum {
231 kMeanResSlopeXAt1stClVsP, ///< mean slope-X residual at first cluster versus P
232 kMeanResSlopeYAt1stClVsP, ///< mean slope-Y residual at first cluster versus P
233 kSigmaResSlopeXAt1stClVsP, ///< slope-X resolution at first cluster versus P
234 kSigmaResSlopeYAt1stClVsP ///< slope-Y resolution at first cluster versus P
235 };
236
237 // Graphs and canvases for eta resolution at vertex
238 enum {
239 kMeanResEtaAtVtxVsP, ///< mean eta residual at vertex versus P
240 kSigmaResEtaAtVtxVsP, ///< eta resolution at vertex
241 kcResEtaAtVtx, ///< eta residual at vertex in 3 angular regions
242 kcResEtaAtVtxMC, ///< eta residual at vertex in 3 MC angular regions
243 kcResEtaAtVtxVsPosAbsEndMC ///< eta residual at vertex versus position at absorber end in 3 MC angular regions
244 };
245
246 // Graphs and canvases for phi resolution at vertex
247 enum {
248 kMeanResPhiAtVtxVsP, ///< mean phi residual at vertex versus P
249 kSigmaResPhiAtVtxVsP, ///< phi resolution at vertex
250 kcResPhiAtVtx, ///< phi residual at vertex in 3 angular regions
251 kcResPhiAtVtxMC, ///< phi residual at vertex in 3 MC angular regions
252 kcResPhiAtVtxVsPosAbsEndMC ///< phi residual at vertex versus position at absorber end in 3 MC angular regions
253 };
254
255 // Graphs and cavases for DCA resolution and MCS dispersion
256 enum {
257 kMeanPDCAVsPIn23deg, ///< mean P * DCA versus P for tracks in ]2,3] degrees at absorber end
258 kSigmaPDCAVsPIn23deg, ///< P * DCA resolution versus P for tracks in ]2,3] degrees at absorber end
259 kMeanPDCAVsPIn310deg, ///< mean P * DCA versus P for tracks in ]3,10[ degrees at absorber end
260 kSigmaPDCAVsPIn310deg, ///< P * DCA resolution versus P for tracks in ]3,10[ degrees at absorber end
261 kMeanPMCSAngVsPIn23deg, ///< mean P * MCS deviation angle versus P for tracks in ]2,3] degrees at absorber end
262 kSigmaPMCSAngVsPIn23deg, ///< P * MCS deviation angle dispersion versus P for tracks in ]2,3] degrees at absorber end
263 kMeanPMCSAngVsPIn310deg, ///< mean P * MCS deviation angle versus P for tracks in ]3,10[ degrees at absorber end
264 kSigmaPMCSAngVsPIn310deg, ///< P * MCS deviation angle dispersion versus P for tracks in ]3,10[ degrees at absorber end
265 kcPDCA, ///< P * DCA in 3 angular regions
266 kcPDCAMC, ///< P * DCA in 3 MC angular regions
267 kcPDCAVsPosAbsEndMC ///< P * DCA versus position at absorber end in 3 MC angular regions
268 };
269
270 // Graphs for cluster resolution
271 enum {
272 kMeanResClXVsCh, ///< mean cluster residual-X versus chamber
273 kMeanResClYVsCh, ///< mean cluster residual-Y versus chamber
274 kSigmaResClXVsCh, ///< cluster resolution-X versus chamber
275 kSigmaResClYVsCh, ///< cluster resolution-Y versus chamber
276 kMeanResClXVsDE, ///< mean cluster residual-X versus DE
277 kMeanResClYVsDE, ///< mean cluster residual-Y versus DE
278 kSigmaResClXVsDE, ///< cluster resolution-X versus DE
279 kSigmaResClYVsDE ///< cluster resolution-Y versus DE
280 };
281
282 TString fDefaultStorage; ///< location of the default OCDB storage
283 Int_t fNPBins; ///< number of momentum bins
284 Double_t fPRange[2]; ///< momentum range
285 Bool_t fCorrectForSystematics; ///< add or not the systematic shifts of the residuals to the resolution
286 Bool_t fFitResiduals; ///< fit or not the cluster residuals to extract means and sigmas
287 UInt_t fRequestedStationMask; //!< mask of requested stations
288 Bool_t fRequest2ChInSameSt45; //!< 2 fired chambers requested in the same station (4 or 5) or not
289 Double_t fSigmaCut; //!< sigma cut to associate clusters with TrackRefs
290 Double_t fSigmaCutTrig; //!< sigma cut to associate trigger track to triggerable track
291 Double_t fClusterMaxRes[2]; //!< highest chamber resolution in both directions
292 Int_t fNDE; //!< total number of DE
293 Int_t fDEIndices[1100]; //!< index of DE in histograms refered by ID
294 Int_t fDEIds[200]; //!< ID of DE refered by index in histograms
295
296 AliCFContainer* fCFContainer; //!< Pointer to the CF container
297 TObjArray* fEfficiencyList; //!< List of histograms for tracker/trigger efficiencies
298 TObjArray* fTriggerList; //!< List of histograms for trigger resolution
299 TObjArray* fTrackerList; //!< List of histograms for tracker resolution
300 TObjArray* fPAtVtxList; //!< List of graph and canvas about momentum resolution at vertex
301 TObjArray* fSlopeAtVtxList; //!< List of graph and canvas about slope resolution at vertex
302 TObjArray* fEtaAtVtxList; //!< List of graph and canvas about eta resolution at vertex
303 TObjArray* fPhiAtVtxList; //!< List of graph and canvas about phi resolution at vertex
304 TObjArray* fPAt1stClList; //!< List of graph and canvas about momentum resolution at first cluster
305 TObjArray* fSlopeAt1stClList; //!< List of graph and canvas about slope resolution at first cluster
306 TObjArray* fDCAList; //!< List of graph and canvas about DCA
307 TObjArray* fClusterList; //!< List of graph and canvas about cluster resolution
308
309 ClassDef(AliAnalysisTaskMuonPerformance, 1); // Muon performance analysis
310};
311
312inline void AliAnalysisTaskMuonPerformance::SetPBins(Int_t nBins, Double_t pMin, Double_t pMax)
313{
314 /// Set the binning to be used to study the detector resolution versus momentum
315 if (nBins > 0) fNPBins = nBins;
316 else AliError("Incorrect number of momentum bins");
317 if (pMin >= 0. && pMax > pMin) {
318 fPRange[0] = pMin;
319 fPRange[1] = pMax;
320 } else AliError("Incorrect momentum range");
321}
322
323
324#endif