]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliBaseMCCorrectionsTask.h
Modified QA script to allow creating QA results (Sans energy loss)
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliBaseMCCorrectionsTask.h
1 // 
2 // Calculate the corrections in the base regions
3 // 
4 #ifndef ALIBASEMCCORRECTIONS_H
5 #define ALIBASEMCCORRECTIONS_H
6 /**
7  * @file   AliBaseMCCorrectionsTask.h
8  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
9  * @date   Wed Mar 23 14:05:51 2011
10  * 
11  * @brief  
12  * 
13  * 
14  * @ingroup pwglf_base_aod
15  */
16 #include <AliBaseESDTask.h>
17 #include <AliESDFMD.h>
18 #include "AliFMDMCEventInspector.h"
19 #include <TH1I.h>
20 class AliBaseMCTrackDensity;
21 class AliCorrectionManagerBase;
22 class AliESDEvent;
23 class TH2D;
24 class TH1D;
25 class TList;
26
27
28 /** 
29  * Calculate the corrections in the base regions
30  * 
31  * @par Inputs: 
32  *   - AliESDEvent 
33  *
34  * @par Outputs: 
35  *   - AliAODBaseMult 
36  * 
37  * @par Histograms 
38  *   
39  * @par Corrections used 
40  * 
41  * @ingroup pwglf_base_tasks
42  * @ingroup pwglf_base_mc
43  * @ingroup pwglf_base_aod
44  * 
45  */
46 class AliBaseMCCorrectionsTask : public AliBaseESDTask
47 {
48 public:
49   /** 
50    * Constructor 
51    * 
52    * @param name Name of task 
53    * @param m    Manager 
54    */
55   AliBaseMCCorrectionsTask(const char* name,
56                            AliCorrectionManagerBase* m);
57   /** 
58    * Constructor
59    */
60   AliBaseMCCorrectionsTask();
61   /** 
62    * @{ 
63    * @name Interface methods 
64    */
65   /** 
66    * Create output objects 
67    * 
68    * @return true on success
69    */
70   virtual Bool_t Book();
71   /** 
72    * Process each event 
73    *
74    * @param esd ESD event
75    * 
76    * @return true on success
77    */  
78   virtual Bool_t Event(AliESDEvent& esd);
79   /** 
80    * End of job
81    * 
82    * @return true on success
83    */
84   virtual Bool_t Finalize();
85   /** 
86    * @} 
87    */
88   /** 
89    * Print this object 
90    * 
91    * @param option   Not used
92    */
93   void Print(Option_t* option="") const;
94
95   /** 
96    * Set the vertex axis to use
97    * 
98    * @param nBins Number of bins
99    * @param vzMin Least @f$z@f$ coordinate of interation point
100    * @param vzMax Largest @f$z@f$ coordinate of interation point
101    */
102   void SetVertexAxis(Int_t nBins, Double_t vzMin, Double_t vzMax=-1000000);
103   /** 
104    * Set the vertex axis to use
105    * 
106    * @param axis Axis
107    */
108   void SetVertexAxis(const TAxis& axis);
109   /** 
110    * Set the eta axis to use
111    * 
112    * @param nBins Number of bins
113    * @param etaMin Least @f$\eta@f$ 
114    * @param etaMax Largest @f$\eta@f$ 
115    */
116   void SetEtaAxis(Int_t nBins, Double_t etaMin, Double_t etaMax=-1000000);
117   /** 
118    * Set the eta axis to use
119    * 
120    * @param axis Axis
121    */
122   void SetEtaAxis(const TAxis& axis);
123   /** 
124    * Get a reference to the track density calculator 
125    * 
126    * @return Reference to the track density calculator 
127    */
128   virtual AliBaseMCTrackDensity& GetTrackDensity() = 0;
129   /** 
130    * Get a reference to the track density calculator 
131    * 
132    * @return Reference to the track density calculator 
133    */
134   virtual const AliBaseMCTrackDensity& GetTrackDensity() const = 0;
135   /** 
136    * Get a reference to the event inspector
137    * 
138    * @return Reference to the event inspector 
139    */
140   AliFMDEventInspector& GetEventInspector() { return fInspector; }
141   /** 
142    * Get a reference to the event inspector
143    * 
144    * @return Reference to the event inspector 
145    */
146   const AliFMDEventInspector& GetEventInspector() const { return fInspector;}
147   /**
148    * setter for the fUseESDVertexCoordinate flag 
149    */
150   void SetUseESDVertex(Bool_t use){ fUseESDVertex = use;}
151   /**
152    * setter for the fCalculateafterESDeventcuts flag 
153    */
154   void SetAfterEventSel(Bool_t use){ fAfterEventSel = use; }
155 protected: 
156   /** 
157    * Copy constructor 
158    * 
159    * @param o Object to copy from 
160    */
161   AliBaseMCCorrectionsTask(const AliBaseMCCorrectionsTask& o);
162   /** 
163    * Assignment operator 
164    * 
165    * @param o Object to assign from 
166    * 
167    * @return Reference to this object 
168    */
169   AliBaseMCCorrectionsTask& operator=(const AliBaseMCCorrectionsTask& o);
170   /**
171    * A vertex bin 
172    * 
173    */
174   struct VtxBin : public TNamed
175   {
176     /** 
177      * Constructor 
178      */
179     VtxBin();
180     /** 
181      * Constructor
182      *  
183      * @param low       Lower @f$v_z@f$ bound
184      * @param high      Upper @f$v_z@f$ bound
185      * @param etaAxis   @f$\eta@f$ axis to use 
186      * @param nPhi      Number of @f$\varphi@f$ bins 
187      */
188     VtxBin(Double_t low, Double_t high, const TAxis& etaAxis, UShort_t nPhi);
189     virtual ~VtxBin() {}
190     /** 
191      * Copy constructor 
192      * 
193      * @param o Object to copy from 
194      */
195     VtxBin(const VtxBin& o);
196     /** 
197      * Assignment operator 
198      * 
199      * @param o Object to assign from 
200      * 
201      * @return Reference to this object
202      */
203     VtxBin& operator=(const VtxBin& o);
204     /** 
205      * Get bin name
206      * 
207      * @param low       Lower @f$v_z@f$ bound
208      * @param high      Upper @f$v_z@f$ bound
209      * 
210      * @return Bin name 
211      */
212     static const char* BinName(Double_t low, Double_t high);
213     /** 
214      * Declare output in passed list 
215      * 
216      * @param list List to put output in 
217      */
218     virtual TList* CreateOutputObjects(TList* list);
219     TH2D*                  fPrimary;  // Cache or primary 
220     TH1D*                  fCounts;   // Event count 
221
222     ClassDef(VtxBin,1); // Vertex bin 
223   };
224   virtual TAxis* DefaultVertexAxis() const { return const_cast<TAxis*>(&fVtxAxis); }
225   virtual TAxis* DefaultEtaAxis() const { return const_cast<TAxis*>(&fEtaAxis); }
226   /** 
227    * Create a vertex bin 
228    * 
229    * @param low      Low cut on @f$IP_{z}@f$
230    * @param high     High cut on @f$IP_{z}@f$ 
231    * 
232    * @return Newly create vertex bin 
233    */
234   virtual VtxBin* CreateVtxBin(Double_t low, Double_t high) = 0;
235   /** 
236    * Process an ESD event 
237    * 
238    * @param esd ESD event 
239    * @param mc  MC event 
240    * @param bin Vertex bin
241    * @param vz  @f$IP_{z}@f$ 
242    * 
243    * @return true on success 
244    */
245   virtual Bool_t ProcessESD(const AliESDEvent& esd, 
246                             const AliMCEvent& mc, 
247                             VtxBin& bin,
248                             Double_t          vz) = 0;
249   /** 
250    * Create corrections objects and store them in passed list
251    * 
252    * @param results Output list 
253    */
254   virtual void CreateCorrections(TList* results) = 0;
255   /** 
256    * Do the final processing of a vertex bin 
257    * 
258    * @param bin       Vertex bin
259    * @param iVz       Vertex bin number 
260    * 
261    * @return true on successd
262    */
263   virtual Bool_t FinalizeVtxBin(VtxBin*      bin, 
264                                 UShort_t     iVz) = 0;
265   /** 
266    * Define our vertex bins 
267    * 
268    * @param list List to read or add binst from/to
269    */
270   void DefineBins(TList* list);
271
272   AliFMDMCEventInspector fInspector; // Event inspector 
273
274   TObjArray* fVtxBins;      // Vertex bins 
275   TH1I*      fHEvents;      // All Events
276   TH1I*      fHEventsTr;    // Histogram of events w/trigger
277   TH1I*      fHEventsTrVtx; // Events w/trigger and vertex 
278   TAxis      fVtxAxis;      // Vertex axis 
279   TAxis      fEtaAxis;      // Eta axis 
280   Bool_t     fUseESDVertex; // if true use Z vertex from ESD in calculations
281   Bool_t     fAfterEventSel; //if true corr. be calc. after events selection
282
283   ClassDef(AliBaseMCCorrectionsTask,1) // Base corrections class
284 };
285
286 #endif
287 // Local Variables:
288 //  mode: C++
289 // End: