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