]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AliFMDEventInspector.h
More code clean up.
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliFMDEventInspector.h
1 #ifndef ALIROOT_PWG2_FORWARD_ANALYSIS2_ALIFMDEVENTINSPECTOR_H
2 #define ALIROOT_PWG2_FORWARD_ANALYSIS2_ALIFMDEVENTINSPECTOR_H
3 #include <TNamed.h>
4 class AliESDEvent;
5 class TH2D;
6 class TH1D;
7 class TH1I;
8 class TAxis;
9 class TList;
10
11 /** 
12  * This class inspects the event 
13  *
14  * @par Input:
15  *   - AliESDFMD object possibly corrected for sharing
16  *
17  * @par Output:
18  *   - A histogram of v_z of events with triggers. 
19  *   - A histogram of v_z of events with vertex and triggers 
20  *   - A histogram of trigger counters 
21  * 
22  * Note, that these are added to the master output list 
23  *
24  * @par Corrections used: 
25  *   - None
26  *
27  * @ingroup pwg2_forward_analysis 
28  */
29 class AliFMDEventInspector : public TNamed
30 {
31 public:
32   /** 
33    * Return codes 
34    */
35   enum ECodes {
36     /** all ok */
37     kOk = 0,
38     /** No ESD event */
39     kNoEvent = 0x1, 
40     /** No triggers found */
41     kNoTriggers = 0x2, 
42     /** No SPD data */ 
43     kNoSPD = 0x4, 
44     /** No FMD data */
45     kNoFMD = 0x8, 
46     /** No vertex found */
47     kNoVertex = 0x10, 
48     /** Vertex out of range */
49     kBadVertex = 0x20
50   };
51   /** 
52    * Trigger bins 
53    */
54   enum ETrgBins { 
55     kInel, 
56     kInelGt0, 
57     kNSD, 
58     kEmpty, 
59     kA, 
60     kB, 
61     kC, 
62     kE
63   };
64   /** 
65    * Collision systems
66    */
67   enum ECollisionSystem { 
68     kUnknown,
69     kPP, 
70     kPbPb
71   };
72   /** 
73    * Constructor 
74    */
75   AliFMDEventInspector();
76   /** 
77    * Constructor 
78    * 
79    * @param name Name of object
80    */
81   AliFMDEventInspector(const char* name);
82   /** 
83    * Copy constructor 
84    * 
85    * @param o Object to copy from 
86    */
87   AliFMDEventInspector(const AliFMDEventInspector& o);
88   /** 
89    * Destructor 
90    */
91   virtual ~AliFMDEventInspector();
92   /** 
93    * Assignement operator
94    * 
95    * @param o Object to assign from 
96    * 
97    * @return Reference to this object
98    */
99   AliFMDEventInspector& operator=(const AliFMDEventInspector&);
100
101   /** 
102    * Initialize the object 
103    * 
104    * @param vtxAxis Vertex axis in use 
105    */
106   void Init(const TAxis& vtxAxis);
107   /** 
108    * Process the event 
109    * 
110    * @param event     Input event 
111    * @param first     True on first event
112    * @param triggers  On return, the triggers fired 
113    * @param lowFlux   On return, true if the event is considered a low-flux 
114    *                  event (according to the setting of fLowFluxCut) 
115    * @param ivz       On return, the found vertex bin (1-based).  A zero
116    *                  means outside of the defined vertex range
117    * @param vz        On return, the z position of the interaction
118    * 
119    * @return 0 (or kOk) on success, otherwise a bit mask of error codes 
120    */
121   UInt_t Process(const AliESDEvent* event, 
122                  UInt_t&            triggers,
123                  Bool_t&            lowFlux,
124                  UShort_t&          ivz, 
125                  Double_t&          vz);
126   /** 
127    * Define the output histograms.  These are put in a sub list of the
128    * passed list.   The histograms are merged before the parent task calls 
129    * AliAnalysisTaskSE::Terminate 
130    * 
131    * @param dir Directory to add to 
132    */
133   void DefineOutput(TList* dir);
134   /** 
135    * Set the number of SPD tracklets for which we consider the event a
136    * low-flux event or not .
137    * 
138    * @param c Cut (default 1000)
139    */
140   void SetLowFluxCut(Int_t c) { fLowFluxCut = c; }
141   /** 
142    * Set the maximum error on @f$ v_z@f$
143    * 
144    * @param c Maximum error (in centimeters)
145    */
146   void SetMaxVzErr(Double_t c=0.1) { fMaxVzErr = c; }
147   /** 
148    * Set the debug level.  The higher the value the more output 
149    * 
150    * @param dbg Debug level 
151    */
152   void SetDebug(Int_t dbg=1) { fDebug = dbg; }
153   /** 
154    * Fetch our histograms from the passed list 
155    * 
156    * @param d             Input
157    * @param hEventsTr     On return, pointer to histogram, or null
158    * @param hEventsTrVtx  On return, pointer to histogram, or null
159    * @param hTriggers     On return, pointer to histogram, or null
160    * 
161    * @return true on success, false otherwise 
162    */
163   Bool_t FetchHistograms(TList* d, 
164                          TH1I*& hEventsTr, 
165                          TH1I*& hEventsTrVtx, 
166                          TH1I*& hTriggers) const;
167   /** 
168    * Read the collision system, collision energy, and L3 field setting
169    * from the ESD
170    * 
171    * @param esd ESD to get information from 
172    * 
173    * @return true on success, false 
174    */
175   Bool_t ReadRunDetails(const AliESDEvent* esd);
176   /** 
177    * Get the collision system (one of the value in ECollisionSystem)
178    * 
179    * @return Collision system 
180    */
181   UShort_t GetCollisionSystem() const { return fCollisionSystem; }
182   /** 
183    * Get the center of mass energy (per nucleon pair) in GeV 
184    * 
185    * @return center of mass energy (per nucleon pair) in GeV 
186    */
187   UShort_t GetEnergy() const { return fEnergy; }
188   /** 
189    * Get the magnetic field setting of the L3 magnet in kilo Gauss. 
190    * 
191    * @return The magnetic field setting 
192    */
193   Short_t  GetField() const { return fField; }
194   /** 
195    * Print information
196    * 
197    * @param option Not used 
198    */
199   void Print(Option_t* option="") const;
200 protected:
201   /** 
202    * Read the trigger information from the ESD event 
203    * 
204    * @param esd        ESD event 
205    * @param triggers   On return, contains the trigger bits 
206    * 
207    * @return @c true on success, @c false otherwise 
208    */
209   Bool_t ReadTriggers(const AliESDEvent* esd, UInt_t& triggers);
210   /** 
211    * Read the vertex information from the ESD event 
212    * 
213    * @param esd  ESD event 
214    * @param vz   On return, the vertex Z position 
215    * 
216    * @return @c true on success, @c false otherwise 
217    */
218   Bool_t ReadVertex(const AliESDEvent* esd, Double_t& vz);
219
220   TH1I*    fHEventsTr;    //! Histogram of events w/trigger
221   TH1I*    fHEventsTrVtx; //! Events w/trigger and vertex 
222   TH1I*    fHTriggers;    //! Triggers
223   TH1I*    fHType;        //! Type (low/high flux) of event
224   Int_t    fLowFluxCut;   //  Low flux cut
225   Double_t fMaxVzErr;     //  Maximum error on v_z
226   TList*   fList;         //! Histogram container 
227   UShort_t fEnergy;       // CMS energy (per nucleon pair) [GeV]
228   Short_t  fField;        // L3 magnetic field [kG]
229   UShort_t fCollisionSystem; //  
230   Int_t    fDebug;        //  Debug level 
231   ClassDef(AliFMDEventInspector,1); // Inspect the event 
232 };
233
234 #endif
235 // Local Variables:
236 //   mode: C++
237 // End:
238
239
240