AliPhysics  defa9f6 (defa9f6)
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 
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 
63  void SetMuonSign(Short_t sign) { fSign = sign; }
64 
65  // set standard cuts to select events to be considered
66  void SetMuonEventCuts(AliMuonEventCuts &eventCuts);
67 
68  // set standard cuts to select tracks to be considered
69  void SetMuonTrackCuts(AliMuonTrackCuts &trackCuts);
70 
72  void UseMCLabel(Bool_t flag = kTRUE) { fUseMCLabel = flag; }
73 
76  void SetExtrapMode(Int_t val) { fExtrapMode = val; }
77 
79  void CorrectForSystematics(Bool_t flag = kTRUE) { fCorrectForSystematics = flag; }
80 
81  void SetAlignStorage(const char* ocdbPath, Int_t version = -1, Int_t subVersion = -1);
82 
83  void ReAlign(const char* oldAlignStorage = 0x0, Int_t oldVersion = -1, Int_t oldSubVersion = -1,
84  const char* newAlignStorage = "", Int_t newVersion = -1, Int_t newSubVersion = -1);
85 
88 
90  void ShowProgressBar(Bool_t flag = kTRUE) {fShowProgressBar = flag;}
91 
93  void PrintClusterRes(Bool_t perCh = kTRUE, Bool_t perDE = kFALSE) {fPrintClResPerCh = perCh; fPrintClResPerDE = perDE;}
94 
95  void FitResiduals(Bool_t flag = kTRUE);
96 
98  void RemoveMonoCathodClusters(Bool_t flag = kTRUE, Bool_t checkAllPads = kTRUE) {fRemoveMonoCathCl = flag; fCheckAllPads = checkAllPads;}
99 
101  void ImproveTracks(Bool_t flag = kTRUE) {fImproveTracks = flag;}
102 
103  virtual void UserCreateOutputObjects();
104  virtual void UserExec(Option_t *);
105  virtual Bool_t UserNotify();
106  virtual void NotifyRun();
107  virtual void Terminate(Option_t *);
108 
109 private:
110 
115 
116  void ModifyClusters(AliMUONTrack& track);
117  void Zoom(TH1* h, Double_t fractionCut = 0.01);
118  void ZoomLeft(TH1* h, Double_t fractionCut = 0.02);
119  void ZoomRight(TH1* h, Double_t fractionCut = 0.02);
120  void GetMeanRMS(TH1* h, Double_t& mean, Double_t& meanErr,Double_t& rms, Double_t& rmsErr, TGraphErrors* gMean = 0x0,
121  TGraphErrors* gRMS = 0x0, Int_t i = 0, Double_t x = 0, Bool_t zoom = kTRUE, Bool_t enableFit = kTRUE);
122  void FillMeanSigmaClusterVsX(const TH2* hIn, const TH2* hOut, TGraphErrors* gMean, TGraphErrors* gSigma);
123  void Cov2CovP(const AliMUONTrackParam &param, TMatrixD &covP);
124  void CheckPads(AliMUONVCluster *cl, Bool_t &hasBending, Bool_t &hasNonBending) const;
125  void CheckPadsBelow(AliMUONVCluster *cl, Bool_t &hasBending, Bool_t &hasNonBending) const;
126 
127 private:
128 
129  enum eResiduals {
133  kMCSPerCh = 6,
138  kMCSPerDE = 16,
145  };
146 
152  };
153 
159  };
160 
167  };
168 
169  enum eLocalChi2 {
172  };
173 
174  enum eChamberRes {
203  };
204 
205  enum eTrackRes {
207  kPRes = 1,
209  kPtRes = 3,
212  };
213 
214  enum eCanvases {
215  kResPerCh = 0,
216  kResPerDE = 1,
227  };
228 
229  static const Int_t fgkMinEntries;
230 
240 
243 
246 
249 
255  TF1* fGaus;
272  Int_t fDEIds[200];
280  AliMUONGeometryTransformer* fOldGeoTransformer;
281  AliMUONGeometryTransformer* fNewGeoTransformer;
282 
283  AliMuonEventCuts* fMuonEventCuts;
284  AliMuonTrackCuts* fMuonTrackCuts;
285 
286  ClassDef(AliAnalysisTaskMuonResolution, 7); // chamber resolution analysis
287 };
288 
289 //________________________________________________________________________
291 {
293  if (chId < 0 || chId >= 10) return;
294  fClusterResNB[chId] = valNB;
295  fClusterResB[chId] = valB;
296 }
297 
298 //________________________________________________________________________
300 {
302  for (Int_t i = 0; i < 10; i++) {
303  fClusterResNB[i] = valNB[i];
304  fClusterResB[i] = valB[i];
305  }
306 }
307 
308 //________________________________________________________________________
310 {
312  for (Int_t i = 0; i < 10; i++) {
313  valNB[i] = fClusterResNB[i];
314  valB[i] = fClusterResB[i];
315  }
316 }
317 
318 //________________________________________________________________________
320 {
322  if (hchId < 0 || hchId >= 20) return;
323  fHalfChShiftNB[hchId] = valNB;
324  fHalfChShiftB[hchId] = valB;
325 }
326 
327 //________________________________________________________________________
329 {
331  for (Int_t i = 0; i < 20; i++) {
332  fHalfChShiftNB[i] = valNB[i];
333  fHalfChShiftB[i] = valB[i];
334  }
335 }
336 
337 //________________________________________________________________________
339 {
341  for (Int_t i = 0; i < 20; i++) {
342  valNB[i] = fHalfChShiftNB[i];
343  valB[i] = fHalfChShiftB[i];
344  }
345 }
346 
347 //________________________________________________________________________
349 {
351  if (iDE < 0 || iDE >= 200) return;
352  fDEShiftNB[iDE] = valNB;
353  fDEShiftB[iDE] = valB;
354 }
355 
356 //________________________________________________________________________
358 {
360  for (Int_t i = 0; i < 200; i++) {
361  fDEShiftNB[i] = valNB[i];
362  fDEShiftB[i] = valB[i];
363  }
364 }
365 
366 //________________________________________________________________________
367 inline void AliAnalysisTaskMuonResolution::GetDEShift(Double_t valNB[200], Double_t valB[200]) const
368 {
370  for (Int_t i = 0; i < 200; i++) {
371  valNB[i] = fDEShiftNB[i];
372  valB[i] = fDEShiftB[i];
373  }
374 }
375 
376 //________________________________________________________________________
377 inline void AliAnalysisTaskMuonResolution::SetAlignStorage(const char* ocdbPath, Int_t version, Int_t subVersion)
378 {
383  if (ocdbPath) {
384  fNewAlignStorage = ocdbPath;
385  fNewAlignVersion = version;
386  fNewAlignSubVersion = subVersion;
387  } else {
388  fNewAlignStorage = "none";
389  fNewAlignVersion = -1;
390  fNewAlignSubVersion = -1;
391  }
392 }
393 
394 //________________________________________________________________________
395 inline void AliAnalysisTaskMuonResolution::ReAlign(const char* oldAlignStorage, Int_t oldVersion, Int_t oldSubVersion,
396  const char* newAlignStorage, Int_t newVersion, Int_t newSubVersion)
397 {
403  if (oldAlignStorage) {
404  fOldAlignStorage = oldAlignStorage;
405  fOldAlignVersion = oldVersion;
406  fOldAlignSubVersion = oldSubVersion;
407  } else {
408  fOldAlignStorage = "none";
409  fOldAlignVersion = -1;
410  fOldAlignSubVersion = -1;
411  }
412  if (newAlignStorage) {
413  fNewAlignStorage = newAlignStorage;
414  fNewAlignVersion = newVersion;
415  fNewAlignSubVersion = newSubVersion;
416  } else {
417  fNewAlignStorage = "none";
418  fNewAlignVersion = -1;
419  fNewAlignSubVersion = -1;
420  }
421  fReAlign = kTRUE;
422 }
423 
424 //________________________________________________________________________
426 {
429  delete fGaus;
430  if (flag) fGaus = new TF1("fGaus","gaus");
431  else fGaus = NULL;
432 }
433 
434 //________________________________________________________________________
435 inline void AliAnalysisTaskMuonResolution::SetMuonEventCuts(AliMuonEventCuts &eventCuts)
436 {
438  delete fMuonEventCuts;
439  fMuonEventCuts = new AliMuonEventCuts(eventCuts);
440 }
441 
442 //________________________________________________________________________
443 inline void AliAnalysisTaskMuonResolution::SetMuonTrackCuts(AliMuonTrackCuts &trackCuts)
444 {
446  delete fMuonTrackCuts;
447  fMuonTrackCuts = new AliMuonTrackCuts(trackCuts);
448 }
449 
450 #endif
451 
Short_t fSign
use only tracks of this sign
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
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
double Double_t
Definition: External.C:58
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) ...
void UseMCLabel(Bool_t flag=kTRUE)
select only tracks with MC label or not
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
int Int_t
Definition: External.C:63
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)
short Short_t
Definition: External.C:23
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.
Definition: External.C:220
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.
void SetMuonSign(Short_t sign)
set the sign of the tracks used to compute the 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
Bool_t fUseMCLabel
use only tracks with MC label or not
const char Option_t
Definition: External.C:48
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
bool Bool_t
Definition: External.C:53
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 ...
Definition: External.C:196
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 ...