]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliBaseAODTask.h
Fix some documentation issues
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliBaseAODTask.h
1 #ifndef ALIBASEAODTASK_H
2 #define ALIBASEAODTASK_H
3 #include <AliAnalysisTaskSE.h>
4 #include <TAxis.h>
5 class AliAODEvent;
6 class AliAODForwardMult;
7 class AliAODCentralMult;
8 class TList;
9
10 /**
11  * Base class for reading in AOD stuff 
12  * 
13  */
14 class AliBaseAODTask : public AliAnalysisTaskSE
15 {
16 public:
17   /** 
18    * Constructor (for I/O - do not use)
19    */
20   AliBaseAODTask(); 
21   /** 
22    * Constructor 
23    * 
24    * @param name Name of task 
25    */
26   AliBaseAODTask(const char* name);
27   /** 
28    * Destructor
29    */
30   virtual ~AliBaseAODTask() {} 
31   /** 
32    * @{ 
33    * @name Set parameters 
34    */
35   /** 
36    * Set the vertex range to use 
37    * 
38    * @param min Minimum (in centermeter)
39    * @param max Maximum (in centermeter)
40    */  
41   void SetIpZRange(Double_t min, Double_t max) { fMinIpZ=min; fMaxIpZ=max; }
42   /** 
43    * Set the trigger maskl 
44    * 
45    * @param mask Trigger mask
46    */
47   void SetTriggerMask(UShort_t mask);
48   /** 
49    * Set the trigger mask 
50    * 
51    * @param mask trigger mask 
52    */
53   void SetTriggerMask(const char* mask);
54   /** 
55    * Set the centrality bins to use. 
56    * 
57    * @code 
58    *   UShort_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
59    *   task->SetCentralityBins(11, bins);
60    * @endcode 
61    * 
62    * @param n     Number of bins (elements in @a bins minus 1)
63    * @param bins  Bin limits 
64    */
65   void SetCentralityAxis(UShort_t n, Short_t* bins);
66   /** 
67    * Define a single centrality bin from @a low to @a high 
68    * 
69    * @param low  Lower bound 
70    * @param high Upper bound
71    */
72   void SetCentralityAxis(Short_t low, Short_t high);
73   /* @} */
74   /** 
75    * @{ 
76    * @name Interface member functions 
77    */
78   /** 
79    * Add this task to the manager and connect the outputs.  If @a
80    * sumFile is null or the empty string, then the sum container is
81    * stored in the default output file of the manager.  If @a resFile
82    * is null or the empty string, then it is set to @a resFile if
83    * defined, otherwise to the default output file of the manager.
84    * 
85    * @param sumFile Output file for sums
86    * @param resFile Output file for sums
87    * 
88    * @return true on success 
89    */
90   virtual Bool_t Connect(const char* sumFile=0, const char* resFile=0);
91   /** 
92    * Book output objects. Derived class should define this to book
93    * output objects on the processing output list @c fList before the
94    * actual event processing.  This is called on the master and on
95    * each slave.
96    * 
97    * If this member function returns false, the execution is stopped
98    * with a fatal signal.
99    *
100    * @return true on success. 
101    */
102   virtual Bool_t Book() = 0;
103   /** 
104    * Called after reading in the first event. Here we can setup stuff
105    * depending on the conditions we're running under.
106    * 
107    * @return true on success.  If this returns false, then we turn the
108    * task into a zombie and we do no more processing.
109    */
110   virtual Bool_t PreData() { return true; }
111   /** 
112    * Called before processing a single event - should not do anything
113    * but clear data, etc.
114    * 
115    * @return true on success
116    */
117   virtual Bool_t PreEvent() { return true; } 
118   /** 
119    * Process a single event
120    * 
121    * @param aod Input event 
122    * 
123    * @return true on success 
124    */
125   virtual Bool_t Event(AliAODEvent& aod) = 0;
126   /** 
127    * Called after processing a single event - should not do anything
128    * but clear data, etc.
129    * 
130    * @return true on success
131    */
132   virtual Bool_t PostEvent() { return true; } 
133   /** 
134    * Do the final analysis on the merged output. 
135    * 
136    * @return true on success
137    */
138   virtual Bool_t Finalize() = 0;
139   /* @} */
140      
141   /** 
142    * @{ 
143    * @name Utilities 
144    */
145   /** 
146    * Print information 
147    * 
148    * @param option Not used
149    */
150   void Print(Option_t* option="") const;
151   /* @} */  
152 protected:
153   /** 
154    * Copyt constructor - not defined
155    *
156    * @param o Object to copy from 
157    */
158   AliBaseAODTask(const AliBaseAODTask& o); 
159   /** 
160    * Assignment operatoer - not defined
161    *
162    * @param o Object to assign from 
163    *
164    * @return reference to this object
165    */
166   AliBaseAODTask& operator=(const AliBaseAODTask& o); 
167   /** @{ 
168    *  @name Task interface 
169    */
170   /** 
171    * Initialise on master - does nothing
172    * 
173    */
174   virtual void   Init() {}
175   /** 
176    * Create output objects.  
177    *
178    * This is called once per slave process 
179    */
180   virtual void UserCreateOutputObjects();
181   /** 
182    * Process a single event 
183    * 
184    * @param option Not used
185    */
186   virtual void UserExec(Option_t* option);
187   /** 
188    * Called at end of event processing.
189    *
190    * This is called once in the master 
191    * 
192    * @param option Not used 
193    */
194   virtual void Terminate(Option_t* option);
195   /* @} */
196   /** 
197    * Get the forward object from the AOD 
198    * 
199    * @param aod AOD event 
200    * @param mc   If true, for MC 
201    * @param verb If truem be verbose
202    * 
203    * @return Forward object or null
204    */
205   AliAODForwardMult* GetForward(const AliAODEvent& aod, 
206                                 Bool_t mc=false, 
207                                 Bool_t verb=true);
208   /** 
209    * Get the central object from the AOD 
210    * 
211    * @param aod  AOD event 
212    * @param mc   If true, for MC 
213    * @param verb If truem be verbose
214    * 
215    * @return Central object or null
216    */
217   AliAODCentralMult* GetCentral(const AliAODEvent& aod, 
218                                 Bool_t mc=false, 
219                                 Bool_t verb=true);
220   /** 
221    * Get the histogram of primary particles 
222    * 
223    * @param aod AOD event 
224    * 
225    * @return Pointer to primary particles, or null
226    */
227   TH2D* GetPrimary(const AliAODEvent& aod);
228   /** 
229    * Store information about the job on output 
230    * 
231    * @param forward Forward object
232    */
233   virtual void StoreInformation(AliAODForwardMult& forward);
234   /** 
235    * Check if the event corresponds to the selected trigger(s),
236    * vertex, and centrality.  Derived classes can overload this to
237    * enable event processing - even if the event is not within cuts.
238    * 
239    * @param forward Forward object
240    * 
241    * @return true if the event is within the cuts. 
242    */
243   virtual Bool_t CheckEvent(const AliAODForwardMult& forward);
244   /** 
245    * Check if we have centrality bins defined
246    * 
247    * @return true if we have one or more centrality bins 
248    */
249   Bool_t HasCentrality() const { return fCentAxis.GetNbins() >= 1; }
250
251   UInt_t   fTriggerMask;   // Trigger mask 
252   Double_t fMinIpZ;        // Least z--coordiante of interaction point
253   Double_t fMaxIpZ;        // Largest z--coordiante of interaction point
254   TAxis    fCentAxis;      // Centrality axis 
255   TH1*     fTriggers;      // Histogram of triggers
256   TH1*     fEventStatus;   // Histogram of event selection 
257   TH1*     fVertex;        // Vertex distribution of all events 
258   TH1*     fCent;          // Centrality distribution of all events
259   TH1*     fAccVertex;     // Vertex distribution of accepted events 
260   TH1*     fAccCent;       // Centrality distribution of accepted events
261   Bool_t   fFirstEvent;    // Information stored or not 
262   Bool_t   fCloneList;     // Wether to clone sum list for results
263   TList*   fSums;          // Output list of sums
264   TList*   fResults;       // Output list of results
265
266   ClassDef(AliBaseAODTask,1)
267 };
268 #endif
269 //
270 // Local Variables:
271 //  mode: C++
272 // End:
273 //