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