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