]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliCentralMultiplicityTask.h
Coverity fixes
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliCentralMultiplicityTask.h
1 // 
2 // Base class for classes that calculate the multiplicity in the
3 // SPD clusters event-by-event
4 // 
5 #ifndef ALICENTRALMULTIPLICITYTASK_H
6 #define ALICENTRALMULTIPLICITYTASK_H
7 /**
8  * @file   AliCentralMultiplicityTask.h
9  * @author Hans Hjersing Dalsgaard
10  * @date   Wed Mar 23 14:00:03 2011
11  * 
12  * @brief  
13  * 
14  * @ingroup pwglf_forward_aod
15  * 
16  */
17 #include <AliAnalysisTaskSE.h>
18 #include "AliFMDEventInspector.h"
19 #include "AliAODCentralMult.h"
20 #include "AliCentralCorrAcceptance.h"
21 #include "AliCentralCorrSecondaryMap.h"
22 //class AliForwardCorrectionManager;
23 class AliESDEvent;
24 class AliMultiplicity;
25 class TH2D;
26 class TList;
27 class TTree;
28
29 /** 
30  * Class that calculates the multiplicity in the
31  * central region event-by-event
32  * 
33  * @par Inputs: 
34  *   - AliESDEvent 
35  *
36  * @par Outputs: 
37  *   - AliAODCentralMult 
38  * 
39  * @par Histograms 
40  *   
41  * @par Corrections used 
42  * 
43  * @ingroup pwglf_forward_tasks
44  * @ingroup pwglf_forward_aod
45  * 
46  */
47 class AliCentralMultiplicityTask : public AliAnalysisTaskSE
48 {
49 public:
50   /** 
51    * @{ 
52    * @name Interface methods 
53    */
54    /** 
55    * Constructor 
56    * 
57    * @param name Name of task 
58    */
59   AliCentralMultiplicityTask(const char* name); 
60   /** 
61    * Constructor 
62    *
63    * Reserved for ROOT's I/O system - do not use
64    */
65   AliCentralMultiplicityTask();
66   /** 
67    * Copy constructor 
68    * 
69    * @param o Object to copy from 
70    */
71   AliCentralMultiplicityTask(const AliCentralMultiplicityTask& o);
72   /** 
73    * Assignment operator 
74    * 
75    * @param o Object to assign from 
76    * 
77    * @return Reference to this object 
78    */
79   AliCentralMultiplicityTask& operator=(const AliCentralMultiplicityTask& o);
80   /** 
81    * Create output objects 
82    * 
83    */
84   virtual void UserCreateOutputObjects();
85   /** 
86    * Process each event 
87    *
88    * @param option Not used
89    */  
90   virtual void UserExec(Option_t* option);
91   /** 
92    * End of job
93    * 
94    * @param option Not used 
95    */
96   virtual void Terminate(Option_t* option);
97   /** 
98    * Print information 
99    * 
100    * @param option Not used
101    */
102   virtual void Print(Option_t* option="") const;
103   /** 
104    * Set whether to use the secondary corrections 
105    * 
106    * @param use Whether to use secondary corrections 
107    */
108   virtual void SetUseSecondary(Bool_t use) { fUseSecondary = use; }
109   /** 
110    * Set whether to use the acceptance corrections 
111    * 
112    * @param use Whether to use acceptance corrections 
113    */
114   virtual void SetUseAcceptance(Bool_t use) { fUseAcceptance = use; }
115
116   AliFMDEventInspector& GetInspector() { return fInspector; }
117   const AliFMDEventInspector& GetInspector() const { return fInspector; }
118
119   //__________________________________________________________________
120   /**
121    * Manager of corrections 
122    *
123    * This is a small class to fetch corrections for secondaries and
124    * dead channels.
125    * 
126    */
127   class Manager 
128   {
129   public:
130     /** 
131      * Constructor
132      * 
133      */
134     Manager();
135     /** 
136      * Copy constructor 
137      * 
138      * @param o 
139      */
140     Manager(const Manager& o);
141     /** 
142      * Destructor
143      */
144     virtual ~Manager() {}
145     /** 
146      * Assignment operator 
147      * 
148      * @param o Object to assign from 
149      * 
150      * @return Reference to this object 
151      */
152     Manager& operator=(const Manager& o);
153     
154     /** 
155      * Initialize 
156      * 
157      * @param sys    Collision system (1: pp, 2: PbPb)
158      * @param sNN    Center of mass energy per nucleon pair [GeV]
159      * @param field  Magnetic field [kG]
160      */
161     void Init(UShort_t sys, UShort_t sNN, Short_t field);
162     
163     /** 
164      * Is initialized 
165      * 
166      */
167     Bool_t IsInit() { return fIsInit; }
168     
169     
170     /** 
171      * Get the acceptance path
172      * 
173      * @return 
174      */
175     const char* GetAcceptancePath() const {return fAcceptancePath.Data(); }
176     /** 
177      * Get the secondary path 
178      * 
179      * @return 
180      */
181     const char* GetSecMapPath() const {return fSecMapPath.Data(); }
182     /** 
183      * Set the path to the acceptance maps 
184      * 
185      * @param path PAth to object file 
186      */
187     void SetAcceptancePath(const char* path) {fAcceptancePath=path; }
188     /** 
189      * Set the path to the secondary maps 
190      * 
191      * @param path Path to object files 
192      */
193     void  SetSecMapPath(const char* path) {fSecMapPath=path; }
194     /** 
195      * Get full path name to object file 
196      * 
197      * @param what   What to get 
198      * @param sys    Collision system
199      * @param sNN    Center of mass energy 
200      * @param field  Magnetic field 
201      * 
202      * @return 
203      */
204     const char* GetFullFileName(UShort_t what, UShort_t sys, UShort_t sNN, 
205                                 Short_t  field) const;
206     /** 
207      * Get the full path name 
208      * 
209      * @param what   What to get
210      * @param sys    Collision system
211      * @param sNN    Center of mass energy 
212      * @param field  Magnetic field 
213      * 
214      * @return 
215      */
216     const char* GetFileName(UShort_t what, UShort_t sys, UShort_t sNN,
217                             Short_t field) const;
218
219     /** 
220      * Get the obejct name 
221      * 
222      * @param what which correction
223      * 
224      * @return Name of object
225      */
226     const char* GetObjectName(UShort_t what) const { 
227       return what == 0 ? GetSecMapName() : GetAcceptanceName(); }
228     /** 
229      * Get the directory part of the full file name 
230      * 
231      * @param what What correction 
232      * 
233      * @return directory path
234      */
235     const char* GetFileDir(UShort_t what) const {
236       return what == 0 ? fSecMapPath.Data() : fAcceptancePath.Data(); }
237
238     /** 
239      * Get the acceptance object name 
240      * 
241      * @return 
242      */
243     const char* GetAcceptanceName() const {return fAcceptanceName.Data(); }
244     /** 
245      * Get the secondary object name 
246      * 
247      * @return 
248      */
249     const char* GetSecMapName() const {return fSecMapName.Data(); }
250     
251     /** 
252      * Get the secondary map
253      * 
254      * @param vtxbin 
255      * 
256      * @return 
257      */
258     TH2D* GetSecMapCorrection(UShort_t vtxbin) const;
259     /** 
260      * Get the acceptance correction 
261      * 
262      * @param vtxbin 
263      * 
264      * @return 
265      */
266     TH1D* GetAcceptanceCorrection(UShort_t vtxbin) const;
267     /** 
268      * Get the secondary correction map object 
269      */
270     AliCentralCorrSecondaryMap* GetSecMap() const { return fSecmap; }
271     /** 
272      * Write a correction object to (a temporary) file.  
273      *    
274      * @param what   What kind of correction
275      * @param sys    Collision system
276      * @param cms    Center of mass energy
277      * @param field  Field 
278      * @param o      Object to write
279      * @param full   If true, write to full path
280      * 
281      * @return True on success 
282      */
283     Bool_t WriteFile(UShort_t what, UShort_t sys, UShort_t cms, Short_t field, 
284                      TObject* o, Bool_t full) const;
285
286     void Print(Option_t* option="") const;
287   private:
288     
289     TString                     fAcceptancePath; // Path to acceptance 
290     TString                     fSecMapPath;     // Path to secondary map
291     AliCentralCorrAcceptance*   fAcceptance;     // Acceptance 
292     AliCentralCorrSecondaryMap* fSecmap;         // Secindary map
293     TString                     fAcceptanceName; // Acceptance name
294     TString                     fSecMapName;     // Secindary name
295     Bool_t                      fIsInit;         // Are we init
296
297     ClassDef(Manager,1); // Manager of data 
298   };
299   /** 
300    * Get the ESD event and initialise manager on first event if not
301    * done already
302    * 
303    * @return Pointer to valid ESD event object 
304    */
305   virtual AliESDEvent* GetESDEvent();
306   /** 
307    * Mark this event for storage in AOD output
308    * 
309    */
310   virtual void MarkEventForStore() const;
311   /** 
312    * Process the ESD SPD information 
313    * 
314    * @param hist    Histogram to fill
315    * @param spdmult SPD multiplicity object
316    */
317   virtual void ProcessESD(TH2D& hist, const AliMultiplicity* spdmult) const;
318   /** 
319    * Corret the data 
320    * 
321    * @param hist    Histogram to correct
322    * @param vtxbin  Vertex bin 
323    */
324   virtual void CorrectData(TH2D& hist, UShort_t vtxbin) const;
325   /** 
326    * Get a reference to the manager 
327    * 
328    * @return Reference to corrections manager 
329    */
330   Manager& GetManager() { return fManager; }
331   /** 
332    * Get a reference to the manager 
333    * 
334    * @return Reference to corrections manager 
335    */
336   const Manager& GetManager() const { return fManager; }
337   void FindEtaLimits();
338
339 protected: 
340   AliFMDEventInspector   fInspector;        // Inspect events 
341   TH2D*                  fData;             // sum histogram if needed
342   TList*                 fList;             // Output List for diagnostics
343   AliAODCentralMult      fAODCentral;       // Output object
344   Manager                fManager;          // Manager object for corrections
345   Bool_t                 fUseSecondary;     // Whether to secondary map
346   Bool_t                 fUseAcceptance;    // Whether to use acceptance corr.
347   Bool_t                 fFirstEventSeen;   // Have we seen first event     
348   Int_t                  fIvz;              // Event's vertex bin 
349   TH2D*                  fNClusterTracklet; // # of clusters vs tracklets 
350   TH2D*                  fClusterPerTracklet; // Clusters per tracklet. 
351   TH1D*                  fNCluster;         //! Number of clusters 
352   TH1D*                  fNTracklet;        //! number of tracklets 
353   TArrayI                fEtaMin;           // Least eta bin to use
354   TArrayI                fEtaMax;           // Largest eta bin to use
355   ClassDef(AliCentralMultiplicityTask,2)    // Forward multiplicity class
356 };
357
358 #endif
359 // Local Variables:
360 //  mode: C++
361 // End:
362