]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDEventInspector.h
Fixed references from PWG2 -> PWGLF - very efficiently done using ETags.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDEventInspector.h
1 // 
2 // This class inspects the event 
3 //
4 #ifndef ALIFMDEVENTINSPECTOR_H
5 #define ALIFMDEVENTINSPECTOR_H
6 /**
7  * @file   AliFMDEventInspector.h
8  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
9  * @date   Wed Mar 23 14:02:48 2011
10  * 
11  * @brief  
12  * 
13  * 
14  * @ingroup pwglf_forward_aod
15  */
16 #include <TNamed.h>
17 #include <TAxis.h>
18 class AliESDEvent;
19 class TH2D;
20 class TH1D;
21 class TH1I;
22 class TH1F;
23 class TH2F;
24 class TAxis;
25 class TList;
26
27 /** 
28  * This class inspects the event 
29  *
30  * @par Input:
31  *   - AliESDFMD object possibly corrected for sharing
32  *
33  * @par Output:
34  *   - A histogram of v_z of events with triggers. 
35  *   - A histogram of v_z of events with vertex and triggers 
36  *   - A histogram of trigger counters 
37  * 
38  * Note, that these are added to the master output list 
39  *
40  * @par Corrections used: 
41  *   - None
42  *
43  * @ingroup pwglf_forward_algo 
44  * @ingroup pwglf_forward_aod
45  */
46 class AliFMDEventInspector : public TNamed
47 {
48 public:
49   /** 
50    * Return codes 
51    */
52   enum ECodes {
53     /** all ok */
54     kOk = 0,
55     /** No ESD event */
56     kNoEvent = 0x1, 
57     /** No triggers found */
58     kNoTriggers = 0x2, 
59     /** No SPD data */ 
60     kNoSPD = 0x4, 
61     /** No FMD data */
62     kNoFMD = 0x8, 
63     /** No vertex found */
64     kNoVertex = 0x10, 
65     /** Vertex out of range */
66     kBadVertex = 0x20
67   };
68   /** 
69    * Trigger bins 
70    */
71   enum ETrgBins { 
72     kInel, 
73     kInelGt0, 
74     kNSD,
75     kV0AND, 
76     kEmpty, 
77     kA, 
78     kB, 
79     kC, 
80     kE,
81     kPileUp,
82     kMCNSD,
83     kOffline
84   };
85   /** 
86    * Collision systems
87    */
88   enum ECollisionSystem { 
89     kUnknown,
90     kPP, 
91     kPbPb
92   };
93   /** 
94    * Constructor 
95    */
96   AliFMDEventInspector();
97   /** 
98    * Constructor 
99    * 
100    * @param name Name of object
101    */
102   AliFMDEventInspector(const char* name);
103   /** 
104    * Copy constructor 
105    * 
106    * @param o Object to copy from 
107    */
108   AliFMDEventInspector(const AliFMDEventInspector& o);
109   /** 
110    * Destructor 
111    */
112   virtual ~AliFMDEventInspector();
113   /** 
114    * Assignement operator
115    * 
116    * @param o Object to assign from 
117    * 
118    * @return Reference to this object
119    */
120   AliFMDEventInspector& operator=(const AliFMDEventInspector&);
121
122   /** 
123    * Initialize the object 
124    * 
125    * @param vtxAxis Vertex axis in use 
126    */
127   virtual void Init(const TAxis& vtxAxis);
128   /** 
129    * Process the event 
130    * 
131    * @param event     Input event 
132    * @param triggers  On return, the triggers fired 
133    * @param lowFlux   On return, true if the event is considered a low-flux 
134    *                  event (according to the setting of fLowFluxCut) 
135    * @param ivz       On return, the found vertex bin (1-based).  A zero
136    *                  means outside of the defined vertex range
137    * @param vz        On return, the z position of the interaction
138    * @param cent      On return, the centrality (in percent) or < 0 
139    *                  if not found
140    * @param nClusters On return, number of SPD clusters in @f$ |\eta|<1@f$ 
141    * 
142    * @return 0 (or kOk) on success, otherwise a bit mask of error codes 
143    */
144   UInt_t Process(const AliESDEvent* event, 
145                  UInt_t&            triggers,
146                  Bool_t&            lowFlux,
147                  UShort_t&          ivz, 
148                  Double_t&          vz,
149                  Double_t&          cent,
150                  UShort_t&          nClusters);
151   /** 
152    * Define the output histograms.  These are put in a sub list of the
153    * passed list.   The histograms are merged before the parent task calls 
154    * AliAnalysisTaskSE::Terminate 
155    * 
156    * @param dir Directory to add to 
157    */
158   void DefineOutput(TList* dir);
159   /** 
160    * Set the number of SPD tracklets for which we consider the event a
161    * low-flux event or not .
162    * 
163    * @param c Cut (default 1000)
164    */
165   void SetLowFluxCut(Int_t c) { fLowFluxCut = c; }
166   /** 
167    * Set the maximum error on @f$ v_z@f$
168    * 
169    * @param c Maximum error (in centimeters)
170    */
171   void SetMaxVzErr(Double_t c=0.1) { fMaxVzErr = c; }
172   /** 
173    * Use the first physics vtx code.   
174    * 
175    * @param use Use it or not 
176    */
177   void SetUseFirstPhysicsVtx(Bool_t use) {fUseFirstPhysicsVertex = use; }
178  /** 
179    * Use the first physics vtx code.   
180    * 
181    * @param use Use it or not 
182    */
183   void SetUseV0AndForNSD(Bool_t use=true) {fUseV0AND = use; }
184   /** 
185    * Set the minimum number of contributors for a 2nd pile-up vertex 
186    * 
187    * @param nContrib Least number of contributors 
188    */
189   void SetMinPileupContributors(UShort_t nContrib=3) 
190   { 
191     fMinPileupContrib = nContrib;
192   }
193   /** 
194    * Set minimum distance from primary vertex to 2nd pile-up vertex 
195    * 
196    * @param cm Distance (in centimeters)
197    */
198   void SetMinPileupDistance(Double_t cm=0.8)
199   {
200     fMinPileupDistance = cm;
201   }
202   /** 
203    * Set the debug level.  The higher the value the more output 
204    * 
205    * @param dbg Debug level 
206    */
207   void SetDebug(Int_t dbg=1) { fDebug = dbg; }
208   /** 
209    * Fetch our histograms from the passed list 
210    * 
211    * @param d             Input
212    * @param hEventsTr     On return, pointer to histogram, or null
213    * @param hEventsTrVtx  On return, pointer to histogram, or null
214    * @param hTriggers     On return, pointer to histogram, or null
215    * 
216    * @return true on success, false otherwise 
217    */
218   Bool_t FetchHistograms(const TList* d, 
219                          TH1I*& hEventsTr, 
220                          TH1I*& hEventsTrVtx, 
221                          TH1I*& hTriggers) const;
222   /** 
223    * Read the collision system, collision energy, and L3 field setting
224    * from the ESD
225    * 
226    * @param esd ESD to get information from 
227    * 
228    * @return true on success, false 
229    */
230   Bool_t ReadRunDetails(const AliESDEvent* esd);
231   /** 
232    * Get the collision system (one of the value in ECollisionSystem)
233    * 
234    * @return Collision system 
235    */
236   UShort_t GetCollisionSystem() const { return fCollisionSystem; }
237   /** 
238    * Get the center of mass energy (per nucleon pair) in GeV 
239    * 
240    * @return center of mass energy (per nucleon pair) in GeV 
241    */
242   UShort_t GetEnergy() const { return fEnergy; }
243   /** 
244    * Get the magnetic field setting of the L3 magnet in kilo Gauss. 
245    * 
246    * @return The magnetic field setting 
247    */
248   Short_t  GetField() const { return fField; }
249   /** 
250    * Print information
251    * 
252    * @param option Not used 
253    */
254   void Print(Option_t* option="") const;
255   /** 
256    * Store information about running conditions in output list 
257    * 
258    * 3 TNamed objects are defined.   The names are fixed, but the
259    * title is a string representation of the information, and the
260    * unique ID contains the identifier 
261    *
262    * - sys   Contains the collision system string and identifier. 
263    * - sNN   Contains the center-of-mass energy per nucleon (GeV)
264    * - field Contains the L3 magnetic field (kG)
265    * - run   Contains the run number
266    * 
267    * @param runNo Run number - read off from ESD event
268    */
269   virtual void StoreInformation(Int_t runNo);
270 protected:
271   /** 
272    * Read the trigger information from the ESD event 
273    * 
274    * @param esd        ESD event 
275    * @param triggers   On return, contains the trigger bits 
276    * @param nClusters  On return, number of SPD clusters in @f$ |\eta|<1@f$ 
277    * 
278    * @return @c true on success, @c false otherwise 
279    */
280   Bool_t ReadTriggers(const AliESDEvent* esd, UInt_t& triggers, 
281                       UShort_t& nClusters);
282   /** 
283    * Read the vertex information from the ESD event 
284    * 
285    * @param esd  ESD event 
286    * @param vz   On return, the vertex Z position 
287    * 
288    * @return @c true on success, @c false otherwise 
289    */
290   Bool_t ReadVertex(const AliESDEvent* esd, Double_t& vz, Double_t& vx, Double_t& vy);
291   /** 
292    * Read centrality from event 
293    * 
294    * @param esd  Event 
295    * @param cent On return, the centrality or negative if not found
296    * @param qual On return, centrality quality flag
297    * 
298    * @return False on error, true otherwise 
299    */
300   virtual Bool_t ReadCentrality(const AliESDEvent* esd, Double_t& cent,
301                                 UShort_t& qual) const;
302
303   TH1I*    fHEventsTr;    //! Histogram of events w/trigger
304   TH1I*    fHEventsTrVtx; //! Events w/trigger and vertex 
305   TH1I*    fHEventsAccepted; //! Events w/trigger and vertex in range 
306   TH2D*    fHEventsAcceptedXY; //! XY vtx with trigger and Z vertex in range 
307   TH1I*    fHTriggers;    //! Triggers
308   TH1I*    fHType;        //! Type (low/high flux) of event
309   TH1I*    fHWords;       //! Trigger words 
310   TH1F*    fHCent;        //! Centrality 
311   TH2F*    fHCentVsQual;  //! Centrality vs quality 
312   Int_t    fLowFluxCut;   //  Low flux cut
313   Double_t fMaxVzErr;     //  Maximum error on v_z
314   TList*   fList;         //! Histogram container 
315   UShort_t fEnergy;       // CMS energy (per nucleon pair) [GeV]
316   Short_t  fField;        // L3 magnetic field [kG]
317   UShort_t fCollisionSystem; //  Collision system
318   Int_t    fDebug;        //  Debug level 
319   TAxis*   fCentAxis;     // Centrality axis used in histograms
320   TAxis    fVtxAxis;      //Vtx Axis 
321   Bool_t   fUseFirstPhysicsVertex; //Use the vtx code from p+p first physics
322   Bool_t   fUseV0AND;     //Use the vtx code from p+p first physics
323   UShort_t fMinPileupContrib; // Minimum number of contributors to 2nd
324                               // pile-up vertex
325   Double_t fMinPileupDistance; // Minimum distance of 2nd pile-up
326                                // vertex 
327   ClassDef(AliFMDEventInspector,4); // Inspect the event 
328 };
329
330 #endif
331 // Local Variables:
332 //   mode: C++
333 // End:
334
335
336