]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliCentralMultiplicityTask.h
Maker scripts now use TrainSetup exclusively.
[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    * Configure this task via a macro 
82    * 
83    * @param macro Macro to configure va 
84    * 
85    * @return true on success, false otherwise
86    */
87   virtual Bool_t Configure(const char* macro="CentralAODConfig.C");
88   /** 
89    * Create output objects 
90    * 
91    */
92   virtual void UserCreateOutputObjects();
93   /** 
94    * Process each event 
95    *
96    * @param option Not used
97    */  
98   virtual void UserExec(Option_t* option);
99   /** 
100    * End of job
101    * 
102    * @param option Not used 
103    */
104   virtual void Terminate(Option_t* option);
105   /** 
106    * Print information 
107    * 
108    * @param option Not used
109    */
110   virtual void Print(Option_t* option="") const;
111   /** 
112    * Set whether to use the secondary corrections 
113    * 
114    * @param use Whether to use secondary corrections 
115    */
116   virtual void SetUseSecondary(Bool_t use) { fUseSecondary = use; }
117   /** 
118    * Set whether to use the acceptance corrections 
119    * 
120    * @param use Whether to use acceptance corrections 
121    */
122   virtual void SetUseAcceptance(Bool_t use) { fUseAcceptance = use; }
123
124   AliFMDEventInspector& GetInspector() { return fInspector; }
125   const AliFMDEventInspector& GetInspector() const { return fInspector; }
126
127   //__________________________________________________________________
128   /**
129    * Manager of corrections 
130    *
131    * This is a small class to fetch corrections for secondaries and
132    * dead channels.
133    * 
134    */
135   class Manager 
136   {
137   public:
138     /** 
139      * Constructor
140      * 
141      */
142     Manager();
143     /** 
144      * Copy constructor 
145      * 
146      * @param o 
147      */
148     Manager(const Manager& o);
149     /** 
150      * Destructor
151      */
152     virtual ~Manager() {}
153     /** 
154      * Assignment operator 
155      * 
156      * @param o Object to assign from 
157      * 
158      * @return Reference to this object 
159      */
160     Manager& operator=(const Manager& o);
161     
162     /** 
163      * Initialize 
164      * 
165      * @param sys    Collision system (1: pp, 2: PbPb)
166      * @param sNN    Center of mass energy per nucleon pair [GeV]
167      * @param field  Magnetic field [kG]
168      */
169     void Init(UShort_t sys, UShort_t sNN, Short_t field);
170     
171     /** 
172      * Is initialized 
173      * 
174      * @return true if initialized 
175      */
176     Bool_t IsInit() { return fIsInit; }
177     /** 
178      * Check if we have the secondary correction
179      * 
180      * @return true if it is read in
181      */
182     Bool_t HasSecondaryCorrection() const { return fSecmap != 0; }
183     /** 
184      * Check if we have the acceptance correction
185      * 
186      * @return true if it is read in
187      */
188     Bool_t HasAcceptanceCorrection() const { return fAcceptance != 0; }
189
190     /** 
191      * Get the acceptance path
192      * 
193      * @return 
194      */
195     const char* GetAcceptancePath() const {return fAcceptancePath.Data(); }
196     /** 
197      * Get the secondary path 
198      * 
199      * @return 
200      */
201     const char* GetSecMapPath() const {return fSecMapPath.Data(); }
202     /** 
203      * Set the path to the acceptance maps 
204      * 
205      * @param path PAth to object file 
206      */
207     void SetAcceptancePath(const char* path) {fAcceptancePath=path; }
208     /** 
209      * Set the path to the secondary maps 
210      * 
211      * @param path Path to object files 
212      */
213     void  SetSecMapPath(const char* path) {fSecMapPath=path; }
214     /** 
215      * Get full path name to object file 
216      * 
217      * @param what   What to get 
218      * @param sys    Collision system
219      * @param sNN    Center of mass energy 
220      * @param field  Magnetic field 
221      * 
222      * @return 
223      */
224     const char* GetFullFileName(UShort_t what, UShort_t sys, UShort_t sNN, 
225                                 Short_t  field) const;
226     /** 
227      * Get the full path name 
228      * 
229      * @param what   What to get
230      * @param sys    Collision system
231      * @param sNN    Center of mass energy 
232      * @param field  Magnetic field 
233      * 
234      * @return 
235      */
236     const char* GetFileName(UShort_t what, UShort_t sys, UShort_t sNN,
237                             Short_t field) const;
238
239     /** 
240      * Get the obejct name 
241      * 
242      * @param what which correction
243      * 
244      * @return Name of object
245      */
246     const char* GetObjectName(UShort_t what) const { 
247       return what == 0 ? GetSecMapName() : GetAcceptanceName(); }
248     /** 
249      * Get the directory part of the full file name 
250      * 
251      * @param what What correction 
252      * 
253      * @return directory path
254      */
255     const char* GetFileDir(UShort_t what) const {
256       return what == 0 ? fSecMapPath.Data() : fAcceptancePath.Data(); }
257
258     /** 
259      * Get the acceptance object name 
260      * 
261      * @return 
262      */
263     const char* GetAcceptanceName() const {return fAcceptanceName.Data(); }
264     /** 
265      * Get the secondary object name 
266      * 
267      * @return 
268      */
269     const char* GetSecMapName() const {return fSecMapName.Data(); }
270     
271     /** 
272      * Get the secondary map
273      * 
274      * @param vtxbin 
275      * 
276      * @return 
277      */
278     TH2D* GetSecMapCorrection(UShort_t vtxbin) const;
279     /** 
280      * Get the acceptance correction 
281      * 
282      * @param vtxbin 
283      * 
284      * @return 
285      */
286     TH1D* GetAcceptanceCorrection(UShort_t vtxbin) const;
287     /** 
288      * Get the secondary correction map object 
289      *
290      * @return The secondary correction map 
291      */
292     AliCentralCorrSecondaryMap* GetSecMap() const { return fSecmap; }
293     /** 
294      * Write a correction object to (a temporary) file.  
295      *    
296      * @param what   What kind of correction
297      * @param sys    Collision system
298      * @param cms    Center of mass energy
299      * @param field  Field 
300      * @param o      Object to write
301      * @param full   If true, write to full path
302      * 
303      * @return True on success 
304      */
305     Bool_t WriteFile(UShort_t what, UShort_t sys, UShort_t cms, Short_t field, 
306                      TObject* o, Bool_t full) const;
307     /** 
308      * Print the object 
309      * 
310      * @param option Not used
311      */
312     void Print(Option_t* option="") const;
313   private:
314     
315     TString                     fAcceptancePath; // Path to acceptance 
316     TString                     fSecMapPath;     // Path to secondary map
317     AliCentralCorrAcceptance*   fAcceptance;     // Acceptance 
318     AliCentralCorrSecondaryMap* fSecmap;         // Secindary map
319     TString                     fAcceptanceName; // Acceptance name
320     TString                     fSecMapName;     // Secindary name
321     Bool_t                      fIsInit;         // Are we init
322
323     ClassDef(Manager,1); // Manager of data 
324   };
325   /** 
326    * Get the ESD event and initialise manager on first event if not
327    * done already
328    * 
329    * @return Pointer to valid ESD event object 
330    */
331   virtual AliESDEvent* GetESDEvent();
332   /** 
333    * Mark this event for storage in AOD output
334    * 
335    */
336   virtual void MarkEventForStore() const;
337   /** 
338    * Process the ESD SPD information 
339    * 
340    * @param hist    Histogram to fill
341    * @param spdmult SPD multiplicity object
342    */
343   virtual void ProcessESD(TH2D& hist, const AliMultiplicity* spdmult) const;
344   /** 
345    * Corret the data 
346    * 
347    * @param hist    Histogram to correct
348    * @param vtxbin  Vertex bin 
349    */
350   virtual void CorrectData(TH2D& hist, UShort_t vtxbin) const;
351   /** 
352    * Get a reference to the manager 
353    * 
354    * @return Reference to corrections manager 
355    */
356   Manager& GetManager() { return fManager; }
357   /** 
358    * Get a reference to the manager 
359    * 
360    * @return Reference to corrections manager 
361    */
362   const Manager& GetManager() const { return fManager; }
363   void FindEtaLimits();
364
365 protected: 
366   AliFMDEventInspector   fInspector;        // Inspect events 
367   TH2D*                  fData;             // sum histogram if needed
368   TList*                 fList;             // Output List for diagnostics
369   AliAODCentralMult      fAODCentral;       // Output object
370   Manager                fManager;          // Manager object for corrections
371   Bool_t                 fUseSecondary;     // Whether to secondary map
372   Bool_t                 fUseAcceptance;    // Whether to use acceptance corr.
373   Bool_t                 fFirstEventSeen;   // Have we seen first event     
374   Int_t                  fIvz;              // Event's vertex bin 
375   TH2D*                  fNClusterTracklet; // # of clusters vs tracklets 
376   TH2D*                  fClusterPerTracklet; // Clusters per tracklet. 
377   TH1D*                  fNCluster;         //! Number of clusters 
378   TH1D*                  fNTracklet;        //! number of tracklets 
379   TArrayI                fEtaMin;           // Least eta bin to use
380   TArrayI                fEtaMax;           // Largest eta bin to use
381   ClassDef(AliCentralMultiplicityTask,2)    // Forward multiplicity class
382 };
383
384 #endif
385 // Local Variables:
386 //  mode: C++
387 // End:
388