28 #include <Riostream.h> 29 #include <TClonesArray.h> 35 #include <TDatabasePDG.h> 38 #include "AliAnalysisManager.h" 39 #include "AliAODHandler.h" 40 #include "AliAODEvent.h" 41 #include "AliAODVertex.h" 42 #include "AliAODTrack.h" 43 #include "AliAODMCHeader.h" 44 #include "AliAODMCParticle.h" 51 #include "AliAnalysisTaskSE.h" 90 fPartOrAndAntiPart(0),
149 DefineOutput(1,TList::Class());
150 DefineOutput(2,TList::Class());
151 DefineOutput(3,AliRDHFCuts::Class());
259 TString mdvname=Form(
"multiDimVectorPtBin%d",i);
262 for(
Int_t ivar=0;ivar<nvars;ivar++){
263 if(varsforopt[ivar]){
267 AliFatal(Form(
"tight and loose cut for optimization variable number %d are the same in ptbin %d\n",ic,i));
271 if(uppervars[ivar]&&lowermdv){
272 AliFatal(Form(
"%s is declared as uppercut, but as been given tighter cut larger then loose cut in ptbin %d \n ---please check your cuts \n ",names[ivar].
Data(),i));
275 if(!uppervars[ivar]&&!lowermdv){
276 AliFatal(Form(
"%s is declared as lower cut, but as been given tighter cut smaller then loose cut in ptbin %d \n ---please check your cuts \n",names[ivar].
Data(),i));
289 AliInfo(
"B feed down not allowed without MC info\n");
296 Int_t abspdg=TMath::Abs(pdg);
297 mass=TDatabasePDG::Instance()->GetParticle(abspdg)->Mass();
317 if(fDebug > 1) printf(
"AnalysisTaskSESignificance::Init() \n");
380 if(fDebug > 1) printf(
"AnalysisTaskSESignificance::UserCreateOutputObjects() \n");
385 fOutput->SetName(
"OutputHistos");
389 cout<<
"ncells = "<<nHist<<
" n ptbins = "<<
fNPtBins<<endl;
391 cout<<
"Total = "<<nHist<<endl;
392 for(
Int_t i=0;i<nHist;i++){
400 hisname.Form(
"hMass_%d",i);
401 signame.Form(
"hSig_%d",i);
402 bkgname.Form(
"hBkg_%d",i);
403 rflname.Form(
"hRfl_%d",i);
405 title.Form(
"Invariant mass;M[GeV/c^{2}];Entries");
428 fHistNEvents=
new TH1F(
"fHistNEvents",
"Number of AODs scanned",8,-0.5,7.5);
430 fHistNEvents->GetXaxis()->SetBinLabel(2,
"nEvSelected (vtx)");
431 fHistNEvents->GetXaxis()->SetBinLabel(3,
"nCandidatesSelected");
432 fHistNEvents->GetXaxis()->SetBinLabel(4,
"nTotEntries Mass hists");
436 fHistNEvents->GetXaxis()->SetBinLabel(7,
"MC Cand from c");
437 fHistNEvents->GetXaxis()->SetBinLabel(8,
"MC Cand from b");
439 fHistNEvents->GetXaxis()->SetBinLabel(7,
"N candidates");
460 if (matchingAODdeltaAODlevel<0 || (matchingAODdeltaAODlevel==0 &&
fAODProtection==1)) {
465 if(fDebug>2) printf(
"Analysing decay %d\n",
fDecChannel);
468 TClonesArray *arrayProng =0;
470 if(!aod && AODEvent() && IsStandardAOD()) {
476 AliAODHandler* aodHandler = (AliAODHandler*)
477 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
478 if(aodHandler->GetExtensions()) {
480 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(
"AliAOD.VertexingHF.root");
482 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject(
fBranchName.Data());
486 arrayProng=(TClonesArray*)aod->GetList()->FindObject(
fBranchName.Data());
488 if(!aod || !arrayProng) {
489 AliError(
"AliAnalysisTaskSESignificance::UserExec:Branch not found!\n");
495 if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001)
return;
496 TClonesArray *arrayMC=0;
497 AliAODMCHeader *mcHeader=0;
502 arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
504 AliError(
"AliAnalysisTaskSESignificance::UserExec:MC particles branch not found!\n");
509 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
511 AliError(
"AliAnalysisTaskSESignificance::UserExec:MC header branch not found!\n");
523 Int_t nProng = arrayProng->GetEntriesFast();
524 if(fDebug>1) printf(
"Number of D2H: %d\n",nProng);
527 TString trigclass=aod->GetFiredTriggerClasses();
528 if(trigclass.Contains(
"C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains(
"C0SMH-B-NOPF-ALL"))
fHistNEvents->Fill(5);
540 for (
Int_t iProng = 0; iProng < nProng; iProng++) {
569 if(!isSelBit)
continue;
583 if (!DStarToD0pi->GetSecondaryVtx())
continue;
585 if (!D0Particle)
continue;
594 AliAODMCParticle *partD = (AliAODMCParticle*)arrayMC->At(labD);
596 Int_t abspdgGranma = TMath::Abs(pdgGranma);
597 if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) {
599 AliDebug(2,Form(
"Particle has a b-meson, or b-baryon mother (pdg code mother = %d )--> not coming from a c-quark, skipping...", pdgGranma));
611 if(isSelected&&isFidAcc) {
613 if(fDebug>1) printf(
"+++++++Is Selected\n");
619 if(ptbin==-1)
continue;
620 TString mdvname=Form(
"multiDimVectorPtBin%d",ptbin);
624 if(fDebug>1)printf(
"nvals = %d\n",nVals);
625 for(
Int_t ivals=0;ivals<nVals;ivals++){
627 if (fDebug>1) printf(
"Overflow!!\n");
637 FillDplus(d,arrayMC,(
Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected);
640 FillD02p(d,arrayMC,(
Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected);
643 FillDstar(DStarToD0pi,arrayMC,(
Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected);
647 FillDs(d,arrayMC,(
Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected,1);
651 FillD04p(d,arrayMC,(
Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected);
654 FillLambdac(d,arrayMC,(
Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected);
668 if(fDebug>1)printf(
"nvals = %d\n",nVals);
669 for(
Int_t ivals=0;ivals<nVals;ivals++){
671 if (fDebug>1) printf(
"Overflow!!\n");
675 FillDs(d,arrayMC,(
Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected,0);
704 AliError(
"Candidate not selected\n");
709 Int_t pdgdaughters[3] = {211,321,211};
717 lab = d->MatchToMC(411,arrayMC,3,pdgdaughters);
732 Int_t pdgdaughtersD0[2]={211,321};
733 Int_t pdgdaughtersD0bar[2]={321,211};
749 Int_t pdgdaughters[2];
755 Int_t prongPdgPlus=421,prongPdgMinus=(-1)*421;
758 AliAODMCParticle *dMC = (AliAODMCParticle*)arrayMC->At(matchtoMC);
759 Int_t pdgMC = dMC->GetPdgCode();
761 if(pdgMC==prongPdgPlus)
fSigHist[index]->Fill(masses[0]);
762 else fRflHist[index]->Fill(masses[0]);
764 }
else fBkgHist[index]->Fill(masses[0]);
769 AliAODMCParticle *dMC = (AliAODMCParticle*)arrayMC->At(matchtoMC);
770 Int_t pdgMC = dMC->GetPdgCode();
772 if(pdgMC==prongPdgMinus)
fSigHist[index]->Fill(masses[1]);
773 else fRflHist[index]->Fill(masses[1]);
774 }
else fBkgHist[index]->Fill(masses[1]);
782 AliInfo(
"Dstar selected\n");
789 Int_t matchtoMC = -1;
792 Int_t prongPdgDStarPlus=413;
797 AliAODMCParticle *dMC = (AliAODMCParticle*)arrayMC->At(matchtoMC);
798 Int_t pdgMC = dMC->GetPdgCode();
800 if (pdgMC==prongPdgDStarPlus)
fSigHist[index]->Fill(mass);
802 dstarD0pi->SetCharge(-1*dstarD0pi->GetCharge());
805 dstarD0pi->SetCharge(-1*dstarD0pi->GetCharge());
819 Int_t pdgDsKKpi[3]={321,321,211};
820 Int_t pdgDspiKK[3]={211,321,321};
827 labDs = d->MatchToMC(431,arrayMC,3,pdgDsKKpi);
830 Int_t isKKpi=isSel&1;
831 Int_t ispiKK=isSel&2;
832 Int_t isPhiKKpi=isSel&4;
833 Int_t isPhipiKK=isSel&8;
834 Int_t isK0starKKpi=isSel&16;
835 Int_t isK0starpiKK=isSel&32;
850 Int_t labDau0=((AliAODTrack*)d->GetDaughter(0))->GetLabel();
851 AliAODMCParticle* p=(AliAODMCParticle*)arrayMC->UncheckedAt(labDau0);
852 Int_t pdgCode0=TMath::Abs(p->GetPdgCode());
874 Int_t labDau0=((AliAODTrack*)d->GetDaughter(0))->GetLabel();
875 AliAODMCParticle* p=(AliAODMCParticle*)arrayMC->UncheckedAt(labDau0);
876 Int_t pdgCode0=TMath::Abs(p->GetPdgCode());
892 AliInfo(
"D0 in 4 prongs channel not implemented\n");
900 Int_t pdgdaughtersLc[3]={2212,321,211};
902 Int_t pdgdaughtersLc2[3]={211,321,2212};
909 if(isSel==1 || isSel==3)
fMassHist[index]->Fill(masses[0]);
910 if(isSel>=2)
fMassHist[index]->Fill(masses[1]);
919 Int_t matchtoMC = -1;
924 Int_t absPdgMom = 4122;
925 matchtoMC = d->MatchToMC(absPdgMom,arrayMC,
fNProngs,pdgdaughtersLc);
929 AliAODMCParticle *dMC = (AliAODMCParticle*)arrayMC->At(matchtoMC);
930 Int_t pdgMC = dMC->GetPdgCode();
931 if (TMath::Abs(pdgMC)!=absPdgMom) AliInfo(
"What's up, isn't it a lambdac ?!");
932 Int_t labDau0 = ((AliAODTrack*)d->GetDaughter(0))->GetLabel();
933 AliAODMCParticle* p0 = (AliAODMCParticle*)arrayMC->UncheckedAt(labDau0);
934 Int_t pdgCode0 = TMath::Abs(p0->GetPdgCode());
935 Int_t labDau1 = ((AliAODTrack*)d->GetDaughter(1))->GetLabel();
936 AliAODMCParticle* p1 = (AliAODMCParticle*)arrayMC->UncheckedAt(labDau1);
937 Int_t pdgCode1 = TMath::Abs(p1->GetPdgCode());
938 Int_t labDau2 = ((AliAODTrack*)d->GetDaughter(2))->GetLabel();
939 AliAODMCParticle* p2 = (AliAODMCParticle*)arrayMC->UncheckedAt(labDau2);
940 Int_t pdgCode2 = TMath::Abs(p2->GetPdgCode());
944 if(pdgCode0==pPDG && pdgCode1==kPDG && pdgCode2==piPDG){
952 if(pdgCode0==piPDG && pdgCode1==kPDG && pdgCode2==pPDG){
959 if(ispKpi==1)
fBkgHist[index]->Fill(masses[0]);
960 if(ispiKp==2)
fBkgHist[index]->Fill(masses[1]);
974 if(fDebug > 1) printf(
"AnalysisTaskSESignificance: Terminate() \n");
979 printf(
"ERROR: fOutput not available\n");
985 printf(
"ERROR: fCutList not available\n");
991 cout<<
"multidimvec not found in TList"<<endl;
996 TCanvas *c1=
new TCanvas(
"c1",
"Invariant mass distribution - loose cuts",500,500);
998 for(
Int_t i=0;i<nHist;i++){
1005 hisname.Form(
"hMass_%d",i);
1006 signame.Form(
"hSig_%d",i);
1007 bkgname.Form(
"hBkg_%d",i);
1008 rflname.Form(
"hRfl_%d",i);
1012 if (!drawn &&
fMassHist[i]->GetEntries() > 0){
1038 Int_t pdgGranma = 0;
1040 mother = mcPart->GetMother();
1044 AliDebug(2,Form(
"mother at step %d = %d", istep, mother));
1045 AliAODMCParticle* mcGranma =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(mother));
1046 if(!mcGranma)
break;
1047 pdgGranma = mcGranma->GetPdgCode();
1048 AliDebug(2,Form(
"Pdg mother at step %d = %d", istep, pdgGranma));
1049 Int_t abspdgGranma = TMath::Abs(pdgGranma);
1050 if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) {
1053 mother = mcGranma->GetMother();
Float_t fLowmasslimit
upper inv mass limit for histos
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)=0
void SetBFeedDown(FeedDownEnum flagB)
Float_t fVars[kMaxCutVar]
number of selection variables
AliRDHFCuts * fRDCuts
lower inv mass limit for histos
virtual void UserExec(Option_t *option)
Double_t DeltaInvMass() const
AliAnalysisTaskSESignificance()
Bool_t HasSelectionBit(Int_t i) const
Int_t fNBins
array with values of cut variables
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabs2prong, Int_t *pdgDg, Int_t *pdgDg2prong, TClonesArray *mcArray, Bool_t isV0=kFALSE) const
Int_t fPDGD0ToKpi[2]
PDG codes for the particles in the D* -> pi + D0 decay.
Int_t fPDGdaughters[4]
number of prong of the decay channel
static Int_t CheckMatchingAODdeltaAODevents()
Int_t fNPtBins
prong cut values
TH1F * fBkgHist[kMaxNHist]
!hist. for inv mass (bkg from MC truth)
void SetPDGdaughterDstoKKpi()
FeedDownEnum fBFeedDown
flag to use selection bit (speed up candidates selection)
Int_t GetWhyRejection() const
Bool_t FillRecoCand(AliVEvent *event, AliAODRecoDecayHF3Prong *rd3)
TList * fOutput
! list send on output slot 0
TString * GetVarNames() const
Int_t fPartOrAndAntiPart
number of bins in the mass histograms
void FillDs(AliAODRecoDecayHF *d, TClonesArray *arrayMC, Int_t index, Int_t isSel, Int_t optDecay)
Int_t fSelectionlevel
AOD branch name for channel.
Bool_t FillRecoCasc(AliVEvent *event, AliAODRecoCascadeHF *rc, Bool_t isDStar, Bool_t recoSecVtx=kFALSE)
Bool_t fUseSelBit
flag for access to MC
Int_t fNProngs
PDG code of D meson.
Class for cuts on AOD reconstructed D+->Kpipi.
void FillLambdac(AliAODRecoDecayHF *d, TClonesArray *arrayMC, Int_t index, Int_t isSel)
virtual ~AliAnalysisTaskSESignificance()
Bool_t * GetIsUpperCut() const
TH1F * fRflHist[kMaxNHist]
!hist. for inv mass (bkg from MC truth)
Bool_t * GetVarsForOpt() const
Int_t CheckOrigin(const AliAODMCParticle *mcPart, const TClonesArray *mcArray) const
virtual void UserCreateOutputObjects()
Implementation of interface methods.
void SetPDGdaughterDstopiKK()
Int_t GetNVarsForOpt() const
ULong64_t * GetGlobalAddressesAboveCuts(const Float_t *values, Float_t pt, Int_t &nVals) const
Int_t fPDGmother
decay channel identifier
Int_t fAODProtection
number of pt bins
void FillD04p(AliAODRecoDecayHF *d, TClonesArray *arrayMC, Int_t index, Int_t isSel)
Bool_t CheckConsistency()
Int_t fPDGDStarToD0pi[2]
Ds resonant channel selected.
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
TString fBranchName
PDG codes of daughters.
void FillDplus(AliAODRecoDecayHF *d, TClonesArray *arrayMC, Int_t index, Int_t isSel)
Bool_t IsEventSelected(AliVEvent *event)
ULong64_t GetNTotCells() const
virtual void PrintAll() const
void SetDsChannel(Int_t chan)
void FillD02p(AliAODRecoDecayHF *d, TClonesArray *arrayMC, Int_t index, Int_t isSel)
void SetMassLimits(Float_t range, Int_t pdg)
Bool_t IsSelected(TObject *obj)
virtual void Terminate(Option_t *option)
Int_t fNVars
selection level: kALL,kTracks,kCandidate
TH1F * fHistNEvents
! hist of n of aods
AliAODRecoDecayHF2Prong * Get2Prong() const
virtual Bool_t IsInFiducialAcceptance(Double_t, Double_t) const
Int_t PtBin(Double_t pt) const
TH1F * fMassHist[kMaxNHist]
Multidimvector container.
Int_t fDecChannel
flag to search for D from B decays
void FillDstar(AliAODRecoCascadeHF *dstarD0pi, TClonesArray *arrayMC, Int_t index, Int_t isSel)
Int_t fDsChannel
fill histograms with particle only (+1), antiparticle only (-1), both (0)
TH1F * fSigHist[kMaxNHist]
!hist. for inv mass (sig from MC truth)