2 // Base class for FMD ESD input - sub classes can use the services to
3 // easily setup a task to process the FMD ESD data
5 #ifndef ALIFMDESDTASK_H
6 #define ALIFMDESDTASK_H
8 #include <AliAnalysisTaskSE.h>
9 class AliFMDEventInspector;
10 class AliCorrectionManagerBase;
17 * Base class for tasks that analyse the FMD ESD. This wraps a
18 * single-event analysis task, and provides a modified interface to
19 * implement for the sub-classes:
22 * class MyFMDESDTask : public AliBaseESDTask
25 * MyFMDESDTask() : AliBaseESDTask() {}
26 * MyFMDESDTask(const char* name) : AliBaseESDTask(name)
29 * AliFMDEventInspector& GetEventInspector() { return fInspector; }
30 * const AliFMDEventInspector& GetEventInspector() const{ return fInspector; }
33 * fNeededCorrections = AliForwardCorrectionManager::kELossFits;
34 * fSharingFilter.CreateUserObject(fList);
37 * Bool_t PreData(const TAxis& vertex, const TAxis& eta)
39 * fSharingFilter.SetupForData(eta);
42 * Bool_t PreEvent() { fESDFMD.Clear(); return true; }
43 * Bool_t PostEvent() { return true; }
44 * Bool_t Event(AliESDEvent& esd)
46 * Bool_t lowFlux = kFALSE;
47 * UInt_t triggers = 0;
51 * UShort_t nClusters = 0;
52 * UInt_t found = fEventInspector.Process(esd, triggers, lowFlux,
53 * ivz, ip, cent, nClusters);
54 * if (found & AliFMDEventInspector::kNoEvent) return false;
55 * if (found & AliFMDEventInspector::kNoTriggers) return false;
56 * if (found & AliFMDEventInspector::kNoSPD) return;
57 * if (found & AliFMDEventInspector::kNoFMD) return;
58 * if (found & AliFMDEventInspector::kNoVertex) return;
59 * if (triggers & AliAODForwardMult::kPileUp) return;
60 * if (found & AliFMDEventInspector::kBadVertex) return;
62 * Bool_t ret = fSharingFilter.Filter(esd, lowFlux, fESDFMD, ip.Z());
67 * GetSharingFilter().Terminate(fList,fResults,Int_t(nTr));
71 * AliFMDEventInsepctor fInspector;
72 * AliFMDSharingFilter fSharingFilter;
78 class AliBaseESDTask : public AliAnalysisTaskSE
82 * Default (I/O) constructor - do not use directly
88 * @param name Name of the task
89 * @param title Class name used in configuration script
90 * @param manager Correction manager
92 AliBaseESDTask(const char* name, const char* title,
93 AliCorrectionManagerBase* manager);
95 * Add this task to the manager and connect the outputs. If @a
96 * sumFile is null or the empty string, then the sum container is
97 * stored in the default output file of the manager. If @a resFile
98 * is null or the empty string, then it is set to @a resFile if
99 * defined, otherwise to the default output file of the manager.
101 * @param sumFile Output file for sums
102 * @param resFile Output file for sums
104 * @return true on success
106 virtual Bool_t Connect(const char* sumFile=0, const char* resFile=0);
108 * Called when initializing the train
110 virtual Bool_t Setup() { return true; }
112 * Book output objects. Derived class should define this to book
113 * output objects on the processing output list @c fList before the
114 * actual event processing. This is called on the master and on
117 * If this member function returns false, the execution is stopped
118 * with a fatal signal.
120 * @return true on success.
122 virtual Bool_t Book() = 0;
124 * Called after reading in the first event. Here we can setup stuff
125 * depending on the conditions we're running under.
127 * @return true on success. If this returns false, then we turn the
128 * task into a zombie and we do no more processing.
130 virtual Bool_t PreData(const TAxis& vertex, const TAxis& eta);
132 * Called before processing a single event - should not do anything
133 * but clear data, etc.
135 * @return true on success
137 virtual Bool_t PreEvent() { return true; }
139 * Process a single event
141 * @param esd Input event
143 * @return true on success
145 virtual Bool_t Event(AliESDEvent& esd) = 0;
147 * Called after processing a single event - should not do anything
148 * but clear data, etc.
150 * @return true on success
152 virtual Bool_t PostEvent() { return true; }
154 * Do the final analysis on the merged output.
156 * @return true on success
158 virtual Bool_t Finalize() { return true; }
161 * @name Utility methods
166 * @param option Not used
168 virtual void Print(Option_t* option="") const;
170 * Set the debug level
174 virtual void SetDebug(Int_t dbg);
176 * Overload super class method for setting debug level to call our
177 * SetDebug member function.
179 * @param dbg Debug level (0: no output, 1: essentials, 3: a whole lot)
181 virtual void SetDebugLevel(Int_t dbg)
183 AliAnalysisTaskSE::SetDebugLevel(dbg);
187 // --- Configuration etc -------------------------------------------
189 * @name Access sub-components
192 * Configure this task via a macro
194 * @param macro Macro to configure va
196 * @return true on success, false otherwise
198 virtual Bool_t Configure(const char* macro="ForwardAODConfig.C");
200 * Get a reference to the event inspector. User must override this
201 * to return proper object
203 * @return Reference to the event inspector
205 virtual AliFMDEventInspector& GetEventInspector() = 0;
207 * Get a reference to the event inspector. User must override this
208 * to return proper object
210 * @return Reference to the event inspector
212 virtual const AliFMDEventInspector& GetEventInspector() const = 0;
216 * Copy constructor - left undefined
218 * @param o Object to copy from
220 AliBaseESDTask(const AliBaseESDTask& o);
222 * Assignment operator - left undefined
224 * @param o Object to assign from
226 * @return Reference to this object.
228 AliBaseESDTask& operator=(const AliBaseESDTask& o);
229 // --- Customize ---------------------------------------------------
231 * Evaluate wether this is for MC. User class can override this
233 * @return true if we're to initialize corrections for MC input
235 virtual Bool_t IsMC() const { return false; }
237 * Set the default eta axis to use in case we didn't get one from
238 * the read-in corretions. Override this if the sub class should go
239 * on even without a valid eta axis from the corrections (e.g. QA
244 virtual TAxis* DefaultEtaAxis() const;
246 * Set the default eta axis to use in case we didn't get one from
247 * the read-in corretions. Override this if the sub class should go
248 * on even without a valid eta axis from the corrections (e.g. QA
253 virtual TAxis* DefaultVertexAxis() const;
255 * Get the correction mananger. Derived class should overload this
256 * to return the proper object.
258 * @return Pointer to correction manager
260 virtual AliCorrectionManagerBase* GetManager() const { return fCorrManager; }
262 * Get the correction mananger. Derived class should overload this
263 * to return the proper object.
265 * @return Pointer to correction manager
267 virtual AliCorrectionManagerBase* GetManager() { return fCorrManager; }
269 // --- Task methods ------------------------------------------------
272 * @name Task interface methods
275 * Initialize the task
279 * Create output objects
281 void UserCreateOutputObjects();
285 * @param option Not used
287 void UserExec(Option_t* option);
291 * @param option Not used
293 void Terminate(Option_t* option);
297 // --- Services for derived classes --------------------------------
299 * Create output branches - called from UserCreateOutputObjects
301 virtual void CreateBranches(AliAODHandler*) {}
303 * Mark this event as one to store in the AOD
306 virtual void MarkEventForStore() const;
308 * Check if all needed corrections are there and accounted for. If not,
311 * @param what Which corrections is needed
313 * @return true if all present, false otherwise
315 virtual Bool_t CheckCorrections(UInt_t what) const;
320 * @param pe On return, the eta axis
321 * @param pv On return ,the vertex axis
322 * @param mc True assume MC input
323 * @param sat True if we need for satellite interactions too
325 * @return true ons succcss
327 virtual Bool_t ReadCorrections(const TAxis*& pe,
332 * Get the ESD event. IF this is the first event, initialise
334 * @return Pointer to ESD event structore
336 virtual AliESDEvent* GetESDEvent();
338 // --- Members -----------------------------------------------------
339 Bool_t fFirstEvent; // Wheter we're waiting for the first event
340 TList* fList; // Output list
341 TList* fResults; // Results list
342 UInt_t fNeededCorrections; // Set this to bit-mask of corrections we need
343 UInt_t fExtraCorrections; // Set this to bit-mask of corrections we'd like
344 Bool_t fCloneList; // Result list is a clone of sum list
347 * A pointer to the corrections manager. This is here to make the
348 * corrections manager persistent - that is, when we write the
349 * analysis train to a file (as done in PROOF) we should also write
350 * down the corrections mananger. This pointer ensures that.
353 AliCorrectionManagerBase* fCorrManager; // Pointer to corrections manager
355 ClassDef(AliBaseESDTask,1);