Update of calibration code (Raphaelle)
[u/mrichter/AliRoot.git] / TRD / AliTRDCalibTask.h
1 #ifndef ALITRDCALIBTASK_H
2 #define ALITRDCALIBTASK_H
3
4 ///////////////////////////////////////////////////////////////////////////////
5 //                                                                           //
6 //  TRD calibration task for offline calibration                             //
7 //                                                                           //
8 ///////////////////////////////////////////////////////////////////////////////
9
10
11 class TList;
12 class TObject;
13 class TObjArray;
14 class TH2F;
15 class TH1F;
16 class TH1I;
17 class TProfile2D;
18 class TH2I;
19 class TTree;
20 class AliESDEvent;
21 class AliESDfriend;
22 class AliESDtrack;
23 class AliESDfriendTrack;
24 class AliTRDtrackV1;
25 class AliTRDCalibraFillHisto;
26 class AliTRDcluster;
27 class AliESDtrackCuts;
28 class AliTRDCalDet;
29
30 #include "TObjString.h"
31 #include "AliAnalysisTaskSE.h" 
32 #include "TMath.h"
33
34 class AliTRDCalibTask : public AliAnalysisTaskSE {
35  public:
36   AliTRDCalibTask(const char *name = "AliTRDCalibTask");
37   virtual ~AliTRDCalibTask();
38   
39   //  virtual void   ConnectInputData(Option_t *);
40   virtual void   UserCreateOutputObjects();
41   virtual void   UserExec(Option_t *);
42   virtual void   Terminate(Option_t *);
43   virtual Bool_t Load(const Char_t *filename);
44   virtual Bool_t Load(TList *lister);
45   void           Plot();
46   virtual Long64_t  Merge(TCollection *li);
47   void           AddTask(const AliTRDCalibTask * calibTask);
48   TList          *GetList() const {return fListHist;};
49
50   void SetHisto2d(Bool_t histo2d)                                   {fHisto2d=histo2d;};
51   void SetVector2d(Bool_t vector2d)                                 {fVector2d=vector2d;};
52   void SetVdriftLinear(Bool_t vdriftLinear)                         {fVdriftLinear = vdriftLinear;};
53   void SetNbTimeBins(Int_t nbTimeBins)                              {fNbTimeBins=nbTimeBins;};  
54   
55   void SetNz(Short_t nz, Int_t i)                                      {fNz[i]=nz;};
56   void SetNrphi(Short_t nrphi, Int_t i)                                {fNrphi[i]=nrphi;};
57   
58   void AddSelectedTriggerClass(const char*name)                        {fSelectedTrigger->Add(new TObjString(name));};
59   void SetReject(Bool_t rejected)                                      {fRejected = rejected;};
60   
61   void SetESDtrackCuts(AliESDtrackCuts * const esdtrackCuts)           {fEsdTrackCuts = esdtrackCuts;};
62   void SetRequirePrimaryVertex(Bool_t requirePrimaryVertex)            {fRequirePrimaryVertex = requirePrimaryVertex;};
63   void SetUseTPCVertex()                                               {fVtxTPC=kTRUE ; fVtxSPD=kFALSE;} 
64   void SetUseSPDVertex()                                               {fVtxTPC=kFALSE; fVtxSPD=kTRUE ;} 
65   void SetMinNbOfContributors(Int_t minNbOfContributors)               {fMinNbContributors = minNbOfContributors;};  
66   void SetRangePrimaryVertexZ(Double_t rangePrimaryVertexZ)            {fRangePrimaryVertexZ = TMath::Abs(rangePrimaryVertexZ);};  
67   
68   void SetLow(Int_t low)                                               {fLow=low;};
69   void SetHigh(Int_t high)                                             {fHigh=high;};
70   void SetFillZero(Bool_t fillZero)                                    {fFillZero =  fillZero;};
71   void SetNormalizeNbOfCluster(Bool_t normalizeNbOfCluster =  kTRUE)   {fNormalizeNbOfCluster = normalizeNbOfCluster;};
72   void SetMaxCluster(Float_t maxCluster)                               {fMaxCluster =  maxCluster; }; 
73   void SetNbMaxCluster(Short_t nbMaxCluster)                           {fNbMaxCluster =  nbMaxCluster; }; 
74   void SetOfflineTracks()                                              {fOfflineTracks=kTRUE; fStandaloneTracks=kFALSE; };
75   void SetStandaloneTracks()                                           {fStandaloneTracks=kTRUE; fOfflineTracks=kFALSE; };
76
77   void SetCalDetGain(AliTRDCalDet * const calDetGain)                         {fCalDetGain = calDetGain;};  
78
79   void SetMaxEvent(Int_t nbevents)                                     { fMaxEvent = nbevents; };
80   void SetDebug(Int_t debug)                                           { fDebug = debug; };
81
82  private:
83   AliESDEvent  *fESD;                            //! ESD object
84   AliESDfriend *fESDfriend;                      //! ESD friend
85   const AliESDtrack *fkEsdTrack;                  //! ESD track
86   AliESDfriendTrack *fFriendTrack;               //! ESD friend track
87   TObject *fCalibObject;                         //! calibration objects attached to the ESD friend
88   AliTRDtrackV1 *fTrdTrack;                      //! trdtrack
89   AliTRDcluster *fCl;                            //! cluster
90   
91   TList       *fListHist;                        //! list of histograms
92
93   AliTRDCalibraFillHisto *fTRDCalibraFillHisto;  //! calibration analyse object
94
95   TH1I        *fNEvents;                         //! counter  
96   
97   TH1F        *fNbTRDTrack;                      //! nb ESD tracks with TRD clusters
98   TH1F        *fNbTRDTrackOffline;               //! nb ESD tracks with TRD clusters
99   TH1F        *fNbTRDTrackStandalone;            //! nb ESD tracks with TRD clusters
100   TH2F        *fNbTPCTRDtrack;                   //! nb TPC and TRD tracks when problems
101    
102   TH1F        *fNbTimeBin;                       //! nb Time Bin
103   TH1F        *fNbTimeBinOffline;                //! nb Time Bin offline
104   TH1F        *fNbTimeBinStandalone;             //! nb Time Bin standalone
105   TH1F        *fNbClusters;                      //! nb Clusters
106   TH1F        *fNbClustersOffline;               //! nb Clusters offline
107   TH1F        *fNbClustersStandalone;            //! nb Clusters standalone
108   TH1F        *fNbTracklets;                     //! nb Tracklets
109   TH1F        *fNbTrackletsOffline;              //! nb Tracklets offline
110   TH1F        *fNbTrackletsStandalone;           //! nb Tracklets standalone
111   
112   TH2F        *fAbsoluteGain;                    //! Absolute Gain without AliESDfriend
113   TH2I        *fCH2dSum;                         //! CH2d charge all
114   TProfile2D  *fPH2dSum;                         //! PH2d PH all
115   TH2I        *fCH2dSM;                          //! CH2d per SM
116   TProfile2D  *fPH2dSM;                          //! PH2d per SM
117
118   Bool_t      fHisto2d;                          // histo
119   Bool_t      fVector2d;                         // vector
120   Bool_t      fVdriftLinear;                     // vdrift Linear
121
122   Int_t       fNbTimeBins;                       // number of timebins 
123
124   Short_t     fNz[3];                            // Nz mode 
125   Short_t     fNrphi[3];                         // Nrphi mode
126    
127   TObjArray   *fSelectedTrigger;                 // Trigger class names accepted/rejected
128   Bool_t      fRejected;                         // Reject the selected trigger class
129   
130   AliESDtrackCuts *fEsdTrackCuts;                // Quality cut on the AliESDtrack
131   Bool_t      fRequirePrimaryVertex;             // Primary Vertex
132   Bool_t      fVtxTPC;                           // Flag for use of TPC vertex
133   Bool_t      fVtxSPD;                           // Flag for use of SPD vertex
134   Int_t       fMinNbContributors;                // Min number of contributors
135   Double_t    fRangePrimaryVertexZ;              // Were the primary vertex is
136   
137   Int_t       fLow;                              // lower limit of nb of TRD clusters per tracklet
138   Int_t       fHigh;                             // higher limit of nb of TRD clusters per tracklet
139   Bool_t      fFillZero;                         // fill zero
140   Bool_t      fNormalizeNbOfCluster;             // normalize with number of clusters (per default not) 
141   Float_t     fRelativeScale;                    // relative scale for gas gain
142   Float_t     fMaxCluster;                       // Maxcluster 
143   Short_t     fNbMaxCluster;                     // Number of tb at the end
144   Bool_t      fOfflineTracks;                    // Only Offline refitted tracks
145   Bool_t      fStandaloneTracks;                 // Take only standalone tracks
146
147   AliTRDCalDet *fCalDetGain;                     // Calib object gain
148
149   Int_t       fMaxEvent;                         // max events
150   Int_t       fCounter;                          // max events
151   Int_t       fDebug;                            // fDebug
152
153   AliTRDCalibTask(const AliTRDCalibTask&); 
154   AliTRDCalibTask& operator=(const AliTRDCalibTask&); 
155
156   ClassDef(AliTRDCalibTask, 1); 
157 };
158
159 #endif
160