]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/AliAnalysisTaskJetSpectrum2.h
pectrum2: add histo + re-arrange filling matching container
[u/mrichter/AliRoot.git] / PWGJE / 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 AliCFContainer;
27 class AliTHn;
28
29 class TList;
30 class TChain;
31 class TH1F;
32 class TH2F;
33 class TH3F;
34 class TRandom3;
35 class TProfile;
36 class TProfile2D;
37 class TSTring;
38
39
40 class AliAnalysisTaskJetSpectrum2 : public AliAnalysisTaskSE
41 {
42  public:
43     AliAnalysisTaskJetSpectrum2();
44     AliAnalysisTaskJetSpectrum2(const char* name);
45     virtual ~AliAnalysisTaskJetSpectrum2();
46     // Implementation of interface methods
47     virtual void UserCreateOutputObjects();
48     virtual void Init();
49     virtual void LocalInit() { Init(); }
50     virtual void UserExec(Option_t *option);
51     virtual void Terminate(Option_t *option);
52     virtual Bool_t Notify();
53
54     virtual void SetUseGlobalSelection(Bool_t b){fUseGlobalSelection = b;}
55     virtual void SetEventClass(Int_t i){fEventClass = i;}
56     virtual void SetExternalWeight(Float_t f){fExternalWeight = f;}
57     virtual void SetUseExternalWeightOnly(Bool_t b){fUseExternalWeightOnly = b;}
58     virtual void SetAODJetInput(Bool_t b){fUseAODJetInput = b;}
59     virtual void SetAODTrackInput(Bool_t b){fUseAODTrackInput = b;}
60     virtual void SetAODMCInput(Bool_t b){fUseAODMCInput = b;}
61     virtual void SetLimitGenJetEta(Bool_t b){fLimitGenJetEta = b;}
62     virtual void SetJetEtaWindow(Float_t f){fJetRecEtaWindow = f;}
63     virtual void SetTrackEtaWindow(Float_t f){fTrackRecEtaWindow = f;}
64     virtual void SetNMatchJets(Short_t f){fNMatchJets = f;}
65     virtual void SetMinJetPt(Float_t f){fMinJetPt = f;}
66     virtual void SetNRPBins(Short_t i){fNRPBins = i;} 
67     virtual void SetNMultBins(Short_t i) {fNBinsMult=i;}
68     virtual void SetNPtLeadingBins(Short_t i) {fNBinsLeadingTrackPt=i;}
69     virtual void SetFlagJetType(Int_t iType,Int_t iF){fFlagJetType[iType] = iF;}
70     virtual void SetMinTrackPt(Float_t f){fMinTrackPt = f;}
71     virtual void SetDeltaPhiWindow(Float_t f){fDeltaPhiWindow = f;}
72     virtual void SetAnalysisType(Int_t i){fAnalysisType = i;}
73     virtual void SetBranchGen(const char* c){fBranchGen = c;}
74     virtual void SetBranchRec(const char* c){fBranchRec = c;}
75     virtual void SetBranchBkgRec(const char* c){fBranchBkgRec = c;}  
76     virtual void SetBranchBkgGen(const char* c){fBranchBkgGen = c;}  
77     virtual void SetTrackTypeGen(Int_t i){fTrackTypeGen = i;}
78     virtual void SetTrackTypeRec(Int_t i){fTrackTypeRec = i;}
79     virtual void SetFilterMask(UInt_t i){fFilterMask = i;}
80     virtual void SetJetTriggerExclude(UInt_t i){fJetTriggerExcludeMask = i;}
81     virtual void SetJetTriggerBest(UInt_t i){fJetTriggerBestMask = i;}
82     virtual void SetMatching(Bool_t b = kTRUE){fDoMatching = b;}
83     virtual void SetRPMethod(Int_t i){fRPMethod = i;}
84     virtual void SetEventSelectionMask(UInt_t i){fEventSelectionMask = i;}
85
86     virtual void SetNonStdFile(char* c){fNonStdFile = c;} 
87
88     virtual void SetNTrigger(Int_t n);
89     virtual void SetTrigger(Int_t i,UInt_t it,const char* c = "");
90
91
92     virtual void SetNAcceptance(Int_t n);
93     virtual void SetAcceptance(Int_t i,Float_t phiMin,Float_t phiMax,Float_t etaMin,Float_t etaMax);// non overlapping regions
94     virtual Int_t CheckAcceptance(Float_t phi,Float_t eta);
95     // Helper
96     //
97
98     // we have different cases
99     // AOD reading -> MC from AOD
100     // ESD reading -> MC from Kinematics
101     // this has to match with our selection of input events
102     enum {kTrackUndef = 0, kTrackAOD, kTrackKineAll,kTrackKineCharged, kTrackAODMCAll, kTrackAODMCCharged, kTrackAODMCChargedAcceptance};
103     enum {kAnaMC =  0x1, kAnaMCESD = 0x2};
104     enum {kMaxJets = 2};
105     enum {kJetRec = 0, kJetGen, kJetRecFull, kJetGenFull, kJetTypes}; //
106     enum {kMaxCorrelation =  3};
107     
108     // 
109     // Stored as function of generated values
110     // 0 all gen jets
111     // 1 all gen jets in eta window
112     // 2 all gen jets with rec partner
113     // 3 all gen jets in eta window with rec partner
114     // 4 all gen jets in eta window with rec partner in eta window
115     // 5 all gen jets in eta window with rec partner in eta window with leading track on reconstructed level
116     // 6 all rec jets in eta window with gen partner
117
118     // Stored as function of reconstructed values:
119     // 7 all rec jets in eta window
120
121
122     enum {kStep0 = 0, kStep1, kStep2, kStep3, kStep4, kStep5, kStep6, kStep7,kMaxStep};
123
124
125  private:
126
127     AliAnalysisTaskJetSpectrum2(const AliAnalysisTaskJetSpectrum2&);
128     AliAnalysisTaskJetSpectrum2& operator=(const AliAnalysisTaskJetSpectrum2&);
129
130     void    MakeJetContainer();
131     Int_t   GetListOfTracks(TList *list,Int_t type);
132     void    FillTrackHistos(TList &particlesList,int iType);
133     Float_t GetRho(TList &list);
134     Float_t GetCentrality();
135     Bool_t  CalculateReactionPlaneAngle(const TList *trackList);
136     Int_t   GetPhiBin(Double_t phi);
137     Double_t GetPhiWeight(Double_t phi,Double_t signedpt);
138     Int_t   GetListOfJets(TList *list,TClonesArray* jarray,Int_t type);
139     void    FillJetHistos(TList &jetsList,TList &particlesList,Int_t iType);
140
141     void    FillMatchHistos(TList &recJetsList,TList &genJetsList);
142
143     Bool_t  JetSelected(AliAODJet *jet);
144     Int_t MultFromJetRefs(TClonesArray *jets);
145     AliVParticle *LeadingTrackFromJetRefs(AliAODJet* jet);
146     AliVParticle *LeadingTrackInCone(AliAODJet* jet,TList *list,Float_t r = 0.4);
147
148
149     AliJetHeader *fJetHeaderRec;//! The jet header that can be fetched from the userinfo
150     AliJetHeader *fJetHeaderGen;//! The jet header that can fetched from the userinfo
151     AliAODEvent  *fAODIn; //! where we take the jets from 
152     AliAODEvent  *fAODOut; //! where we take the jets from 
153     AliAODExtension  *fAODExtension; //! where we take the jets from can be input or output AOD
154
155     AliCFContainer *fhnJetContainer; //! like particle container in corrfw with different steps need AliCFContainer with Scale(), and clone() to do the same
156     THnSparse    *fhnCorrelation;    //! response matrix for unfolding 
157     THnSparseF   *fhnEvent;          //! event counts 
158     TF1          *f1PtScale;         //! correction function to correct to the average true jet energy depending on p_T,rec
159
160     TString       fBranchRec;  // AOD branch name for reconstructed
161     TString       fBranchGen;  // AOD brnach for genereated
162     TString       fBranchBkgRec;  //AOD branch for background 
163     TString       fBranchBkgGen;  //AOD branch for background 
164     TString       fNonStdFile; // name of delta aod file to catch the extension
165
166     TRandom3*     fRandomizer; //! randomizer
167
168     Bool_t        fUseAODJetInput;        // take jet from input AOD not from ouptu AOD
169     Bool_t        fUseAODTrackInput;      // take track from input AOD not from ouptu AOD
170     Bool_t        fUseAODMCInput;         // take MC from input AOD not from ouptu AOD
171     Bool_t        fUseGlobalSelection;    // Limit the eta of the generated jets
172     Bool_t        fUseExternalWeightOnly; // use only external weight
173     Bool_t        fLimitGenJetEta;        // Limit the eta of the generated jets
174     Bool_t        fDoMatching;            // switch on the matching between rec and gen
175     Short_t       fNMatchJets;            // number of leading jets considered from the list
176     Short_t       fNRPBins;               // number of bins with respect to RP
177     UInt_t        fJetTriggerExcludeMask; // mask for jet triggers to exclude
178     UInt_t        fJetTriggerBestMask; // mask for best jet triggers
179     UInt_t        fFilterMask;            // filter bit for slecected tracks
180     UInt_t        fEventSelectionMask;    // Selection information used to filter events
181     Int_t         fNTrigger;              // number of triggers for selection
182     UInt_t        *fTriggerBit;            //[fNTrigger] trigger bits 
183     Int_t         fNAcceptance;            // number of triggers for selection
184     Short_t       fNBinsLeadingTrackPt;   // number of bins leading track pt in sparse. Two options: 1 or 10
185     Short_t       fNBinsMult;             // number of bins in multiplicity in sparse
186     Int_t         fAnalysisType;          // Analysis type 
187     Int_t         fTrackTypeRec;          // type of tracks used for FF 
188     Int_t         fTrackTypeGen;          // type of tracks used for FF 
189     Int_t         fFlagJetType[kJetTypes]; // disable the filling and booking of certain JetType histos
190     Int_t         fEventClass;            // event class to be looked at for this instance of the task
191     Int_t         fRPMethod;              // method for subevent calculation
192     Float_t       fAvgTrials;             // Average nimber of trials
193     Float_t       fExternalWeight;        // external weight
194     Float_t       fJetRecEtaWindow;       // eta window for rec jets
195     Float_t       fTrackRecEtaWindow;     // eta window for rec tracks
196     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
197     Float_t       fMinTrackPt;            // limits the track p_T 
198     Float_t       fDeltaPhiWindow;        // minium angle between dijets
199     Float_t       *fAcceptancePhiMin;     //[fNAcceptance] minimum phi 
200     Float_t       *fAcceptancePhiMax;     //[fNAcceptance] maximum phi
201     Float_t       *fAcceptanceEtaMin;     //[fNAcceptance] minimum eta 
202     Float_t       *fAcceptanceEtaMax;     //[fNAcceptance] maximum eta
203     Float_t       fCentrality;            // ! centrality
204     Float_t       fRPAngle;               // ! RP angle of the reaction plane
205     Int_t         fMultRec;               // ! reconstructed track multiplicity
206     Int_t         fMultGen;               // ! generated track multiplicity
207     TString       *fTriggerName;  //[fNTrigger] array of trigger names
208
209     TProfile*     fh1Xsec;   //! pythia cross section and trials
210     TH1F*         fh1Trials; //! trials are added
211     TH1F*         fh1AvgTrials; //! trials are added
212     TH1F*         fh1PtHard;  //! Pt har of the event...       
213     TH1F*         fh1PtHardNoW;  //! Pt har of the event without weigt       
214     TH1F*         fh1PtHardTrials;  //! Number of trials 
215     TH1F*         fh1ZVtx;          //! z-vtx distribution
216     TH1F*         fh1RP;            //! RP distribution
217     TH1F*         fh1Centrality;    //! centrality distribution
218     TH1F*         fh1TmpRho;        //! just temporary histo for calculation    
219     TH2F*         fh2MultRec;       //! reconstructed track multiplicity   
220     TH2F*         fh2MultGen;       //! generated track multiplicity   
221     TH2F*         fh2RPCentrality;   //! RP vs centrality
222
223     TH2F*         fh2PtFGen;                //! found vs generated 
224     TH2F*         fh2RelPtFGen;             //! relative difference between generated and found 
225     TH3F*         fh3RelPtFGenLeadTrkPt;    //! relative difference between generated and found vs leading track pT
226
227     
228
229     // Jet histos second go
230
231     TH1F*         fh1NJets[kJetTypes];      //! nr of gen jets
232     TH1F*         fh1SumPtTrack[kJetTypes]; //! sum over all track pT    
233
234     TH1F*         fh1PtIn[kJetTypes][kMaxJets+1];  //! Jet pt  
235     TH1F*         fh1PtJetsIn[kJetTypes];       //! Jet pt for all jets
236     TH1F*         fh1PtJetsInRej[kJetTypes];    //! Jet pt for all rejected jets
237     TH1F*         fh1PtJetsInBest[kJetTypes];    //! Jet pt for all rejected jets
238     TH1F*         fh1PtTracksIn[kJetTypes];     //! track pt for all tracks
239     TH1F*         fh1PtTracksInLow[kJetTypes];  //! track pt for all tracks
240     
241     TH2F*         fh2NJetsPt[kJetTypes];    //! Number of found jets above threshold
242     TH2F*         fh2NTracksPt[kJetTypes];  //! Number of tracks above threshold
243     TProfile2D    *fp2MultRPPhiTrackPt[kJetTypes];         //! for mean pT vs RP   
244     TProfile2D    *fp2CentRPPhiTrackPt[kJetTypes];         //! for mean pT vs RP   
245     THnSparseF    *fhnJetPt[kJetTypes];                  //! jet pt information for analysis
246     THnSparseF    *fhnJetPtBest[kJetTypes];                  //! best jet for analysis
247     THnSparseF    *fhnJetPtRej[kJetTypes];                  //! Rej jet for analysis
248     THnSparseF    *fhnJetPtQA[kJetTypes];                //! jet pt information for QA
249     THnSparseF    *fhnTrackPt[kJetTypes];                //! track pt information for analysis
250     THnSparseF    *fhnTrackPtQA[kJetTypes];              //! track pt information for analysis
251
252     TH2F*         fh2LTrackPtJetPt[kJetTypes][kMaxJets+1];       //! leading track within the jet vs jet pt 
253
254     TH1F*   fh1DijetMinv[kJetTypes];            //! dijet inv mass
255     TH2F*   fh2DijetDeltaPhiPt[kJetTypes];      //! dijet delta phi vs pt
256     TH2F*   fh2DijetAsymPt[kJetTypes];          //! dijet asym vs pt after delta phi cut
257     TH2F*   fh2DijetPt2vsPt1[kJetTypes];        //! dijet pt2 vs pt1
258     TH2F*   fh2DijetDifvsSum[kJetTypes];        //! dijet dif vs sum
259
260
261     TList *fHistList;                  //! Output list
262    
263
264     ClassDef(AliAnalysisTaskJetSpectrum2, 23); // Analysis task for standard jet analysis
265 };
266  
267 #endif