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