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