]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/UserTasks/AliAnalysisTaskJetsTriggerTRD.h
Fix for Coverity defect 21419
[u/mrichter/AliRoot.git] / PWGJE / UserTasks / AliAnalysisTaskJetsTriggerTRD.h
1 #include "TH1.h"
2 #include "TH2.h"
3 #include "TH3.h"
4
5 #include "AliLog.h"
6
7 #include "AliAnalysisTaskSE.h"
8
9 #define ID(x) x, #x
10
11 class TList;
12
13 class AliAnalysisTaskJetsTriggerTRD :
14   public AliAnalysisTaskSE
15 {
16 public:
17   AliAnalysisTaskJetsTriggerTRD(const char *name = "jets_trg_trd");
18   ~AliAnalysisTaskJetsTriggerTRD();
19
20   // analysis operations
21   virtual void   UserCreateOutputObjects();
22   virtual Bool_t Notify();
23   virtual void   UserExec(Option_t *option);
24   virtual void   Terminate(const Option_t *option);
25
26   // task configuration
27   void  SetNumberOfJetPtBins(Int_t n) { fNoJetPtBins = n; }
28   Int_t GetNumberOfJetPtBins() const { return fNoJetPtBins; }
29
30   void    SetJetPtBinMax(Float_t ptmax) { fJetPtBinMax = ptmax; }
31   Float_t GetJetPtBinMax() const { return fJetPtBinMax; }
32
33   void SetJetBranchName(const char* branchName) { strncpy(fJetBranchName, branchName, fgkStringLength-1); }
34   const char* GetJetBranchName() const { return fJetBranchName; }
35
36   // histograms
37   enum Hist_t {
38       kHistStat = 0,
39       kHistJetPtMC,
40       kHistNoJets,
41       kHistTrackGTU,
42       kHistNPtMin,
43       kHistLeadJetPt,
44       kHistJetPt,
45       kHistJetPtITS,
46       kHistJetPt3x3,
47       kHistJetPtNoTracks3,
48       kHistLast
49   };
50
51   // statistics
52   enum Stat_t {
53       kStatSeen = 1,
54       kStatTrg,
55       kStatUsed,
56       kStatEvCuts,
57       kStatLast
58   };
59
60   // trigger conditions
61   enum Trigger_t {
62     // untriggered
63     kTrgMinBias = 1, // CINT1
64     kTrgInt7,
65     kTrgInt8,
66     kTrgEMC7,
67     kTrgEMC8,
68     // TRD jet trigger (HJT)
69     kTrgInt7WUHJT,
70     kTrgInt8WUHJT,
71     kTrgEMC7WUHJT,
72     kTrgEMC8WUHJT,
73     kTrgEMCEJE,
74     kTrgEMCEGA,
75     //
76     kTrgLast
77   };       
78
79 protected:
80   UInt_t fTriggerMask;          // internal representation of trigger conditions
81
82   Bool_t DetectTriggers();
83   void   MarkTrigger(Trigger_t trg) { fTriggerMask |= (1 << trg); }
84   Bool_t IsTrigger(Trigger_t trg) const { return (fTriggerMask & (1 << trg)); }
85
86   // output objects
87   TList *fOutputList;           // list of output objects
88
89   // histogram management
90   TH1  *fHist[kHistLast];       //! pointers to histogram
91   const char *fShortTaskId;     //! short identifier for the task
92
93   TH1*&  GetHistogram(Hist_t hist, Int_t idx = 0) { return fHist[hist + idx]; }
94
95   TH1*   AddHistogram(Hist_t hist, const char *hid, TString title,
96                       Int_t xbins, Float_t xmin, Float_t xmax, Int_t binType = 1);
97   TH2*   AddHistogram(Hist_t hist, const char *hid, TString title,
98                       Int_t xbins, Float_t xmin, Float_t xmax,
99                       Int_t ybins, Float_t ymin, Float_t ymax, Int_t binType = 1);
100   TH3*   AddHistogram(Hist_t hist, const char *hid, TString title,
101                       Int_t xbins, Float_t xmin, Float_t xmax,
102                       Int_t ybins, Float_t ymin, Float_t ymax,
103                       Int_t zbins, Float_t zmin, Float_t zmax, Int_t binType = 1);
104
105   void    FillH1(Hist_t hist, Float_t x, Float_t weight = 1., Int_t idx = 0)
106   { GetHistogram(hist, idx)->Fill(x, weight); }
107   void    FillH2(Hist_t hist, Float_t x, Float_t y, Float_t weight = 1., Int_t idx = 0)
108   { ((TH2*) GetHistogram(hist, idx))->Fill(x, y, weight); }
109   void    FillH3(Hist_t hist, Float_t x, Float_t y, Float_t z, Float_t weight = 1., Int_t idx = 0)
110   { ((TH3*) GetHistogram(hist, idx))->Fill(x, y, z, weight); }
111
112   // task configuration
113   Int_t    fNoJetPtBins;                // number of bins for jet pt
114   Float_t  fJetPtBinMax;                // max jet pt (GeV) in histograms
115
116   Float_t  fXsection;                   // x-section from PYTHIA
117   Float_t  fAvgTrials;                  // ratio of PYTHIA events
118                                         // over accepted events
119   Float_t  fPtHard;                     // pt hard
120
121   static const Int_t fgkStringLength = 100; // max length for the jet branch name
122   char fJetBranchName[fgkStringLength];     // jet branch name
123
124   // not implemented
125   AliAnalysisTaskJetsTriggerTRD(const AliAnalysisTaskJetsTriggerTRD &rhs);
126   AliAnalysisTaskJetsTriggerTRD& operator=(const AliAnalysisTaskJetsTriggerTRD &rhs);
127
128   ClassDef(AliAnalysisTaskJetsTriggerTRD, 1);
129 };