]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliTriggerAnalysis.h
Fixed compilation
[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 TH1F;
20 class TH2F;
21 class TCollection;
22 class TMap;
23
24 class AliTriggerAnalysis : public TObject
25 {
26   public:
27     enum Trigger { kAcceptAll = 1, kMB1 = 2, kMB2, kMB3, kSPDGFO, kSPDGFOBits, kV0A, kV0C, kV0OR, kV0AND, kV0ABG, kV0CBG, kZDC, kZDCA, kZDCC, kFMDA, kFMDC, kFPANY, kNSD1, kMB1Prime, kStartOfFlags = 0x0100, kOfflineFlag = 0x8000, kOneParticle = 0x16000 }; // MB1, MB2, MB3 definition from ALICE-INT-2005-025
28     enum AliceSide { kASide = 1, kCSide, kCentralBarrel };
29     enum V0Decision { kV0Invalid = -1, kV0Empty = 0, kV0BB, kV0BG, kV0Fake };
30     
31     AliTriggerAnalysis();
32     virtual ~AliTriggerAnalysis();
33     
34     void EnableHistograms();
35     void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
36     
37     Bool_t IsTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
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
45     Bool_t IsOfflineTriggerFired(const AliESDEvent* aEsd, Trigger trigger);
46
47     // using trigger classes in ESD
48     Bool_t IsTriggerClassFired(const AliESDEvent* aEsd, const Char_t* tclass) const;
49     
50     // some "raw" trigger functions
51     Int_t SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, Bool_t fillHists = kFALSE);
52     Bool_t SPDGFOTrigger(const AliESDEvent* aEsd, Int_t origin);
53     V0Decision V0Trigger(const AliESDEvent* aEsd, AliceSide side, Bool_t online, Bool_t fillHists = kFALSE);
54     Bool_t ZDCTrigger(const AliESDEvent* aEsd, AliceSide side) const;
55     Bool_t FMDTrigger(const AliESDEvent* aEsd, AliceSide side);
56     Int_t SSDClusters(const AliESDEvent* aEsd);
57     static const char* GetTriggerName(Trigger trigger);
58     
59     void FillHistograms(const AliESDEvent* aEsd);
60     void FillTriggerClasses(const AliESDEvent* aEsd);
61     
62     void SetSPDGFOThreshhold(Int_t t) { fSPDGFOThreshold = t; }
63     void SetSPDGFOEfficiency(TH1F* hist) { fSPDGFOEfficiency = hist; }
64     void SetV0TimeOffset(Float_t offset) { fV0TimeOffset = offset; }
65     void SetV0AdcThr(Float_t thr) { fV0AdcThr = thr; }
66     void SetV0HwPars(Float_t thr, Float_t winLow, Float_t winHigh) { fV0HwAdcThr = thr; fV0HwWinLow = winLow; fV0HwWinHigh = winHigh; }
67     void SetFMDThreshold(Float_t low, Float_t hit) { fFMDLowCut = low; fFMDHitCut = hit; }
68     
69     Int_t GetSPDGFOThreshhold() const { return fSPDGFOThreshold; }
70     Float_t GetV0TimeOffset() const { return fV0TimeOffset; }
71     Float_t GetV0AdcThr()     const { return fV0AdcThr; }
72     Float_t GetFMDLowThreshold() const { return fFMDLowCut; }
73     Float_t GetFMDHitThreshold() const { return fFMDHitCut; }
74     
75     virtual Long64_t Merge(TCollection* list);
76     void SaveHistograms() const;
77     
78     void PrintTriggerClasses() const;
79
80   protected:
81     Bool_t IsL0InputFired(const AliESDEvent* aEsd, UInt_t input) const;
82     Bool_t IsL1InputFired(const AliESDEvent* aEsd, UInt_t input) const;
83     Bool_t IsL2InputFired(const AliESDEvent* aEsd, UInt_t input) const;
84     Bool_t IsInputFired(const AliESDEvent* aEsd, Char_t level, UInt_t input) const;
85     
86     Float_t V0CorrectLeadingTime(Int_t i, Float_t time, Float_t adc, Int_t runNumber) const;
87     Float_t V0LeadingTimeWeight(Float_t adc) const;
88     
89     Int_t FMDHitCombinations(const AliESDEvent* aEsd, AliceSide side, Bool_t fillHists = kFALSE);
90
91     Int_t fSPDGFOThreshold;         // number of chips to accept a SPD GF0 trigger
92     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)
93     
94     Float_t fV0TimeOffset;          // time offset applied to the times read from the V0 (in ns)
95     Float_t fV0AdcThr;              // thresholds applied on V0 ADC data
96     Float_t fV0HwAdcThr;            // online V0 trigger - thresholds applied on ADC data 
97     Float_t fV0HwWinLow;            // online V0 trigger - lower edge of time window
98     Float_t fV0HwWinHigh;           // online V0 trigger - upper edge of time window
99
100     Float_t fFMDLowCut;             // 
101     Float_t fFMDHitCut;             // 
102     
103     TH2F* fHistBitsSPD;        // offline trigger bits (calculated from clusters) vs hardware trigger bits
104     TH1F* fHistFiredBitsSPD;   // fired hardware bits
105     TH1F* fHistV0A;            // histograms that histogram the criterion the cut is applied on: bb triggers
106     TH1F* fHistV0C;            // histograms that histogram the criterion the cut is applied on: bb triggers
107     TH1F* fHistZDC;            // histograms that histogram the criterion the cut is applied on: fired bits (6 bins)
108     TH1F* fHistFMDA;           // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
109     TH1F* fHistFMDC;           // histograms that histogram the criterion the cut is applied on: number of hit combination above threshold
110     TH1F* fHistFMDSingle;      // histograms that histogram the criterion the cut is applied on: single mult value (more than one entry per event)
111     TH1F* fHistFMDSum;         // histograms that histogram the criterion the cut is applied on: summed mult value (more than one entry per event)
112     
113     TMap* fTriggerClasses;    // counts the active trigger classes (uses the full string)
114     
115     Bool_t fMC;              // flag if MC is analyzed
116
117     ClassDef(AliTriggerAnalysis, 9)
118     
119   private:
120     AliTriggerAnalysis(const AliTriggerAnalysis&);
121     AliTriggerAnalysis& operator=(const AliTriggerAnalysis&);
122 };
123
124 #endif