29 #include "AliAnalysisTaskSE.h"
30 #include "AliAnalysisManager.h"
31 #include "AliAnalysisDataContainer.h"
32 #include "AliAODHandler.h"
34 #include "AliMCEventHandler.h"
35 #include "AliMCEvent.h"
37 #include "AliMultiplicity.h"
43 #include "AliAODMCParticle.h"
44 #include "AliAODMCHeader.h"
45 #include "AliAODRecoDecay.h"
71 DefineInput(0, TChain::Class());
72 DefineOutput(1, TList::Class());
91 fHistMESyst =
new TH1F(*(static_cast<TH1F*>(HistMESys)));
94 DefineInput(0, TChain::Class());
95 DefineOutput(1, TList::Class());
118 fOutput->SetName(
"OutputHistos");
120 fHistNEvents =
new TH1F(
"hNEvents",
"number of events ",15,-0.5,14.5);
122 fHistNEvents->GetXaxis()->SetBinLabel(2,
"nEvents Matched dAOD");
123 fHistNEvents->GetXaxis()->SetBinLabel(3,
"nEvents Mismatched dAOD");
125 fHistNEvents->GetXaxis()->SetBinLabel(5,
"n. passing IsEvSelected");
126 fHistNEvents->GetXaxis()->SetBinLabel(6,
"n. rejected due to trigger");
127 fHistNEvents->GetXaxis()->SetBinLabel(7,
"n. rejected due to not reco vertex");
128 fHistNEvents->GetXaxis()->SetBinLabel(8,
"n. rejected for contr vertex");
129 fHistNEvents->GetXaxis()->SetBinLabel(9,
"n. rejected for vertex out of accept");
130 fHistNEvents->GetXaxis()->SetBinLabel(10,
"n. rejected for pileup events");
131 fHistNEvents->GetXaxis()->SetBinLabel(11,
"no. of out centrality events");
132 fHistNEvents->GetXaxis()->SetBinLabel(12,
"no. of 3 prong candidates");
133 fHistNEvents->GetXaxis()->SetBinLabel(13,
"no. of D after filtering cuts");
134 fHistNEvents->GetXaxis()->SetBinLabel(14,
"no. of D after selection cuts");
135 fHistNEvents->GetXaxis()->SetBinLabel(15,
"no. of not on-the-fly rec D");
170 AliFatal(
"The decay channel MUST be defined according to AliCFVertexing::DecayChannel - Exiting...");
183 if (matchingAODdeltaAODlevel<0 || (matchingAODdeltaAODlevel==0 &&
fAODProtection==1)) {
190 TClonesArray *arrayBranch=0;
192 if(!aod && AODEvent() && IsStandardAOD()) {
198 AliAODHandler* aodHandler = (AliAODHandler*)
199 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
200 if(aodHandler->GetExtensions()) {
201 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(
"AliAOD.VertexingHF.root");
204 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject(
"Charm3Prong");
206 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject(
"D0toKpi");
208 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject(
"Dstar");
213 arrayBranch=(TClonesArray*)aod->GetList()->FindObject(
"Charm3Prong");
215 arrayBranch=(TClonesArray*)aod->GetList()->FindObject(
"D0toKpi");
217 arrayBranch=(TClonesArray*)aod->GetList()->FindObject(
"Dstar");
221 AliError(
"Could not find array of HF vertices");
226 AliAODVertex *aodVtx = (AliAODVertex*)aod->GetPrimaryVertex();
227 if (!aodVtx || TMath::Abs(aod->GetMagneticField())<0.001) {
228 AliDebug(3,
"The event was skipped due to missing vertex or magnetic field issue");
243 Float_t ntracks = aod->GetNumberOfTracks();
252 Int_t runNumber = aod->GetRunNumber();
254 TClonesArray *arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
255 AliAODMCHeader *mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
258 AliError(
"AliAnalysisTaskTrackingSysPropagation::UserExec: MC particles branch not found!\n");
263 AliError(
"AliAnalysisTaskTrackingSysPropagation::UserExec: MC header branch not found!\n");
269 if(aod->GetTriggerMask()==0 && (runNumber>=195344 && runNumber<=195677)) {
279 Double_t zMCVertex = mcHeader->GetVtxZ();
290 Int_t nCand = arrayBranch->GetEntriesFast();
293 Int_t pdgDaughter[3];
294 Int_t pdg2Daughter[2];
324 AliError(
"WRONG DECAY SETTING");
334 for (
Int_t iCand = 0; iCand < nCand; iCand++) {
355 Bool_t isDStarCand =kTRUE;
360 if(!d->GetSecondaryVtx())
continue;
371 AliAODVertex *origownvtx=0x0;
379 if(retCodeAnalysisCuts > 0) {
382 Int_t isPhiKKpi = retCodeAnalysisCuts&4;
383 Int_t isPhipiKK = retCodeAnalysisCuts&8;
384 if(!(isPhiKKpi || isPhipiKK))
continue;
388 Int_t nDau = d->GetNDaughters();
395 mcLabel = d->MatchToMC(
fPDGcode,arrayMC,nprongs,pdgDaughter);
396 if (mcLabel < 0)
continue;
397 for(
Int_t iDau=0; iDau < nDau; iDau++){
398 track = (AliAODTrack*)d->GetDaughter(iDau);
400 AliError(
"Daughter particle track not found");
404 Int_t labDau = track->GetLabel();
405 AliAODMCParticle* p = (AliAODMCParticle*)arrayMC->UncheckedAt(TMath::Abs(labDau));
406 double ptdau = track->Pt();
409 if(bin > 0 && bin <= nbinsME) syst +=
fHistMESyst->GetBinContent(bin);
410 else if(bin > nbinsME) syst +=
fHistMESyst->GetBinContent(nbinsME);
412 AliError(
"Check input histo at low pt!");
420 mcLabel = ((
AliAODRecoCascadeHF*)d)->MatchToMC(413,421,pdgDaughter,pdg2Daughter,arrayMC,kFALSE);
421 if (mcLabel < 0)
continue;
429 Int_t labDau = track->GetLabel();
430 AliAODMCParticle* p = (AliAODMCParticle*)arrayMC->UncheckedAt(TMath::Abs(labDau));
431 double ptdau = track->Pt();
434 if(bin > 0 && bin <= nbinsME) syst +=
fHistMESyst->GetBinContent(bin);
435 else if(bin > nbinsME) syst +=
fHistMESyst->GetBinContent(nbinsME);
437 AliError(
"Check input histo at low pt!");
444 for(
Int_t iDau=0; iDau < 2; iDau++){
446 track = (AliAODTrack*)D0->GetDaughter(iDau);
451 labDau = track->GetLabel();
452 p=(AliAODMCParticle*)arrayMC->UncheckedAt(TMath::Abs(labDau));
456 if(bin > 0 && bin <= nbinsME) syst +=
fHistMESyst->GetBinContent(bin);
457 else if(bin > nbinsME) syst +=
fHistMESyst->GetBinContent(nbinsME);
459 AliError(
"Check input histo at low pt!");
468 double trackEffSys = 0.;
469 if(bin > 0 && bin <= nbinsTE) trackEffSys =
fHistTrEffSyst->GetBinContent(bin);
470 else if(bin > nbinsTE) trackEffSys =
fHistTrEffSyst->GetBinContent(nbinsTE);
472 AliError(
"Check input histo at low pt!");
476 syst = TMath::Sqrt(syst*syst+trackEffSys*trackEffSys);
491 AliError(
"ERROR: fOutput not available\n");
495 Printf(
"Number of Analyzed Events = %f",
fHistNEvents->GetBinContent(1));
497 AliError(
"ERROR: fHistNEvents not available\n");
500 Printf(
"end of Terminate");
Bool_t IsEventRejectedDueToCentrality() const
Bool_t IsEventRejectedDueToZVertexOutsideFiducialRegion() const
AliAnalysisTaskTrackingSysPropagation()
Bool_t IsEventRejectedDueToNotRecoVertex() const
virtual void UserCreateOutputObjects()
Int_t IsEventSelectedInCentrality(AliVEvent *event)
void UnsetOwnPrimaryVtx()
static Int_t CheckMatchingAODdeltaAODevents()
Bool_t IsEventRejectedDueToVertexContributors() const
TH2F * fhSystMatchEffD
histo with Pt daughters vs pt candidate
Bool_t FillRecoCand(AliVEvent *event, AliAODRecoDecayHF3Prong *rd3)
TH1F * fHistTrEffSyst
histo with match. eff. systematics vs pt (need to be passed as input)
virtual ~AliAnalysisTaskTrackingSysPropagation()
Double_t GetMaxVtxZ() const
Bool_t FillRecoCasc(AliVEvent *event, AliAODRecoCascadeHF *rc, Bool_t isDStar, Bool_t recoSecVtx=kFALSE)
DecChannel fDecayChannel
histo with systematic uncertainty on the candidate
TH1F * fHistNEvents
tlist with output
Class for cuts on AOD reconstructed D+->Kpipi.
Double_t fMaxPt
flag to activate protection against AOD-dAOD mismatch.
AliAODVertex * GetOwnPrimaryVtx() const
TH2F * fhPtDauVsD
histo with track. eff. systematics vs pt (need to be passed as input)
Bool_t IsEventRejectedDueToPileup() const
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
Bool_t IsEventSelected(AliVEvent *event)
Bool_t IsSelected(TObject *obj)
virtual void UserExec(Option_t *)
TH1F * fHistMESyst
histo with number of events
virtual void Terminate(Option_t *)
Bool_t IsEventRejectedDueToTrigger() const
virtual Bool_t IsInFiducialAcceptance(Double_t, Double_t) const
Int_t GetUseCentrality() const
AliRDHFCuts * fAnalysisCuts
max pt in the outputs histos