12 #include "TLorentzVector.h"
14 #include "AliVParticle.h"
17 #include <THnSparse.h>
26 fh3JetPtDRTrackPt(0x0),
34 fhSmoothEfficiency(0),
40 fpAppliedEfficiency(0),
45 fCollTemplates.SetOwner(kTRUE);
51 fh3JetPtDRTrackPt(0x0),
59 fhSmoothEfficiency(0),
65 fpAppliedEfficiency(0),
72 const Int_t nBinPt = 118;
73 Double_t binLimitsPt[nBinPt+1];
74 for(Int_t iPt = 0;iPt <= nBinPt;iPt++){
76 binLimitsPt[iPt] = 0. + (Double_t)iPt*0.15;
78 binLimitsPt[iPt] = binLimitsPt[iPt-1] + 1.0;
81 const Int_t nBinsPtJ = 200;
82 const Double_t minPtJ = -50.;
83 const Double_t maxPtJ = 150.;
85 fpAppliedEfficiency =
new TProfile(
"fpAppliedEfficiency",
"fpAppliedEfficiency",nBinPt,binLimitsPt);
87 const Int_t nvars = 5;
88 Int_t
nbins[nvars] = {nBinsPtJ, 21 , 21 , 21 , 21};
89 Double_t minbin[nvars] = {minPtJ , 0. , 0. , 0. , 0.};
90 Double_t maxbin[nvars] = {maxPtJ , 20., 20., 20., 20.};
92 TString axtitles[nvars] = {
"#it{p}_{T,jet}",
"N constituents added",
"N_{constituents} #times (1/eff - 1)",
"N_{truth}"};
93 for(Int_t i = 0; i<nvars; i++){
96 fhNmissing =
new THnSparseF(nameh.Data(), title.Data(), nvars,
nbins, minbin, maxbin);
99 fListOfOutput->SetName(
"JetByJetCorrectionOutput");
100 fListOfOutput->SetOwner();
110 fh3JetPtDRTrackPt(other.fh3JetPtDRTrackPt),
111 fBinWidthJetPt(other.fBinWidthJetPt),
112 fJetPtMin(other.fJetPtMin),
113 fJetPtMax(other.fJetPtMax),
114 fCollTemplates(other.fCollTemplates),
115 fInitialized(other.fInitialized),
116 fEfficiencyFixed(other.fEfficiencyFixed),
117 fhEfficiency(other.fhEfficiency),
118 fhSmoothEfficiency(other.fhSmoothEfficiency),
119 fCorrectpTtrack(other.fCorrectpTtrack),
120 fpAppliedEfficiency(other.fpAppliedEfficiency),
121 fhNmissing(other.fhNmissing),
131 if (&other ==
this)
return *
this;
132 TNamed::operator=(other);
153 Printf(
"AliEmcalJetByJetCorrection %s not initialized",GetName());
166 Double_t fillarray[5];
167 fillarray[0] = jet->
Pt();
180 npc=
fRndm->Poisson(np);
185 TLorentzVector corrVec; corrVec.SetPtEtaPhiM(jet->
Pt(),jet->
Eta(),jet->
Phi(),jet->
M());
187 Double_t
mass = 0.13957;
189 for(Int_t i = 0; i<npc; i++) {
192 hTemplate->GetRandom2(r,pt);
193 Double_t t = TMath::TwoPi()*
gRandom->Uniform(1.);
194 Double_t deta = r*TMath::Cos(t);
195 Double_t dphi = r*TMath::Sin(t);
196 TLorentzVector curVec;
197 curVec.SetPtEtaPhiM(pt,deta+jet->
Eta(),dphi+jet->
Phi(),
mass);
198 new ((*fArrayTrackCorr)[i]) TLorentzVector(curVec);
211 Printf(
"%s fh3JetPtDRTrackPt not known",GetName());
216 Printf(
"%s fhEfficiency not known",GetName());
221 fRndm =
new TRandom3(1234);
226 Double_t smallBinW = 0.9;
227 Double_t pTFitRange[2]={6,100};
228 for(Int_t ibeff=0;ibeff<nBinsEf;ibeff++){
237 TF1* fitfuncEff =
new TF1(
"fitfuncEff",
"[0]+x*[1]", pTFitRange[0], pTFitRange[1]);
241 for(Int_t i=0;i<nBinsEfSmth;i++){
250 Double_t effInterp =
fhEfficiency->Interpolate(binCentreT);
261 if(fJetPtMin<fh3JetPtDRTrackPt->GetXaxis()->GetXmin())
264 Double_t eps = 0.00001;
278 for(Int_t ipTtr=0;ipTtr<nBinspTtr;ipTtr++){
279 for(Int_t ir=0;ir<nBinsr;ir++){
280 Double_t uncorr = h2->GetBinContent(ir+1,ipTtr+1);
281 Double_t corr = uncorr/
GetEfficiency(h2->GetYaxis()->GetBinCenter(ipTtr+1));
282 h2->SetBinContent(ir+1, ipTtr+1, corr);
327 if(!jet || !fTracks)
return -1.;
331 Double_t sumPtCh = 0.;
333 vp =
static_cast<AliVParticle*
>(jet->
TrackAt(icc, fTracks));
Double_t fJetPtMax
maximum jet pt
TClonesArray * fArrayTrackCorr
TClonesArray containing the jet constituents after correction.
AliEmcalJetByJetCorrection & operator=(const AliEmcalJetByJetCorrection &jet)
AliEmcalJet * Eval(const AliEmcalJet *jet, TClonesArray *fTracks)
Bool_t fNpPoisson
draw Nmissing particle from a Poissonian with mean Nconst(1/eff-1)
AliEmcalJetByJetCorrection()
TH1D * fhSmoothEfficiency
single particle efficiency smooth (see Init())
UShort_t GetNumberOfTracks() const
Double_t GetEfficiency(const Double_t pt) const
TProfile * fpAppliedEfficiency
Control profile efficiency.
Double_t fJetPtMin
minimum jet pt
TList * fListOfOutput
list containing all histograms
Bool_t fExternalNmissed
Set to true if want to give Nmissing from the MassStructureTask.
THnSparse * fhNmissing
pTjet vs number of added constituents (depends on settings) versus Nmissed constituents ...
TH3 * fh3JetPtDRTrackPt
3D template
TRandom3 * fRndm
TRandom3 object.
Short_t TrackAt(Int_t idx) const
Double_t fBinWidthJetPt
jet pt bin width in which to do correction
TObjArray fCollTemplates
templates (2D histos with track pT vs r)
Double_t fEfficiencyFixed
fixed efficiency for all pT and all types of tracks
Bool_t fCorrectpTtrack
if true the templates are corrected by track efficiency
Double_t GetMeanPtConstituents(const AliEmcalJet *jet, TClonesArray *fTracks) const
Int_t GetJetPtBin(const Double_t jetpt) const
ClassImp(AliEmcalJetByJetCorrection) AliEmcalJetByJetCorrection
TH1 * fhEfficiency
single particle efficiency
Bool_t fInitialized
status of initialization
Int_t fNMissedTracks
Track missed in reconstruction calculated from external input (to be improved)