]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliCentralMultiplicityTask.h
Fix some problems with PAR file generation.
[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     Bool_t HasSecondaryCorrection() const { return fSecmap != 0; }
170     Bool_t HasAcceptanceCorrection() const { return fAcceptance != 0; }
171
172     /** 
173      * Get the acceptance path
174      * 
175      * @return 
176      */
177     const char* GetAcceptancePath() const {return fAcceptancePath.Data(); }
178     /** 
179      * Get the secondary path 
180      * 
181      * @return 
182      */
183     const char* GetSecMapPath() const {return fSecMapPath.Data(); }
184     /** 
185      * Set the path to the acceptance maps 
186      * 
187      * @param path PAth to object file 
188      */
189     void SetAcceptancePath(const char* path) {fAcceptancePath=path; }
190     /** 
191      * Set the path to the secondary maps 
192      * 
193      * @param path Path to object files 
194      */
195     void  SetSecMapPath(const char* path) {fSecMapPath=path; }
196     /** 
197      * Get full path name to object file 
198      * 
199      * @param what   What to get 
200      * @param sys    Collision system
201      * @param sNN    Center of mass energy 
202      * @param field  Magnetic field 
203      * 
204      * @return 
205      */
206     const char* GetFullFileName(UShort_t what, UShort_t sys, UShort_t sNN, 
207                                 Short_t  field) const;
208     /** 
209      * Get the full path name 
210      * 
211      * @param what   What to get
212      * @param sys    Collision system
213      * @param sNN    Center of mass energy 
214      * @param field  Magnetic field 
215      * 
216      * @return 
217      */
218     const char* GetFileName(UShort_t what, UShort_t sys, UShort_t sNN,
219                             Short_t field) const;
220
221     /** 
222      * Get the obejct name 
223      * 
224      * @param what which correction
225      * 
226      * @return Name of object
227      */
228     const char* GetObjectName(UShort_t what) const { 
229       return what == 0 ? GetSecMapName() : GetAcceptanceName(); }
230     /** 
231      * Get the directory part of the full file name 
232      * 
233      * @param what What correction 
234      * 
235      * @return directory path
236      */
237     const char* GetFileDir(UShort_t what) const {
238       return what == 0 ? fSecMapPath.Data() : fAcceptancePath.Data(); }
239
240     /** 
241      * Get the acceptance object name 
242      * 
243      * @return 
244      */
245     const char* GetAcceptanceName() const {return fAcceptanceName.Data(); }
246     /** 
247      * Get the secondary object name 
248      * 
249      * @return 
250      */
251     const char* GetSecMapName() const {return fSecMapName.Data(); }
252     
253     /** 
254      * Get the secondary map
255      * 
256      * @param vtxbin 
257      * 
258      * @return 
259      */
260     TH2D* GetSecMapCorrection(UShort_t vtxbin) const;
261     /** 
262      * Get the acceptance correction 
263      * 
264      * @param vtxbin 
265      * 
266      * @return 
267      */
268     TH1D* GetAcceptanceCorrection(UShort_t vtxbin) const;
269     /** 
270      * Get the secondary correction map object 
271      */
272     AliCentralCorrSecondaryMap* GetSecMap() const { return fSecmap; }
273     /** 
274      * Write a correction object to (a temporary) file.  
275      *    
276      * @param what   What kind of correction
277      * @param sys    Collision system
278      * @param cms    Center of mass energy
279      * @param field  Field 
280      * @param o      Object to write
281      * @param full   If true, write to full path
282      * 
283      * @return True on success 
284      */
285     Bool_t WriteFile(UShort_t what, UShort_t sys, UShort_t cms, Short_t field, 
286                      TObject* o, Bool_t full) const;
287
288     void Print(Option_t* option="") const;
289   private:
290     
291     TString                     fAcceptancePath; // Path to acceptance 
292     TString                     fSecMapPath;     // Path to secondary map
293     AliCentralCorrAcceptance*   fAcceptance;     // Acceptance 
294     AliCentralCorrSecondaryMap* fSecmap;         // Secindary map
295     TString                     fAcceptanceName; // Acceptance name
296     TString                     fSecMapName;     // Secindary name
297     Bool_t                      fIsInit;         // Are we init
298
299     ClassDef(Manager,1); // Manager of data 
300   };
301   /** 
302    * Get the ESD event and initialise manager on first event if not
303    * done already
304    * 
305    * @return Pointer to valid ESD event object 
306    */
307   virtual AliESDEvent* GetESDEvent();
308   /** 
309    * Mark this event for storage in AOD output
310    * 
311    */
312   virtual void MarkEventForStore() const;
313   /** 
314    * Process the ESD SPD information 
315    * 
316    * @param hist    Histogram to fill
317    * @param spdmult SPD multiplicity object
318    */
319   virtual void ProcessESD(TH2D& hist, const AliMultiplicity* spdmult) const;
320   /** 
321    * Corret the data 
322    * 
323    * @param hist    Histogram to correct
324    * @param vtxbin  Vertex bin 
325    */
326   virtual void CorrectData(TH2D& hist, UShort_t vtxbin) const;
327   /** 
328    * Get a reference to the manager 
329    * 
330    * @return Reference to corrections manager 
331    */
332   Manager& GetManager() { return fManager; }
333   /** 
334    * Get a reference to the manager 
335    * 
336    * @return Reference to corrections manager 
337    */
338   const Manager& GetManager() const { return fManager; }
339   void FindEtaLimits();
340
341 protected: 
342   AliFMDEventInspector   fInspector;        // Inspect events 
343   TH2D*                  fData;             // sum histogram if needed
344   TList*                 fList;             // Output List for diagnostics
345   AliAODCentralMult      fAODCentral;       // Output object
346   Manager                fManager;          // Manager object for corrections
347   Bool_t                 fUseSecondary;     // Whether to secondary map
348   Bool_t                 fUseAcceptance;    // Whether to use acceptance corr.
349   Bool_t                 fFirstEventSeen;   // Have we seen first event     
350   Int_t                  fIvz;              // Event's vertex bin 
351   TH2D*                  fNClusterTracklet; // # of clusters vs tracklets 
352   TH2D*                  fClusterPerTracklet; // Clusters per tracklet. 
353   TH1D*                  fNCluster;         //! Number of clusters 
354   TH1D*                  fNTracklet;        //! number of tracklets 
355   TArrayI                fEtaMin;           // Least eta bin to use
356   TArrayI                fEtaMax;           // Largest eta bin to use
357   ClassDef(AliCentralMultiplicityTask,2)    // Forward multiplicity class
358 };
359
360 #endif
361 // Local Variables:
362 //  mode: C++
363 // End:
364