Reduction of memory consumption in case of many triggers in the configuration (e...
[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;
449618cd 19class AliESDtrackCuts;
27704f6c 20class TH1F;
21class TH2F;
70fdd197 22class TCollection;
c01a136b 23class TMap;
ff8c4f30 24
70fdd197 25class AliTriggerAnalysis : public TObject
ff8c4f30 26{
27 public:
7c55ebd9 28 enum Trigger { kAcceptAll = 1, kMB1 = 2, kMB2, kMB3, kSPDGFO, kSPDGFOBits, kV0A, kV0C, kV0OR, kV0AND,
0d12ffff 29 kV0ABG, kV0CBG, kZDC, kZDCA, kZDCC, kZNA, kZNC, kZNABG, kZNCBG, kFMDA, kFMDC, kFPANY, kNSD1, kMB1Prime,
1ea7a921 30 kSPDGFOL0, kSPDGFOL1, kZDCTDCA, kZDCTDCC, kZDCTime, kCTPV0A, kCTPV0C, kTPCLaserWarmUp, kSPDClsVsTrkBG,
b68d0b5e 31 kCentral,kSemiCentral, kT0, kT0BG, kT0Pileup, kEMCAL,kTPCHVdip,
32 kTRDHCO, kTRDHJT, kTRDHSE, kTRDHQU, kTRDHEE,
1ea7a921 33 kStartOfFlags = 0x0100, kOfflineFlag = 0x8000, kOneParticle = 0x10000, kOneTrack = 0x20000}; // MB1, MB2, MB3 definition from ALICE-INT-2005-025
c8d3e441 34 enum AliceSide { kASide = 1, kCSide, kCentralBarrel };
733f0542 35 enum V0Decision { kV0Invalid = -1, kV0Empty = 0, kV0BB, kV0BG, kV0Fake };
559b5ed7 36 enum T0Decision { kT0Invalid = -1, kT0Empty = 0, kT0BB, kT0DecBG, kT0DecPileup };
ff8c4f30 37
70fdd197 38 AliTriggerAnalysis();
61899827 39 virtual ~AliTriggerAnalysis();
907972ff 40
891c67bd 41 void EnableHistograms(Bool_t isLowFlux = kFALSE);
a2ce3799 42 void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
61899827 43
44 Bool_t IsTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
7c55ebd9 45 Int_t EvaluateTrigger(const AliESDEvent* aEsd, Trigger trigger);
70fdd197 46
47 // using trigger bits in ESD
48 Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, Trigger trigger) const;
49 Bool_t IsTriggerBitFired(ULong64_t triggerMask, Trigger trigger) const;
50 Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, ULong64_t tclass) const;
51
52 // using ESD data from detectors
61899827 53 Bool_t IsOfflineTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
70fdd197 54
55 // using trigger classes in ESD
56 Bool_t IsTriggerClassFired(const AliESDEvent* aEsd, const Char_t* tclass) const;
57
c01a136b 58 // some "raw" trigger functions
c2ba5a61 59 Int_t SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, Bool_t fillHists = kFALSE, Int_t layer = 0);
61899827 60 Bool_t SPDGFOTrigger(const AliESDEvent* aEsd, Int_t origin);
559b5ed7 61 Bool_t IsSPDClusterVsTrackletBG(const AliESDEvent* esd, Bool_t fillHists = kFALSE);
97fa3cbc 62 V0Decision V0Trigger(const AliESDEvent* aEsd, AliceSide side, Bool_t online, Bool_t fillHists = kFALSE);
559b5ed7 63 T0Decision T0Trigger(const AliESDEvent* aEsd, Bool_t online, Bool_t fillHists = kFALSE);
ce08cb1f 64 Bool_t ZDCTrigger (const AliESDEvent* aEsd, AliceSide side) const;
7c55ebd9 65 Bool_t ZDCTDCTrigger(const AliESDEvent* aEsd, AliceSide side, Bool_t useZN=kTRUE, Bool_t useZP=kFALSE, Bool_t fillHists=kFALSE) const;
66 Bool_t ZDCTimeTrigger(const AliESDEvent *aEsd, Bool_t fillHists=kFALSE) const;
0d12ffff 67 Bool_t ZDCTimeBGTrigger(const AliESDEvent *aEsd, AliceSide side) const;
61899827 68 Bool_t FMDTrigger(const AliESDEvent* aEsd, AliceSide side);
85c71ba7 69 Int_t SSDClusters(const AliESDEvent* aEsd);
8d5a14d6 70 Bool_t EMCALCellsTrigger(const AliESDEvent *aEsd);
70fdd197 71 static const char* GetTriggerName(Trigger trigger);
72
7c55ebd9 73 Bool_t IsLaserWarmUpTPCEvent(const AliESDEvent* esd);
b68d0b5e 74 Bool_t IsHVdipTPCEvent(const AliESDEvent* esd);
75 Bool_t TRDTrigger(const AliESDEvent* esd, Trigger trigger);
7c55ebd9 76
907972ff 77 void FillHistograms(const AliESDEvent* aEsd);
c01a136b 78 void FillTriggerClasses(const AliESDEvent* aEsd);
ff8c4f30 79
80 void SetSPDGFOThreshhold(Int_t t) { fSPDGFOThreshold = t; }
27704f6c 81 void SetSPDGFOEfficiency(TH1F* hist) { fSPDGFOEfficiency = hist; }
1ea7a921 82 void SetSPDClustersVsTrackletsParameters(Float_t a, Float_t b) { fASPDCvsTCut = a; fBSPDCvsTCut =b;}
61899827 83 void SetV0TimeOffset(Float_t offset) { fV0TimeOffset = offset; }
97fa3cbc 84 void SetV0AdcThr(Float_t thr) { fV0AdcThr = thr; }
85 void SetV0HwPars(Float_t thr, Float_t winLow, Float_t winHigh) { fV0HwAdcThr = thr; fV0HwWinLow = winLow; fV0HwWinHigh = winHigh; }
7a11141c 86 void SetFMDThreshold(Float_t low, Float_t hit) { fFMDLowCut = low; fFMDHitCut = hit; }
4011b280 87 void SetDoFMD(Bool_t flag = kTRUE) {fDoFMD = flag;}
7c55ebd9 88 void SetZDCCutParams(Float_t refSum, Float_t refDelta, Float_t sigmaSum, Float_t sigmaDelta) { fZDCCutRefSum = refSum; fZDCCutRefDelta = refDelta; fZDCCutSigmaSum = sigmaSum; fZDCCutSigmaDelta = sigmaDelta; }
d6305a15 89 void SetCorrZDCCutParams(Float_t refSum, Float_t refDelta, Float_t sigmaSum, Float_t sigmaDelta) { fZDCCutRefSumCorr = refSum; fZDCCutRefDeltaCorr = refDelta; fZDCCutSigmaSumCorr = sigmaSum; fZDCCutSigmaDeltaCorr = sigmaDelta; }
b68d0b5e 90 void SetZNCorrCutParams(Float_t znaTimeCorrMin, Float_t znaTimeCorrMax, Float_t zncTimeCorrMin, Float_t zncTimeCorrMax)
91 { fZDCCutZNATimeCorrMin = znaTimeCorrMin; fZDCCutZNATimeCorrMax = znaTimeCorrMax;
92 fZDCCutZNCTimeCorrMin = zncTimeCorrMin; fZDCCutZNCTimeCorrMax = zncTimeCorrMax; }
93
94 void SetTRDTriggerParameters(Float_t ptHSE, UChar_t pidHSE, Float_t ptHQU, UChar_t pidHQU, Float_t ptHEE, UChar_t pidHEE, UChar_t minSectorHEE, UChar_t maxSectorHEE, Float_t ptHJT, UChar_t nHJT) {
95 fTRDptHSE = ptHSE; fTRDpidHSE = pidHSE;
96 fTRDptHQU = ptHQU; fTRDpidHQU = pidHQU;
97 fTRDptHEE = ptHEE; fTRDpidHEE = pidHEE;
98 fTRDminSectorHEE = minSectorHEE; fTRDmaxSectorHEE = maxSectorHEE;
99 fTRDptHJT = ptHJT; fTRDnHJT = nHJT;
100 }
4011b280 101
ff8c4f30 102 Int_t GetSPDGFOThreshhold() const { return fSPDGFOThreshold; }
61899827 103 Float_t GetV0TimeOffset() const { return fV0TimeOffset; }
97fa3cbc 104 Float_t GetV0AdcThr() const { return fV0AdcThr; }
7a11141c 105 Float_t GetFMDLowThreshold() const { return fFMDLowCut; }
106 Float_t GetFMDHitThreshold() const { return fFMDHitCut; }
8dec6e35 107 TMap * GetTriggerClasses() const { return fTriggerClasses;}
108
109
907972ff 110 virtual Long64_t Merge(TCollection* list);
61899827 111 void SaveHistograms() const;
c01a136b 112
113 void PrintTriggerClasses() const;
449618cd 114 void SetESDTrackCuts(AliESDtrackCuts* cuts) { fEsdTrackCuts = cuts;}
115 AliESDtrackCuts* GetESDTrackCuts() const {return fEsdTrackCuts;}
ff8c4f30 116
52f3b98d 117 void SetTPCOnly(Bool_t bTPCOnly) {fTPCOnly = bTPCOnly;}
118 Bool_t GetTPCOnly() const {return fTPCOnly;}
7c55ebd9 119
ff8c4f30 120 protected:
70fdd197 121 Bool_t IsL0InputFired(const AliESDEvent* aEsd, UInt_t input) const;
122 Bool_t IsL1InputFired(const AliESDEvent* aEsd, UInt_t input) const;
123 Bool_t IsL2InputFired(const AliESDEvent* aEsd, UInt_t input) const;
124 Bool_t IsInputFired(const AliESDEvent* aEsd, Char_t level, UInt_t input) const;
125
2078f478 126 Float_t V0CorrectLeadingTime(Int_t i, Float_t time, Float_t adc, Int_t runNumber) const;
bcd135ec 127 Float_t V0LeadingTimeWeight(Float_t adc) const;
907972ff 128
61899827 129 Int_t FMDHitCombinations(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists = kFALSE);
ff8c4f30 130
131 Int_t fSPDGFOThreshold; // number of chips to accept a SPD GF0 trigger
27704f6c 132 TH1F* 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)
733f0542 133
61899827 134 Float_t fV0TimeOffset; // time offset applied to the times read from the V0 (in ns)
97fa3cbc 135 Float_t fV0AdcThr; // thresholds applied on V0 ADC data
136 Float_t fV0HwAdcThr; // online V0 trigger - thresholds applied on ADC data
137 Float_t fV0HwWinLow; // online V0 trigger - lower edge of time window
138 Float_t fV0HwWinHigh; // online V0 trigger - upper edge of time window
7c55ebd9 139
140 Float_t fZDCCutRefSum; // ZDC time cut configuration
141 Float_t fZDCCutRefDelta; // ZDC time cut configuration
142 Float_t fZDCCutSigmaSum; // ZDC time cut configuration
143 Float_t fZDCCutSigmaDelta; // ZDC time cut configuration
97fa3cbc 144
d6305a15 145 Float_t fZDCCutRefSumCorr; // Corrected ZDC time cut configuration
146 Float_t fZDCCutRefDeltaCorr; // Corrected ZDC time cut configuration
147 Float_t fZDCCutSigmaSumCorr; // Corrected ZDC time cut configuration
148 Float_t fZDCCutSigmaDeltaCorr; // Corrected ZDC time cut configuration
149
b68d0b5e 150 Float_t fZDCCutZNATimeCorrMin; // Corrected ZNA time cut configuration
151 Float_t fZDCCutZNATimeCorrMax; // Corrected ZNA time cut configuration
152 Float_t fZDCCutZNCTimeCorrMin; // Corrected ZNA time cut configuration
153 Float_t fZDCCutZNCTimeCorrMax; // Corrected ZNA time cut configuration
00eea33b 154
1ea7a921 155 Float_t fASPDCvsTCut; // constant for the linear cut in SPD clusters vs tracklets
156 Float_t fBSPDCvsTCut; // slope for the linear cut in SPD clusters vs tracklets
157
b68d0b5e 158 // Variables for the TRD triggers
159 Float_t fTRDptHSE; // pt threshold for HSE trigger
160 UChar_t fTRDpidHSE; // PID threshold for HSE trigger
161 Float_t fTRDptHQU; // pt threshold for HQU trigger
162 UChar_t fTRDpidHQU; // PID threshold for HQU trigger
163 Float_t fTRDptHEE; // pt threshold for HEE trigger
164 UChar_t fTRDpidHEE; // PID threshold for HEE trigger
165 UChar_t fTRDminSectorHEE; // min sector for HEE trigger
166 UChar_t fTRDmaxSectorHEE; // max sector for HEE trigger
167 Float_t fTRDptHJT; // pt threshold for HJT trigger
168 UChar_t fTRDnHJT; // no of track threshold for HJT trigger
1ea7a921 169
4011b280 170 Bool_t fDoFMD; // If false, skips the FMD (physics selection runs much faster)
7a11141c 171 Float_t fFMDLowCut; //
172 Float_t fFMDHitCut; //
907972ff 173
27704f6c 174 TH2F* fHistBitsSPD; // offline trigger bits (calculated from clusters) vs hardware trigger bits
175 TH1F* fHistFiredBitsSPD; // fired hardware bits
1ea7a921 176 TH2F* fHistSPDClsVsTrk; // histogram of clusters vs tracklet BG cut
27704f6c 177 TH1F* fHistV0A; // histograms that histogram the criterion the cut is applied on: bb triggers
178 TH1F* fHistV0C; // histograms that histogram the criterion the cut is applied on: bb triggers
ce08cb1f 179 TH1F* fHistZDC; //histograms that histogram the criterion the cut is applied on: fired bits (6 bins)
180 TH1F* fHistTDCZDC; // histograms that histogram the criterion the cut is applied on: TDC bits (32 bins)
102cfd12 181 TH2F* fHistTimeZDC; // histograms that histogram the criterion the cut is applied on: ZDC TDC timing
fcb18b05 182 TH2F* fHistTimeCorrZDC; // histograms that histogram the criterion the cut is applied on: ZDC Corrected TDC timing
27704f6c 183 TH1F* fHistFMDA; // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
184 TH1F* fHistFMDC; // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
185 TH1F* fHistFMDSingle; // histograms that histogram the criterion the cut is applied on: single mult value (more than one entry per event)
186 TH1F* fHistFMDSum; // histograms that histogram the criterion the cut is applied on: summed mult value (more than one entry per event)
559b5ed7 187 TH1F* fHistT0; // histograms that histogram the criterion the cut is applied on: bb triggers
c01a136b 188 TMap* fTriggerClasses; // counts the active trigger classes (uses the full string)
189
a2ce3799 190 Bool_t fMC; // flag if MC is analyzed
449618cd 191 AliESDtrackCuts* fEsdTrackCuts; //Track Cuts to select ESD tracks
7a11141c 192
52f3b98d 193 Bool_t fTPCOnly; // flag to set whether TPC only tracks have to be used for the offline trigger
194
33561da5 195 ClassDef(AliTriggerAnalysis, 21)
ff8c4f30 196
197 private:
70fdd197 198 AliTriggerAnalysis(const AliTriggerAnalysis&);
199 AliTriggerAnalysis& operator=(const AliTriggerAnalysis&);
ff8c4f30 200};
201
202#endif