]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/UserTasks/AliAnalysisTaskJetHBOM.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGJE / UserTasks / AliAnalysisTaskJetHBOM.h
1 #ifndef ALIANALYSISTASKJETHBOM_H
2 #define ALIANALYSISTASKJETHBOM_H
3  
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 // **************************************
8 // Task used for the correction of detector effects for background fluctuations in jet spectra by the HBOM method
9 // *******************************************
10
11 #include  "AliAnalysisTaskSE.h"
12 #include  "THnSparse.h" // cannot forward declare ThnSparseF
13 #ifndef __CINT__
14 #include "fastjet/ClusterSequenceArea.hh"
15 #include "fastjet/AreaDefinition.hh"
16 #include "fastjet/JetDefinition.hh"
17 #include "fastjet/PseudoJet.hh"
18 #else
19 namespace fastjet {
20   class PseudoJet;
21   class GhostedAreaSpec;
22   class AreaType;
23   class JetDefinition;
24   class JetAlgorithm;
25   class Strategy;
26   class RecombinationScheme;
27 }
28 #endif
29 #include "TH1F.h"
30 #include "TH2D.h"
31
32
33 ////////////////
34 class AliJetHeader;
35 class AliESDEvent;
36 class AliAODEvent;
37 class AliAODExtension;
38 class AliAODJet;
39 class AliGenPythiaEventHeader;
40 class AliCFManager;
41 class AliAODJetEventBackground;
42 class AliJetFinder;
43 class TList;
44 class TChain;
45 class TH3F;
46 class TProfile;
47 class TRandom3;
48 class TRefArray;
49 class TClonesArray;
50 class TF1;
51
52 class AliAnalysisTaskJetHBOM : public AliAnalysisTaskSE
53 {
54  public:
55     AliAnalysisTaskJetHBOM();
56     AliAnalysisTaskJetHBOM(const char* name);
57     virtual ~AliAnalysisTaskJetHBOM();
58     // Implementation of interface methods
59     virtual void UserCreateOutputObjects();
60     virtual void Init();
61     virtual void LocalInit() { Init(); }
62     virtual void UserExec(Option_t *option);
63     virtual void Terminate(Option_t *option);
64     virtual Bool_t Notify();
65
66     
67
68     virtual void SetAODTrackInput(Bool_t b){fUseAODTrackInput = b;}
69     virtual void SetAODMCInput(Bool_t b){fUseAODMCInput = b;}
70     virtual void SetEventSelection(Bool_t b){fEventSelection = b;}
71     virtual void SetTrackEtaWindow(Float_t f){fTrackEtaWindow = f;}
72     virtual void SetTrackTypeGen(Int_t i){fTrackTypeGen = i;}
73     virtual void SetTrackTypeRec(Int_t i){fTrackTypeRec = i;}
74     virtual void SetTrackPtCut(Float_t x){fTrackPtCut = x;}
75     virtual void SetCentralityCut(Float_t xLo,Float_t xUp){fCentCutLo = xLo; fCentCutUp = xUp;}
76     virtual void SetFilterMask(UInt_t i,Int_t iType = 0){fFilterMask = i;
77       fFilterType = iType;}
78     virtual void SetJetTypes(UInt_t i){fJetTypes = i;}
79     virtual void SetVtxCuts(Float_t z,Float_t r = 1){fVtxZCut = z; fVtxR2Cut = r *r;}    
80     virtual void SetBackgroundBranch(const char* c){fBackgroundBranch = c;}
81     virtual const char* GetBackgroundBranch(){return fBackgroundBranch.Data();}    
82     virtual void SetNSkipLeadingRan(Int_t x){fNSkipLeadingRan = x;}
83     virtual void SetNSkipLeadingCone(Int_t x){fNSkipLeadingCone = x;}
84     virtual void SetNRandomCones(Int_t x){fNRandomCones = x;}
85     virtual void SetRandConePos(Double_t eta, Double_t phi){randCone_pos=1;randCone_Eta=eta;randCone_Phi=phi;}
86
87     virtual void SetfNHBOM(Int_t x){fNHBOM = x;};
88     virtual void SetEfficiencyPt(TH1F *h){fh1efficiencyPt = (TH1F*)h->Clone("h1efficiencyPt");}
89     virtual void SetEfficiencyPhi(TH2D *h){fh2efficiencyPhi = (TH2D*)h->Clone("h2efficiencyPhi");}
90
91     virtual void SetJetOutputBranch(const char *c){fNonStdBranch = c;}
92     virtual const char* GetJetOutputBranch(){return fNonStdBranch.Data();}
93     virtual void SetJetOutputFile(const char *c){fNonStdFile = c;}
94     virtual const char* GetJetOutputFile(){return fNonStdFile.Data();}
95     virtual void SetMaxTrackPtInJet(Float_t x){fMaxTrackPtInJet = x;}
96     virtual void SetJetOutputMinPt(Float_t x){fJetOutputMinPt = x;}
97
98     //Setters for detector level effects
99     virtual void SetSmearResolution(Bool_t b){fUseTrMomentumSmearing = b;} 
100     virtual void SetDiceEfficiency(Bool_t b){fUseDiceEfficiency = b;} 
101     virtual void SetMomentumResolutionHybrid(TProfile *p1, TProfile *p2, TProfile *p3);
102     virtual void SetEfficiencyHybrid(TH1 *h1, TH1 *h2, TH1 *h3);
103
104     Double_t GetMomentumSmearing(Int_t cat, Double_t pt);
105     void FitMomentumResolution();
106
107
108     // for Fast Jet
109     fastjet::JetAlgorithm        GetAlgorithm()         const {return fAlgorithm;}
110     fastjet::Strategy            GetStrategy()          const {return fStrategy;}
111     fastjet::RecombinationScheme GetRecombScheme()      const {return fRecombScheme;}
112     fastjet::AreaType            GetAreaType()          const {return fAreaType;}
113     // Setters
114     void SetRparam(Double_t f)                           {fRparam = f;}
115     void SetAlgorithm(fastjet::JetAlgorithm f)           {fAlgorithm = f;}
116     void SetStrategy(fastjet::Strategy f)                {fStrategy = f;}
117     void SetRecombScheme(fastjet::RecombinationScheme f) {fRecombScheme = f;}
118     void SetAreaType(fastjet::AreaType f)                {fAreaType = f;}
119     void SetGhostArea(Double_t f) {fGhostArea = f;}
120     void SetActiveAreaRepeats(Int_t f) {fActiveAreaRepeats = f;}
121     void SetGhostEtamax(Double_t f) {fGhostEtamax = f;}
122
123
124
125     // Helper
126     //
127
128     // we have different cases
129     // AOD reading -> MC from AOD
130     // ESD reading -> MC from Kinematics
131     // this has to match with our selection of input events
132     enum {kTrackUndef = 0, kTrackAOD, kTrackKineAll,kTrackKineCharged, kTrackAODMCAll, kTrackAODMCCharged, kTrackAODMCChargedAcceptance, kTrackAODextra, kTrackAODextraonly};
133     enum {kMaxJets = 4};
134     enum {kMaxCorrelation =  3};
135     enum {kMaxRadius =       5};
136     enum {kMaxCent =         4};
137     enum {kJet = 1<<0,
138           kJetRan = 1<<1,         
139           kRC = 1<<2,
140           kRCRan = 1<<3
141     };
142     
143
144  private:
145
146     AliAnalysisTaskJetHBOM(const AliAnalysisTaskJetHBOM&);
147     AliAnalysisTaskJetHBOM& operator=(const AliAnalysisTaskJetHBOM&);
148
149     Int_t GetListOfTracks(TList *list,Int_t type);
150
151     AliAODEvent     *fAOD;                // ! where we take the jets from can be input or output AOD
152     AliAODExtension *fAODExtension;       // ! AOD extension in case we write a non-sdt branch to a separate file and the aod is standard
153     TRefArray       *fRef;               // ! trefarray for track references within the jet
154     Bool_t        fUseAODTrackInput;      // take track from input AOD not from ouptu AOD
155     Bool_t        fUseAODMCInput;         // take MC from input AOD not from ouptu AOD
156     Bool_t        fEventSelection;        // use the event selection of this task, otherwise analyse all
157     UInt_t        fFilterMask;            // filter bit for slecected tracks
158     UInt_t        fFilterMaskBestPt;      // filter bit to mark jets with high quality leading tracks
159
160     UInt_t        fFilterType;            // filter type 0 = all, 1 = ITSTPC, 2 = TPC
161     UInt_t        fJetTypes;              // 1<<0 regular jets, 1<<1 << randomized event 1<<2 random cones 1<<3 random cones randomiuzed event
162     Int_t         fTrackTypeRec;          // type of tracks used for FF 
163     Int_t         fTrackTypeGen;          // type of tracks used for FF 
164     Int_t         fNSkipLeadingRan;       // number of leading tracks to be skipped in the randomized event
165     Int_t         fNSkipLeadingCone;      // number of leading jets to be for the random cones
166     Int_t         fNRandomCones;          // number of generated random cones
167     Bool_t        randCone_pos;           // use fixed position for random cones
168     Double_t      randCone_Eta;           // eta for random Cone at fixed position
169     Double_t      randCone_Phi;           // phi for random Cone at fixed position
170     Int_t         fNHBOM;                 // number of detector runs
171     Float_t       fTrackEtaWindow;        // eta window used for corraltion plots between rec and gen 
172     Float_t       fTrackPtCut;            // minimum track pt to be accepted
173     Float_t       fJetOutputMinPt;        // minimum p_t for jets to be written out
174     Float_t       fMaxTrackPtInJet;       // maximum track pt within a jet for flagging...
175     //    Float_t       fJetTriggerPtCut;       // minimum jwt pT for AOD to be written
176     Float_t       fVtxZCut;               // zvtx cut
177     Float_t       fVtxR2Cut;              // R vtx cut (squared) 
178     Float_t       fCentCutUp;             // upper limit on centrality
179     Float_t       fCentCutLo;             // lower limit on centrality
180     // output configurartion
181     TString       fNonStdBranch;      // the name of the non-std branch name, if empty no branch is filled
182     TString       fBackgroundBranch;  // name of the branch used for background subtraction
183     TString       fNonStdFile;        // The optional name of the output file the non-std branch is written to
184
185     //Detector level effects
186     TProfile *fMomResH1; // Momentum resolution from TrackQA Hybrid Category 1
187     TProfile *fMomResH2; // Momentum resolution from TrackQA Hybrid Category 2
188     TProfile *fMomResH3; // Momentum resolution from TrackQA Hybrid Category 3
189     TF1 *fMomResH1Fit; //fit
190     TF1 *fMomResH2Fit; //fit
191     TF1 *fMomResH3Fit; //fit
192
193     TH1      *fhEffH1;        // Efficiency for Spectra Hybrid Category 1
194     TH1      *fhEffH2;        // Efficiency for Spectra Hybrid Category 2
195     TH1      *fhEffH3;        // Efficiency for Spectra Hybrid Category 3
196     Bool_t    fUseTrMomentumSmearing;     // Apply momentum smearing on track level
197     Bool_t    fUseDiceEfficiency;         // Apply efficiency on track level by dicing
198
199     // Fast jet
200     Double_t fRparam;                  // fastjet distance parameter
201     fastjet::JetAlgorithm fAlgorithm; //fastjet::kt_algorithm
202     fastjet::Strategy fStrategy;  //= fastjet::Best;
203     fastjet::RecombinationScheme fRecombScheme; // = fastjet::BIpt_scheme;
204     fastjet::AreaType fAreaType;  // fastjet area type
205     Double_t fGhostArea;          // fasjet ghost area
206     Int_t fActiveAreaRepeats;     // fast jet active area repeats
207     Double_t fGhostEtamax;        // fast jet ghost area
208
209     Double_t background; //background rho in the event
210
211     TClonesArray  *fTCARandomConesOut;    //! TCA of output jets in randomized event
212
213     TRandom3*     fRandom;   //! random number generator
214     TProfile*     fh1Xsec;   //! pythia cross section and trials
215     TH1F*         fh1Trials; //! trials are added
216     TH1F*         fh1PtHard;  //! Pt har of the event...       
217     TH1F*         fh1PtHardNoW;  //! Pt har of the event without weigt       
218     TH1F*         fh1PtHardTrials;  //! Number of trials 
219
220     TH1F*         fh1Nch;            //! charged particle mult
221     TH1F*         fh1CentralityPhySel;          // ! centrality of anaylsed events 
222     TH1F*         fh1Centrality;                // ! centrality of selected events 
223     TH1F*         fh1DeltapT;        // pT of random Cone - background energy
224     TH1F*         fh1Rho;            //background rho
225     TH1F*         fh1RhoSigma;       //fluctuation of the background
226     TH1F*         fh1PtRandCone;     //pT of random Cone
227
228     TH1F*         fh1efficiencyPt;          //here efficiency is stored
229     TH2D*         fh2efficiencyPhi;         //here efficiency is stored
230
231     TH1F*         fh1ZPhySel;          // ! zvtx of anaylsed events 
232     TH1F*         fh1Z;                // ! zvtx of selected events 
233
234
235     TList *fHistList; //!leading tracks to be skipped in the randomized event Output list
236    
237
238     ClassDef(AliAnalysisTaskJetHBOM, 1) 
239 };
240  
241 #endif