]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliTriggerAnalysis.h
Unintentional delete corrected.
[u/mrichter/AliRoot.git] / ANALYSIS / AliTriggerAnalysis.h
1 /* $Id: AliTriggerAnalysis.h 35782 2009-10-22 11:54:31Z jgrosseo $ */
2
3 #ifndef ALITRIGGERANALYSIS_H
4 #define ALITRIGGERANALYSIS_H
5
6 #include <TObject.h>
7
8 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
9  * See cxx source for full Copyright notice                               */
10
11 //-------------------------------------------------------------------------
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
15 //   Origin: Jan Fiete Grosse-Oetringhaus, CERN
16 //-------------------------------------------------------------------------
17
18 class AliESDEvent;
19 class AliESDtrackCuts;
20 class TH1F;
21 class TH2F;
22 class TCollection;
23 class TMap;
24
25 class AliTriggerAnalysis : public TObject
26 {
27   public:
28     enum Trigger { kAcceptAll = 1, kMB1 = 2, kMB2, kMB3, kSPDGFO, kSPDGFOBits, kV0A, kV0C, kV0OR, kV0AND, 
29       kV0ABG, kV0CBG, kZDC, kZDCA, kZDCC, kFMDA, kFMDC, kFPANY, kNSD1, kMB1Prime, 
30       kSPDGFOL0, kSPDGFOL1, kZDCTDCA, kZDCTDCC, kZDCTime, kCTPV0A, kCTPV0C, kTPCLaserWarmUp, 
31       kStartOfFlags = 0x0100, kOfflineFlag = 0x8000, kOneParticle = 0x10000, kOneTrack = 0x20000}; // MB1, MB2, MB3 definition from ALICE-INT-2005-025
32     enum AliceSide { kASide = 1, kCSide, kCentralBarrel };
33     enum V0Decision { kV0Invalid = -1, kV0Empty = 0, kV0BB, kV0BG, kV0Fake };
34     
35     AliTriggerAnalysis();
36     virtual ~AliTriggerAnalysis();
37     
38     void EnableHistograms();
39     void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
40     
41     Bool_t IsTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
42     Int_t EvaluateTrigger(const AliESDEvent* aEsd, Trigger trigger);
43     
44     // using trigger bits in ESD
45     Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, Trigger trigger) const;
46     Bool_t IsTriggerBitFired(ULong64_t triggerMask, Trigger trigger) const;
47     Bool_t IsTriggerBitFired(const AliESDEvent* aEsd, ULong64_t tclass) const;
48     
49     // using ESD data from detectors
50     Bool_t IsOfflineTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
51
52     // using trigger classes in ESD
53     Bool_t IsTriggerClassFired(const AliESDEvent* aEsd, const Char_t* tclass) const;
54     
55     // some "raw" trigger functions
56     Int_t SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, Bool_t fillHists = kFALSE, Int_t layer = 0);
57     Bool_t SPDGFOTrigger(const AliESDEvent* aEsd, Int_t origin);
58     V0Decision V0Trigger(const AliESDEvent* aEsd, AliceSide side, Bool_t online, Bool_t fillHists = kFALSE);
59     Bool_t ZDCTrigger   (const AliESDEvent* aEsd, AliceSide side) const;
60     Bool_t ZDCTDCTrigger(const AliESDEvent* aEsd, AliceSide side, Bool_t useZN=kTRUE, Bool_t useZP=kFALSE, Bool_t fillHists=kFALSE) const;
61     Bool_t ZDCTimeTrigger(const AliESDEvent *aEsd, Bool_t fillHists=kFALSE) const;
62     Bool_t FMDTrigger(const AliESDEvent* aEsd, AliceSide side);
63     Int_t SSDClusters(const AliESDEvent* aEsd);
64     static const char* GetTriggerName(Trigger trigger);
65     
66     Bool_t IsLaserWarmUpTPCEvent(const AliESDEvent* esd);
67     
68     void FillHistograms(const AliESDEvent* aEsd);
69     void FillTriggerClasses(const AliESDEvent* aEsd);
70     
71     void SetSPDGFOThreshhold(Int_t t) { fSPDGFOThreshold = t; }
72     void SetSPDGFOEfficiency(TH1F* hist) { fSPDGFOEfficiency = hist; }
73     void SetV0TimeOffset(Float_t offset) { fV0TimeOffset = offset; }
74     void SetV0AdcThr(Float_t thr) { fV0AdcThr = thr; }
75     void SetV0HwPars(Float_t thr, Float_t winLow, Float_t winHigh) { fV0HwAdcThr = thr; fV0HwWinLow = winLow; fV0HwWinHigh = winHigh; }
76     void SetFMDThreshold(Float_t low, Float_t hit) { fFMDLowCut = low; fFMDHitCut = hit; }
77     void SetDoFMD(Bool_t flag = kTRUE) {fDoFMD = flag;}
78     void SetZDCCutParams(Float_t refSum, Float_t refDelta, Float_t sigmaSum, Float_t sigmaDelta) { fZDCCutRefSum = refSum; fZDCCutRefDelta = refDelta; fZDCCutSigmaSum = sigmaSum; fZDCCutSigmaDelta = sigmaDelta; }
79
80     Int_t GetSPDGFOThreshhold() const { return fSPDGFOThreshold; }
81     Float_t GetV0TimeOffset() const { return fV0TimeOffset; }
82     Float_t GetV0AdcThr()     const { return fV0AdcThr; }
83     Float_t GetFMDLowThreshold() const { return fFMDLowCut; }
84     Float_t GetFMDHitThreshold() const { return fFMDHitCut; }
85     TMap * GetTriggerClasses() const { return fTriggerClasses;}
86
87
88     virtual Long64_t Merge(TCollection* list);
89     void SaveHistograms() const;
90     
91     void PrintTriggerClasses() const;
92     void SetESDTrackCuts(AliESDtrackCuts* cuts) { fEsdTrackCuts = cuts;}
93     AliESDtrackCuts* GetESDTrackCuts() const  {return fEsdTrackCuts;}
94
95
96   protected:
97     Bool_t IsL0InputFired(const AliESDEvent* aEsd, UInt_t input) const;
98     Bool_t IsL1InputFired(const AliESDEvent* aEsd, UInt_t input) const;
99     Bool_t IsL2InputFired(const AliESDEvent* aEsd, UInt_t input) const;
100     Bool_t IsInputFired(const AliESDEvent* aEsd, Char_t level, UInt_t input) const;
101     
102     Float_t V0CorrectLeadingTime(Int_t i, Float_t time, Float_t adc, Int_t runNumber) const;
103     Float_t V0LeadingTimeWeight(Float_t adc) const;
104     
105     Int_t FMDHitCombinations(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists = kFALSE);
106
107     Int_t fSPDGFOThreshold;         // number of chips to accept a SPD GF0 trigger
108     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)
109     
110     Float_t fV0TimeOffset;          // time offset applied to the times read from the V0 (in ns)
111     Float_t fV0AdcThr;              // thresholds applied on V0 ADC data
112     Float_t fV0HwAdcThr;            // online V0 trigger - thresholds applied on ADC data 
113     Float_t fV0HwWinLow;            // online V0 trigger - lower edge of time window
114     Float_t fV0HwWinHigh;           // online V0 trigger - upper edge of time window
115     
116     Float_t fZDCCutRefSum;          // ZDC time cut configuration
117     Float_t fZDCCutRefDelta;        // ZDC time cut configuration
118     Float_t fZDCCutSigmaSum;        // ZDC time cut configuration
119     Float_t fZDCCutSigmaDelta;      // ZDC time cut configuration
120
121     Bool_t  fDoFMD;                 // If false, skips the FMD (physics selection runs much faster)
122     Float_t fFMDLowCut;             // 
123     Float_t fFMDHitCut;             // 
124     
125     TH2F* fHistBitsSPD;        // offline trigger bits (calculated from clusters) vs hardware trigger bits
126     TH1F* fHistFiredBitsSPD;   // fired hardware bits
127     TH1F* fHistV0A;            // histograms that histogram the criterion the cut is applied on: bb triggers
128     TH1F* fHistV0C;            // histograms that histogram the criterion the cut is applied on: bb triggers
129     TH1F* fHistZDC;            //histograms that histogram the criterion the cut is applied on: fired bits (6 bins)
130     TH1F* fHistTDCZDC;         // histograms that histogram the criterion the cut is applied on: TDC bits (32 bins)
131     TH2F* fHistTimeZDC;        // histograms that histogram the criterion the cut is applied on: ZDC TDC timing
132     TH2F* fHistTimeCorrZDC;    // histograms that histogram the criterion the cut is applied on: ZDC Corrected TDC timing
133     TH1F* fHistFMDA;           // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
134     TH1F* fHistFMDC;           // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
135     TH1F* fHistFMDSingle;      // histograms that histogram the criterion the cut is applied on: single mult value (more than one entry per event)
136     TH1F* fHistFMDSum;         // histograms that histogram the criterion the cut is applied on: summed mult value (more than one entry per event)
137     
138     TMap* fTriggerClasses;    // counts the active trigger classes (uses the full string)
139     
140     Bool_t fMC;              // flag if MC is analyzed
141     AliESDtrackCuts* fEsdTrackCuts;  //Track Cuts to select ESD tracks
142
143     ClassDef(AliTriggerAnalysis, 14)
144     
145   private:
146     AliTriggerAnalysis(const AliTriggerAnalysis&);
147     AliTriggerAnalysis& operator=(const AliTriggerAnalysis&);
148 };
149
150 #endif