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