1 #ifndef ALIBASEAODTASK_H
2 #define ALIBASEAODTASK_H
3 #include <AliAnalysisTaskSE.h>
6 class AliAODForwardMult;
7 class AliAODCentralMult;
11 * Base class for reading in AOD stuff
14 class AliBaseAODTask : public AliAnalysisTaskSE
18 * Constructor (for I/O - do not use)
24 * @param name Name of task
25 * @param title Class name used in configuration script
27 AliBaseAODTask(const char* name,
32 virtual ~AliBaseAODTask() {}
34 * Configure this task via a macro
36 * @param macro Macro to configure va
38 * @return true on success, false otherwise
40 virtual Bool_t Configure(const char* macro="-default-");
43 * @name Set parameters
46 * Set the vertex range to use
48 * @param min Minimum (in centermeter)
49 * @param max Maximum (in centermeter)
51 void SetIpZRange(Double_t min, Double_t max) { fMinIpZ=min; fMaxIpZ=max; }
53 * Set the trigger maskl
55 * @param mask Trigger mask
57 void SetTriggerMask(UShort_t mask);
59 * Set the trigger mask
61 * @param mask trigger mask
63 void SetTriggerMask(const char* mask);
65 * Set the centrality bins to use.
68 * UShort_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
69 * task->SetCentralityBins(11, bins);
72 * @param n Number of bins (elements in @a bins minus 1)
73 * @param bins Bin limits
75 void SetCentralityAxis(UShort_t n, Short_t* bins);
77 * Define a single centrality bin from @a low to @a high
79 * @param low Lower bound
80 * @param high Upper bound
82 void SetCentralityAxis(Short_t low, Short_t high);
86 * @name Interface member functions
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.
95 * @param sumFile Output file for sums
96 * @param resFile Output file for sums
98 * @return true on success
100 virtual Bool_t Connect(const char* sumFile=0, const char* resFile=0);
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
107 * If this member function returns false, the execution is stopped
108 * with a fatal signal.
110 * @return true on success.
112 virtual Bool_t Book() = 0;
114 * Called after reading in the first event. Here we can setup stuff
115 * depending on the conditions we're running under.
117 * @return true on success. If this returns false, then we turn the
118 * task into a zombie and we do no more processing.
120 virtual Bool_t PreData() { return true; }
122 * Called before processing a single event - should not do anything
123 * but clear data, etc.
125 * @return true on success
127 virtual Bool_t PreEvent() { return true; }
129 * Process a single event
131 * @param aod Input event
133 * @return true on success
135 virtual Bool_t Event(AliAODEvent& aod) = 0;
137 * Called after processing a single event - should not do anything
138 * but clear data, etc.
140 * @return true on success
142 virtual Bool_t PostEvent() { return true; }
144 * Do the final analysis on the merged output.
146 * @return true on success
148 virtual Bool_t Finalize() = 0;
158 * @param option Not used
160 void Print(Option_t* option="") const;
164 * Copyt constructor - not defined
166 * @param o Object to copy from
168 AliBaseAODTask(const AliBaseAODTask& o);
170 * Assignment operatoer - not defined
172 * @param o Object to assign from
174 * @return reference to this object
176 AliBaseAODTask& operator=(const AliBaseAODTask& o);
178 * @name Task interface
181 * Initialise on master - does nothing
184 virtual void Init() {}
186 * Create output objects.
188 * This is called once per slave process
190 virtual void UserCreateOutputObjects();
192 * Process a single event
194 * @param option Not used
196 virtual void UserExec(Option_t* option);
198 * Called at end of event processing.
200 * This is called once in the master
202 * @param option Not used
204 virtual void Terminate(Option_t* option);
207 * Get the forward object from the AOD
209 * @param aod AOD event
210 * @param mc If true, for MC
211 * @param verb If truem be verbose
213 * @return Forward object or null
215 AliAODForwardMult* GetForward(const AliAODEvent& aod,
219 * Get the central object from the AOD
221 * @param aod AOD event
222 * @param mc If true, for MC
223 * @param verb If truem be verbose
225 * @return Central object or null
227 AliAODCentralMult* GetCentral(const AliAODEvent& aod,
231 * Get the histogram of primary particles
233 * @param aod AOD event
235 * @return Pointer to primary particles, or null
237 TH2D* GetPrimary(const AliAODEvent& aod);
239 * Store information about the job on output
241 * @param forward Forward object
243 virtual void StoreInformation(AliAODForwardMult& forward);
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.
249 * @param forward Forward object
251 * @return true if the event is within the cuts.
253 virtual Bool_t CheckEvent(const AliAODForwardMult& forward);
255 * Check if we have centrality bins defined
257 * @return true if we have one or more centrality bins
259 Bool_t HasCentrality() const
261 return (fCentAxis.GetNbins() >= 1 &&
262 fCentAxis.GetXbins() &&
263 fCentAxis.GetXbins()->GetArray());
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.
271 * @return Name of the configuration script to use.
273 virtual const char* DefaultConfig() const { return "dNdetaConfig.C"; }
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
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
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
290 ClassDef(AliBaseAODTask,1)