]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGJE / FlavourJetTasks / AliAnalysisTaskFlavourJetCorrelations.h
1 #ifndef ALIANALYSISTASKFLAVOURJETCORRELATIONS_H
2 #define ALIANALYSISTASKFLAVOURJETCORRELATIONS_H
3 /**************************************************************************
4 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
5 *                                                                        *
6 * Author: The ALICE Off-line Project.                                    *
7 * Contributors are mentioned in the code where appropriate.              *
8 *                                                                        *
9 * Permission to use, copy, modify and distribute this software and its   *
10 * documentation strictly for non-commercial purposes is hereby granted   *
11 * without fee, provided that the above copyright notice appears in all   *
12 * copies and that both the copyright notice and this permission notice   *
13 * appear in the supporting documentation. The authors make no claims     *
14 * about the suitability of this software for any purpose. It is          *
15 * provided "as is" without express or implied warranty.                  *
16 **************************************************************************/
17
18 //-----------------------------------------------------------------------
19 // Author : A. Grelli,  Utrecht University
20 //          C. Bianchin, Utrecht University
21 //          X. Zhang, LBNL
22 //-----------------------------------------------------------------------
23
24
25 #include <TH2F.h>
26 #include "AliAODEvent.h"
27 #include "AliPicoTrack.h"
28 #include "AliAnalysisTaskEmcalJet.h"
29 #include "AliRhoParameter.h"
30
31 class TH3F;
32 class TParticle ;
33 class TClonesArray ;
34 class THnSparse;
35 class AliMCParticle;
36 class AliAODMCParticle;
37 class AliRDHFCuts;
38 class AliEmcalJet;
39 class AliAODRecoDecayHF;
40 class AliAODRecoCascadeHF;
41 class AliAODEvent;
42
43 class AliAnalysisTaskFlavourJetCorrelations : public AliAnalysisTaskEmcalJet 
44 {
45    
46 public:
47    
48    enum ECandidateType{ kD0toKpi, kDstartoKpipi };
49    
50    AliAnalysisTaskFlavourJetCorrelations();
51    AliAnalysisTaskFlavourJetCorrelations(const Char_t* name,AliRDHFCuts* cuts, ECandidateType candtype, Bool_t jetOnly=kFALSE);
52    virtual ~AliAnalysisTaskFlavourJetCorrelations();
53    
54    virtual void     UserCreateOutputObjects();
55    virtual Bool_t   Run();
56    virtual void     Terminate(Option_t *);
57    virtual void     Init();
58    virtual void     LocalInit() {Init();}
59    
60    // inizializations
61    Bool_t DefineHistoForAnalysis();  
62    
63    // set MC usage
64    void   SetMC(Bool_t theMCon) {fUseMCInfo = theMCon;}
65    Bool_t GetMC() const {return fUseMCInfo;}
66    // set usage of reconstructed tracks
67    void   SetUseReco(Bool_t reco) {fUseReco=reco;}
68    Bool_t GetUseReco() const {return fUseReco;}
69    //no setter because needed in the constructor
70    Bool_t GetJetOnlyMode() const {return fJetOnlyMode;}
71    void SetTypeDJetSelection(Int_t type) {fTypeDInJet=type;} //see IsDInJet for possibilities
72    Int_t GetTypeDJetSelection() const {return fTypeDInJet;} 
73    
74    void SetMassLimits(Double_t range, Int_t pdg);
75    void SetMassLimits(Double_t lowlimit, Double_t uplimit);
76    
77    //jet reconstruction algorithm
78    void SetJetArrayName(TString jetArrName) {fJetArrName=jetArrName;};
79    TString GetJetArrayName() const {return fJetArrName;};
80    
81    // trigger on jet events
82    void SetTriggerOnLeadingJet(Bool_t triggerOnLeadingJet) {fLeadingJetOnly=triggerOnLeadingJet;};
83    Bool_t GetTriggerOnLeadingJet() const {return fLeadingJetOnly;}
84    
85    
86    // Array of D0 width for the Dstar
87    Bool_t SetD0WidthForDStar(Int_t nptbins,Float_t* width);
88    
89    //Bool_t   FillMCDJetInfo(AliPicoTrack *jetTrk,AliEmcalJet* jet, TClonesArray *mcArray,Double_t ptjet);
90    void FillHistogramsRecoJetCorr(AliVParticle* candidate, AliEmcalJet *jet, AliAODEvent* aodEvent);
91    void FillHistogramsD0JetCorr(AliAODRecoDecayHF* candidate, Double_t dPhi, Double_t z, Double_t ptD, Double_t ptj, Bool_t bDInEMCalAcc, Bool_t bJetInEMCalAcc, AliAODEvent* aodEvent);
92    
93    void FillHistogramsDstarJetCorr(AliAODRecoCascadeHF* dstar, Double_t dPhi,  Double_t z, Double_t ptD, Double_t ptj, Bool_t bDInEMCalAcc, Bool_t bJetInEMCalAcc);
94    void FillHistogramsMCGenDJetCorr(Double_t dPhi, Double_t z,Double_t ptD,Double_t ptjet, Bool_t bDInEMCalAcc, Bool_t bJetInEMCalAcc);
95    void SideBandBackground(AliAODRecoCascadeHF *candDstar, AliEmcalJet *jet);
96    void MCBackground(AliAODRecoDecayHF *candbg, AliEmcalJet *jet);
97    void FillMassHistograms(Double_t mass,Double_t ptD);
98    void FlagFlavour(AliEmcalJet* jet);
99    Int_t IsDzeroSideBand(AliAODRecoCascadeHF *candDstar);
100    Bool_t InEMCalAcceptance(AliVParticle *vpart);
101    
102    void LightTHnSparse(){
103       fSwitchOnSB=0;
104       fSwitchOnPhiAxis=0;
105       fSwitchOnOutOfConeAxis=0;
106    }
107    void HeavyTHnSparse(){
108       fSwitchOnSB=1;
109       fSwitchOnPhiAxis=1;
110       fSwitchOnOutOfConeAxis=1;
111    }
112    
113    void TurnOffTHnSparse() {fSwitchOnSparses=kFALSE;}
114    
115    /*
116    void SwitchOnSB(){fSwitchOnSB=1;};
117    void SwitchOffSB(){fSwitchOnSB=0;};
118    void SwitchOnPhiAxis(){fSwitchOnPhiAxis=1;}
119    void SwitchOffPhiAxis(){fSwitchOffPhiAxis=0;}
120    void SwitchOnOutOfConeAxis(){fSwitchOnOutOfConeAxis=1;}
121    void SwitchOffOutOfConeAxis(){fSwitchOnOutOfConeAxis=0;}
122    */
123    
124 private:
125    
126    AliAnalysisTaskFlavourJetCorrelations(const AliAnalysisTaskFlavourJetCorrelations &source);
127    AliAnalysisTaskFlavourJetCorrelations& operator=(const AliAnalysisTaskFlavourJetCorrelations& source); 
128    
129    Double_t Z(AliVParticle* part,AliEmcalJet* jet, Bool_t transverse=kFALSE) const;
130    Double_t Z(Double_t* p, Double_t *pj) const;
131    Double_t ZT(Double_t* p, Double_t *pj) const;
132    Float_t DeltaR(AliEmcalJet *p1, AliVParticle *p2) const;
133    Bool_t AreDaughtersInJet(AliEmcalJet *thejet, AliAODRecoDecayHF* charm, Int_t*& daughOutOfJet, AliAODTrack**& dtrks, Bool_t fillH);
134    Bool_t IsDInJet(AliEmcalJet *thejet, AliAODRecoDecayHF* charm, Bool_t fillH=kFALSE);
135    void RecalculateMomentum(Double_t* pj, const Double_t* pmissing) const;
136    
137    
138    Bool_t fUseMCInfo;             //  Use MC info
139    Bool_t fUseReco;               // use reconstructed tracks when running on MC
140    Int_t  fCandidateType;         // Dstar or D0
141    Int_t  fPDGmother;             // PDG code of D meson
142    Int_t  fNProngs;               // number of prong of the decay channel  
143    Int_t  fPDGdaughters[4];       // PDG codes of daughters
144    Float_t fSigmaD0[30];          //
145    TString fBranchName;           // AOD branch name
146    AliRDHFCuts *fCuts;            // Cuts 
147    
148    Double_t fMinMass;             // mass lower limit histogram
149    Double_t fMaxMass;             // mass upper limit histogram
150    
151    TString  fJetArrName;          // name of the jet array, taken from the task running the jet finder
152    TString fCandArrName;          // string which correspond to the candidate type
153    Bool_t fLeadingJetOnly;        // use only the leading jet in the event to make the correlations
154    Double_t fJetRadius;           // jet radius (filled from the JetContainer)
155    TClonesArray *fCandidateArray;   //! contains candidates selected by AliRDHFCuts
156    TClonesArray *fSideBandArray;    //! contains candidates selected by AliRDHFCuts::IsSelected(kTracks), to be used for side bands (DStar case only!!)
157    Bool_t fJetOnlyMode;           //switch to simple version which analyses jets only
158    Double_t fPmissing[3];             // jet missing momentum due to D mesons out of cone
159    Double_t fPtJet;                   // pt jet, if requeted corrected with the missing pt
160    Bool_t   fIsDInJet;                // flag D meson in jet
161    Int_t    fTypeDInJet;              // way of selecting D in jets (see IsDInJet in cxx)
162    TClonesArray *fTrackArr;      //array of the tracks used in the jet finder 
163    Bool_t fSwitchOnSB;          // flag to switch off/on the SB analysis (default is off)
164    Bool_t fSwitchOnPhiAxis;     // flag to switch off/on the DeltaPhi axis in THnSparse (to be used in combination with switch OutOfCone)
165    Bool_t fSwitchOnOutOfConeAxis; //flag to switch off/on the out of cone axis in THnSparse (to be switch on if DeltaPhi is on)
166    Bool_t fSwitchOnSparses;     // turn on/off all THnSparse
167     
168    Int_t fNAxesBigSparse;      // number of axis
169    
170    // Histograms
171    TH1I* fhstat;
172    //generic jet and jet track distributions
173    TH1F* fhPtJetTrks;
174    TH1F* fhPhiJetTrks;
175    TH1F* fhEtaJetTrks;
176    TH1F* fhEjetTrks;
177    TH1F* fhPtJet;
178    TH1F* fhPhiJet;
179    TH1F* fhEtaJet;
180    TH1F* fhEjet;
181    TH1F* fhNtrArr;
182    TH1F* fhNJetPerEv;
183    TH1F* fhdeltaRJetTracks;
184    THnSparse* fhsJet; //available in jet only mode
185    // event characteristics;
186    TH1F* fhNDPerEvNoJet;
187    TH1F* fhptDPerEvNoJet;
188    TH1F* fhNJetPerEvNoD;
189    TH1F* fhPtJetPerEvNoD;
190    //D mesons
191    THnSparse* fhsDstandalone;
192    TH2F* fhInvMassptD;
193    TH2F* fhDiffSideBand;
194    TH2F* fhInvMassptDbg;
195    TH1F* fhPtPion;
196
197    //histograms for checks
198    TH1F* fhztracksinjet;
199    TH1F* fhDiffPtTrPtJzNok;
200    TH1F* fhDiffPtTrPtJzok;
201    TH1F* fhDiffPzTrPtJzok;
202    TH1F* fhDiffPzTrPtJzNok;
203    TH1I* fhNtrkjzNok;
204    TH1F* fhztracksinjetT;
205    TH1I* fhControlDInJ;
206    TH1I* fhIDddaugh   ;
207    TH1I* fhIDddaughOut;
208    TH1I* fhIDjetTracks;
209    TH1F* fhDRdaughOut ;
210    TH1F* fhzDinjet;
211    TH1F* fhmissingp;
212    TH1F**fhMissPi;
213    TH1F* fhDeltaPtJet;
214    TH1F* fhRelDeltaPtJet;
215    // D-jet correlation histograms
216    TH1F* fhzDT;
217    TH1F* fhDeltaRD;
218    TH3F* fhDeltaRptDptj;
219    TH3F* fhDeltaRptDptjB;
220    //main histograms
221    THnSparse* fhsDphiz;
222    
223
224    ClassDef(AliAnalysisTaskFlavourJetCorrelations,6); // class for charm-jet CorrelationsExch
225 };
226
227 #endif