Apply corrections
[u/mrichter/AliRoot.git] / ANALYSIS / AliTriggerAnalysis.h
CommitLineData
70fdd197 1/* $Id: AliTriggerAnalysis.h 35782 2009-10-22 11:54:31Z jgrosseo $ */
ff8c4f30 2
70fdd197 3#ifndef ALITRIGGERANALYSIS_H
4#define ALITRIGGERANALYSIS_H
ff8c4f30 5
6#include <TObject.h>
ff8c4f30 7
7a11141c 8/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
9 * See cxx source for full Copyright notice */
10
11//-------------------------------------------------------------------------
70fdd197 12// Implementation of Class AliTriggerAnalysis
13// This class provides function to check if events have been triggered based on the data in the ESD
14// The trigger bits, trigger class inputs and only the data (offline trigger) can be used
7a11141c 15// Origin: Jan Fiete Grosse-Oetringhaus, CERN
16//-------------------------------------------------------------------------
17
ff8c4f30 18class AliESDEvent;
907972ff 19class TH1;
90dc86e9 20class TH2;
70fdd197 21class TCollection;
c01a136b 22class TMap;
ff8c4f30 23
70fdd197 24class AliTriggerAnalysis : public TObject
ff8c4f30 25{
26 public:
733f0542 27 enum Trigger { kAcceptAll = 1, kMB1 = 2, kMB2, kMB3, kSPDGFO, kSPDGFOBits, kV0A, kV0C, kV0OR, kV0AND, kV0ABG, kV0CBG, kZDC, kZDCA, kZDCC, kFMDA, kFMDC, kFPANY, kNSD1, kStartOfFlags = 0x0100, kOfflineFlag = 0x8000 }; // MB1, MB2, MB3 definition from ALICE-INT-2005-025
c8d3e441 28 enum AliceSide { kASide = 1, kCSide, kCentralBarrel };
733f0542 29 enum V0Decision { kV0Invalid = -1, kV0Empty = 0, kV0BB, kV0BG, kV0Fake };
ff8c4f30 30
70fdd197 31 AliTriggerAnalysis();
61899827 32 virtual ~AliTriggerAnalysis();
907972ff 33
34 void EnableHistograms();
a2ce3799 35 void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
61899827 36
37 Bool_t IsTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
70fdd197 38
39 // using trigger bits in ESD
40 Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, Trigger trigger) const;
41 Bool_t IsTriggerBitFired(ULong64_t triggerMask, Trigger trigger) const;
42 Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, ULong64_t tclass) const;
43
44 // using ESD data from detectors
61899827 45 Bool_t IsOfflineTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
70fdd197 46
47 // using trigger classes in ESD
48 Bool_t IsTriggerClassFired(const AliESDEvent* aEsd, const Char_t* tclass) const;
49
c01a136b 50 // some "raw" trigger functions
296dd262 51 Int_t SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, Bool_t fillHists = kFALSE);
61899827 52 Bool_t SPDGFOTrigger(const AliESDEvent* aEsd, Int_t origin);
53 V0Decision V0Trigger(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists = kFALSE);
c01a136b 54 Bool_t ZDCTrigger(const AliESDEvent* aEsd, AliceSide side) const;
61899827 55 Bool_t FMDTrigger(const AliESDEvent* aEsd, AliceSide side);
c01a136b 56
70fdd197 57 static const char* GetTriggerName(Trigger trigger);
58
907972ff 59 void FillHistograms(const AliESDEvent* aEsd);
c01a136b 60 void FillTriggerClasses(const AliESDEvent* aEsd);
ff8c4f30 61
62 void SetSPDGFOThreshhold(Int_t t) { fSPDGFOThreshold = t; }
733f0542 63 void SetSPDGFOEfficiency(TH1* hist) { fSPDGFOEfficiency = hist; }
61899827 64 void SetV0TimeOffset(Float_t offset) { fV0TimeOffset = offset; }
7a11141c 65 void SetFMDThreshold(Float_t low, Float_t hit) { fFMDLowCut = low; fFMDHitCut = hit; }
ff8c4f30 66
67 Int_t GetSPDGFOThreshhold() const { return fSPDGFOThreshold; }
61899827 68 Float_t GetV0TimeOffset() const { return fV0TimeOffset; }
7a11141c 69 Float_t GetFMDLowThreshold() const { return fFMDLowCut; }
70 Float_t GetFMDHitThreshold() const { return fFMDHitCut; }
907972ff 71
72 virtual Long64_t Merge(TCollection* list);
61899827 73 void SaveHistograms() const;
c01a136b 74
75 void PrintTriggerClasses() const;
ff8c4f30 76
77 protected:
70fdd197 78 Bool_t IsL0InputFired(const AliESDEvent* aEsd, UInt_t input) const;
79 Bool_t IsL1InputFired(const AliESDEvent* aEsd, UInt_t input) const;
80 Bool_t IsL2InputFired(const AliESDEvent* aEsd, UInt_t input) const;
81 Bool_t IsInputFired(const AliESDEvent* aEsd, Char_t level, UInt_t input) const;
82
c01a136b 83 Float_t V0CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const;
bcd135ec 84 Float_t V0LeadingTimeWeight(Float_t adc) const;
907972ff 85
61899827 86 Int_t FMDHitCombinations(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists = kFALSE);
ff8c4f30 87
88 Int_t fSPDGFOThreshold; // number of chips to accept a SPD GF0 trigger
733f0542 89 TH1* fSPDGFOEfficiency; // SPD FASTOR efficiency - is applied in SPDFiredChips. Histogram contains efficiency as function of chip number (bin 1..400: first layer; 401..1200: second layer)
90
61899827 91 Float_t fV0TimeOffset; // time offset applied to the times read from the V0 (in ns)
ff8c4f30 92
7a11141c 93 Float_t fFMDLowCut; //
94 Float_t fFMDHitCut; //
907972ff 95
c01a136b 96 TH2* fHistBitsSPD; // offline trigger bits (calculated from clusters) vs hardware trigger bits
c2fff146 97 TH1* fHistFiredBitsSPD; // fired hardware bits
907972ff 98 TH1* fHistV0A; // histograms that histogram the criterion the cut is applied on: bb triggers
99 TH1* fHistV0C; // histograms that histogram the criterion the cut is applied on: bb triggers
100 TH1* fHistZDC; // histograms that histogram the criterion the cut is applied on: fired bits (6 bins)
101 TH1* fHistFMDA; // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
102 TH1* fHistFMDC; // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
103 TH1* fHistFMDSingle; // histograms that histogram the criterion the cut is applied on: single mult value (more than one entry per event)
104 TH1* fHistFMDSum; // histograms that histogram the criterion the cut is applied on: summed mult value (more than one entry per event)
c01a136b 105
106 TMap* fTriggerClasses; // counts the active trigger classes (uses the full string)
107
a2ce3799 108 Bool_t fMC; // flag if MC is analyzed
7a11141c 109
733f0542 110 ClassDef(AliTriggerAnalysis, 7)
ff8c4f30 111
112 private:
70fdd197 113 AliTriggerAnalysis(const AliTriggerAnalysis&);
114 AliTriggerAnalysis& operator=(const AliTriggerAnalysis&);
ff8c4f30 115};
116
117#endif