]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliCentralMultiplicityTask.h
Major refactoring of the code.
[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 "AliBaseESDTask.h"
18 #include "AliFMDEventInspector.h"
19 #include "AliAODCentralMult.h"
20 class AliCentralCorrectionManager;
21 class AliESDEvent;
22 class AliMultiplicity;
23 class TH2D;
24 class TList;
25 class TTree;
26 class TObjArray;
27
28 /** 
29  * Class that calculates the multiplicity in the
30  * central region event-by-event
31  * 
32  * @par Inputs: 
33  *   - AliESDEvent 
34  *
35  * @par Outputs: 
36  *   - AliAODCentralMult 
37  * 
38  * @par Histograms 
39  *   
40  * @par Corrections used 
41  * 
42  * @ingroup pwglf_forward_tasks
43  * @ingroup pwglf_forward_aod
44  * 
45  */
46 class AliCentralMultiplicityTask : public AliBaseESDTask
47 {
48 public:
49   /** 
50    * @{ 
51    * @name Interface methods 
52    */
53    /** 
54    * Constructor 
55    * 
56    * @param name Name of task 
57    */
58   AliCentralMultiplicityTask(const char* name); 
59   /** 
60    * Constructor 
61    *
62    * Reserved for ROOT's I/O system - do not use
63    */
64   AliCentralMultiplicityTask();
65   /** 
66    * Create output objects 
67    * 
68    * @return true on success
69    */
70   virtual Bool_t Book();
71   /** 
72    * Creat output objects in tree 
73    * 
74    * @param ah Handler 
75    */
76   virtual void CreateBranches(AliAODHandler* ah);
77   /** 
78    * Called just before first event
79    * 
80    * @param v Vertex axis 
81    * @param e @f$\eta@f$ axis
82    * 
83    * @return true on success
84    */
85   virtual Bool_t PreData(const TAxis& v, const TAxis& e);
86   /** 
87    * Called before event
88    * 
89    * @return true on success
90    */
91   virtual Bool_t PreEvent();
92   /** 
93    * Process each event 
94    *
95    * @param esd ESD event
96    * 
97    * @return true on success   
98    */  
99   virtual Bool_t Event(AliESDEvent& esd);
100   /** 
101    * End of job
102    * 
103    * @return true on success   
104    */
105   virtual Bool_t Finalize();
106   /** 
107    * Print information 
108    * 
109    * @param option Not used
110    */
111   virtual void Print(Option_t* option="") const;
112   /** 
113    * Set whether to use the secondary corrections 
114    * 
115    * @param use Whether to use secondary corrections 
116    */
117   virtual void SetUseSecondary(Bool_t use) { fUseSecondary = use; }
118   /** 
119    * Set whether to use the acceptance corrections 
120    * 
121    * @param use Whether to use acceptance corrections 
122    */
123   virtual void SetUseAcceptance(Bool_t use) { fUseAcceptance = use; }
124   /** 
125    * Set whether to make diagnostics or not
126    * 
127    * @param use If true, store some extra diagnostic histograms
128    */
129   virtual void SetMakeDiagnostics(Bool_t use=true) { fStore = use; }
130   /** 
131    * Get the event inspector
132    * 
133    * @return Reference to used event inspector
134    */
135   AliFMDEventInspector& GetEventInspector() { return fInspector; }
136   /** 
137    * Get the event inspector
138    * 
139    * @return Reference to used event inspector
140    */
141   const AliFMDEventInspector& GetEventInspector() const { return fInspector; }
142
143 protected:
144   /** 
145    * Copy constructor 
146    * 
147    * @param o Object to copy from 
148    */
149   AliCentralMultiplicityTask(const AliCentralMultiplicityTask& o);
150   /** 
151    * Assignment operator 
152    * 
153    * @param o Object to assign from 
154    * 
155    * @return Reference to this object 
156    */
157   AliCentralMultiplicityTask& operator=(const AliCentralMultiplicityTask& o);
158   /** 
159    * Process the ESD SPD information 
160    * 
161    * @param hist    Histogram to fill
162    * @param spdmult SPD multiplicity object
163    */
164   virtual void ProcessESD(TH2D& hist, 
165                           const AliMultiplicity* spdmult) const;
166   /**
167    * A vertex bin. 
168    *
169    * Used to store and apply corrections and fiducial cuts
170    */
171   struct VtxBin : public TObject
172   {
173     /** 
174      * Constructor 
175      * 
176      * @param iVz    Bin number
177      * @param minIpZ Least @f$IP_{z}@f$
178      * @param maxIpZ Largest  @f$IP_{z}@f$
179      */
180     VtxBin(Int_t iVz=0, Double_t minIpZ=0, Double_t maxIpZ=0);
181     /** 
182      * Copy constructor
183      * 
184      * @param o Object to copy from 
185      */
186     VtxBin(const VtxBin& o);
187     /** 
188      * Assignment operator
189      * 
190      * @param o Object to assign from 
191      * 
192      * @return Reference to this object
193      */  
194     VtxBin& operator=(const VtxBin& o);
195     /** 
196      * Get the name 
197      * 
198      * @return The name 
199      */
200     const char* GetName() const;
201     /** 
202      * Prepare for data 
203      * 
204      * @param l         List
205      * @param coverage  Template 
206      * @param store     Whether to store results
207      */
208     void SetupForData(TList* l, TH2* coverage, Bool_t store=true);
209     /** 
210      * Correct the input data
211      * 
212      * @param aodHist       Histogram
213      * @param useSecondary  Whether to use secondary correction or not 
214      * @param useAcceptance Whether to use acceptance correction or not 
215      * @param sum           Whether to sum or not 
216      */
217     void Correct(TH2D&  aodHist,
218                  Bool_t useSecondary,
219                  Bool_t useAcceptance,
220                  Bool_t sum=true) const;
221     /** 
222      * Print information
223      * 
224      * @param option Not used 
225      */
226     void Print(Option_t* option="") const;
227
228     Int_t        fId;     // Vertex bin number 
229     Double_t     fMinIpZ; // Least value of ipZ 
230     Double_t     fMaxIpZ; // Largest value of ipZ 
231     Int_t        fEtaMin; // Smallest eta bin to use 
232     Int_t        fEtaMax; // Largest eta bin to use 
233     TH2*         fSec;    // Our secondary correction
234     TH1*         fAcc;    // Our acceptance correction 
235     mutable TH2* fHits;   // Diagnostics sum 
236
237     ClassDef(VtxBin,1);
238   };
239     
240 protected: 
241   /** 
242    * Make a simple @f$\frac{dN_{ch}}{d\eta}@f$ estimate. 
243    * 
244    * @param input   Sum list
245    * @param output  Output list 
246    * @param nTr     On return, the number of events w/triggers
247    * @param nTrVtx  On return, the number of events w/triggers+vertex
248    * @param nAcc    On return, the number of accepted events 
249    * 
250    * @return true on success, false otherwise 
251    */
252   Bool_t MakeSimpledNdeta(const TList* input, 
253                           TList*       output,
254                           Double_t&    nTr, 
255                           Double_t&    nTrVtx, 
256                           Double_t&    nAcc);
257   TAxis* DefaultEtaAxis() const { return new TAxis(200,-4,6); }
258   TAxis* DefaultVertexAxis() const { return new TAxis(10,-10,10); }
259   AliFMDEventInspector   fInspector;        // Inspect events 
260   AliAODCentralMult      fAODCentral;       // Output object
261   Bool_t                 fUseSecondary;     // Whether to secondary map
262   Bool_t                 fUseAcceptance;    // Whether to use acceptance corr.
263   Int_t                  fIvz;              // Event's vertex bin 
264   TH2D*                  fNClusterTracklet; // # of clusters vs tracklets 
265   TH2D*                  fClusterPerTracklet; // Clusters per tracklet. 
266   TH1D*                  fNCluster;         //! Number of clusters 
267   TH1D*                  fNTracklet;        //! number of tracklets 
268   TObjArray*             fVtxList;          //! Array of vertex bins
269   Bool_t                 fStore;            // Store diagnostics
270   TH2D*                  fHData;            // Sum of signals 
271 private:
272   ClassDef(AliCentralMultiplicityTask,5)    // Forward multiplicity class
273 };
274
275 #endif
276 // Local Variables:
277 //  mode: C++
278 // End:
279