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