]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/TRD/AliTRDrecoTask.h
expand trending functionality by generic PutTrendValue/GetTrendValue
[u/mrichter/AliRoot.git] / PWGPP / TRD / AliTRDrecoTask.h
1 #ifndef ALITRDRECOTASK_H\r
2 #define ALITRDRECOTASK_H\r
3 \r
4 ///////////////////////////////////////////////////////\r
5 //\r
6 // Basic class for Performance/Calibration TRD tasks\r
7 //\r
8 // Author: Alexandru Bercuci, 10/09/2008\r
9 //\r
10 //////////////////////////////////////////////////\r
11 \r
12 #ifndef ALIANALYSISTASKSE_H\r
13 #include "AliAnalysisTaskSE.h"\r
14 #endif\r
15 \r
16 #ifndef ALITRDTRACKINFO_H\r
17 #include "info/AliTRDtrackInfo.h"\r
18 #endif\r
19 \r
20 #ifndef ALITRDEVENTINFO_H\r
21 #include "info/AliTRDeventInfo.h"\r
22 #endif\r
23 \r
24 class TAxis;\r
25 class TH1;\r
26 class TH2;\r
27 class TH3;\r
28 class TF1;\r
29 class TList;\r
30 class TObjArray;\r
31 class TTreeSRedirector;\r
32 class AliTRDtrackV1;\r
33 template <typename Value> class TVectorT;\r
34 typedef class TVectorT<Float_t> TVector;\r
35 class AliTRDrecoTask : public AliAnalysisTaskSE \r
36 {\r
37 friend class AliEveTRDTrackList;\r
38 public:\r
39   enum AliTRDrecoSteeringBits{\r
40      kMCdata      = BIT(18)\r
41     ,kFriends     = BIT(19)\r
42     ,kPostProcess = BIT(20)\r
43     ,kHeavyIon    = BIT(21)\r
44   };\r
45   \r
46   class AliTRDrecoProjection : public TNamed\r
47   {\r
48   public:\r
49     AliTRDrecoProjection();\r
50     virtual ~AliTRDrecoProjection();\r
51     AliTRDrecoProjection& operator+=(const AliTRDrecoProjection& other);\r
52     AliTRDrecoProjection& operator=(const AliTRDrecoProjection& other);\r
53     void      Build(const Char_t *n, const Char_t *t, Int_t ix, Int_t iy, Int_t iz, TAxis *aa[]);\r
54     Double_t  GetTrendValue(const Int_t mid=0, Double_t *m=NULL, Double_t *s=NULL) const;\r
55     TH3*      H() const { return fH;}\r
56     void      Increment(Int_t bin[], Double_t v);\r
57     TH2*      Projection2D(const Int_t nstat, const Int_t ncol, const Int_t mid=0, Bool_t del=kTRUE);\r
58     void      SetRebinStrategy(Int_t n, Int_t rebx[], Int_t reby[]);\r
59     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;}\r
60   private:\r
61     AliTRDrecoProjection(const AliTRDrecoProjection&);\r
62   protected:\r
63     TH3  *fH;          // data container\r
64     Int_t fAx[3];      // projection axes\r
65     Int_t fNrebin;     // no. of rebinning steps\r
66     Int_t *fRebinX;    //[fNrebin] rebinning of the X axis\r
67     Int_t *fRebinY;    //[fNrebin] rebinning of the Y axis\r
68     Float_t fRange[4]; //show range of the z processed\r
69 \r
70     ClassDef(AliTRDrecoProjection, 2)  // wrapper for a projection container THnSparse -> TH3\r
71   };\r
72 \r
73   AliTRDrecoTask();\r
74   AliTRDrecoTask(const char *name, const char *title);\r
75   virtual ~AliTRDrecoTask();\r
76   \r
77   \r
78   virtual void   UserCreateOutputObjects();\r
79   virtual void   UserExec(Option_t *opt);\r
80   virtual void   SetDebugLevel(Int_t level);\r
81   \r
82     \r
83   static Float_t GetMeanStat(TH1 *h, Float_t cut=0., Option_t *opt="");\r
84   Int_t          GetNRefFigures() const; \r
85   const Char_t*  GetNameId() const       { return fNameId;}\r
86   TList*         GetPlotFunctors() const { return fPlotFuncList;}\r
87   static Int_t   GetPtBinSignificant(Float_t pt);\r
88   virtual Bool_t GetRefFigure(Int_t ifig);\r
89   virtual void   MakeSummary();\r
90   void           MakeDetectorPlot(Int_t ly=0, const Option_t *opt="eta");\r
91   void           MakeDetectorPlotNEW(Int_t ly=0, const Option_t *opt="eta");\r
92   Bool_t         IsHeavyIon() const      { return TestBit(kHeavyIon);};\r
93   Bool_t         IsPP() const            { return !TestBit(kHeavyIon);};\r
94   Bool_t         HasFriends() const      { return TestBit(kFriends);};\r
95   Bool_t         HasMCdata() const       { return TestBit(kMCdata);};\r
96   Bool_t         HasPostProcess() const  { return TestBit(kPostProcess);};\r
97   Bool_t         HasRunTerminate() const { return fRunTerminate; }\r
98   virtual TObjArray* Histos()            { return fContainer;}\r
99 \r
100   virtual Bool_t Load(const Char_t *file = "AnalysisResults.root", const Char_t *dir = "TRD_Performance");\r
101   virtual Bool_t LoadDetectorMap(const Char_t *file = "AnalysisResults.root", const Char_t *dir = "TRD_Performance");\r
102   virtual Bool_t Save(TObjArray * const res);\r
103   virtual Bool_t PostProcess();\r
104   virtual Bool_t PutTrendValue(const Char_t *name, Double_t val, Double_t err=0);\r
105   virtual void   SetFriends(Bool_t fr = kTRUE) {SetBit(kFriends, fr);}\r
106   virtual void   SetMCdata(Bool_t mc = kTRUE) {SetBit(kMCdata, mc);}\r
107   virtual void   SetNameId(const Char_t *nid) {snprintf(fNameId, 10, "%s", nid);}\r
108   virtual void   SetPostProcess(Bool_t pp = kTRUE) {SetBit(kPostProcess, pp);}\r
109   static Float_t SetNormZ(TH2 *h2, Int_t bxmin=1, Int_t bxmax=-1, Int_t bymin=1, Int_t bymax=-1, Float_t thr=0.);\r
110   static void    SetRangeZ(TH2 *h2, Float_t m, Float_t M, Float_t thr=0.);\r
111   void SetRunTerminate(Bool_t runTerminate = kTRUE) { fRunTerminate = runTerminate; }\r
112   virtual void   Terminate(Option_t *);\r
113 \r
114 protected:\r
115   static TTreeSRedirector* DebugStream() { return fgDebugStream;}\r
116   virtual void   InitFunctorList();\r
117   Bool_t         HasFunctorList() const { return fPlotFuncList != NULL; }\r
118 \r
119   Char_t                fNameId[10];       // unique identifier of task particularity\r
120   UChar_t               fNRefFigures;      // no of reference figures reported by task\r
121   TObjArray             *fDets;            //! OLD container to store detector position and status support should be discontinued \r
122   TVector               *fDetsV;           //! NEW container to store detector position and status\r
123   TObjArray             *fContainer;       //! container to store results\r
124   AliTRDeventInfo       *fEvent;           //! Event Info\r
125   TObjArray             *fTracks;          //! Array of tracks\r
126   TObjArray             *fClusters;        //! Array of clusters\r
127   const TObjArray       *fkClusters;       //! current detector clusters array\r
128   const AliTRDtrackV1   *fkTrack;          //! current track\r
129   const AliTRDtrackInfo::AliMCinfo  *fkMC; //! MC info\r
130   const AliTRDtrackInfo::AliESDinfo *fkESD;//! ESD info\r
131   Char_t                 fSpecies;         //! species index +1 with charge sign\r
132   Float_t                fPt;              //! p_t of the track being analyzed\r
133   Float_t                fPhi;             //! phi of the track being analyzed\r
134   Float_t                fEta;             //! eta of the track being analyzed\r
135 \r
136 private:\r
137   AliTRDrecoTask(const AliTRDrecoTask&);\r
138   AliTRDrecoTask& operator=(const AliTRDrecoTask&);\r
139 \r
140   TList             *fPlotFuncList;        //! track functors list\r
141   TList             *fDetFuncList;         //! detector functors list\r
142   Bool_t            fRunTerminate;         // Switch for Terminate Function\r
143   static TTreeSRedirector *fgDebugStream;  //! Debug stream\r
144   static const Int_t fgNPt0 = 4;           // No of significant pt bins \r
145   static Float_t fgPt0[fgNPt0];            // Array with limits for significant pt bins \r
146 \r
147   ClassDef(AliTRDrecoTask, 5) // base TRD reconstruction task\r
148 };\r
149 \r
150 #endif\r
151 \r