2 // This class inspects the event
4 #ifndef ALIFMDEVENTINSPECTOR_H
5 #define ALIFMDEVENTINSPECTOR_H
7 * @file AliFMDEventInspector.h
8 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
9 * @date Wed Mar 23 14:02:48 2011
14 * @ingroup pwglf_forward_aod
19 #include "AliDisplacedVertexSelection.h"
21 class AliOADBPhysicsSelection;
31 * This class inspects the event
34 * - AliESDFMD object possibly corrected for sharing
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
41 * Note, that these are added to the master output list
43 * @par Corrections used:
46 * @ingroup pwglf_forward_algo
47 * @ingroup pwglf_forward_aod
49 class AliFMDEventInspector : public TNamed
58 /** No ESD event - bin 2 */
60 /** No triggers found - bin 3 */
62 /** No SPD data - bin 4 */
64 /** No FMD data - bin 5 */
66 /** No vertex found - bin 6 */
68 /** Vertex out of range - bin 7 */
91 enum ECollisionSystem {
99 AliFMDEventInspector();
103 * @param name Name of object
105 AliFMDEventInspector(const char* name);
109 * @param o Object to copy from
111 AliFMDEventInspector(const AliFMDEventInspector& o);
115 virtual ~AliFMDEventInspector();
117 * Assignement operator
119 * @param o Object to assign from
121 * @return Reference to this object
123 AliFMDEventInspector& operator=(const AliFMDEventInspector&);
126 * Initialize the object
128 * @param vtxAxis Vertex axis in use
130 virtual void Init(const TAxis& vtxAxis);
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)
138 * @param ivz On return, the found vertex bin (1-based). A zero
139 * means outside of the defined vertex range
140 * @param vz On return, the z position of the interaction
141 * @param cent On return, the centrality (in percent) or < 0
143 * @param nClusters On return, number of SPD clusters in @f$ |\eta|<1@f$
145 * @return 0 (or kOk) on success, otherwise a bit mask of error codes
147 UInt_t Process(const AliESDEvent* event,
153 UShort_t& nClusters);
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
159 * @param dir Directory to add to
161 void DefineOutput(TList* dir);
163 * Set the number of SPD tracklets for which we consider the event a
164 * low-flux event or not .
166 * @param c Cut (default 1000)
168 void SetLowFluxCut(Int_t c) { fLowFluxCut = c; }
170 * Set the maximum error on @f$ v_z@f$
172 * @param c Maximum error (in centimeters)
174 void SetMaxVzErr(Double_t c=0.1) { fMaxVzErr = c; }
176 * Use the first physics vtx code.
178 * @param use Use it or not
180 void SetUseFirstPhysicsVtx(Bool_t use) {fUseFirstPhysicsVertex = use; }
182 * Use the first physics vtx code.
184 * @param use Use it or not
186 void SetUseV0AndForNSD(Bool_t use=true) {fUseV0AND = use; }
188 * Set the minimum number of contributors for a 2nd pile-up vertex
190 * @param nContrib Least number of contributors
192 void SetMinPileupContributors(UShort_t nContrib=3)
194 fMinPileupContrib = nContrib;
197 * Set minimum distance from primary vertex to 2nd pile-up vertex
199 * @param cm Distance (in centimeters)
201 void SetMinPileupDistance(Double_t cm=0.8)
203 fMinPileupDistance = cm;
206 * Enable selection of displaced vertices.
208 * @param use whether to use
210 void SetUseDisplacedVertices(Bool_t use=true)
212 fUseDisplacedVertices = use;
216 * Set the debug level. The higher the value the more output
218 * @param dbg Debug level
220 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
222 * Fetch our histograms from the passed list
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
229 * @return true on success, false otherwise
231 Bool_t FetchHistograms(const TList* d,
234 TH1I*& hTriggers) const;
236 * Read the collision system, collision energy, and L3 field setting
239 * @param esd ESD to get information from
241 * @return true on success, false
243 Bool_t ReadRunDetails(const AliESDEvent* esd);
245 * Get the collision system (one of the value in ECollisionSystem)
247 * @return Collision system
249 UShort_t GetCollisionSystem() const { return fCollisionSystem; }
251 * Get the center of mass energy (per nucleon pair) in GeV
253 * @return center of mass energy (per nucleon pair) in GeV
255 UShort_t GetEnergy() const { return fEnergy; }
257 * Get the magnetic field setting of the L3 magnet in kilo Gauss.
259 * @return The magnetic field setting
261 Short_t GetField() const { return fField; }
265 * @param option Not used
267 void Print(Option_t* option="") const;
269 * Store information about running conditions in output list
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
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)
278 * - run Contains the run number
280 * @param runNo Run number - read off from ESD event
282 virtual void StoreInformation(Int_t runNo);
284 * Return a string representing the return code
288 * @return String representation
290 static const char* CodeString(UInt_t mask);
293 * Cache the configure trigger classes from the physis selection.
295 * @param cache where to cache the trigger class.
296 * @param classes List of configured classes.
297 * @param o Object from OADB with config
299 void CacheConfiguredTriggerClasses(TList& cache,
300 const TList* classes,
301 AliOADBPhysicsSelection* o);
303 * Read the trigger information from the ESD event
305 * @param esd ESD event
306 * @param triggers On return, contains the trigger bits
307 * @param nClusters On return, number of SPD clusters in @f$ |\eta|<1@f$
309 * @return @c true on success, @c false otherwise
311 Bool_t ReadTriggers(const AliESDEvent& esd, UInt_t& triggers,
312 UShort_t& nClusters);
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.
317 * @param fastonly Event was in fast-only partition
319 * @return true if event was in the fast-only partition, for the run
322 virtual Bool_t CheckFastPartition(bool fastonly) const;
324 * Check if we have an NSD trigger for pp runs
327 * @param triggers Trigger mask to be filled
329 * @return true if we have an NSD trigger
331 virtual Bool_t CheckNSD(const AliESDEvent& esd, UInt_t& triggers) const;
333 * Check if we have an INEL>0 trigger
336 * @param nClusters On return, number of clusters
337 * @param triggers Trigger mask to be filled
339 * @return true if we have an INEL>0 trigger
341 virtual Bool_t CheckINELGT0(const AliESDEvent& esd, UShort_t& nClusters,
342 UInt_t& triggers) const;
344 * Check if this is a pile-up event
347 * @param triggers Trigger mask to be filled
349 * @return true if this is a pile-up event
351 virtual Bool_t CheckPileup(const AliESDEvent& esd, UInt_t& triggers) const;
353 * Check if we have a cosmic trigger. These should be filtered out.
355 * @param trigStri Trigger string
357 * @return true if we have a cosmic trigger
359 virtual Bool_t CheckCosmics(const TString& trigStri) const;
361 * Check if the trigger string corresponds to an empty event
363 * @param trigStr Trigger string
364 * @param triggers Trigger mask to be filled
366 * @return true if the trigger string corresponds to an empty event
368 virtual Bool_t CheckEmpty(const TString& trigStr, UInt_t& triggers) const;
370 * Check the trigger words to see if we have a B, A, C, or E event.
373 * @param triggers Trigger mask to be filled
375 * @return always true
377 virtual Bool_t CheckWords(const AliESDEvent& esd, UInt_t& triggers) const;
379 * Read the vertex information from the ESD event
381 * @param esd ESD event
382 * @param vz On return, the vertex Z position
383 * @param vx On return, the vertex X position
384 * @param vy On return, the vertex Y position
386 * @return @c true on success, @c false otherwise
388 Bool_t ReadVertex(const AliESDEvent& esd,
393 * Check the vertex using the method used in PWG-UD. That is
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
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
405 * @return true if the vertex was found and met the requirements
407 virtual Bool_t CheckPWGUDVertex(const AliESDEvent& esd,
412 * Check the vertex. That is
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
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
423 * @return true if the vertex was found and met the requirements
425 virtual Bool_t CheckVertex(const AliESDEvent& esd,
430 * Read centrality from event
433 * @param cent On return, the centrality or negative if not found
434 * @param qual On return, centrality quality flag
436 * @return False on error, true otherwise
438 Bool_t ReadCentrality(const AliESDEvent& esd, Double_t& cent,
439 UShort_t& qual) const;
441 TH1I* fHEventsTr; //! Histogram of events w/trigger
442 TH1I* fHEventsTrVtx; //! Events w/trigger and vertex
443 TH1I* fHEventsAccepted; //! Events w/trigger and vertex in range
444 TH2D* fHEventsAcceptedXY; //! XY vtx with trigger and Z vertex in range
445 TH1I* fHTriggers; //! Triggers
446 TH1I* fHType; //! Type (low/high flux) of event
447 TH1I* fHWords; //! Trigger words
448 TH1F* fHCent; //! Centrality
449 TH2F* fHCentVsQual; //! Centrality vs quality
450 TH1I* fHStatus; //! Event processing status
451 Int_t fLowFluxCut; // Low flux cut
452 Double_t fMaxVzErr; // Maximum error on v_z
453 TList* fList; //! Histogram container
454 UShort_t fEnergy; // CMS energy (per nucleon pair) [GeV]
455 Short_t fField; // L3 magnetic field [kG]
456 UShort_t fCollisionSystem; // Collision system
457 Int_t fDebug; // Debug level
458 TAxis* fCentAxis; // Centrality axis used in histograms
459 TAxis fVtxAxis; //Vtx Axis
460 Bool_t fUseFirstPhysicsVertex; //Use the vtx code from p+p first physics
461 Bool_t fUseV0AND; //Use the vtx code from p+p first physics
462 UShort_t fMinPileupContrib; // Minimum number of contributors to 2nd
464 Double_t fMinPileupDistance; // Minimum distance of 2nd pile-up
466 Bool_t fUseDisplacedVertices; //Analyze displaced vertices?
467 AliDisplacedVertexSelection fDisplacedVertex; //Displaced vertex selector
468 TList fCollWords; //! Configured collision words
469 TList fBgWords; //! Configured background words
470 ClassDef(AliFMDEventInspector,4); // Inspect the event