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