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
26 AliBaseAODTask(const char* name);
30 virtual ~AliBaseAODTask() {}
33 * @name Set parameters
36 * Set the vertex range to use
38 * @param min Minimum (in centermeter)
39 * @param max Maximum (in centermeter)
41 void SetIpZRange(Double_t min, Double_t max) { fMinIpZ=min; fMaxIpZ=max; }
43 * Set the trigger maskl
45 * @param mask Trigger mask
47 void SetTriggerMask(UShort_t mask);
49 * Set the trigger mask
51 * @param mask trigger mask
53 void SetTriggerMask(const char* mask);
55 * Set the centrality bins to use.
58 * UShort_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
59 * task->SetCentralityBins(11, bins);
62 * @param n Number of bins (elements in @a bins minus 1)
63 * @param bins Bin limits
65 void SetCentralityAxis(UShort_t n, Short_t* bins);
67 * Define a single centrality bin from @a low to @a high
69 * @param low Lower bound
70 * @param high Upper bound
72 void SetCentralityAxis(Short_t low, Short_t high);
76 * @name Interface member functions
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.
85 * @param sumFile Output file for sums
86 * @param resFile Output file for sums
88 * @return true on success
90 virtual Bool_t Connect(const char* sumFile=0, const char* resFile=0);
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
97 * If this member function returns false, the execution is stopped
98 * with a fatal signal.
100 * @return true on success.
102 virtual Bool_t Book() = 0;
104 * Called after reading in the first event. Here we can setup stuff
105 * depending on the conditions we're running under.
107 * @return true on success. If this returns false, then we turn the
108 * task into a zombie and we do no more processing.
110 virtual Bool_t PreData() { return true; }
112 * Called before processing a single event - should not do anything
113 * but clear data, etc.
115 * @return true on success
117 virtual Bool_t PreEvent() { return true; }
119 * Process a single event
121 * @param aod Input event
123 * @return true on success
125 virtual Bool_t Event(AliAODEvent& aod) = 0;
127 * Called after processing a single event - should not do anything
128 * but clear data, etc.
130 * @return true on success
132 virtual Bool_t PostEvent() { return true; }
134 * Do the final analysis on the merged output.
136 * @return true on success
138 virtual Bool_t Finalize() = 0;
148 * @param option Not used
150 void Print(Option_t* option="") const;
154 * Copyt constructor - not defined
156 * @param o Object to copy from
158 AliBaseAODTask(const AliBaseAODTask& o);
160 * Assignment operatoer - not defined
162 * @param o Object to assign from
164 * @return reference to this object
166 AliBaseAODTask& operator=(const AliBaseAODTask& o);
168 * @name Task interface
171 * Initialise on master - does nothing
174 virtual void Init() {}
176 * Create output objects.
178 * This is called once per slave process
180 virtual void UserCreateOutputObjects();
182 * Process a single event
184 * @param option Not used
186 virtual void UserExec(Option_t* option);
188 * Called at end of event processing.
190 * This is called once in the master
192 * @param option Not used
194 virtual void Terminate(Option_t* option);
197 * Get the forward object from the AOD
199 * @param aod AOD event
200 * @param mc If true, for MC
201 * @param verb If truem be verbose
203 * @return Forward object or null
205 AliAODForwardMult* GetForward(const AliAODEvent& aod,
209 * Get the central object from the AOD
211 * @param aod AOD event
212 * @param mc If true, for MC
213 * @param verb If truem be verbose
215 * @return Central object or null
217 AliAODCentralMult* GetCentral(const AliAODEvent& aod,
221 * Get the histogram of primary particles
223 * @param aod AOD event
225 * @return Pointer to primary particles, or null
227 TH2D* GetPrimary(const AliAODEvent& aod);
229 * Store information about the job on output
231 * @param forward Forward object
233 virtual void StoreInformation(AliAODForwardMult& forward);
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.
239 * @param forward Forward object
241 * @return true if the event is within the cuts.
243 virtual Bool_t CheckEvent(const AliAODForwardMult& forward);
245 * Check if we have centrality bins defined
247 * @return true if we have one or more centrality bins
249 Bool_t HasCentrality() const { return fCentAxis.GetNbins() >= 1; }
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
266 ClassDef(AliBaseAODTask,1)