e THnSparse structure to store MC residuals
[u/mrichter/AliRoot.git] / PWG1 / TRD / AliTRDcalibration.h
1 #ifndef ALITRDCALIBRATION_H
2 #define ALITRDCALIBRATION_H
3
4 // macro for extremely simple analysis
5
6 ///////////////////////////////////////////////////////////////////////////////
7 //                                                                           //
8 //  TRD calibration class                                                    //
9 //                                                                           //
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #include "AliTRDrecoTask.h"
13
14 class TList;
15 class TObject;
16 class TH1F;
17 class TProfile2D;
18 class TGraph;
19 class TH2I;
20 class TH2D;
21 class TTree;
22 class TObjArray;
23 class AliTRDtrackV1;
24 class AliTRDCalibraFillHisto;
25 class AliTRDCalibraVector;
26 class AliTRDCalibraMode;
27 class AliTRDcluster;
28 class AliTRDtrackInfo;
29
30 class AliTRDcalibration : public AliTRDrecoTask 
31 {
32  
33 public:
34
35   // Plots registered for this task
36   enum{
37     kNbTrack        =  0     // Nb tracks per event
38       ,kNbTracklet     =  1     // Nb of traklets per detector
39       ,kNbTimeBin      =  2     // Nb of clusters per timebin
40       ,kNbClusters     =  3     // Nb of clusters per tracklet
41       ,kPHSum          =  4     // All integrated PH
42       ,kCHSum          =  5     // All integrated CH
43       ,kPH2D           =  6     // PH2D
44       ,kCH2D           =  7     // CH2D
45       ,kPRF2D          =  8     // PRF2D 
46       ,kPH2DVector     =  9     // PH2D
47       ,kCH2DVector     =  10     // CH2D
48       ,kPRF2DVector    =  11     // PRF2D 
49       ,kLinearFitter   =  12    // For the one with the most stats 
50       ,kGainFactor     =  13    // Gain factor
51       ,kVdriftT0Factor   = 14   // VdriftT0 average pulse height
52       ,kVdriftLorentzAngleFactor = 15  // VdriftLorentzAngle
53       ,kPRFFactor = 16                 //PRF Factor
54       };
55   
56
57   AliTRDcalibration();
58   AliTRDcalibration(char* name);
59   virtual ~AliTRDcalibration();
60   
61   virtual void    UserCreateOutputObjects();
62   virtual void    UserExec(Option_t *option);
63   virtual void    Terminate(Option_t *);
64   virtual Bool_t  GetRefFigure(Int_t ifig);
65   virtual Bool_t  PostProcess();
66
67   Bool_t FillGraphIndex(const TObjArray *vectora, TGraph *graph) const;
68   Bool_t AddStatsPerDetector(const TH2I *ch);
69   Bool_t AddStatsPerDetector(const TProfile2D *ph, Int_t i);
70
71   Bool_t SetNrphiFromTObject(const char *name, Int_t i, AliTRDCalibraMode *calibMode) const;
72   Bool_t SetNzFromTObject(const char *name, Int_t i, AliTRDCalibraMode *calibMode) const;
73
74   Int_t  GetNumberOfGroupsPRF(const char* nametitle) const;
75   TH2I  *GetSumCH() const                                           { return fCHSum; };
76   TH2D  *GetSumDet() const                                          { return fDetSum;};
77   AliTRDCalibraVector  *GetSumDetVector() const                     { return fDetSumVector;};
78   TObjArray *GetArrayCalib() const                                  { return fArrayCalib;  };
79
80
81   void SetHisto2d(Bool_t histo2d)                                   {fHisto2d=histo2d;};
82   void SetVector2d(Bool_t vector2d)                                 {fVector2d=vector2d;};
83   void SetVdriftLinear(Bool_t vdriftLinear)                         {fVdriftLinear = vdriftLinear;};
84   void SetNbTimeBins(Int_t nbTimeBins)                              {fNbTimeBins=nbTimeBins;};
85   void SetLow(Int_t low)                                            {flow=low;};
86   void SetHigh(Int_t high)                                          {fhigh=high;};
87   void SetNz(Short_t nz, Int_t i)                                   {fNz[i]=nz;};
88   void SetNrphi(Short_t nrphi, Int_t i)                             {fNrphi[i]=nrphi;};
89   void SetFillZero(Bool_t fillZero)                                 {ffillZero =  fillZero;};
90   void SetNormalizeNbOfCluster(Bool_t normalizeNbOfCluster)         {fnormalizeNbOfCluster = normalizeNbOfCluster;};
91   void SetMaxCluster(Float_t maxcluster)                            {fmaxCluster =  maxcluster; }; 
92   void SetOfflineTracks()                                           {fOfflineTracks=kTRUE; fStandaloneTracks=kFALSE; };
93   void SetStandaloneTracks()                                        {fStandaloneTracks=kTRUE; fOfflineTracks=kFALSE; };
94   void SetCompressPerDetector(Bool_t compressPerDetector=kTRUE)     {fCompressPerDetector=compressPerDetector; };
95    
96 private:
97   AliTRDtrackInfo  *fTrackInfo;                  //track info
98
99   AliTRDtrackV1 *ftrdTrack;                      //trdtrack
100   AliTRDcluster *fcl;                            //cluster
101   
102   AliTRDCalibraFillHisto *fTRDCalibraFillHisto;  //! calibration analyse object
103   TH1F        *fNbTRDTrack;                      //! nb ESD tracks used
104   TH1F        *fNbTRDTrackOffline;               //! nb ESD tracks offline used
105   TH1F        *fNbTRDTrackStandalone;            //! nb ESD tracks standalone used
106   TH1F        *fNbTRDTracklet;                   //! nb tracklets used
107   TH1F        *fNbTRDTrackletOffline;            //! nb tracklets offline used
108   TH1F        *fNbTRDTrackletStandalone;         //! nb tracklets standalone used
109   TH1F        *fNbTimeBin;                       //! nb Time Bin
110   TH1F        *fNbTimeBinOffline;                //! nb Time Bin offline
111   TH1F        *fNbTimeBinStandalone;             //! nb Time Bin standalone
112   TH1F        *fNbClusters;                      //! nb Clusters
113   TH1F        *fNbClustersOffline;               //! nb Clusters offline
114   TH1F        *fNbClustersStandalone;            //! nb Clusters standalone
115   TProfile2D  *fPHSM;                            //! Per SM
116   TH2I        *fCHSM;                            //! Per SM
117
118   TProfile2D  *fPHSum;                           //! All together PH
119   TH2I        *fCHSum;                           //! All together CH during the task, used also if want to use AddStatsPerDetector
120   TH2D        *fDetSum;                          //! AddStatsPerDetector
121   AliTRDCalibraVector *fDetSumVector;            //! AddStatsPerDetector
122   
123   Bool_t      fHisto2d;                          // histo
124   Bool_t      fVector2d;                         // vector
125   Bool_t      fVdriftLinear;                     // vdrift Linear
126   
127   Int_t       flow;                              // lower limit nb of clusters
128   Int_t       fhigh;                             // higher limit nb of clusters
129   Int_t       fNbTimeBins;                       // number of timebins 
130   Bool_t      ffillZero;                         // fill zero
131   Short_t     fNz[3];                            // Nz mode 
132   Short_t     fNrphi[3];                         // Nrphi mode
133   Bool_t      fnormalizeNbOfCluster;             // normalize with number of clusters
134   Float_t     fmaxCluster;                       // maxcluster (noise at the end)
135   Bool_t      fOfflineTracks;                    // Offline refited tracks
136   Bool_t      fStandaloneTracks;                 // Take only standalone tracks
137
138   Bool_t      fCompressPerDetector;              //! Compress per detector 
139
140   TObjArray  *fGraph;                            //! array of graphs filled in PostProcess
141   TObjArray  *fArrayCalib;                       //! array of calibration objects filled in PostProcess
142   Bool_t      fPostProcess;                      //Post process 
143
144   AliTRDcalibration(const AliTRDcalibration&); 
145   AliTRDcalibration& operator=(const AliTRDcalibration&); 
146
147   ClassDef(AliTRDcalibration, 1) // calibration task
148 };
149 #endif