]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AliFMDEventInspector.h
Multiple fixes:
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDEventInspector.h
CommitLineData
7984e5f7 1//
2// This class inspects the event
3//
4#ifndef ALIFMDEVENTINSPECTOR_H
5#define ALIFMDEVENTINSPECTOR_H
ffca499d 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 *
bd6f5206 14 * @ingroup pwglf_forward_aod
ffca499d 15 */
8565b10b 16#include <TNamed.h>
5bb5d1f6 17#include <TAxis.h>
241cca4d 18#include <TList.h>
65abd48b 19#include "AliDisplacedVertexSelection.h"
8565b10b 20class AliESDEvent;
241cca4d 21class AliOADBPhysicsSelection;
8565b10b 22class TH2D;
23class TH1D;
24class TH1I;
5e4d905e 25class TH1F;
e308a636 26class TH2F;
8565b10b 27class TAxis;
241cca4d 28// class TList;
8565b10b 29
30/**
31 * This class inspects the event
32 *
33 * @par Input:
34 * - AliESDFMD object possibly corrected for sharing
35 *
36 * @par Output:
37 * - A histogram of v_z of events with triggers.
38 * - A histogram of v_z of events with vertex and triggers
39 * - A histogram of trigger counters
40 *
41 * Note, that these are added to the master output list
42 *
43 * @par Corrections used:
44 * - None
45 *
bd6f5206 46 * @ingroup pwglf_forward_algo
47 * @ingroup pwglf_forward_aod
8565b10b 48 */
49class AliFMDEventInspector : public TNamed
50{
51public:
52 /**
53 * Return codes
54 */
55 enum ECodes {
241cca4d 56 /** all ok - bin 1 */
8565b10b 57 kOk = 0,
241cca4d 58 /** No ESD event - bin 2 */
8565b10b 59 kNoEvent = 0x1,
241cca4d 60 /** No triggers found - bin 3 */
8565b10b 61 kNoTriggers = 0x2,
241cca4d 62 /** No SPD data - bin 4 */
8565b10b 63 kNoSPD = 0x4,
241cca4d 64 /** No FMD data - bin 5 */
8565b10b 65 kNoFMD = 0x8,
241cca4d 66 /** No vertex found - bin 6 */
8565b10b 67 kNoVertex = 0x10,
241cca4d 68 /** Vertex out of range - bin 7 */
0be6c8cd 69 kBadVertex = 0x20
8565b10b 70 };
71 /**
72 * Trigger bins
73 */
74 enum ETrgBins {
75 kInel,
76 kInelGt0,
e6463868 77 kNSD,
78 kV0AND,
8565b10b 79 kEmpty,
80 kA,
81 kB,
82 kC,
0be6c8cd 83 kE,
84 kPileUp,
85 kMCNSD,
86 kOffline
8565b10b 87 };
0bd4b00f 88 /**
89 * Collision systems
90 */
91 enum ECollisionSystem {
92 kUnknown,
93 kPP,
94 kPbPb
95 };
8565b10b 96 /**
97 * Constructor
98 */
99 AliFMDEventInspector();
100 /**
101 * Constructor
102 *
103 * @param name Name of object
104 */
105 AliFMDEventInspector(const char* name);
106 /**
107 * Copy constructor
108 *
109 * @param o Object to copy from
110 */
111 AliFMDEventInspector(const AliFMDEventInspector& o);
112 /**
113 * Destructor
114 */
115 virtual ~AliFMDEventInspector();
116 /**
117 * Assignement operator
118 *
119 * @param o Object to assign from
120 *
121 * @return Reference to this object
122 */
123 AliFMDEventInspector& operator=(const AliFMDEventInspector&);
124
125 /**
126 * Initialize the object
127 *
128 * @param vtxAxis Vertex axis in use
129 */
e1f47419 130 virtual void Init(const TAxis& vtxAxis);
8565b10b 131 /**
132 * Process the event
133 *
134 * @param event Input event
135 * @param triggers On return, the triggers fired
136 * @param lowFlux On return, true if the event is considered a low-flux
137 * event (according to the setting of fLowFluxCut)
0bd4b00f 138 * @param ivz On return, the found vertex bin (1-based). A zero
139 * means outside of the defined vertex range
c389303e 140 * @param vz On return, the z position of the interaction
5e4d905e 141 * @param cent On return, the centrality (in percent) or < 0
142 * if not found
5bb5d1f6 143 * @param nClusters On return, number of SPD clusters in @f$ |\eta|<1@f$
8565b10b 144 *
145 * @return 0 (or kOk) on success, otherwise a bit mask of error codes
146 */
147 UInt_t Process(const AliESDEvent* event,
148 UInt_t& triggers,
149 Bool_t& lowFlux,
0bd4b00f 150 UShort_t& ivz,
5e4d905e 151 Double_t& vz,
5bb5d1f6 152 Double_t& cent,
153 UShort_t& nClusters);
8565b10b 154 /**
155 * Define the output histograms. These are put in a sub list of the
156 * passed list. The histograms are merged before the parent task calls
157 * AliAnalysisTaskSE::Terminate
158 *
159 * @param dir Directory to add to
160 */
161 void DefineOutput(TList* dir);
162 /**
163 * Set the number of SPD tracklets for which we consider the event a
164 * low-flux event or not .
165 *
166 * @param c Cut (default 1000)
167 */
168 void SetLowFluxCut(Int_t c) { fLowFluxCut = c; }
169 /**
170 * Set the maximum error on @f$ v_z@f$
171 *
172 * @param c Maximum error (in centimeters)
173 */
174 void SetMaxVzErr(Double_t c=0.1) { fMaxVzErr = c; }
e83d0620 175 /**
176 * Use the first physics vtx code.
177 *
178 * @param use Use it or not
179 */
180 void SetUseFirstPhysicsVtx(Bool_t use) {fUseFirstPhysicsVertex = use; }
31554871 181 /**
182 * Use the first physics vtx code.
183 *
184 * @param use Use it or not
185 */
e6463868 186 void SetUseV0AndForNSD(Bool_t use=true) {fUseV0AND = use; }
187 /**
188 * Set the minimum number of contributors for a 2nd pile-up vertex
189 *
190 * @param nContrib Least number of contributors
191 */
192 void SetMinPileupContributors(UShort_t nContrib=3)
193 {
194 fMinPileupContrib = nContrib;
195 }
196 /**
197 * Set minimum distance from primary vertex to 2nd pile-up vertex
198 *
199 * @param cm Distance (in centimeters)
200 */
201 void SetMinPileupDistance(Double_t cm=0.8)
202 {
203 fMinPileupDistance = cm;
204 }
65abd48b 205 /**
206 * Enable selection of displaced vertices.
207 *
208 * @param use whether to use
209 */
210 void SetUseDisplacedVertices(Bool_t use=true)
211 {
212 fUseDisplacedVertices = use;
213 }
214
8565b10b 215 /**
216 * Set the debug level. The higher the value the more output
217 *
218 * @param dbg Debug level
219 */
220 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
221 /**
222 * Fetch our histograms from the passed list
223 *
224 * @param d Input
225 * @param hEventsTr On return, pointer to histogram, or null
226 * @param hEventsTrVtx On return, pointer to histogram, or null
227 * @param hTriggers On return, pointer to histogram, or null
228 *
229 * @return true on success, false otherwise
230 */
fb3430ac 231 Bool_t FetchHistograms(const TList* d,
8565b10b 232 TH1I*& hEventsTr,
233 TH1I*& hEventsTrVtx,
234 TH1I*& hTriggers) const;
0bd4b00f 235 /**
236 * Read the collision system, collision energy, and L3 field setting
237 * from the ESD
238 *
239 * @param esd ESD to get information from
240 *
241 * @return true on success, false
242 */
243 Bool_t ReadRunDetails(const AliESDEvent* esd);
244 /**
245 * Get the collision system (one of the value in ECollisionSystem)
246 *
247 * @return Collision system
248 */
249 UShort_t GetCollisionSystem() const { return fCollisionSystem; }
250 /**
251 * Get the center of mass energy (per nucleon pair) in GeV
252 *
253 * @return center of mass energy (per nucleon pair) in GeV
254 */
255 UShort_t GetEnergy() const { return fEnergy; }
256 /**
257 * Get the magnetic field setting of the L3 magnet in kilo Gauss.
258 *
259 * @return The magnetic field setting
260 */
261 Short_t GetField() const { return fField; }
262 /**
263 * Print information
264 *
265 * @param option Not used
266 */
267 void Print(Option_t* option="") const;
f7cfc454 268 /**
269 * Store information about running conditions in output list
270 *
271 * 3 TNamed objects are defined. The names are fixed, but the
272 * title is a string representation of the information, and the
273 * unique ID contains the identifier
274 *
275 * - sys Contains the collision system string and identifier.
276 * - sNN Contains the center-of-mass energy per nucleon (GeV)
277 * - field Contains the L3 magnetic field (kG)
9b2f2e39 278 * - run Contains the run number
f7cfc454 279 *
9b2f2e39 280 * @param runNo Run number - read off from ESD event
f7cfc454 281 */
9b2f2e39 282 virtual void StoreInformation(Int_t runNo);
241cca4d 283 /**
284 * Return a string representing the return code
285 *
286 * @param mask Code
287 *
288 * @return String representation
289 */
290 static const char* CodeString(UInt_t mask);
8565b10b 291protected:
241cca4d 292 /**
293 * Cache the configure trigger classes from the physis selection.
294 *
295 * @param cache where to cache the trigger class.
296 * @param classes List of configured classes.
297 * @param o Object from OADB with config
298 */
299 void CacheConfiguredTriggerClasses(TList& cache,
300 const TList* classes,
301 AliOADBPhysicsSelection* o);
8565b10b 302 /**
303 * Read the trigger information from the ESD event
304 *
305 * @param esd ESD event
306 * @param triggers On return, contains the trigger bits
5bb5d1f6 307 * @param nClusters On return, number of SPD clusters in @f$ |\eta|<1@f$
8565b10b 308 *
309 * @return @c true on success, @c false otherwise
310 */
241cca4d 311 Bool_t ReadTriggers(const AliESDEvent& esd, UInt_t& triggers,
5bb5d1f6 312 UShort_t& nClusters);
241cca4d 313 /**
314 * Check, for the @f$\sqrt{s}=2.76GeV@f$ pp run wether this event
315 * was in the fast partition, and if so, filter it out.
316 *
317 * @param fastonly Event was in fast-only partition
318 *
319 * @return true if event was in the fast-only partition, for the run
320 * period.
321 */
322 virtual Bool_t CheckFastPartition(bool fastonly) const;
323 /**
324 * Check if we have an NSD trigger for pp runs
325 *
326 * @param esd Data
327 * @param triggers Trigger mask to be filled
328 *
329 * @return true if we have an NSD trigger
330 */
331 virtual Bool_t CheckNSD(const AliESDEvent& esd, UInt_t& triggers) const;
332 /**
333 * Check if we have an INEL&gt;0 trigger
334 *
335 * @param esd Data
336 * @param nClusters On return, number of clusters
337 * @param triggers Trigger mask to be filled
338 *
339 * @return true if we have an INEL&gt;0 trigger
340 */
341 virtual Bool_t CheckINELGT0(const AliESDEvent& esd, UShort_t& nClusters,
342 UInt_t& triggers) const;
343 /**
344 * Check if this is a pile-up event
345 *
346 * @param esd Data
347 * @param triggers Trigger mask to be filled
348 *
349 * @return true if this is a pile-up event
350 */
351 virtual Bool_t CheckPileup(const AliESDEvent& esd, UInt_t& triggers) const;
352 /**
353 * Check if we have a cosmic trigger. These should be filtered out.
354 *
355 * @param trigStri Trigger string
356 *
357 * @return true if we have a cosmic trigger
358 */
359 virtual Bool_t CheckCosmics(const TString& trigStri) const;
360 /**
361 * Check if the trigger string corresponds to an empty event
362 *
363 * @param trigStr Trigger string
364 * @param triggers Trigger mask to be filled
365 *
366 * @return true if the trigger string corresponds to an empty event
367 */
368 virtual Bool_t CheckEmpty(const TString& trigStr, UInt_t& triggers) const;
369 /**
370 * Check the trigger words to see if we have a B, A, C, or E event.
371 *
372 * @param esd Data
373 * @param triggers Trigger mask to be filled
374 *
375 * @return always true
376 */
377 virtual Bool_t CheckWords(const AliESDEvent& esd, UInt_t& triggers) const;
8565b10b 378 /**
379 * Read the vertex information from the ESD event
380 *
381 * @param esd ESD event
382 * @param vz On return, the vertex Z position
290052e7 383 * @param vx On return, the vertex X position
384 * @param vy On return, the vertex Y position
8565b10b 385 *
386 * @return @c true on success, @c false otherwise
387 */
241cca4d 388 Bool_t ReadVertex(const AliESDEvent& esd,
290052e7 389 Double_t& vz,
390 Double_t& vx,
391 Double_t& vy);
241cca4d 392 /**
393 * Check the vertex using the method used in PWG-UD. That is
394 *
395 * - Check we have a vertex and status is OK
396 * - Check if we have an SPD vertex and that it's status is OK
397 * - Check if the vertex is from the Z-vertexer, and if it is,
398 * - Check that the dispersion and resolution is OK
399 *
400 * @param esd Data
401 * @param vz On return, the Z coordinate of the IP
402 * @param vx On return, possibly the X coordinate of the IP
403 * @param vy On return, possibly the Y coordinate of the IP
404 *
405 * @return true if the vertex was found and met the requirements
406 */
407 virtual Bool_t CheckPWGUDVertex(const AliESDEvent& esd,
408 Double_t& vz,
409 Double_t& vx,
410 Double_t& vy) const;
411 /**
412 * Check the vertex. That is
413 *
414 * - Check if we have an SPD vertex and that it's status is OK
415 * - Check that we have enough contributors
416 * - Check that the reslution is OK
417 *
418 * @param esd Data
419 * @param vz On return, the Z coordinate of the IP
420 * @param vx On return, possibly the X coordinate of the IP
421 * @param vy On return, possibly the Y coordinate of the IP
422 *
423 * @return true if the vertex was found and met the requirements
424 */
425 virtual Bool_t CheckVertex(const AliESDEvent& esd,
426 Double_t& vz,
427 Double_t& vx,
428 Double_t& vy) const;
e1f47419 429 /**
430 * Read centrality from event
431 *
432 * @param esd Event
433 * @param cent On return, the centrality or negative if not found
ffca499d 434 * @param qual On return, centrality quality flag
e1f47419 435 *
436 * @return False on error, true otherwise
437 */
241cca4d 438 Bool_t ReadCentrality(const AliESDEvent& esd, Double_t& cent,
439 UShort_t& qual) const;
8565b10b 440
441 TH1I* fHEventsTr; //! Histogram of events w/trigger
442 TH1I* fHEventsTrVtx; //! Events w/trigger and vertex
5bb5d1f6 443 TH1I* fHEventsAccepted; //! Events w/trigger and vertex in range
96110c91 444 TH2D* fHEventsAcceptedXY; //! XY vtx with trigger and Z vertex in range
8565b10b 445 TH1I* fHTriggers; //! Triggers
0bd4b00f 446 TH1I* fHType; //! Type (low/high flux) of event
fe52e455 447 TH1I* fHWords; //! Trigger words
5e4d905e 448 TH1F* fHCent; //! Centrality
e308a636 449 TH2F* fHCentVsQual; //! Centrality vs quality
241cca4d 450 TH1I* fHStatus; //! Event processing status
8565b10b 451 Int_t fLowFluxCut; // Low flux cut
452 Double_t fMaxVzErr; // Maximum error on v_z
453 TList* fList; //! Histogram container
0bd4b00f 454 UShort_t fEnergy; // CMS energy (per nucleon pair) [GeV]
455 Short_t fField; // L3 magnetic field [kG]
fb3430ac 456 UShort_t fCollisionSystem; // Collision system
8565b10b 457 Int_t fDebug; // Debug level
e308a636 458 TAxis* fCentAxis; // Centrality axis used in histograms
31554871 459 TAxis fVtxAxis; //Vtx Axis
e83d0620 460 Bool_t fUseFirstPhysicsVertex; //Use the vtx code from p+p first physics
31554871 461 Bool_t fUseV0AND; //Use the vtx code from p+p first physics
e6463868 462 UShort_t fMinPileupContrib; // Minimum number of contributors to 2nd
463 // pile-up vertex
464 Double_t fMinPileupDistance; // Minimum distance of 2nd pile-up
465 // vertex
65abd48b 466 Bool_t fUseDisplacedVertices; //Analyze displaced vertices?
467 AliDisplacedVertexSelection fDisplacedVertex; //Displaced vertex selector
241cca4d 468 TList fCollWords; //! Configured collision words
469 TList fBgWords; //! Configured background words
e6463868 470 ClassDef(AliFMDEventInspector,4); // Inspect the event
8565b10b 471};
472
473#endif
474// Local Variables:
475// mode: C++
476// End:
477
478
479