AliPhysics  9fe175b (9fe175b)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskMuonResolution.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKMUONRESOLUTION_H
2 #define ALIANALYSISTASKMUONRESOLUTION_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice */
5 
6 /* $Id$ */
7 
11 //Author: Philippe Pillot - SUBATECH Nantes
12 
13 #include <TString.h>
14 #include <TMatrixD.h>
15 #include <TF1.h>
16 #include "AliAnalysisTaskSE.h"
17 #include "AliMuonEventCuts.h"
18 #include "AliMuonTrackCuts.h"
19 
20 class TH1;
21 class TH2;
22 class TGraphErrors;
23 class TObjArray;
24 class TList;
25 class AliMUONTrack;
26 class AliMUONTrackParam;
27 class AliMUONGeometryTransformer;
28 class AliMUONVCluster;
29 
30 class AliAnalysisTaskMuonResolution : public AliAnalysisTaskSE {
31 public:
32 
34  AliAnalysisTaskMuonResolution(const char *name);
36 
38  void SetDefaultStorage(const char* ocdbPath) { fDefaultStorage = ocdbPath; }
39 
40  void SetStartingResolution(Int_t chId, Double_t valNB, Double_t valB);
41  void SetStartingResolution(Double_t valNB[10], Double_t valB[10]);
42  void GetStartingResolution(Double_t valNB[10], Double_t valB[10]) const;
43 
44  void SetHalfChShift(Int_t hchId, Double_t valNB, Double_t valB);
45  void SetHalfChShift(Double_t valNB[20], Double_t valB[20]);
46  void GetHalfChShift(Double_t valNB[20], Double_t valB[20]) const;
47  void ShiftHalfCh(Bool_t flag = kTRUE) { fShiftHalfCh = flag; }
48  void PrintHalfChShift(Bool_t flag = kTRUE) { fPrintHalfChShift = flag; }
49 
50  void SetDEShift(Int_t iDE, Double_t valNB, Double_t valB);
51  void SetDEShift(Double_t valNB[200], Double_t valB[200]);
52  void GetDEShift(Double_t valNB[200], Double_t valB[200]) const;
53  void ShiftDE(Bool_t flag = kTRUE) { fShiftDE = flag; }
54  void PrintDEShift(Bool_t flag = kTRUE) { fPrintDEShift = flag; }
55 
57  void SetMinMomentum(Double_t val) { fMinMomentum = val; }
58 
60  void SetMinPt(Double_t val) { fMinPt = val; }
61 
62  // set standard cuts to select events to be considered
63  void SetMuonEventCuts(AliMuonEventCuts &eventCuts);
64 
65  // set standard cuts to select tracks to be considered
66  void SetMuonTrackCuts(AliMuonTrackCuts &trackCuts);
67 
70  void SetExtrapMode(Int_t val) { fExtrapMode = val; }
71 
73  void CorrectForSystematics(Bool_t flag = kTRUE) { fCorrectForSystematics = flag; }
74 
75  void SetAlignStorage(const char* ocdbPath, Int_t version = -1, Int_t subVersion = -1);
76 
77  void ReAlign(const char* oldAlignStorage = 0x0, Int_t oldVersion = -1, Int_t oldSubVersion = -1,
78  const char* newAlignStorage = "", Int_t newVersion = -1, Int_t newSubVersion = -1);
79 
81  TObjArray* GetCanvases() {return fCanvases;}
82 
84  void ShowProgressBar(Bool_t flag = kTRUE) {fShowProgressBar = flag;}
85 
87  void PrintClusterRes(Bool_t perCh = kTRUE, Bool_t perDE = kFALSE) {fPrintClResPerCh = perCh; fPrintClResPerDE = perDE;}
88 
89  void FitResiduals(Bool_t flag = kTRUE);
90 
92  void RemoveMonoCathodClusters(Bool_t flag = kTRUE, Bool_t checkAllPads = kTRUE) {fRemoveMonoCathCl = flag; fCheckAllPads = checkAllPads;}
93 
95  void ImproveTracks(Bool_t flag = kTRUE) {fImproveTracks = flag;}
96 
97  virtual void UserCreateOutputObjects();
98  virtual void UserExec(Option_t *);
99  virtual Bool_t UserNotify();
100  virtual void NotifyRun();
101  virtual void Terminate(Option_t *);
102 
103 private:
104 
109 
110  void ModifyClusters(AliMUONTrack& track);
111  void Zoom(TH1* h, Double_t fractionCut = 0.01);
112  void ZoomLeft(TH1* h, Double_t fractionCut = 0.02);
113  void ZoomRight(TH1* h, Double_t fractionCut = 0.02);
114  void GetMeanRMS(TH1* h, Double_t& mean, Double_t& meanErr,Double_t& rms, Double_t& rmsErr, TGraphErrors* gMean = 0x0,
115  TGraphErrors* gRMS = 0x0, Int_t i = 0, Double_t x = 0, Bool_t zoom = kTRUE, Bool_t enableFit = kTRUE);
116  void FillMeanSigmaClusterVsX(const TH2* hIn, const TH2* hOut, TGraphErrors* gMean, TGraphErrors* gSigma);
117  void Cov2CovP(const AliMUONTrackParam &param, TMatrixD &covP);
118  void CheckPads(AliMUONVCluster *cl, Bool_t &hasBending, Bool_t &hasNonBending) const;
119  void CheckPadsBelow(AliMUONVCluster *cl, Bool_t &hasBending, Bool_t &hasNonBending) const;
120 
121 private:
122 
123  enum eResiduals {
127  kMCSPerCh = 6,
132  kMCSPerDE = 16,
139  };
140 
146  };
147 
153  };
154 
161  };
162 
163  enum eLocalChi2 {
166  };
167 
168  enum eChamberRes {
197  };
198 
199  enum eTrackRes {
201  kPRes = 1,
203  kPtRes = 3,
206  };
207 
208  enum eCanvases {
209  kResPerCh = 0,
210  kResPerDE = 1,
221  };
222 
223  static const Int_t fgkMinEntries;
224 
225  TObjArray* fResiduals;
226  TObjArray* fResidualsVsP;
227  TObjArray* fResidualsVsCent;
228  TObjArray* fResidualsVsAngle;
229  TObjArray* fLocalChi2;
230  TObjArray* fChamberRes;
231  TObjArray* fTrackRes;
232  TObjArray* fCanvases;
233  TObjArray* fTmpHists;
234 
235  Double_t fClusterResNB[10];
236  Double_t fClusterResB[10];
237 
238  Double_t fHalfChShiftNB[20];
239  Double_t fHalfChShiftB[20];
240 
241  Double_t fDEShiftNB[200];
242  Double_t fDEShiftB[200];
243 
244  TString fDefaultStorage;
245  Int_t fNEvents;
249  TF1* fGaus;
250  Double_t fMinMomentum;
251  Double_t fMinPt;
252  Int_t fExtrapMode;
255  Bool_t fCheckAllPads;
256  Bool_t fImproveTracks;
257  Bool_t fShiftHalfCh;
259  Bool_t fShiftDE;
260  Bool_t fPrintDEShift;
261  Bool_t fOCDBLoaded;
262  Int_t fNDE;
263  Int_t fDEIndices[1100];
264  Int_t fDEIds[200];
265  Bool_t fReAlign;
272  AliMUONGeometryTransformer* fOldGeoTransformer;
273  AliMUONGeometryTransformer* fNewGeoTransformer;
274 
275  AliMuonEventCuts* fMuonEventCuts;
276  AliMuonTrackCuts* fMuonTrackCuts;
277 
278  ClassDef(AliAnalysisTaskMuonResolution, 5); // chamber resolution analysis
279 };
280 
281 //________________________________________________________________________
282 inline void AliAnalysisTaskMuonResolution::SetStartingResolution(Int_t chId, Double_t valNB, Double_t valB)
283 {
285  if (chId < 0 || chId >= 10) return;
286  fClusterResNB[chId] = valNB;
287  fClusterResB[chId] = valB;
288 }
289 
290 //________________________________________________________________________
291 inline void AliAnalysisTaskMuonResolution::SetStartingResolution(Double_t valNB[10], Double_t valB[10])
292 {
294  for (Int_t i = 0; i < 10; i++) {
295  fClusterResNB[i] = valNB[i];
296  fClusterResB[i] = valB[i];
297  }
298 }
299 
300 //________________________________________________________________________
301 inline void AliAnalysisTaskMuonResolution::GetStartingResolution(Double_t valNB[10], Double_t valB[10]) const
302 {
304  for (Int_t i = 0; i < 10; i++) {
305  valNB[i] = fClusterResNB[i];
306  valB[i] = fClusterResB[i];
307  }
308 }
309 
310 //________________________________________________________________________
311 inline void AliAnalysisTaskMuonResolution::SetHalfChShift(Int_t hchId, Double_t valNB, Double_t valB)
312 {
314  if (hchId < 0 || hchId >= 20) return;
315  fHalfChShiftNB[hchId] = valNB;
316  fHalfChShiftB[hchId] = valB;
317 }
318 
319 //________________________________________________________________________
320 inline void AliAnalysisTaskMuonResolution::SetHalfChShift(Double_t valNB[20], Double_t valB[20])
321 {
323  for (Int_t i = 0; i < 20; i++) {
324  fHalfChShiftNB[i] = valNB[i];
325  fHalfChShiftB[i] = valB[i];
326  }
327 }
328 
329 //________________________________________________________________________
330 inline void AliAnalysisTaskMuonResolution::GetHalfChShift(Double_t valNB[20], Double_t valB[20]) const
331 {
333  for (Int_t i = 0; i < 20; i++) {
334  valNB[i] = fHalfChShiftNB[i];
335  valB[i] = fHalfChShiftB[i];
336  }
337 }
338 
339 //________________________________________________________________________
340 inline void AliAnalysisTaskMuonResolution::SetDEShift(Int_t iDE, Double_t valNB, Double_t valB)
341 {
343  if (iDE < 0 || iDE >= 200) return;
344  fDEShiftNB[iDE] = valNB;
345  fDEShiftB[iDE] = valB;
346 }
347 
348 //________________________________________________________________________
349 inline void AliAnalysisTaskMuonResolution::SetDEShift(Double_t valNB[200], Double_t valB[200])
350 {
352  for (Int_t i = 0; i < 200; i++) {
353  fDEShiftNB[i] = valNB[i];
354  fDEShiftB[i] = valB[i];
355  }
356 }
357 
358 //________________________________________________________________________
359 inline void AliAnalysisTaskMuonResolution::GetDEShift(Double_t valNB[200], Double_t valB[200]) const
360 {
362  for (Int_t i = 0; i < 200; i++) {
363  valNB[i] = fDEShiftNB[i];
364  valB[i] = fDEShiftB[i];
365  }
366 }
367 
368 //________________________________________________________________________
369 inline void AliAnalysisTaskMuonResolution::SetAlignStorage(const char* ocdbPath, Int_t version, Int_t subVersion)
370 {
375  if (ocdbPath) {
376  fNewAlignStorage = ocdbPath;
377  fNewAlignVersion = version;
378  fNewAlignSubVersion = subVersion;
379  } else {
380  fNewAlignStorage = "none";
381  fNewAlignVersion = -1;
382  fNewAlignSubVersion = -1;
383  }
384 }
385 
386 //________________________________________________________________________
387 inline void AliAnalysisTaskMuonResolution::ReAlign(const char* oldAlignStorage, Int_t oldVersion, Int_t oldSubVersion,
388  const char* newAlignStorage, Int_t newVersion, Int_t newSubVersion)
389 {
395  if (oldAlignStorage) {
396  fOldAlignStorage = oldAlignStorage;
397  fOldAlignVersion = oldVersion;
398  fOldAlignSubVersion = oldSubVersion;
399  } else {
400  fOldAlignStorage = "none";
401  fOldAlignVersion = -1;
402  fOldAlignSubVersion = -1;
403  }
404  if (newAlignStorage) {
405  fNewAlignStorage = newAlignStorage;
406  fNewAlignVersion = newVersion;
407  fNewAlignSubVersion = newSubVersion;
408  } else {
409  fNewAlignStorage = "none";
410  fNewAlignVersion = -1;
411  fNewAlignSubVersion = -1;
412  }
413  fReAlign = kTRUE;
414 }
415 
416 //________________________________________________________________________
418 {
421  delete fGaus;
422  if (flag) fGaus = new TF1("fGaus","gaus");
423  else fGaus = NULL;
424 }
425 
426 //________________________________________________________________________
427 inline void AliAnalysisTaskMuonResolution::SetMuonEventCuts(AliMuonEventCuts &eventCuts)
428 {
430  delete fMuonEventCuts;
431  fMuonEventCuts = new AliMuonEventCuts(eventCuts);
432 }
433 
434 //________________________________________________________________________
435 inline void AliAnalysisTaskMuonResolution::SetMuonTrackCuts(AliMuonTrackCuts &trackCuts)
436 {
438  delete fMuonTrackCuts;
439  fMuonTrackCuts = new AliMuonTrackCuts(trackCuts);
440 }
441 
442 #endif
443 
Double_t fHalfChShiftB[20]
half-chamber deplacements in bending direction
muon slope-X/Y reconstructed resolution at first cluster vs p
cluster-track residual-X/Y distribution in chamber i versus momentum (cluster attached to the track) ...
muon momentum reconstructed resolution at first cluster vs p
cluster X/Y-resolution per chamber versus momentum
ClassDef(AliAnalysisTaskMuonResolution, 5)
cluster-track residual-X/Y distribution in half-chamber i versus track angle in X/Y direction (cluste...
cluster-track residual-X/Y distribution integrated over chambers versus centrality (cluster not attac...
static const Int_t fgkMinEntries
minimum number of entries needed to compute resolution
AliMUONGeometryTransformer * fOldGeoTransformer
geometry transformer used to recontruct the present data
Bool_t fShiftDE
flag telling wether to displace DEs by fDEShift(N)B[i] or not
void RemoveMonoCathodClusters(Bool_t flag=kTRUE, Bool_t checkAllPads=kTRUE)
set the flag to remove mono-cathod clusters (either considering all the pads or only the ones directl...
cluster-track residual-X/Y per DE: mean (cluster in)
cluster-track residual-X/Y distribution in chamber i versus centrality (cluster not attached to the t...
cluster-track residual-X/Y distribution per DE (cluster not attached to the track) ...
Bool_t fPrintClResPerCh
print the cluster resolution per chamber
cluster X/Y-resolution integrated over chambers versus centrality
cluster-track residual-X/Y per chamber: sigma (cluster out)
Bool_t fShowProgressBar
show the progression bar
TString fOldAlignStorage
location of the OCDB storage where to find old MUON/Align/Data (use the default one if empty) ...
TString fNewAlignStorage
location of the OCDB storage where to find new MUON/Align/Data (use the default one if empty) ...
Bool_t fShiftHalfCh
flag telling wether to displace half-chambers by fHalfChShift(N)B[i] or not
cluster X/Y-resolution integrated over chambers versus track angle in X/Y direction ...
Bool_t fImproveTracks
flag telling whether to improve or not the track before measuring the resolution
Bool_t fPrintHalfChShift
print the half-chamber displacements
cluster X/Y-resolution integrated over chambers versus momentum
AliMuonEventCuts * fMuonEventCuts
cuts to select events to be considered
cluster-track residual-X/Y distribution per chamber (cluster not attached to the track) ...
AliMuonTrackCuts * fMuonTrackCuts
cuts to select tracks to be considered
Bool_t fPrintDEShift
print the DE displacements
cluster-track residual-X/Y per chamber: mean (cluster out)
void ZoomLeft(TH1 *h, Double_t fractionCut=0.02)
Int_t fDEIds[200]
ID of DE refered by index in histograms.
cluster-track residual-X/Y distribution integrated over chambers versus track angle in X/Y direction ...
TObjArray * GetCanvases()
return the list of summary canvases
Double_t fClusterResNB[10]
cluster resolution in non-bending direction
void Zoom(TH1 *h, Double_t fractionCut=0.01)
Bool_t fRemoveMonoCathCl
remove or not the mono-cathod clusters
void FillMeanSigmaClusterVsX(const TH2 *hIn, const TH2 *hOut, TGraphErrors *gMean, TGraphErrors *gSigma)
AliAnalysisTaskMuonResolution & operator=(const AliAnalysisTaskMuonResolution &rhs)
Not implemented.
cluster-track residual-X/Y distribution in chamber i versus track angle in X/Y direction (cluster att...
TObjArray * fCanvases
List of canvases summarizing the results.
muon momentum reconstructed resolution at vertex vs p
Double_t fHalfChShiftNB[20]
half-chamber deplacements in non-bending direction
void SetAlignStorage(const char *ocdbPath, Int_t version=-1, Int_t subVersion=-1)
cluster-track residual-X/Y distribution in chamber i versus centrality (cluster attached to the track...
AliMUONGeometryTransformer * fNewGeoTransformer
new geometry transformer containing the new alignment to be applied
muon slope-X/Y reconstructed resolution at vertex vs p
Double_t fMinMomentum
use only tracks with momentum higher than this value
cluster-track residual-X/Y per chamber: dispersion (cluster out)
void ShowProgressBar(Bool_t flag=kTRUE)
set the flag to show the progression bar
Bool_t fOCDBLoaded
flag telling if the OCDB has been properly loaded or not
void SetHalfChShift(Int_t hchId, Double_t valNB, Double_t valB)
TObjArray * fResidualsVsP
List of residual vs. p histos.
calculated cluster X/Y-resolution per chamber
void CheckPadsBelow(AliMUONVCluster *cl, Bool_t &hasBending, Bool_t &hasNonBending) const
cluster-track residual-X/Y distribution per half chamber (cluster not attached to the track) ...
cluster-track residual-X/Y distribution in chamber i versus momentum (cluster not attached to the tra...
combined cluster-track residual-X/Y per half chamber
void GetMeanRMS(TH1 *h, Double_t &mean, Double_t &meanErr, Double_t &rms, Double_t &rmsErr, TGraphErrors *gMean=0x0, TGraphErrors *gRMS=0x0, Int_t i=0, Double_t x=0, Bool_t zoom=kTRUE, Bool_t enableFit=kTRUE)
cluster-track residual-X/Y distribution integrated over chambers versus centrality (cluster attached ...
cluster-track residual-X/Y per half-chamber versus track angle in X/Y direction: mean (cluster in) ...
void ReAlign(const char *oldAlignStorage=0x0, Int_t oldVersion=-1, Int_t oldSubVersion=-1, const char *newAlignStorage="", Int_t newVersion=-1, Int_t newSubVersion=-1)
local chi2-X/Y/total distribution per chamber
cluster-track residual-X/Y per chamber versus centrality: mean (cluster in)
Int_t fNEvents
number of processed events
TObjArray * fResiduals
List of residual histos.
TObjArray * fResidualsVsAngle
List of residual vs. track angle histos.
muon transverse momentum reconstructed resolution at vertex vs p
cluster-track residual-X/Y distribution integrated over chambers versus momentum (cluster not attache...
void PrintClusterRes(Bool_t perCh=kTRUE, Bool_t perDE=kFALSE)
set the flag to print the cluster resolution per chamber/DE
TObjArray * fTrackRes
List of plots related to track resolution (p, pT, ...)
void GetHalfChShift(Double_t valNB[20], Double_t valB[20]) const
Int_t fOldAlignVersion
specific version of the old MUON/Align/Data/object to load
Double_t fMinPt
use only tracks with pT higher than this value
MCS X/Y-dispersion of extrapolated track per DE.
void ImproveTracks(Bool_t flag=kTRUE)
set the flag to improve the track before measuring the resolution
TObjArray * fLocalChi2
List of plots related to local chi2 per chamber/DE.
cluster-track residual-X/Y distribution per chamber (cluster attached to the track) ...
void SetMuonTrackCuts(AliMuonTrackCuts &trackCuts)
cluster-track residual-X/Y distribution in chamber i versus track angle in X/Y direction (cluster not...
TObjArray * fResidualsVsCent
List of residual vs. centrality histos.
Int_t fNewAlignSubVersion
specific subversion of the new MUON/Align/Data/object to load
cluster-track residual-X/Y per DE: mean (cluster out)
void GetStartingResolution(Double_t valNB[10], Double_t valB[10]) const
MCS X/Y-dispersion of extrapolated track per chamber.
Double_t fDEShiftB[200]
DE deplacements in bending direction.
Double_t fClusterResB[10]
cluster resolution in bending direction
cluster-track residual-X/Y per half chamber: mean (cluster in)
cluster-track residual-X/Y per chamber versus momentum: mean (cluster in)
cluster X/Y-resolution per chamber versus centrality
Muon spectrometer resolution.
Double_t fDEShiftNB[200]
DE deplacements in non-bending direction.
cluster-track residual-X/Y per chamber: sigma (cluster in)
MCS X/Y-dispersion of extrapolated track per chamber.
cluster-track residual-X/Y per chamber: mean (cluster in)
cluster-track residual-X/Y distribution integrated over chambers versus momentum (cluster attached to...
cluster-track residual-X/Y per half chamber: mean (cluster out)
Bool_t fCheckAllPads
use all pads or only the ones directly below the cluster to look for mono-cathods ...
void SetDefaultStorage(const char *ocdbPath)
Set location of the default OCDB storage (if not set use "raw://")
void SetDEShift(Int_t iDE, Double_t valNB, Double_t valB)
TObjArray * fChamberRes
List of plots related to chamber/DE resolution.
cluster-track residual-X/Y per chamber versus track angle in X/Y direction: mean (cluster in) ...
cluster-track residual-X/Y distribution per half chamber (cluster attached to the track) ...
void ZoomRight(TH1 *h, Double_t fractionCut=0.02)
TString fDefaultStorage
location of the default OCDB storage
void SetMinPt(Double_t val)
set the minimum pT value of the tracks used to compute the resolution
MCS X/Y-dispersion of extrapolated track per half chamber.
void CorrectForSystematics(Bool_t flag=kTRUE)
set the flag to add or not the systematic shifts of the residuals to the resolution ...
Bool_t fPrintClResPerDE
print the cluster resolution per DE
void GetDEShift(Double_t valNB[200], Double_t valB[200]) const
Int_t fOldAlignSubVersion
specific subversion of the old MUON/Align/Data/object to load
Bool_t fCorrectForSystematics
add or not the systematic shifts of the residuals to the resolution
Int_t fDEIndices[1100]
index of DE in histograms refered by ID
void Cov2CovP(const AliMUONTrackParam &param, TMatrixD &covP)
cluster X/Y-resolution per chamber versus track angle in X/Y direction
TObjArray * fTmpHists
List of temporary histograms.
TF1 * fGaus
gaussian function to fit the residuals
Int_t fNewAlignVersion
specific version of the new MUON/Align/Data/object to load
void SetStartingResolution(Int_t chId, Double_t valNB, Double_t valB)
muon transverse momentum reconstructed resolution at first cluster vs p
Bool_t fReAlign
flag telling whether to re-align the spectrometer or not before computing resolution ...
void SetMinMomentum(Double_t val)
set the minimum momentum value of the tracks used to compute the resolution
void SetMuonEventCuts(AliMuonEventCuts &eventCuts)
void CheckPads(AliMUONVCluster *cl, Bool_t &hasBending, Bool_t &hasNonBending) const
cluster-track residual-X/Y distribution per DE (cluster attached to the track)
Int_t fExtrapMode
extrapolation mode to get the track parameters and covariances at a given cluster ...
cluster-track residual-X/Y distribution integrated over chambers versus track angle in X/Y direction ...