]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/EMCAL/AliAnalysisTaskEmcal.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliAnalysisTaskEmcal.h
1 #ifndef ALIANALYSISTASKEMCAL_H
2 #define ALIANALYSISTASKEMCAL_H
3
4 // $Id: AliAnalysisTaskEmcal.h 64518 2013-10-14 12:44:52Z loizides $
5
6 class TClonesArray;
7 class TString;
8 class TList;
9 class AliEmcalParticle;
10 class AliMCParticle;
11 class AliVCluster;
12 class AliVTrack;
13 class AliVParticle;
14 class AliVCaloCells;
15 class TH1;
16 class TProfile;
17 class AliEMCALGeometry;
18 class AliParticleContainer;
19 class AliClusterContainer;
20 class AliGenPythiaEventHeader;
21 class AliVCaloTrigger;
22 class AliAnalysisUtils;
23 class AliEmcalTriggerPatchInfo;
24
25 #include "Rtypes.h"
26
27 #include "AliAnalysisTaskSE.h"
28
29 class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
30  public:
31
32   enum BeamType {
33     kNA       = -1,
34     kpp       = 0,
35     kAA       = 1,
36     kpA       = 2
37   };
38
39   enum TriggerType {
40     kND       = -1,
41     kJ1       = 0,
42     kJ2       = 1,
43     kG1             = 2,
44     kG2             = 3,
45     kL0       = 4
46   };
47
48   enum TriggerCategory {
49     kTriggerLevel0 = 0,      // Online trigger categories
50     kTriggerLevel1Jet = 1,
51     kTriggerLevel1Gamma=2,
52     kTriggerRecalcJet = 3,   // Recalculated max trigger patch; does not need to be above trigger threshold
53     kTriggerRecalcGamma = 4
54   };
55
56   AliAnalysisTaskEmcal();
57   AliAnalysisTaskEmcal(const char *name, Bool_t histo=kFALSE); 
58   virtual ~AliAnalysisTaskEmcal();
59
60   AliParticleContainer       *AddParticleContainer(const char *n);
61   AliClusterContainer        *AddClusterContainer(const char *n);
62   AliParticleContainer       *GetParticleContainer(Int_t i=0)         const;
63   AliClusterContainer        *GetClusterContainer(Int_t i=0)          const;
64   AliParticleContainer       *GetParticleContainer(const char* name)  const;
65   AliClusterContainer        *GetClusterContainer(const char* name)   const;
66   void                        RemoveParticleContainer(Int_t i=0)                    { fParticleCollArray.RemoveAt(i)                      ; } 
67   void                        RemoveClusterContainer(Int_t i=0)                     { fClusterCollArray.RemoveAt(i)                       ; } 
68   void                        SetCaloCellsName(const char *n)                       { fCaloCellsName     = n                              ; }
69   void                        SetCaloTriggerPatchInfoName(const char *n)            { fCaloTriggerPatchInfoName = n                       ; }
70   void                        SetCaloTriggersName(const char *n)                    { fCaloTriggersName  = n                              ; }
71   void                        SetCentRange(Double_t min, Double_t max)              { fMinCent           = min  ; fMaxCent = max          ; }
72   void                        SetCentralityEstimator(const char *c)                 { fCentEst           = c                              ; }
73   void                        SetClusName(const char *n)                            { AddClusterContainer(n)                              ; }
74   void                        SetClusPtCut(Double_t cut, Int_t c=0);
75   void                        SetClusTimeCut(Double_t min, Double_t max, Int_t c=0);
76   void                        SetEventPlaneVsEmcal(Double_t ep)                     { fEventPlaneVsEmcal = ep                             ; }
77   void                        SetForceBeamType(BeamType f)                          { fForceBeamType     = f                              ; }
78   void                        SetHistoBins(Int_t nbins, Double_t min, Double_t max) { fNbins = nbins; fMinBinPt = min; fMaxBinPt = max    ; }
79   void                        SetIsEmbedded(Bool_t i)                               { fIsEmbedded        = i                              ; }
80   void                        SetIsPythia(Bool_t i)                                 { fIsPythia          = i                              ; }
81   void                        SetMCLabelShift(Int_t s)                              { fMCLabelShift      = s                              ; }
82   void                        SetMinMCLabel(Int_t s)                                { fMinMCLabel        = s                              ; }
83   void                        SetMinNTrack(Int_t min)                               { fMinNTrack         = min                            ; }
84   void                        SetMinPtTrackInEmcal(Double_t min)                    { fMinPtTrackInEmcal = min                            ; }
85   void                        SetNCentBins(Int_t n)                                 { fNcentBins         = n                              ; } 
86   void                        SetNeedEmcalGeom(Bool_t n)                            { fNeedEmcalGeom     = n                              ; }
87   void                        SetOffTrigger(UInt_t t)                               { fOffTrigger        = t                              ; }
88   void                        SetTrackEtaLimits(Double_t min, Double_t max, Int_t c=0);
89   void                        SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0);
90   void                        SetTrackPtCut(Double_t cut, Int_t c=0);
91   void                        SetTracksName(const char *n)                          { AddParticleContainer(n)                             ; }
92   void                        SetTrigClass(const char *n)                           { fTrigClass         = n                              ; } 
93   void                        SetTriggerTypeSel(TriggerType t)                      { fTriggerTypeSel    = t                              ; } 
94   void                        SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup = kTRUE) { fUseAliAnaUtils    = b ; fRejectPileup = bRejPilup  ; }
95   void                        SetVzRange(Double_t min, Double_t max)                { fMinVz             = min  ; fMaxVz   = max          ; }
96   void                        SetUseSPDTrackletVsClusterBG(Bool_t b)                { fTklVsClusSPDCut   = b                              ; }
97
98  protected:
99   void                        SetRejectionReasonLabels(TAxis* axis);
100   Double_t*                   GenerateFixedBinArray(Int_t n, Double_t min, Double_t max) const;
101   void                        GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array) const;
102   void                        SetMakeGeneralHistograms(Bool_t g)                    { fGeneralHistograms = g                              ; }
103   Bool_t                      AcceptCluster(AliVCluster *clus, Int_t c = 0)      const;
104   Bool_t                      AcceptTrack(AliVParticle *track, Int_t c = 0)      const;
105   void                        AddObjectToEvent(TObject *obj);
106   AliVParticle               *GetAcceptParticleFromArray(Int_t p, Int_t c=0)     const;
107   AliVCluster                *GetAcceptClusterFromArray(Int_t cl, Int_t c=0)     const;
108   TClonesArray               *GetArrayFromEvent(const char *name, const char *clname=0);
109   BeamType                    GetBeamType();
110   TClonesArray               *GetParticleArray(Int_t i=0)                        const;
111   TClonesArray               *GetClusterArray(Int_t i=0)                         const;
112   Int_t                       GetNParticles(Int_t i=0)                           const;
113   Int_t                       GetNClusters(Int_t i=0)                            const;
114   AliEmcalTriggerPatchInfo   *GetMainTriggerPatch(TriggerCategory triggersel = kTriggerLevel1Jet, Bool_t doOfflinSimple = kFALSE);
115   Bool_t                                                    HasTriggerType(TriggerType triggersel);
116   ULong_t                                                 GetTriggerList();
117   Bool_t                      PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard);
118   void                        UserCreateOutputObjects();
119   void                        UserExec(Option_t *option);
120   Bool_t                      UserNotify();
121
122   // Virtual functions, to be overloaded in derived classes
123   virtual void                ExecOnce();
124   virtual Bool_t              FillGeneralHistograms();
125   virtual Bool_t              IsEventSelected();
126   virtual Bool_t              RetrieveEventObjects();
127   virtual Bool_t              FillHistograms()                                     { return kTRUE                 ; }
128   virtual Bool_t              Run()                                                { return kTRUE                 ; }
129
130   BeamType                    fForceBeamType;              // forced beam type
131   Bool_t                      fGeneralHistograms;          // whether or not it should fill some general histograms
132   Bool_t                      fInitialized;                // whether or not the task has been already initialized
133   Bool_t                      fCreateHisto;                // whether or not create histograms
134   TString                     fCaloCellsName;              // name of calo cell collection
135   TString                     fCaloTriggersName;           // name of calo triggers collection
136   TString                     fCaloTriggerPatchInfoName;   // trigger patch info array name
137   Double_t                    fMinCent;                    // min centrality for event selection
138   Double_t                    fMaxCent;                    // max centrality for event selection
139   Double_t                    fMinVz;                      // min vertex for event selection
140   Double_t                    fMaxVz;                      // max vertex for event selection
141   Double_t                    fTrackPtCut;                 // cut on track pt in event selection
142   Int_t                       fMinNTrack;                  // minimum nr of tracks in event with pT>fTrackPtCut
143   Bool_t                      fUseAliAnaUtils;             // used for LHC13* data: z-vtx, Ncontributors, z-vtx resolution cuts
144   Bool_t                      fRejectPileup;               // Reject pilup using function AliAnalysisUtils::IsPileUpEvent()
145   Bool_t                      fTklVsClusSPDCut;            // Apply tracklet-vs-cluster SPD cut to reject background events in pp
146   AliAnalysisUtils           *fAliAnalysisUtils;           //! vertex selection (optional)
147   UInt_t                      fOffTrigger;                 // offline trigger for event selection
148   TString                     fTrigClass;                  // trigger class name for event selection
149   TriggerType                 fTriggerTypeSel;             // trigger type to select based on trigger patches
150   Int_t                       fNbins;                      // no. of pt bins
151   Double_t                    fMinBinPt;                   // min pt in histograms
152   Double_t                    fMaxBinPt;                   // max pt in histograms
153   Double_t                    fMinPtTrackInEmcal;          // min pt track in emcal
154   Double_t                    fEventPlaneVsEmcal;          // select events which have a certain event plane wrt the emcal
155   Double_t                    fMinEventPlane;              // minimum event plane value
156   Double_t                    fMaxEventPlane;              // maximum event plane value
157   TString                     fCentEst;                    // name of V0 centrality estimator
158   Bool_t                      fIsEmbedded;                 // trigger, embedded signal
159   Bool_t                      fIsPythia;                   // trigger, if it is a PYTHIA production
160   Int_t                       fSelectPtHardBin;            // select one pt hard bin for analysis
161   Int_t                       fMinMCLabel;                 // minimum MC label value for the tracks/clusters being considered MC particles
162   Int_t                       fMCLabelShift;               // if MC label > fMCLabelShift, MC label -= fMCLabelShift
163   Int_t                       fNcentBins;                  // how many centrality bins
164   Bool_t                      fNeedEmcalGeom;              // whether or not the task needs the emcal geometry
165   Bool_t                      fIsEsd;                      //!whether it's an ESD analysis
166   AliEMCALGeometry           *fGeom;                       //!emcal geometry
167   TClonesArray               *fTracks;                     //!tracks
168   TClonesArray               *fCaloClusters;               //!clusters
169   AliVCaloCells              *fCaloCells;                  //!cells
170   AliVCaloTrigger            *fCaloTriggers;               //!calo triggers
171   TClonesArray               *fTriggerPatchInfo;           //!trigger patch info array
172   Double_t                    fCent;                       //!event centrality
173   Int_t                       fCentBin;                    //!event centrality bin
174   Double_t                    fEPV0;                       //!event plane V0
175   Double_t                    fEPV0A;                      //!event plane V0A
176   Double_t                    fEPV0C;                      //!event plane V0C
177   Double_t                    fVertex[3];                  //!event vertex
178   Int_t                       fNVertCont;                  //!event vertex number of contributors
179   BeamType                    fBeamType;                   //!event beam type
180   AliGenPythiaEventHeader    *fPythiaHeader;               //!event Pythia header
181   Double_t                    fPtHard;                     //!event pt hard
182   Int_t                       fPtHardBin;                  //!event pt hard bin
183   Int_t                       fNTrials;                    //!event trials
184   Float_t                     fXsection;                   //!x-section from pythia header
185   TObjArray                   fParticleCollArray;          // particle/track collection array
186   TObjArray                   fClusterCollArray;           // cluster collection array
187   ULong_t                     fTriggers;                   // list of fired triggers
188
189   TList                      *fOutput;                     //!output list
190   TH1                        *fHistEventCount;             //!incoming and selected events
191   TH1                        *fHistTrialsAfterSel;         //!total number of trials per pt hard bin after selection
192   TH1                        *fHistEventsAfterSel;         //!total number of events per pt hard bin after selection
193   TProfile                   *fHistXsectionAfterSel;       //!x section from pythia header
194   TH1                        *fHistTrials;                 //!trials from pyxsec.root
195   TH1                        *fHistEvents;                 //!total number of events per pt hard bin
196   TProfile                   *fHistXsection;               //!x section from pyxsec.root
197   TH1                        *fHistPtHard;                 //!pt hard distribution
198   TH1                        *fHistCentrality;             //!event centrality distribution
199   TH1                        *fHistZVertex;                //!z vertex position
200   TH1                        *fHistEventPlane;             //!event plane distribution
201   TH1                        *fHistEventRejection;         //!book keep reasons for rejecting event
202
203  private:
204   AliAnalysisTaskEmcal(const AliAnalysisTaskEmcal&);            // not implemented
205   AliAnalysisTaskEmcal &operator=(const AliAnalysisTaskEmcal&); // not implemented
206
207   ClassDef(AliAnalysisTaskEmcal, 11) // EMCAL base analysis task
208 };
209 #endif