]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/UserTasks/AliAnalysisTaskJetsTriggerTRD.h
updates to TRD trigger analysis
[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* const branchName) { strncpy(fJetBranchName, branchName, fgkStringLength-1); }
34   const char* GetJetBranchName() const { return fJetBranchName; }
35
36   // histograms
37   enum Hist_t {
38       kHistStat = 0,
39       kHistNoJets,
40       kHistTrackGTU,
41       kHistJetPt, kHistJetPtITS, kHistJetPt3x3,
42       kHistJetPtEMC, kHistJetPtHJT,
43       kHistJetPtNoTracks3,
44       kHistLast
45   };
46
47   // statistics
48   enum Stat_t {
49       kStatSeen = 1,
50       kStatUsed,
51       kStatMB,
52       kStatLast
53   };
54
55   // trigger conditions
56   enum Trigger_t { 
57       kTrgMB = 0,
58       kTrgInt,
59       kTrgInt78,
60       kTrgHJT,
61       kTrgEMC,
62       kTrgLast
63   };       
64
65 protected:
66   UInt_t fTriggerMask;          // internal representation of trigger conditions
67
68   Bool_t DetectTriggers();
69   void   MarkTrigger(Trigger_t trg) { fTriggerMask |= (1 << trg); }
70   Bool_t IsTrigger(Trigger_t trg) const { return (fTriggerMask & (1 << trg)); }
71
72   // output objects
73   TList *fOutputList;           // list of output objects
74
75   // histogram management
76   TH1  *fHist[kHistLast];       //! pointers to histogram
77   const char *fShortTaskId;     //! short identifier for the task
78
79   TH1*&  GetHistogram(Hist_t hist, const Int_t idx = 0) { return fHist[hist + idx]; }
80
81   TH1*   AddHistogram(Hist_t hist, const char *hid, TString title,
82                       Int_t xbins, Float_t xmin, Float_t xmax, Int_t binType = 1);
83   TH2*   AddHistogram(Hist_t hist, const char *hid, TString title,
84                       Int_t xbins, Float_t xmin, Float_t xmax,
85                       Int_t ybins, Float_t ymin, Float_t ymax, Int_t binType = 1);
86   TH3*   AddHistogram(Hist_t hist, const char *hid, TString title,
87                       Int_t xbins, Float_t xmin, Float_t xmax,
88                       Int_t ybins, Float_t ymin, Float_t ymax,
89                       Int_t zbins, Float_t zmin, Float_t zmax, Int_t binType = 1);
90
91   void    FillH1(Hist_t hist, Float_t x, Float_t weight = 1., Int_t idx = 0)
92   { GetHistogram(hist, idx)->Fill(x, weight); }
93   void    FillH2(Hist_t hist, Float_t x, Float_t y, Float_t weight = 1., Int_t idx = 0)
94   { ((TH2*) GetHistogram(hist, idx))->Fill(x, y, weight); }
95   void    FillH3(Hist_t hist, Float_t x, Float_t y, Float_t z, Float_t weight = 1., Int_t idx = 0)
96   { ((TH3*) GetHistogram(hist, idx))->Fill(x, y, z, weight); }
97
98   // task configuration
99   Int_t    fNoJetPtBins;                // number of bins for jet pt
100   Float_t  fJetPtBinMax;                // max jet pt (GeV) in histograms
101
102   static const Int_t fgkStringLength = 100; // max length for the jet branch name
103   char fJetBranchName[fgkStringLength];     // jet branch name
104
105   // not implemented
106   AliAnalysisTaskJetsTriggerTRD(const AliAnalysisTaskJetsTriggerTRD &rhs);
107   AliAnalysisTaskJetsTriggerTRD& operator=(const AliAnalysisTaskJetsTriggerTRD &rhs);
108
109   ClassDef(AliAnalysisTaskJetsTriggerTRD, 1);
110 };