]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.h
6a856433ad80fc589083747c3fe1fcd5e133feac
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwardMultiplicityBase.h
1 // 
2 // Base class for classes that calculate the multiplicity in the
3 // forward regions event-by-event
4 // 
5 #ifndef ALIFORWARDMULTIPLICITYBASE_H
6 #define ALIFORWARDMULTIPLICITYBASE_H
7 /**
8  * @file   AliForwardMultiplicityBase.h
9  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
10  * @date   Wed Mar 23 14:06:29 2011
11  * 
12  * @brief  
13  * 
14  * 
15  * @ingroup pwglf_forward_aod
16  */
17 #include <AliAnalysisTaskSE.h>
18 #include "AliForwardUtil.h"
19 #include "AliAODForwardMult.h"
20 #include "AliAODForwardEP.h"
21 class AliFMDEventInspector;
22 class AliFMDEnergyFitter;
23 class AliFMDSharingFilter;
24 class AliFMDDensityCalculator;
25 class AliFMDCorrector;
26 class AliFMDHistCollector;
27 class AliAODHandler;
28 class AliForwardCorrectionManager;
29 class AliFMDEventPlaneFinder;
30 class AliESDEvent;
31 class TH2D;
32 class TList;
33 class TTree;
34 class TAxis;
35
36 /** 
37  * @defgroup pwglf_forward PWGLF Forward analysis
38  *
39  * Code to do the multiplicity analysis in the forward psuedo-rapidity
40  * regions
41  *
42  */
43 /** 
44  * @defgroup pwglf_forward_tasks Tasks
45  *
46  * Code to do the multiplicity analysis in the forward psuedo-rapidity
47  * regions
48  *
49  * @ingroup pwglf_forward 
50  */
51 /** 
52  * @defgroup pwglf_forward_topical Topical
53  *
54  * The code divided according to topic
55  */
56 /** 
57  * @defgroup pwglf_forward_aod AOD
58  * 
59  * Code to do with AOD production 
60  *
61  * @ingroup pwglf_forward_topical
62  */
63 /** 
64  * Base class for classes that calculate the multiplicity in the
65  * forward regions event-by-event
66  * 
67  * @par Inputs: 
68  *   - AliESDEvent 
69  *
70  * @par Outputs: 
71  *   - AliAODForwardMult 
72  * 
73  * @par Histograms 
74  *   
75  * @par Corrections used 
76  * 
77  * @ingroup pwglf_forward_tasks
78  * @ingroup pwglf_forward_aod
79  * 
80  */
81 class AliForwardMultiplicityBase : public AliAnalysisTaskSE
82 {
83 public:
84   /** 
85    * @{ 
86    * @name Interface methods 
87    */
88   /** 
89    * Initialize the task 
90    * 
91    */
92   virtual void Init() { fFirstEvent = true; }
93   /** 
94    * Create output objects 
95    * 
96    */
97   virtual void UserCreateOutputObjects();
98   /** 
99    * Process each event 
100    *
101    * @param option Not used
102    */  
103   virtual void UserExec(Option_t* option) = 0;
104   /** 
105    * End of job
106    * 
107    * @param option Not used 
108    */
109   virtual void Terminate(Option_t* option);
110   /** 
111    * @} 
112    */
113   /** 
114    * Configure this task via a macro 
115    * 
116    * @param macro Macro to configure va 
117    * 
118    * @return true on success, false otherwise
119    */
120   virtual Bool_t Configure(const char* macro="ForwardAODConfig.C");
121   /** 
122    * Print information 
123    * 
124    * @param option Not used
125    */
126   virtual void Print(Option_t* option="") const;
127   /** 
128    * Whether to enable low-flux code 
129    * 
130    * @param use IF true, enable low-flux code 
131    */
132   virtual void SetEnableLowFlux(Bool_t use=true) { fEnableLowFlux = use; }
133   /** 
134    * @{ 
135    * @name Access to sub-algorithms 
136    */
137   /**
138    * Get reference to the EventInspector algorithm 
139    * 
140    * @return Reference to AliFMDEventInspector object 
141    */
142   virtual AliFMDEventInspector& GetEventInspector() = 0;
143   /**
144    * Get reference to the SharingFilter algorithm 
145    * 
146    * @return Reference to AliFMDSharingFilter object 
147    */
148   virtual AliFMDSharingFilter& GetSharingFilter() = 0;
149   /**
150    * Get reference to the DensityCalculator algorithm 
151    * 
152    * @return Reference to AliFMDDensityCalculator object 
153    */
154   virtual AliFMDDensityCalculator& GetDensityCalculator() = 0;
155   /**
156    * Get reference to the Corrections algorithm 
157    * 
158    * @return Reference to AliFMDCorrector object 
159    */
160   virtual AliFMDCorrector& GetCorrections() = 0;
161   /**
162    * Get reference to the HistCollector algorithm 
163    * 
164    * @return Reference to AliFMDHistCollector object 
165    */
166   virtual AliFMDHistCollector& GetHistCollector() = 0;
167   /**
168    * Get reference to the EventInspector algorithm 
169    * 
170    * @return Reference to AliFMDEventInspector object 
171    */
172   virtual const AliFMDEventInspector& GetEventInspector() const = 0;
173   /**
174    * Get reference to the SharingFilter algorithm 
175    * 
176    * @return Reference to AliFMDSharingFilter object 
177    */
178   virtual const AliFMDSharingFilter& GetSharingFilter() const = 0;
179   /**
180    * Get reference to the DensityCalculator algorithm 
181    * 
182    * @return Reference to AliFMDDensityCalculator object 
183    */
184   virtual const AliFMDDensityCalculator& GetDensityCalculator() const = 0;
185   /**
186    * Get reference to the Corrections algorithm 
187    * 
188    * @return Reference to AliFMDCorrector object 
189    */
190   virtual const AliFMDCorrector& GetCorrections() const = 0;
191   /**
192    * Get reference to the HistCollector algorithm 
193    * 
194    * @return Reference to AliFMDHistCollector object 
195    */
196   virtual const AliFMDHistCollector& GetHistCollector() const = 0;
197    /**
198    * Get reference to the EventPlaneFinder algorithm 
199    * 
200    * @return Reference to AliFMDEventPlaneFinder object 
201    */
202   virtual AliFMDEventPlaneFinder& GetEventPlaneFinder() = 0;
203   /**
204    * Get reference to the EventPlaneFinder algorithm 
205    * 
206    * @return Reference to AliFMDEventPlaneFinder object 
207    */
208   virtual const AliFMDEventPlaneFinder& GetEventPlaneFinder() const = 0;
209   /* @} */
210
211   /** 
212    * Set the debug level 
213    * 
214    * @param dbg 
215    */
216   virtual void SetDebug(Int_t dbg);
217   /** 
218    * Overload super class method for setting debug level to call our
219    * SetDebug member function.
220    * 
221    * @param dbg Debug level (0: no output, 1: essentials, 3: a whole lot)
222    */
223   virtual void SetDebugLevel(Int_t dbg) 
224   { 
225     AliAnalysisTaskSE::SetDebugLevel(dbg); 
226     SetDebug(dbg);
227   }
228   /** 
229    * Set whether to make separate branches for each ring.  If enabled
230    * there will be 5 additional branches on the AOD tree - each
231    * holding a TH2D object of the charged particle multiplicity in
232    * @f$(\eta,\varphi)@f$ bins for that event.
233    * 
234    * @param use If true, make separate branches for each ring. 
235    */
236   void SetStorePerRing(Bool_t use) { fStorePerRing = use; }
237 protected: 
238   /** 
239    * Constructor 
240    * 
241    * @param name Name of task 
242    */
243   AliForwardMultiplicityBase(const char* name); 
244   /** 
245    * Constructor
246    */
247   AliForwardMultiplicityBase() 
248   : AliAnalysisTaskSE(), 
249     fEnableLowFlux(true), 
250     fFirstEvent(true),
251     fStorePerRing(false),
252     fList(0),
253     fHData(0),
254     fHistos(),
255     fAODFMD(),
256     fAODEP(),
257     fRingSums(),
258     fCorrManager(0)
259   {}
260   /** 
261    * Copy constructor 
262    * 
263    * @param o Object to copy from 
264    */
265   AliForwardMultiplicityBase(const AliForwardMultiplicityBase& o)
266     : AliAnalysisTaskSE(o),
267       fEnableLowFlux(o.fEnableLowFlux), 
268       fFirstEvent(o.fFirstEvent),
269       fStorePerRing(o.fStorePerRing),
270       fList(o.fList),
271       fHData(o.fHData),
272       fHistos(o.fHistos),
273       fAODFMD(o.fAODFMD),
274       fAODEP(o.fAODEP),
275       fRingSums(o.fRingSums),
276       fCorrManager(o.fCorrManager)
277   {
278     DefineOutput(1, TList::Class());
279     DefineOutput(2, TList::Class());
280   }
281   /** 
282    * Assignment operator 
283    * 
284    * @param o Object to assign from 
285    * 
286    * @return Reference to this object 
287    */
288   AliForwardMultiplicityBase& operator=(const AliForwardMultiplicityBase& o);
289   /** 
290    * Check if all needed corrections are there and accounted for.  If not,
291    * do a Fatal exit 
292    * 
293    * @param what Which corrections is needed
294    * 
295    * @return true if all present, false otherwise
296    */  
297   Bool_t CheckCorrections(UInt_t what) const;
298   /** 
299    * Read corrections
300    * 
301    * 
302    * @param pe  On return, the eta axis
303    * @param pv  On return ,the vertex axis 
304    * @param mc  True assume MC input
305    * 
306    * @return true ons succcss
307    */
308   virtual Bool_t ReadCorrections(const TAxis*& pe, 
309                                  const TAxis*& pv,
310                                  Bool_t mc=false,
311                                  Bool_t sat=false);
312   /**
313    * Get the ESD event. IF this is the first event, initialise
314    *
315    * @return Pointer to ESD event structore 
316    */
317   virtual AliESDEvent* GetESDEvent();
318   /** 
319    * Initialise the sub objects and stuff.  Called on first event
320    *
321    * @return false on errors 
322    */
323   virtual Bool_t SetupForData();
324   /** 
325    * Initialize members based on eta and vertex axis - only available
326    * after first event - called from SetupForData.
327    * 
328    * @param pe @f$\eta@f$ axis
329    * @param pv Interaction point Z-coordinate axis 
330    */
331   virtual void InitMembers(const TAxis* pe, const TAxis* pv);
332   /**
333    * Create output branches - called from UserCreateOutputObjects
334    */
335   virtual void CreateBranches(AliAODHandler* ah);
336   /**
337    * Mark this event as one to store in the AOD 
338    * 
339    */
340   virtual void MarkEventForStore() const;
341   /** 
342    * Do estimates of @f$dN/d\eta@f$  - called at Terminate
343    * 
344    * @param input  Input list
345    * @param output Output list
346    */
347   virtual void EstimatedNdeta(const TList* input, TList* output) const;
348   /** 
349    * Calculate a simple dN/deta from all accepted events 
350    * 
351    * @param input  Input list
352    * @param output Output list
353    * @param nTr    On return, number of triggers
354    * @param nTrVtx On return, number of trigger+vertex events
355    * @param nAcc   On return, number of accepted events
356    * 
357    * @return true on success 
358    */
359   virtual Bool_t MakeSimpledNdeta(const TList* input, 
360                                   TList*       output,
361                                   Double_t&    nTr, 
362                                   Double_t&    nTrVtx, 
363                                   Double_t&    nAcc);
364   /** 
365    * Make Ring @f$ dN/d\eta @f$ histogram and a stack 
366    * 
367    * @param input      List with summed signals 
368    * @param output     Output list 
369    * @param inName     Input name 
370    * @param outName    Output name
371    * @param style      Style 
372    */
373   virtual void MakeRingdNdeta(const TList* input, 
374                               const char*  inName,
375                               TList*       output,
376                               const char*  outName,
377                               Int_t        style=20) const;
378   Bool_t                 fEnableLowFlux;// Whether to use low-flux specific code
379   Bool_t                 fFirstEvent;   // Whether the event is the first seen 
380   Bool_t                 fStorePerRing; // Store each ring on separate branch
381   TList*                 fList;         // Output list
382   TH2D*                  fHData;        // Summed 1/Nd^2N_{ch}/dphideta
383   AliForwardUtil::Histos fHistos;       // Cache histograms 
384   AliAODForwardMult      fAODFMD;       // Output object
385   AliAODForwardEP        fAODEP;        // Output object
386   AliForwardUtil::Histos fRingSums;     // Cache histograms 
387 private:
388   /**
389    * A pointer to the corrections manager.  This is here to make the
390    * corrections manager persistent - that is, when we write the
391    * analysis train to a file (as done in PROOF) we should also write
392    * down the corrections mananger.   This pointer ensures that. 
393    * 
394    */
395   AliForwardCorrectionManager* fCorrManager; // Pointer to corrections manager
396
397   ClassDef(AliForwardMultiplicityBase,3) // Forward multiplicity class
398 };
399
400 #endif
401
402 // Local Variables:
403 //  mode: C++
404 // End:
405