]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AliFMDEventInspector.h
Added scripts for Casper/Valentina style P(N_{ch}) analysis
[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;
66cf95f2 27class TH2I;
8565b10b 28class TAxis;
5ca83fee 29class TVector3;
241cca4d 30// class TList;
8565b10b 31
32/**
33 * This class inspects the event
34 *
35 * @par Input:
36 * - AliESDFMD object possibly corrected for sharing
37 *
38 * @par Output:
39 * - A histogram of v_z of events with triggers.
40 * - A histogram of v_z of events with vertex and triggers
41 * - A histogram of trigger counters
42 *
43 * Note, that these are added to the master output list
44 *
45 * @par Corrections used:
46 * - None
47 *
bd6f5206 48 * @ingroup pwglf_forward_algo
49 * @ingroup pwglf_forward_aod
8565b10b 50 */
51class AliFMDEventInspector : public TNamed
52{
53public:
54 /**
55 * Return codes
56 */
57 enum ECodes {
241cca4d 58 /** all ok - bin 1 */
8565b10b 59 kOk = 0,
241cca4d 60 /** No ESD event - bin 2 */
8565b10b 61 kNoEvent = 0x1,
241cca4d 62 /** No triggers found - bin 3 */
8565b10b 63 kNoTriggers = 0x2,
241cca4d 64 /** No SPD data - bin 4 */
8565b10b 65 kNoSPD = 0x4,
241cca4d 66 /** No FMD data - bin 5 */
8565b10b 67 kNoFMD = 0x8,
241cca4d 68 /** No vertex found - bin 6 */
8565b10b 69 kNoVertex = 0x10,
241cca4d 70 /** Vertex out of range - bin 7 */
0be6c8cd 71 kBadVertex = 0x20
8565b10b 72 };
73 /**
74 * Trigger bins
75 */
76 enum ETrgBins {
77 kInel,
78 kInelGt0,
e6463868 79 kNSD,
80 kV0AND,
8565b10b 81 kEmpty,
82 kA,
83 kB,
84 kC,
0be6c8cd 85 kE,
86 kPileUp,
87 kMCNSD,
8449e3e0 88 kSatellite,
0be6c8cd 89 kOffline
8565b10b 90 };
5934a3e3 91 /**
92 * Centrality methods
93 */
94 enum ECentMethod {
95 kV0Multiplicity,
96 kV0Amplitude,
97 kV0Charge,
98 kFMDRough,
99 kNTracks,
100 kLTracks,
101 kCL0,
102 kCL1,
103 kCND,
104 kNParticles,
105 kNeutrons,
106 kV0vsFMD,
107 kV0vsNTracks,
108 kZEMvsZDC
109 };
110
0bd4b00f 111 /**
112 * Collision systems
113 */
114 enum ECollisionSystem {
115 kUnknown,
116 kPP,
117 kPbPb
118 };
8449e3e0 119 enum EVtxStatus {
120 kVtxOK = 1,
121 kNoVtx,
122 kNoSPDVtx,
123 kFewContrib,
124 kUncertain,
125 kNotVtxZ
126 };
127 enum ETrgStatus {
128 kNoTrgWords=1,
129 kPP2760Fast,
130 kMUON,
131 kTriggered,
132 kMinBias,
133 kMinBiasNoSPD,
134 kV0AndTrg,
135 kHighMult,
136 kCentral,
137 kSemiCentral,
138 kDiffractive,
139 kUser,
140 kOther
141 };
5ca83fee 142 /**
143 * Folder name
144 */
145 static const char* fgkFolderName;
8565b10b 146 /**
147 * Constructor
148 */
149 AliFMDEventInspector();
150 /**
151 * Constructor
152 *
153 * @param name Name of object
154 */
155 AliFMDEventInspector(const char* name);
156 /**
157 * Copy constructor
158 *
159 * @param o Object to copy from
160 */
161 AliFMDEventInspector(const AliFMDEventInspector& o);
162 /**
163 * Destructor
164 */
165 virtual ~AliFMDEventInspector();
166 /**
167 * Assignement operator
168 *
169 * @param o Object to assign from
170 *
171 * @return Reference to this object
172 */
173 AliFMDEventInspector& operator=(const AliFMDEventInspector&);
174
175 /**
176 * Initialize the object
177 *
178 * @param vtxAxis Vertex axis in use
179 */
5934a3e3 180 virtual void SetupForData(const TAxis& vtxAxis);
8565b10b 181 /**
182 * Process the event
183 *
184 * @param event Input event
185 * @param triggers On return, the triggers fired
186 * @param lowFlux On return, true if the event is considered a low-flux
187 * event (according to the setting of fLowFluxCut)
0bd4b00f 188 * @param ivz On return, the found vertex bin (1-based). A zero
189 * means outside of the defined vertex range
33438b4c 190 * @param ip On return, coordinates of interaction point
5e4d905e 191 * @param cent On return, the centrality (in percent) or < 0
192 * if not found
5bb5d1f6 193 * @param nClusters On return, number of SPD clusters in @f$ |\eta|<1@f$
8565b10b 194 *
195 * @return 0 (or kOk) on success, otherwise a bit mask of error codes
196 */
197 UInt_t Process(const AliESDEvent* event,
198 UInt_t& triggers,
199 Bool_t& lowFlux,
0bd4b00f 200 UShort_t& ivz,
5ca83fee 201 TVector3& ip,
5bb5d1f6 202 Double_t& cent,
203 UShort_t& nClusters);
8565b10b 204 /**
205 * Define the output histograms. These are put in a sub list of the
206 * passed list. The histograms are merged before the parent task calls
207 * AliAnalysisTaskSE::Terminate
208 *
209 * @param dir Directory to add to
210 */
5934a3e3 211 void CreateOutputObjects(TList* dir);
8565b10b 212 /**
213 * Set the number of SPD tracklets for which we consider the event a
214 * low-flux event or not .
215 *
216 * @param c Cut (default 1000)
217 */
218 void SetLowFluxCut(Int_t c) { fLowFluxCut = c; }
219 /**
220 * Set the maximum error on @f$ v_z@f$
221 *
222 * @param c Maximum error (in centimeters)
223 */
224 void SetMaxVzErr(Double_t c=0.1) { fMaxVzErr = c; }
e83d0620 225 /**
226 * Use the first physics vtx code.
227 *
228 * @param use Use it or not
229 */
230 void SetUseFirstPhysicsVtx(Bool_t use) {fUseFirstPhysicsVertex = use; }
31554871 231 /**
232 * Use the first physics vtx code.
233 *
234 * @param use Use it or not
235 */
ffd35d33 236 void SetpA2012Vtx(Bool_t use) {fUsepA2012Vertex= use; }
237 /**
238 * Use the 2012 pA vtx code.
239 *
240 * @param use Use it or not
241 */
242
e6463868 243 void SetUseV0AndForNSD(Bool_t use=true) {fUseV0AND = use; }
244 /**
245 * Set the minimum number of contributors for a 2nd pile-up vertex
246 *
247 * @param nContrib Least number of contributors
248 */
249 void SetMinPileupContributors(UShort_t nContrib=3)
250 {
251 fMinPileupContrib = nContrib;
252 }
253 /**
254 * Set minimum distance from primary vertex to 2nd pile-up vertex
255 *
256 * @param cm Distance (in centimeters)
257 */
258 void SetMinPileupDistance(Double_t cm=0.8)
259 {
260 fMinPileupDistance = cm;
261 }
65abd48b 262 /**
263 * Enable selection of displaced vertices.
264 *
265 * @param use whether to use
266 */
267 void SetUseDisplacedVertices(Bool_t use=true)
268 {
269 fUseDisplacedVertices = use;
270 }
8449e3e0 271 Bool_t IsUseDisplacedVertices() const { return fUseDisplacedVertices; }
272 /**
273 * Set the lower centrality cut - if negative, do not use
274 *
275 * @deprecated We should accept all events in the AOD pass
276 *
277 * @param mincent Lower cut on centrality
278 */
279 void SetMinCentrality(Double_t mincent=-1.0);
280 /**
281 * Set the upper centrality cut - if negative, do not use
282 *
283 * @deprecated We should accept all events in the AOD pass
284 *
285 * @param mincent Upper cut on centrality
286 */
287 void SetMaxCentrality(Double_t maxcent=-1.0);
5934a3e3 288 /**
289 * Set the centrality method to use. Possible values are
290 *
291 * - VOM - VZERO multiplicity
292 * - V0A - VZERO amplitude
293 * - V0C - VZERO charge
294 * - FMD - FMD scaled energy loss
295 * - TRK - Number of tracks
296 * - TKL - Number of tracks
297 * - CL0 -
298 * - CL1 -
299 * - CND -
300 * - NPA - Neutral particles
301 * - ZNA - ZDC neutron amplitude
302 * - V0MvsFMD - VZERO versus FMD
303 * - TKLvsVOM - Tracks versus VZERO
304 * - ZEMvsZDC - ZDC
305 *
306 * @param m
307 */
308 void SetCentralityMethod(const TString& m) { fCentMethod = m; }
8449e3e0 309 /**
310 * Set the centrality method
311 *
312 * @param m Method identifier
313 */
5934a3e3 314 void SetCentralityMethod(ECentMethod m);
8565b10b 315 /**
316 * Set the debug level. The higher the value the more output
317 *
318 * @param dbg Debug level
319 */
320 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
e65b8b56 321 /**
322 * Set whether this is MC or not. Needed by energy loss fitter task
323 * that never instantices AliFMDMCEventInspector. In particular, we
324 * need this to make sure we ignore the FAST partition flag in MC
325 * for 2.76TeV pp.
326 *
327 * @param isMC If true, assume MC input
328 */
329 void SetMC(Bool_t isMC=true) { fMC = isMC; }
8565b10b 330 /**
331 * Fetch our histograms from the passed list
332 *
333 * @param d Input
334 * @param hEventsTr On return, pointer to histogram, or null
335 * @param hEventsTrVtx On return, pointer to histogram, or null
5ca83fee 336 * @param hEventsAcc On return, pointer to histogram, or null
8565b10b 337 * @param hTriggers On return, pointer to histogram, or null
338 *
339 * @return true on success, false otherwise
340 */
fb3430ac 341 Bool_t FetchHistograms(const TList* d,
8565b10b 342 TH1I*& hEventsTr,
343 TH1I*& hEventsTrVtx,
5ca83fee 344 TH1I*& hEventsAcc,
8565b10b 345 TH1I*& hTriggers) const;
0bd4b00f 346 /**
347 * Read the collision system, collision energy, and L3 field setting
348 * from the ESD
349 *
350 * @param esd ESD to get information from
351 *
352 * @return true on success, false
353 */
354 Bool_t ReadRunDetails(const AliESDEvent* esd);
355 /**
356 * Get the collision system (one of the value in ECollisionSystem)
357 *
358 * @return Collision system
359 */
360 UShort_t GetCollisionSystem() const { return fCollisionSystem; }
361 /**
362 * Get the center of mass energy (per nucleon pair) in GeV
363 *
364 * @return center of mass energy (per nucleon pair) in GeV
365 */
366 UShort_t GetEnergy() const { return fEnergy; }
367 /**
368 * Get the magnetic field setting of the L3 magnet in kilo Gauss.
369 *
370 * @return The magnetic field setting
371 */
372 Short_t GetField() const { return fField; }
8449e3e0 373 /**
374 * Get the current run number
375 *
376 * @return The current run number
377 */
378 ULong_t GetRunNumber() const { return fRunNumber; }
0bd4b00f 379 /**
380 * Print information
381 *
382 * @param option Not used
383 */
8449e3e0 384 void Print(Option_t* option="") const;
4f9319f3 385 // getter for fmincentrality
8449e3e0 386 // Double_t GetMinCentrality() const { return fMinCent;}
4f9319f3 387 // gettter for fmaxcentrality
8449e3e0 388 // Double_t GetMaxCentrality() const { return fMaxCent;}
f7cfc454 389 /**
390 * Store information about running conditions in output list
391 *
392 * 3 TNamed objects are defined. The names are fixed, but the
393 * title is a string representation of the information, and the
394 * unique ID contains the identifier
395 *
396 * - sys Contains the collision system string and identifier.
397 * - sNN Contains the center-of-mass energy per nucleon (GeV)
398 * - field Contains the L3 magnetic field (kG)
9b2f2e39 399 * - run Contains the run number
f7cfc454 400 *
401 */
8449e3e0 402 virtual void StoreInformation();
241cca4d 403 /**
404 * Return a string representing the return code
405 *
406 * @param mask Code
407 *
408 * @return String representation
409 */
410 static const char* CodeString(UInt_t mask);
8565b10b 411protected:
241cca4d 412 /**
413 * Cache the configure trigger classes from the physis selection.
414 *
415 * @param cache where to cache the trigger class.
416 * @param classes List of configured classes.
417 * @param o Object from OADB with config
418 */
419 void CacheConfiguredTriggerClasses(TList& cache,
420 const TList* classes,
421 AliOADBPhysicsSelection* o);
8565b10b 422 /**
423 * Read the trigger information from the ESD event
424 *
425 * @param esd ESD event
426 * @param triggers On return, contains the trigger bits
5bb5d1f6 427 * @param nClusters On return, number of SPD clusters in @f$ |\eta|<1@f$
8565b10b 428 *
429 * @return @c true on success, @c false otherwise
430 */
241cca4d 431 Bool_t ReadTriggers(const AliESDEvent& esd, UInt_t& triggers,
5bb5d1f6 432 UShort_t& nClusters);
8449e3e0 433 /**
434 * Possible extra check for p-Pb from 2012/13 - require V0AND.
435 *
436 * @param esd Event structure
437 *
438 * @return true on success
439 */
da70cd6a 440 Bool_t CheckpAExtraV0(const AliESDEvent& esd) const;
241cca4d 441 /**
442 * Check, for the @f$\sqrt{s}=2.76GeV@f$ pp run wether this event
443 * was in the fast partition, and if so, filter it out.
444 *
445 * @param fastonly Event was in fast-only partition
446 *
447 * @return true if event was in the fast-only partition, for the run
448 * period.
449 */
450 virtual Bool_t CheckFastPartition(bool fastonly) const;
451 /**
452 * Check if we have an NSD trigger for pp runs
453 *
454 * @param esd Data
455 * @param triggers Trigger mask to be filled
456 *
457 * @return true if we have an NSD trigger
458 */
459 virtual Bool_t CheckNSD(const AliESDEvent& esd, UInt_t& triggers) const;
460 /**
461 * Check if we have an INEL&gt;0 trigger
462 *
463 * @param esd Data
464 * @param nClusters On return, number of clusters
465 * @param triggers Trigger mask to be filled
466 *
467 * @return true if we have an INEL&gt;0 trigger
468 */
469 virtual Bool_t CheckINELGT0(const AliESDEvent& esd, UShort_t& nClusters,
470 UInt_t& triggers) const;
471 /**
472 * Check if this is a pile-up event
473 *
474 * @param esd Data
475 * @param triggers Trigger mask to be filled
476 *
477 * @return true if this is a pile-up event
478 */
479 virtual Bool_t CheckPileup(const AliESDEvent& esd, UInt_t& triggers) const;
dd556bcd 480 /**
481 * Check for multi-vertex pile-up
482 *
483 * @param esd ESD event
484 *
485 * @return true if multiple vertices found
486 */
487 virtual Bool_t CheckMultiVertex(const AliESDEvent& esd) const;
241cca4d 488 /**
489 * Check if we have a cosmic trigger. These should be filtered out.
490 *
491 * @param trigStri Trigger string
492 *
493 * @return true if we have a cosmic trigger
494 */
495 virtual Bool_t CheckCosmics(const TString& trigStri) const;
496 /**
497 * Check if the trigger string corresponds to an empty event
498 *
499 * @param trigStr Trigger string
500 * @param triggers Trigger mask to be filled
501 *
502 * @return true if the trigger string corresponds to an empty event
503 */
504 virtual Bool_t CheckEmpty(const TString& trigStr, UInt_t& triggers) const;
505 /**
506 * Check the trigger words to see if we have a B, A, C, or E event.
507 *
508 * @param esd Data
509 * @param triggers Trigger mask to be filled
510 *
511 * @return always true
512 */
513 virtual Bool_t CheckWords(const AliESDEvent& esd, UInt_t& triggers) const;
8565b10b 514 /**
515 * Read the vertex information from the ESD event
516 *
517 * @param esd ESD event
5ca83fee 518 * @param ip On return, the coordinates of the IP
8565b10b 519 *
520 * @return @c true on success, @c false otherwise
521 */
5ca83fee 522 Bool_t ReadVertex(const AliESDEvent& esd, TVector3& ip);
241cca4d 523 /**
524 * Check the vertex using the method used in PWG-UD. That is
525 *
526 * - Check we have a vertex and status is OK
527 * - Check if we have an SPD vertex and that it's status is OK
528 * - Check if the vertex is from the Z-vertexer, and if it is,
529 * - Check that the dispersion and resolution is OK
530 *
531 * @param esd Data
5ca83fee 532 * @param ip On return, the coordinates of the IP
241cca4d 533 *
8449e3e0 534 * @return status
241cca4d 535 */
8449e3e0 536 virtual EVtxStatus CheckPWGUDVertex(const AliESDEvent& esd,
537 TVector3& ip) const;
241cca4d 538 /**
539 * Check the vertex. That is
540 *
541 * - Check if we have an SPD vertex and that it's status is OK
542 * - Check that we have enough contributors
543 * - Check that the reslution is OK
544 *
545 * @param esd Data
5ca83fee 546 * @param ip On return, the coordinates of the IP
241cca4d 547 *
8449e3e0 548 * @return status
241cca4d 549 */
8449e3e0 550 virtual EVtxStatus CheckpA2012Vertex(const AliESDEvent& esd,
551 TVector3& ip) const;
ffd35d33 552 /**
553 * Check the vertex for pA 2012 settings. That is
554 *
555 *
556 * @param esd Data
557 * @param ip On return, the coordinates of the IP
558 *
559 * @return true if the vertex was found and met the requirements
560 */
561
562
563
564
8449e3e0 565 virtual EVtxStatus CheckVertex(const AliESDEvent& esd, TVector3& ip) const;
e1f47419 566 /**
567 * Read centrality from event
568 *
569 * @param esd Event
570 * @param cent On return, the centrality or negative if not found
ffca499d 571 * @param qual On return, centrality quality flag
e1f47419 572 *
573 * @return False on error, true otherwise
574 */
73b32206 575 virtual Bool_t ReadCentrality(const AliESDEvent& esd, Double_t& cent,
576 UShort_t& qual) const;
8565b10b 577
578 TH1I* fHEventsTr; //! Histogram of events w/trigger
579 TH1I* fHEventsTrVtx; //! Events w/trigger and vertex
5bb5d1f6 580 TH1I* fHEventsAccepted; //! Events w/trigger and vertex in range
96110c91 581 TH2D* fHEventsAcceptedXY; //! XY vtx with trigger and Z vertex in range
8565b10b 582 TH1I* fHTriggers; //! Triggers
66cf95f2 583 TH2I* fHTriggerCorr; //! Correlation of triggers
0bd4b00f 584 TH1I* fHType; //! Type (low/high flux) of event
fe52e455 585 TH1I* fHWords; //! Trigger words
5e4d905e 586 TH1F* fHCent; //! Centrality
e308a636 587 TH2F* fHCentVsQual; //! Centrality vs quality
241cca4d 588 TH1I* fHStatus; //! Event processing status
8449e3e0 589 TH1I* fHVtxStatus; //! Vertex processing status
590 TH1I* fHTrgStatus; //! Trigger processing status
8565b10b 591 Int_t fLowFluxCut; // Low flux cut
592 Double_t fMaxVzErr; // Maximum error on v_z
593 TList* fList; //! Histogram container
0bd4b00f 594 UShort_t fEnergy; // CMS energy (per nucleon pair) [GeV]
595 Short_t fField; // L3 magnetic field [kG]
fb3430ac 596 UShort_t fCollisionSystem; // Collision system
8565b10b 597 Int_t fDebug; // Debug level
e308a636 598 TAxis* fCentAxis; // Centrality axis used in histograms
31554871 599 TAxis fVtxAxis; //Vtx Axis
e83d0620 600 Bool_t fUseFirstPhysicsVertex; //Use the vtx code from p+p first physics
31554871 601 Bool_t fUseV0AND; //Use the vtx code from p+p first physics
e6463868 602 UShort_t fMinPileupContrib; // Minimum number of contributors to 2nd
603 // pile-up vertex
604 Double_t fMinPileupDistance; // Minimum distance of 2nd pile-up
605 // vertex
65abd48b 606 Bool_t fUseDisplacedVertices; //Analyze displaced vertices?
607 AliDisplacedVertexSelection fDisplacedVertex; //Displaced vertex selector
241cca4d 608 TList fCollWords; //! Configured collision words
609 TList fBgWords; //! Configured background words
5934a3e3 610 TString fCentMethod;
8449e3e0 611 Double_t fMinCent; //min centrality
612 Double_t fMaxCent; //max centrailty
613 Bool_t fUsepA2012Vertex;// flag to use pA2012 Veretx selection
614 ULong_t fRunNumber; // Current run number
e65b8b56 615 Bool_t fMC; // Is this MC input
616 ClassDef(AliFMDEventInspector,11); // Inspect the event
8565b10b 617};
618
619#endif
620// Local Variables:
621// mode: C++
622// End:
623
624
625