fix constantness definition for all compilers
[u/mrichter/AliRoot.git] / PWG1 / TRD / AliTRDresolution.h
CommitLineData
1ee39b3a 1#ifndef ALITRDRESOLUTION_H
2#define ALITRDRESOLUTION_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id: AliTRDresolution.h 27496 2008-07-22 08:35:45Z cblume $ */
7
8////////////////////////////////////////////////////////////////////////////
9// //
10// TRD Resolution performance //
11// //
12// Authors: //
13// Alexandru Bercuci <A.Bercuci@gsi.de> //
14// Markus Fasel <M.Fasel@gsi.de> //
15// //
16////////////////////////////////////////////////////////////////////////////
17
18#ifndef ALITRDRECOTASK_H
19#include "AliTRDrecoTask.h"
20#endif
21
3ed01fbe 22class TAxis;
1ee39b3a 23class TH1;
24class TH2;
3ed01fbe 25class TH3;
1ee39b3a 26class TF1;
27class TGraphErrors;
28class TObjArray;
92c40e64 29class TDatabasePDG;
1ee39b3a 30class AliTRDrecoParam;
31class AliTRDseedV1;
32class AliTRDtrackInfo;
08bdd9d1 33class AliTrackPoint;
1ee39b3a 34class AliTRDresolution : public AliTRDrecoTask
35{
36public:
1ee39b3a 37 enum ETRDresolutionSteer {
08bdd9d1 38 kVerbose = BIT(18) // switch verbosity
39 ,kVisual = BIT(19) // show partial results during processing
40 ,kTrackRefit = BIT(20) // steer track refit
00a56108 41 ,kTrackSelect= BIT(21) // steer track selection
3ed01fbe 42 ,kXchange = BIT(22) // use exchange containers
1ee39b3a 43 };
3ceb45ae 44 enum ETRDresolutionSlots {
705f8b0a 45 kClToTrk = 2
3ceb45ae 46 ,kClToMC
47 ,kTrkltToTrk
48 ,kTrkltToMC
49 ,kNSlots = 4
50 };
51 enum ETRDresolutionClass {
52 kCluster=0 // cluster - track
53 ,kTracklet // tracklet - track residuals/pulls
54 ,kTrackIn // tracklet - track residuals/pulls at lower TRD entrance
3ceb45ae 55 ,kMCcluster // cluster-mc resolution/pulls
56 ,kMCtracklet // tracklet-mc resolution/pulls
57 ,kMCtrackIn // TPC track monitor
3ceb45ae 58 ,kMCtrack // TRD track monitor
f429b017 59/* ,kTrackOut // tracklet - track residuals/pulls at lower TRD entrance during refit
60 ,kMCtrackOut // TOF/HMPID track monitor*/
3ceb45ae 61 ,kNclasses // total number of resolution classes
62 };
0b366e97 63 enum ETRDresolutionClassProjs {
64 kClNproj=48 // cluster projections
65 ,kTrkltNproj=72 // tracklet projections
66 ,kTrkInNproj=8 // trackIn projections
67 ,kTrkNproj=72 // track projections
68 };
3ceb45ae 69 enum ETRDresolutionProjs {
70 kBC = 0 // bunch cross
71 ,kPhi
72 ,kEta
3ceb45ae 73 ,kYrez
3ceb45ae 74 ,kPrez
3ed01fbe 75 ,kZrez
76 ,kSpeciesChgRC
77 ,kPt
3ceb45ae 78 ,kNdim // no of dimensions in the THnSparse
705f8b0a 79 };
9dcc64cc 80 enum ETRDresolutionSegmentation {
81 kSector = 0
82 ,kStack
83 ,kDetector
3ceb45ae 84 ,kNbunchCross = 3 // no of classes for bunch crossing
3ed01fbe 85 ,kNpt = 20 // no of log bins in pt spectrum
3ceb45ae 86 ,kNcharge = 2
9dcc64cc 87 };
1ee39b3a 88
89 AliTRDresolution();
3ed01fbe 90 AliTRDresolution(char* name, Bool_t xchange=kTRUE);
1ee39b3a 91 virtual ~AliTRDresolution();
92
3ed01fbe 93 static Bool_t FitTrack(const Int_t np, AliTrackPoint *points, Float_t params[10]);
94 static Bool_t FitTracklet(const Int_t ly, const Int_t np, const AliTrackPoint *points, const Float_t trackPars[10], Float_t trackletPars[3]);
95 void UserCreateOutputObjects();
3ceb45ae 96// Float_t GetCorrectionX(Int_t det, Int_t tb) const {return fXcorr[det][tb];}
3ed01fbe 97 Float_t GetDyRange() const {return fDyRange;}
98 static Float_t GetMeanStat(TH1 *h, Float_t cut=0., Option_t *opt="");
99 Float_t GetPtThreshold() const {return fPtThreshold;}
100 static Int_t GetPtBin(Float_t pt);
101 Bool_t GetRefFigure(Int_t ifig);
3ceb45ae 102
1ee39b3a 103 TObjArray* Histos();
3ceb45ae 104// Bool_t Load(const Char_t *file = "AnalysisResults.root", const Char_t *dir="TRD_Performance");
105// Bool_t LoadCorrection(const Char_t *file=NULL);
3ed01fbe 106 void MakeSummary();
107 static void MakePtSegmentation(Float_t pt0=0.5, Float_t dpt=0.002);
2589cf64 108
3ed01fbe 109 TObjArray* Results(ETRDresolutionClass c) const {if(!fProj) return NULL; return (TObjArray*)fProj->At(c);}
110 void UserExec(Option_t * opt);
111 void InitExchangeContainers();
3ceb45ae 112// Bool_t HasLoadCorrection() const {return TestBit(kLoadCorr);}
3ed01fbe 113 Bool_t HasTrackRefit() const {return TestBit(kTrackRefit);}
114 Bool_t HasTrackSelection() const {return TestBit(kTrackSelect);}
115 Bool_t IsVerbose() const {return TestBit(kVerbose);}
116 Bool_t IsVisual() const {return TestBit(kVisual);}
117 Bool_t UseExchangeContainers() const {return TestBit(kXchange);}
118 Bool_t PostProcess();
119
120 TH1* PlotCluster(const AliTRDtrackV1 *t=NULL);
121 TH1* PlotTracklet(const AliTRDtrackV1 *t=NULL);
122 TH1* PlotTrackIn(const AliTRDtrackV1 *t=NULL);
f429b017 123// TH1* PlotTrackOut(const AliTRDtrackV1 *t=NULL);
3ed01fbe 124 TH1* PlotMC(const AliTRDtrackV1 *t=NULL);
125
126 static Bool_t Process(TH2* const h2, TGraphErrors **g, Int_t stat=100);
127 void SetDyRange(Float_t dy) {fDyRange = dy;}
3ceb45ae 128// void SetSegmentationLevel(Int_t l=0);
3ed01fbe 129 void SetPtThreshold(Float_t pt) {fPtThreshold = pt;}
3ceb45ae 130// void SetLoadCorrection(Bool_t v = kTRUE) {SetBit(kLoadCorr, v);}
3ed01fbe 131 void SetVerbose(Bool_t v = kTRUE) {SetBit(kVerbose, v);}
132 void SetVisual(Bool_t v = kTRUE) {SetBit(kVisual, v);}
133 void SetTrackRefit(Bool_t v = kTRUE) {SetBit(kTrackRefit, v);}
134 void SetTrackSelection(Bool_t v = kTRUE) {SetBit(kTrackSelect, v);}
135 void SetUseExchangeContainers(Bool_t v = kTRUE) {SetBit(kXchange, v);}
1ee39b3a 136
3ed01fbe 137 void Terminate(Option_t * opt);
138 static Bool_t UseTrack(const Int_t np, const AliTrackPoint *points, Float_t params[10]);
3ceb45ae 139
1ee39b3a 140private:
3ed01fbe 141 class AliTRDresolutionProjection{
142 friend class AliTRDresolution; // Friend class
143 public:
144 AliTRDresolutionProjection();
145 virtual ~AliTRDresolutionProjection();
146 void Build(const Char_t *n, const Char_t *t, Int_t ix, Int_t iy, Int_t iz, TAxis *aa[]);
147 void Increment(Int_t bin[], Double_t v);
148 TH2* Projection2D(const Int_t nstat, const Int_t ncol, const Int_t mid=0);
149 void SetRebinStrategy(Int_t n, Int_t rebx[], Int_t reby[]);
0b30040d 150 void SetShowRange(Float_t zm, Float_t zM, Float_t em=0., Float_t eM=0.) {fRange[0] = zm; fRange[1] = zM; fRange[2] = em; fRange[3] = eM;}
3ed01fbe 151 private:
152 AliTRDresolutionProjection(const AliTRDresolutionProjection&);
153 AliTRDresolutionProjection& operator=(const AliTRDresolutionProjection&);
154 protected:
155 TH3 *fH; // data container
156 Int_t fAx[3]; // projection axes
157 Int_t fNrebin; // no. of rebinning steps
158 Int_t *fRebinX; //[fNrebin] rebinning of the X axis
159 Int_t *fRebinY; //[fNrebin] rebinning of the Y axis
0b30040d 160 Float_t fRange[4]; //show range of the z processed
3ed01fbe 161 ClassDef(AliTRDresolutionProjection, 1) // wrapper for a projection container THnSparse -> TH3
162 };
163
1ee39b3a 164 AliTRDresolution(const AliTRDresolution&);
165 AliTRDresolution& operator=(const AliTRDresolution&);
afca20ef 166
3ed01fbe 167 void AdjustF1(TH1 *h, TF1 *f);
9dcc64cc 168 TObjArray* BuildMonitorContainerCluster(const char* name, Bool_t expand=kFALSE, Float_t range=-1.);
2589cf64 169 TObjArray* BuildMonitorContainerTracklet(const char* name, Bool_t expand=kFALSE);
3d2a3dff 170 TObjArray* BuildMonitorContainerTrack(const char* name);
0b30040d 171 void DrawSigma(TH2 *h2, Float_t scale=1, Float_t m=0., Float_t M=-1., const Char_t *t=NULL);
3ed01fbe 172 void GetLandauMpvFwhm(TF1 * const f, Float_t &mpv, Float_t &xm, Float_t &xM);
173 void GetRange(TH2 *h2, Char_t mod, Float_t *range);
174
175protected:
f429b017 176 Bool_t MakeProjectionCluster(Bool_t mc=kFALSE);
177 Bool_t MakeProjectionTracklet(Bool_t mc=kFALSE);
178 Bool_t MakeProjectionTrackIn(Bool_t mc=kFALSE);
179 Bool_t MakeProjectionTrack();
3ed01fbe 180 Bool_t Process(TH2* const h2, TF1 *f, Float_t k, TGraphErrors **g);
181 Bool_t Pulls(Double_t dyz[2], Double_t cc[3], Double_t tilt) const;
1ee39b3a 182
3ceb45ae 183 UShort_t fIdxPlot; // plot counter (internal)
184 UShort_t fIdxFrame; // frame counter (internal)
185 Float_t fPtThreshold; // pt threshold for some performance plots
186 Float_t fDyRange; // min/max dy
187 static Char_t const *fgPerformanceName[kNclasses]; //! name of performance plot
3ceb45ae 188 static Int_t const fgkNbins[kNdim]; //! no of bins/projection
189 static Double_t const fgkMin[kNdim]; //! low limits for projections
190 static Double_t const fgkMax[kNdim]; //! high limits for projections
191 static Char_t const *fgkTitle[kNdim]; //! title of projection
192 static Float_t fgPtBin[kNpt+1]; //! pt segmentation
193 TObjArray *fProj; //! result holder - sigma values
194 TDatabasePDG *fDBPDG; //! PDG database
1ee39b3a 195
196 // calibration containers
3ed01fbe 197 TObjArray *fCl; //! cluster2track calib
198 TObjArray *fMCcl; //! cluster2mc calib
1ee39b3a 199
3ceb45ae 200 ClassDef(AliTRDresolution, 10) // TRD tracking resolution task
1ee39b3a 201};
202#endif