AliPhysics  75b74d3 (75b74d3)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 void NotifyRun();
100  virtual void Terminate(Option_t *);
101 
102 private:
103 
108 
109  void ModifyClusters(AliMUONTrack& track);
110  void Zoom(TH1* h, Double_t fractionCut = 0.01);
111  void ZoomLeft(TH1* h, Double_t fractionCut = 0.02);
112  void ZoomRight(TH1* h, Double_t fractionCut = 0.02);
113  void GetMeanRMS(TH1* h, Double_t& mean, Double_t& meanErr,Double_t& rms, Double_t& rmsErr, TGraphErrors* gMean = 0x0,
114  TGraphErrors* gRMS = 0x0, Int_t i = 0, Double_t x = 0, Bool_t zoom = kTRUE, Bool_t enableFit = kTRUE);
115  void FillMeanSigmaClusterVsX(const TH2* hIn, const TH2* hOut, TGraphErrors* gMean, TGraphErrors* gSigma);
116  void Cov2CovP(const AliMUONTrackParam &param, TMatrixD &covP);
117  void CheckPads(AliMUONVCluster *cl, Bool_t &hasBending, Bool_t &hasNonBending) const;
118  void CheckPadsBelow(AliMUONVCluster *cl, Bool_t &hasBending, Bool_t &hasNonBending) const;
119 
120 private:
121 
122  enum eResiduals {
126  kMCSPerCh = 6,
131  kMCSPerDE = 16,
138  };
139 
145  };
146 
152  };
153 
160  };
161 
162  enum eLocalChi2 {
165  };
166 
167  enum eChamberRes {
196  };
197 
198  enum eTrackRes {
200  kPRes = 1,
202  kPtRes = 3,
205  };
206 
207  enum eCanvases {
208  kResPerCh = 0,
209  kResPerDE = 1,
220  };
221 
222  static const Int_t fgkMinEntries;
223 
224  TObjArray* fResiduals;
225  TObjArray* fResidualsVsP;
226  TObjArray* fResidualsVsCent;
227  TObjArray* fResidualsVsAngle;
228  TObjArray* fLocalChi2;
229  TObjArray* fChamberRes;
230  TObjArray* fTrackRes;
231  TObjArray* fCanvases;
232  TObjArray* fTmpHists;
233 
234  Double_t fClusterResNB[10];
235  Double_t fClusterResB[10];
236 
237  Double_t fHalfChShiftNB[20];
238  Double_t fHalfChShiftB[20];
239 
240  Double_t fDEShiftNB[200];
241  Double_t fDEShiftB[200];
242 
243  TString fDefaultStorage;
244  Int_t fNEvents;
248  TF1* fGaus;
249  Double_t fMinMomentum;
250  Double_t fMinPt;
251  Int_t fExtrapMode;
254  Bool_t fCheckAllPads;
255  Bool_t fImproveTracks;
256  Bool_t fShiftHalfCh;
258  Bool_t fShiftDE;
259  Bool_t fPrintDEShift;
260  Bool_t fOCDBLoaded;
261  Int_t fNDE;
262  Int_t fDEIndices[1100];
263  Int_t fDEIds[200];
264  Bool_t fReAlign;
271  AliMUONGeometryTransformer* fOldGeoTransformer;
272  AliMUONGeometryTransformer* fNewGeoTransformer;
273 
274  AliMuonEventCuts* fMuonEventCuts;
275  AliMuonTrackCuts* fMuonTrackCuts;
276 
277  ClassDef(AliAnalysisTaskMuonResolution, 5); // chamber resolution analysis
278 };
279 
280 //________________________________________________________________________
281 inline void AliAnalysisTaskMuonResolution::SetStartingResolution(Int_t chId, Double_t valNB, Double_t valB)
282 {
284  if (chId < 0 || chId >= 10) return;
285  fClusterResNB[chId] = valNB;
286  fClusterResB[chId] = valB;
287 }
288 
289 //________________________________________________________________________
290 inline void AliAnalysisTaskMuonResolution::SetStartingResolution(Double_t valNB[10], Double_t valB[10])
291 {
293  for (Int_t i = 0; i < 10; i++) {
294  fClusterResNB[i] = valNB[i];
295  fClusterResB[i] = valB[i];
296  }
297 }
298 
299 //________________________________________________________________________
300 inline void AliAnalysisTaskMuonResolution::GetStartingResolution(Double_t valNB[10], Double_t valB[10]) const
301 {
303  for (Int_t i = 0; i < 10; i++) {
304  valNB[i] = fClusterResNB[i];
305  valB[i] = fClusterResB[i];
306  }
307 }
308 
309 //________________________________________________________________________
310 inline void AliAnalysisTaskMuonResolution::SetHalfChShift(Int_t hchId, Double_t valNB, Double_t valB)
311 {
313  if (hchId < 0 || hchId >= 20) return;
314  fHalfChShiftNB[hchId] = valNB;
315  fHalfChShiftB[hchId] = valB;
316 }
317 
318 //________________________________________________________________________
319 inline void AliAnalysisTaskMuonResolution::SetHalfChShift(Double_t valNB[20], Double_t valB[20])
320 {
322  for (Int_t i = 0; i < 20; i++) {
323  fHalfChShiftNB[i] = valNB[i];
324  fHalfChShiftB[i] = valB[i];
325  }
326 }
327 
328 //________________________________________________________________________
329 inline void AliAnalysisTaskMuonResolution::GetHalfChShift(Double_t valNB[20], Double_t valB[20]) const
330 {
332  for (Int_t i = 0; i < 20; i++) {
333  valNB[i] = fHalfChShiftNB[i];
334  valB[i] = fHalfChShiftB[i];
335  }
336 }
337 
338 //________________________________________________________________________
339 inline void AliAnalysisTaskMuonResolution::SetDEShift(Int_t iDE, Double_t valNB, Double_t valB)
340 {
342  if (iDE < 0 || iDE >= 200) return;
343  fDEShiftNB[iDE] = valNB;
344  fDEShiftB[iDE] = valB;
345 }
346 
347 //________________________________________________________________________
348 inline void AliAnalysisTaskMuonResolution::SetDEShift(Double_t valNB[200], Double_t valB[200])
349 {
351  for (Int_t i = 0; i < 200; i++) {
352  fDEShiftNB[i] = valNB[i];
353  fDEShiftB[i] = valB[i];
354  }
355 }
356 
357 //________________________________________________________________________
358 inline void AliAnalysisTaskMuonResolution::GetDEShift(Double_t valNB[200], Double_t valB[200]) const
359 {
361  for (Int_t i = 0; i < 200; i++) {
362  valNB[i] = fDEShiftNB[i];
363  valB[i] = fDEShiftB[i];
364  }
365 }
366 
367 //________________________________________________________________________
368 inline void AliAnalysisTaskMuonResolution::SetAlignStorage(const char* ocdbPath, Int_t version, Int_t subVersion)
369 {
374  if (ocdbPath) {
375  fNewAlignStorage = ocdbPath;
376  fNewAlignVersion = version;
377  fNewAlignSubVersion = subVersion;
378  } else {
379  fNewAlignStorage = "none";
380  fNewAlignVersion = -1;
381  fNewAlignSubVersion = -1;
382  }
383 }
384 
385 //________________________________________________________________________
386 inline void AliAnalysisTaskMuonResolution::ReAlign(const char* oldAlignStorage, Int_t oldVersion, Int_t oldSubVersion,
387  const char* newAlignStorage, Int_t newVersion, Int_t newSubVersion)
388 {
394  if (oldAlignStorage) {
395  fOldAlignStorage = oldAlignStorage;
396  fOldAlignVersion = oldVersion;
397  fOldAlignSubVersion = oldSubVersion;
398  } else {
399  fOldAlignStorage = "none";
400  fOldAlignVersion = -1;
401  fOldAlignSubVersion = -1;
402  }
403  if (newAlignStorage) {
404  fNewAlignStorage = newAlignStorage;
405  fNewAlignVersion = newVersion;
406  fNewAlignSubVersion = newSubVersion;
407  } else {
408  fNewAlignStorage = "none";
409  fNewAlignVersion = -1;
410  fNewAlignSubVersion = -1;
411  }
412  fReAlign = kTRUE;
413 }
414 
415 //________________________________________________________________________
417 {
420  delete fGaus;
421  if (flag) fGaus = new TF1("fGaus","gaus");
422  else fGaus = NULL;
423 }
424 
425 //________________________________________________________________________
426 inline void AliAnalysisTaskMuonResolution::SetMuonEventCuts(AliMuonEventCuts &eventCuts)
427 {
429  delete fMuonEventCuts;
430  fMuonEventCuts = new AliMuonEventCuts(eventCuts);
431 }
432 
433 //________________________________________________________________________
434 inline void AliAnalysisTaskMuonResolution::SetMuonTrackCuts(AliMuonTrackCuts &trackCuts)
435 {
437  delete fMuonTrackCuts;
438  fMuonTrackCuts = new AliMuonTrackCuts(trackCuts);
439 }
440 
441 #endif
442 
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 ...