]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.h
ab5dc4791136fc1df3572ace3fce6c1e2dddff54
[u/mrichter/AliRoot.git] / PWG4 / JetTasks / AliAnalysisTaskJetSpectrum2.h
1
2 #ifndef ALIANALYSISTASKJETSPECTRUM2_H
3 #define ALIANALYSISTASKJETSPECTRUM2_H
4  
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 // **************************************
9 // Task used for the correction of determiantion of reconstructed jet spectra
10 // Compares input (gen) and output (rec) jets   
11 // *******************************************
12
13 #include  "AliAnalysisTaskSE.h"
14 #include  "THnSparse.h" // cannot forward declare ThnSparseF
15
16 ////////////////
17 class AliJetHeader;
18 class AliESDEvent;
19 class AliAODEvent;
20 class AliAODExtension;
21 class AliAODJet;
22 class AliVParticle;
23 class AliAODJetEventBackground;
24 class AliGenPythiaEventHeader;
25 class AliCFManager;
26 class AliTHn;
27
28 class TList;
29 class TChain;
30 class TH1F;
31 class TH2F;
32 class TH3F;
33 class TRandom3;
34 class TProfile;
35 class TSTring;
36
37
38 class AliAnalysisTaskJetSpectrum2 : public AliAnalysisTaskSE
39 {
40  public:
41     AliAnalysisTaskJetSpectrum2();
42     AliAnalysisTaskJetSpectrum2(const char* name);
43     virtual ~AliAnalysisTaskJetSpectrum2() {;}
44     // Implementation of interface methods
45     virtual void UserCreateOutputObjects();
46     virtual void Init();
47     virtual void LocalInit() { Init(); }
48     virtual void UserExec(Option_t *option);
49     virtual void Terminate(Option_t *option);
50     virtual Bool_t Notify();
51
52     virtual void SetUseGlobalSelection(Bool_t b){fUseGlobalSelection = b;}
53     virtual void SetEventClass(Int_t i){fEventClass = i;}
54     virtual void SetExternalWeight(Float_t f){fExternalWeight = f;}
55     virtual void SetUseExternalWeightOnly(Bool_t b){fUseExternalWeightOnly = b;}
56     virtual void SetAODJetInput(Bool_t b){fUseAODJetInput = b;}
57     virtual void SetAODTrackInput(Bool_t b){fUseAODTrackInput = b;}
58     virtual void SetAODMCInput(Bool_t b){fUseAODMCInput = b;}
59     virtual void SetLimitGenJetEta(Bool_t b){fLimitGenJetEta = b;}
60     virtual void SetJetEtaWindow(Float_t f){fJetRecEtaWindow = f;}
61     virtual void SetTrackEtaWindow(Float_t f){fTrackRecEtaWindow = f;}
62     virtual void SetNMatchJets(Short_t f){fNMatchJets = f;}
63     virtual void SetMinJetPt(Float_t f){fMinJetPt = f;}
64     virtual void SetNRPBins(Short_t i){fNRPBins = i;} 
65     virtual void SetFlagJetType(Int_t iType,Int_t iF){fFlagJetType[iType] = iF;}
66     virtual void SetMinTrackPt(Float_t f){fMinTrackPt = f;}
67     virtual void SetDeltaPhiWindow(Float_t f){fDeltaPhiWindow = f;}
68     virtual void SetAnalysisType(Int_t i){fAnalysisType = i;}
69     virtual void SetBranchGen(const char* c){fBranchGen = c;}
70     virtual void SetBranchRec(const char* c){fBranchRec = c;}
71     virtual void SetBranchBkgRec(const char* c){fBranchBkgRec = c;}  
72     virtual void SetBranchBkgGen(const char* c){fBranchBkgGen = c;}  
73     virtual void SetTrackTypeGen(Int_t i){fTrackTypeGen = i;}
74     virtual void SetTrackTypeRec(Int_t i){fTrackTypeRec = i;}
75     virtual void SetFilterMask(UInt_t i){fFilterMask = i;}
76     virtual void SetMatching(Bool_t b = kTRUE){fDoMatching = b;}
77     virtual void SetEventSelectionMask(UInt_t i){fEventSelectionMask = i;}
78     virtual void SetPhiWeights(TH3F *phiw){fh3PhiWeights = phiw;}
79     virtual void SetFlatteningCoeff(Float_t *fA,Float_t *fB){
80       fFlatA[0] = fA[0];fFlatA[1] = fA[1];
81       fFlatA[0] = fB[0];fFlatB[1] = fB[1];
82     }
83     virtual void SetDeltaQxy(Float_t *fD){
84       fDeltaQxy[0] = fD[0];
85       fDeltaQxy[1] = fD[1];
86     }
87     virtual void SetNonStdFile(char* c){fNonStdFile = c;} 
88
89
90     // Helper
91     //
92
93     // we have different cases
94     // AOD reading -> MC from AOD
95     // ESD reading -> MC from Kinematics
96     // this has to match with our selection of input events
97     enum {kTrackUndef = 0, kTrackAOD, kTrackKineAll,kTrackKineCharged, kTrackAODMCAll, kTrackAODMCCharged, kTrackAODMCChargedAcceptance};
98     enum {kAnaMC =  0x1, kAnaMCESD = 0x2};
99     enum {kMaxJets = 2};
100     enum {kJetRec = 0, kJetGen, kJetRecFull, kJetGenFull, kJetTypes}; //
101     enum {kMaxCorrelation =  3};
102     
103     // 
104     // 0 all jets
105     // 1 all jet in eta window
106     // 2 all jets with partner
107     // 3 all jets in eta window with partner
108     // 4 all jets with partner in eta window
109     enum {kStep0 = 0, kStep1, kStep2, kStep3, kStep4,kMaxStep};
110
111
112  private:
113
114     AliAnalysisTaskJetSpectrum2(const AliAnalysisTaskJetSpectrum2&);
115     AliAnalysisTaskJetSpectrum2& operator=(const AliAnalysisTaskJetSpectrum2&);
116
117     void    MakeJetContainer();
118     Int_t   GetListOfTracks(TList *list,Int_t type);
119     void    FillTrackHistos(TList &particlesList,int iType);
120     Float_t GetCentrality();
121     Bool_t  CalculateReactionPlaneAngle(const TList *trackList);
122     Int_t   GetPhiBin(Double_t phi);
123     Double_t GetPhiWeight(Double_t phi,Double_t signedpt);
124     Int_t   GetListOfJets(TList *list,TClonesArray* jarray,Int_t type);
125     void    FillJetHistos(TList &jetsList,TList &particlesList,Int_t iType);
126
127     void    FillMatchHistos(TList &recJetsList,TList &genJetsList);
128
129     Bool_t  JetSelected(AliAODJet *jet);
130     Int_t MultFromJetRefs(TClonesArray *jets);
131     AliVParticle *LeadingTrackFromJetRefs(AliAODJet* jet);
132     AliVParticle *LeadingTrackInCone(AliAODJet* jet,TList *list,Float_t r = 0.4);
133
134
135     AliJetHeader *fJetHeaderRec;//! The jet header that can be fetched from the userinfo
136     AliJetHeader *fJetHeaderGen;//! The jet header that can fetched from the userinfo
137     AliAODEvent  *fAODIn; //! where we take the jets from 
138     AliAODEvent  *fAODOut; //! where we take the jets from 
139     AliAODExtension  *fAODExtension; //! where we take the jets from can be input or output AOD
140     AliTHn   *fhnJetContainer;               //! like particle container in corrfw with different steps need AliCFContainer with Scale(), and clone() to do the same
141     AliTHn   *fhnCorrelation;                //! response matrix for unfolding 
142     THnSparseF   *fhnEvent;                  //! event counts 
143     TF1          *f1PtScale;                 //! correction function to correct to the average true jet energy depending on p_T,rec
144
145     TString       fBranchRec;  // AOD branch name for reconstructed
146     TString       fBranchGen;  // AOD brnach for genereated
147     TString       fBranchBkgRec;  //AOD branch for background 
148     TString       fBranchBkgGen;  //AOD branch for background 
149     TString       fNonStdFile; // name of delta aod file to catch the extension
150
151     TRandom3*     fRandomizer; //! randomizer
152
153     Bool_t        fUseAODJetInput;        // take jet from input AOD not from ouptu AOD
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        fUseGlobalSelection;    // Limit the eta of the generated jets
157     Bool_t        fUseExternalWeightOnly; // use only external weight
158     Bool_t        fLimitGenJetEta;        // Limit the eta of the generated jets
159     Bool_t        fDoMatching;            // switch on the matching between rec and gen
160     Short_t       fNMatchJets;            // number of leading jets considered from the list
161     Short_t       fNRPBins;               // number of bins with respect to RP
162     UInt_t        fFilterMask;            // filter bit for slecected tracks
163     UInt_t        fEventSelectionMask;    // Selection information used to filter events
164     Int_t         fAnalysisType;          // Analysis type 
165     Int_t         fTrackTypeRec;          // type of tracks used for FF 
166     Int_t         fTrackTypeGen;          // type of tracks used for FF 
167     Int_t         fFlagJetType[kJetTypes]; // disable the filling and booking of certain JetType histos
168     Int_t         fEventClass;            // event class to be looked at for this instance of the task
169     Int_t         fRPSubeventMethod;      // method for subevent calculation
170     Float_t       fAvgTrials;             // Average nimber of trials
171     Float_t       fExternalWeight;        // external weight
172     Float_t       fJetRecEtaWindow;       // eta window for rec jets
173     Float_t       fTrackRecEtaWindow;     // eta window for rec tracks
174     Float_t       fMinJetPt;              // limits the jet p_T in addition to what already is done in the jet finder, this is important for jet matching for JF with lo threshold
175     Float_t       fMinTrackPt;            // limits the track p_T 
176     Float_t       fDeltaPhiWindow;        // minium angle between dijets
177     Float_t       fCentrality;            // ! centrality
178     Float_t       fRPAngle;               // ! RP angle of the reaction plane
179     Float_t       fFlatA[2];              // flattening for RP
180     Float_t       fFlatB[2];              // flattening for RP
181     Float_t       fDeltaQxy[2];           // centering of QX QY
182     Int_t         fMultRec;               // ! reconstructed track multiplicity
183     Int_t         fMultGen;               // ! generated track multiplicity
184     
185
186     TProfile*     fh1Xsec;   //! pythia cross section and trials
187     TH1F*         fh1Trials; //! trials are added
188     TH1F*         fh1PtHard;  //! Pt har of the event...       
189     TH1F*         fh1PtHardNoW;  //! Pt har of the event without weigt       
190     TH1F*         fh1PtHardTrials;  //! Number of trials 
191     TH1F*         fh1ZVtx;          //! z-vtx distribution
192     TH1F*         fh1RP;            //! RP distribution
193     TH1F*         fh1Centrality;    //! centrality distribution
194     TH1F*         fh1TmpRho;        //! just temporary histo for calculation    
195     TH2F*         fh2MultRec;       //! reconstructed track multiplicity   
196     TH2F*         fh2MultGen;       //! generated track multiplicity   
197     TH2F*         fh2RPSubevents;   //! subevent RP 
198     TH2F*         fh2RPCentrality;   //! RP vs centrality
199     TH2F*         fh2RPDeltaRP;     //! centrality vs. RP dela  
200     TH2F*         fh2RPQxQy;        //! QX QY moments
201     TH2F*         fh2RPCosDeltaRP;  //! RP resolution
202
203     TH2F*         fh2PtFGen;                //! found vs generated 
204     TH2F*         fh2RelPtFGen;             //! relative difference between generated and found 
205
206     TH3F*         fh3PhiWeights;  // RP phi weights, need to be set externally
207     TH3F*         fh3RPPhiTracks; //! RP angle
208     
209
210     // Jet histos second go
211
212     TH1F*         fh1NJets[kJetTypes];      //! nr of gen jets
213     TH1F*         fh1SumPtTrack[kJetTypes]; //! sum over all track pT    
214
215     TH1F*         fh1PtIn[kJetTypes][kMaxJets+1];  //! Jet pt  
216     TH1F*         fh1PtJetsIn[kJetTypes];       //! Jet pt for all jets
217     TH1F*         fh1PtTracksIn[kJetTypes];     //! track pt for all tracks
218     TH1F*         fh1PtTracksInLow[kJetTypes];  //! track pt for all tracks
219     
220     TH2F*         fh2NJetsPt[kJetTypes];    //! Number of found jets above threshold
221     TH2F*         fh2NTracksPt[kJetTypes];  //! Number of tracks above threshold
222
223     THnSparseF    *fhnJetPt[kJetTypes];                  //! jet pt information for analysis
224     THnSparseF    *fhnJetPtQA[kJetTypes];                //! jet pt information for QA
225     THnSparseF    *fhnTrackPt[kJetTypes];                //! track pt information for analysis
226     THnSparseF    *fhnTrackPtQA[kJetTypes];              //! track pt information for analysis
227
228     TH2F*         fh2LTrackPtJetPt[kJetTypes][kMaxJets+1];       //! leading track within the jet vs jet pt 
229
230     TH1F*   fh1DijetMinv[kJetTypes];            //! dijet inv mass
231     TH2F*   fh2DijetDeltaPhiPt[kJetTypes];      //! dijet delta phi vs pt
232     TH2F*   fh2DijetAsymPt[kJetTypes];          //! dijet asym vs pt after delta phi cut
233     TH2F*   fh2DijetPt2vsPt1[kJetTypes];        //! dijet pt2 vs pt1
234     TH2F*   fh2DijetDifvsSum[kJetTypes];        //! dijet dif vs sum
235
236
237     TList *fHistList;                  //! Output list
238    
239
240     ClassDef(AliAnalysisTaskJetSpectrum2, 16) // Analysis task for standard jet analysis
241 };
242  
243 #endif