]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliForwardMCCorrectionsTask.h
Fixes for pA indenfication of events
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwardMCCorrectionsTask.h
1 // 
2 // Calculate the corrections in the forward regions
3 // 
4 #ifndef ALIFORWARDMCCORRECTIONS_H
5 #define ALIFORWARDMCCORRECTIONS_H
6 /**
7  * @file   AliForwardMCCorrectionsTask.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_forward_aod
15  */
16 #include <AliAnalysisTaskSE.h>
17 #include <AliESDFMD.h>
18 #include "AliFMDMCEventInspector.h"
19 #include "AliFMDMCTrackDensity.h"
20 #include <TH1I.h>
21 class AliESDEvent;
22 class AliFMDCorrSecondaryMap;
23 class TH2D;
24 class TH1D;
25 class TList;
26
27
28 /** 
29  * Calculate the corrections in the forward regions
30  * 
31  * @par Inputs: 
32  *   - AliESDEvent 
33  *
34  * @par Outputs: 
35  *   - AliAODForwardMult 
36  * 
37  * @par Histograms 
38  *   
39  * @par Corrections used 
40  * 
41  * @ingroup pwglf_forward_tasks
42  * @ingroup pwglf_forward_mc
43  * @ingroup pwglf_forward_aod
44  * 
45  */
46 class AliForwardMCCorrectionsTask : public AliAnalysisTaskSE
47 {
48 public:
49   /** 
50    * Constructor 
51    * 
52    * @param name Name of task 
53    */
54   AliForwardMCCorrectionsTask(const char* name);
55   /** 
56    * Constructor
57    */
58   AliForwardMCCorrectionsTask();
59   /** 
60    * Copy constructor 
61    * 
62    * @param o Object to copy from 
63    */
64   AliForwardMCCorrectionsTask(const AliForwardMCCorrectionsTask& o);
65   /** 
66    * Assignment operator 
67    * 
68    * @param o Object to assign from 
69    * 
70    * @return Reference to this object 
71    */
72   AliForwardMCCorrectionsTask& operator=(const AliForwardMCCorrectionsTask& o);
73   /** 
74    * @{ 
75    * @name Interface methods 
76    */
77   /** 
78    * Initialize the task 
79    * 
80    */
81   virtual void Init();
82   /** 
83    * Create output objects 
84    * 
85    */
86   virtual void UserCreateOutputObjects();
87   /** 
88    * Process each event 
89    *
90    * @param option Not used
91    */  
92   virtual void UserExec(Option_t* option);
93   /** 
94    * End of job
95    * 
96    * @param option Not used 
97    */
98   virtual void Terminate(Option_t* option);
99   /** 
100    * @} 
101    */
102   /** 
103    * Print this object 
104    * 
105    * @param option   Not used
106    */
107   void         Print(Option_t* option="") const;
108
109   /** 
110    * Set the vertex axis to use
111    * 
112    * @param nBins Number of bins
113    * @param vzMin Least @f$z@f$ coordinate of interation point
114    * @param vzMax Largest @f$z@f$ coordinate of interation point
115    */
116   void SetVertexAxis(Int_t nBins, Double_t vzMin, Double_t vzMax=-1000000);
117   /** 
118    * Set the vertex axis to use
119    * 
120    * @param axis Axis
121    */
122   void SetVertexAxis(const TAxis& axis);
123   /** 
124    * Set the eta axis to use
125    * 
126    * @param nBins Number of bins
127    * @param etaMin Least @f$\eta@f$ 
128    * @param etaMax Largest @f$\eta@f$ 
129    */
130   void SetEtaAxis(Int_t nBins, Double_t etaMin, Double_t etaMax=-1000000);
131   /** 
132    * Set the eta axis to use
133    * 
134    * @param axis Axis
135    */
136   void SetEtaAxis(const TAxis& axis);
137   /** 
138    * Get a reference to the track density calculator 
139    * 
140    * @return Reference to the track density calculator 
141    */
142   AliFMDMCTrackDensity& GetTrackDensity() { return fTrackDensity; }
143   /** 
144    * Get a reference to the track density calculator 
145    * 
146    * @return Reference to the track density calculator 
147    */
148   const AliFMDMCTrackDensity& GetTrackDensity() const { return fTrackDensity; }
149   /** 
150    * Get a reference to the event inspector
151    * 
152    * @return Reference to the event inspector 
153    */
154   AliFMDMCEventInspector& GetEventInspector() { return fInspector; }
155   /** 
156    * Get a reference to the event inspector
157    * 
158    * @return Reference to the event inspector 
159    */
160   const AliFMDMCEventInspector& GetEventInspector() const { return fInspector;}
161 protected: 
162   /**
163    * A vertex bin 
164    * 
165    */
166   struct VtxBin : public TNamed
167   {
168     /** 
169      * Constructor 
170      */
171     VtxBin();
172     /** 
173      * Constructor
174      *  
175      * @param low       Lower @f$v_z@f$ bound
176      * @param high      Upper @f$v_z@f$ bound
177      * @param etaAxis   @f$\eta@f$ axis to use 
178      */
179     VtxBin(Double_t low, Double_t high, const TAxis& etaAxis);
180     /** 
181      * Copy constructor 
182      * 
183      * @param o Object to copy from 
184      */
185     VtxBin(const VtxBin& o);
186     /** 
187      * Assignment operator 
188      * 
189      * @param o Object to assign from 
190      * 
191      * @return Reference to this object
192      */
193     VtxBin& operator=(const VtxBin& o);
194     /** 
195      * Get bin name
196      * 
197      * @param low       Lower @f$v_z@f$ bound
198      * @param high      Upper @f$v_z@f$ bound
199      * 
200      * @return Bin name 
201      */
202     static const char* BinName(Double_t low, Double_t high);
203     /** 
204      * Declare output in passed list 
205      * 
206      * @param list List to put output in 
207      */
208     void DefineOutput(TList* list);
209     /** 
210      * Calculate the background correction
211      * 
212      * @param hits      Summed hits (track-refs)
213      * @param primary   Summed primaries 
214      * 
215      * @return Background correction
216      */
217     TH2D* MakeBg(const TH2D* hits, const TH2D* primary) const;
218     /** 
219      * End of job process 
220      * 
221      * @param o   List to add output to 
222      * @param i   Input 
223      * @param iVz Vertex bin
224      * @param map Corrections map 
225      */
226     void Finish(const TList*            i, 
227                 TList*                  o,
228                 UShort_t                iVz, 
229                 AliFMDCorrSecondaryMap* map);
230
231     AliForwardUtil::Histos fHists;    // Cache of per-ring histograms
232     TH2D*                  fPrimary;  // Cache or primary 
233     TH1D*                  fCounts;   // Event count 
234
235     ClassDef(VtxBin,1); // Vertex bin 
236   };
237   /** 
238    * Define our vertex bins 
239    * 
240    * @param list List to read or add binst from/to
241    */
242   void DefineBins(TList* list);
243
244   AliFMDMCEventInspector fInspector; // Event inspector 
245   AliFMDMCTrackDensity   fTrackDensity; // Get the track density 
246
247   AliESDFMD  fESDFMD;       // Cache object
248   TObjArray* fVtxBins;      // Vertex bins 
249   Bool_t     fFirstEvent;   // First event flag 
250   TH1I*      fHEvents;      // All Events
251   TH1I*      fHEventsTr;    // Histogram of events w/trigger
252   TH1I*      fHEventsTrVtx; // Events w/trigger and vertex 
253   TAxis      fVtxAxis;      // Vertex axis 
254   TAxis      fEtaAxis;      // Eta axis 
255   TList*     fList;         // Output list 
256
257   ClassDef(AliForwardMCCorrectionsTask,1) // Forward corrections class
258 };
259
260 #endif
261 // Local Variables:
262 //  mode: C++
263 // End:
264