25 #include <TParticle.h>
27 #include <THnSparse.h>
30 #include <TDatabasePDG.h>
31 #include <TParameter.h>
32 #include <AliAnalysisDataSlot.h>
33 #include <AliAnalysisDataContainer.h>
35 #include "AliMCEvent.h"
36 #include "AliAnalysisManager.h"
37 #include "AliAODMCHeader.h"
38 #include "AliAODHandler.h"
40 #include "AliAODVertex.h"
41 #include "AliAODRecoDecay.h"
46 #include "AliESDtrack.h"
47 #include "AliAODMCParticle.h"
49 #include "AliAODEvent.h"
50 #include "AliVertexerTracks.h"
51 #include "AliNeutralTrackParam.h"
62 fSingleSideband(kFALSE),
76 fIsSignalPrompt(kFALSE),
77 fIsSignalFromB(kFALSE),
78 fIsBackground(kFALSE),
96 fSingleSideband(kFALSE),
104 fListSignalPrompt(0),
110 fIsSignalPrompt(kFALSE),
111 fIsSignalFromB(kFALSE),
112 fIsBackground(kFALSE),
120 fSignalTypeForTree(0)
131 DefineOutput(1, TH1D::Class());
132 DefineOutput(2, TList::Class());
133 DefineOutput(3, TList::Class());
134 DefineOutput(4, TList::Class());
135 DefineOutput(5, TList::Class());
136 DefineOutput(6, TList::Class());
137 DefineOutput(7, AliRDHFCutsDStartoKpipi::Class());
138 DefineOutput(8, AliNormalizationCounter::Class());
139 DefineOutput(9, TTree::Class());
141 for (
Int_t i=0;i<30;i++) {
170 const char* name = GetOutputSlot(7)->GetContainer()->GetName();
171 copyCuts->SetName(name);
173 PostData(7, copyCuts);
175 fPDGMDStarD0 = TDatabasePDG::Instance()->GetParticle(413)->Mass() - TDatabasePDG::Instance()->GetParticle(421)->Mass();
180 fNEvents =
new TH1D(GetOutputSlot(1)->GetContainer()->GetName(),
"Counter", 21, -0.5, 20.5);
181 fNEvents->GetXaxis()->SetBinLabel(1,
"Events");
182 fNEvents->GetXaxis()->SetBinLabel(2,
"Magnetic field");
183 fNEvents->GetXaxis()->SetBinLabel(3,
"Selected");
184 fNEvents->GetXaxis()->SetBinLabel(4,
"Primary vertex");
185 fNEvents->GetXaxis()->SetBinLabel(5,
"Candidates");
186 fNEvents->GetXaxis()->SetBinLabel(6,
"Passed track cuts");
187 fNEvents->GetXaxis()->SetBinLabel(7,
"Passed fiducial acc cuts");
188 fNEvents->GetXaxis()->SetBinLabel(8,
"Passed cand cuts");
189 fNEvents->GetXaxis()->SetBinLabel(9,
"Recalc prim vtx");
190 fNEvents->GetXaxis()->SetBinLabel(10,
"Calc D* vtx");
191 fNEvents->GetXaxis()->SetBinLabel(11,
"Pass daught imppar cut");
192 fNEvents->GetXaxis()->SetBinLabel(12,
"Real D* (MC)");
193 fNEvents->GetXaxis()->SetBinLabel(13,
"Skip from Hijing (MC)");
236 fTreeCandidate =
new TTree(GetOutputSlot(9)->GetContainer()->GetName(), GetOutputSlot(9)->GetContainer()->GetName());
256 TString listName = list->GetName();
257 listName.ReplaceAll(
"list",
"");
259 if (listName.EqualTo(
"signalfromb")) {
260 listName =
"signal from B";
262 if (listName.EqualTo(
"signalprompt")) {
263 listName =
"signal prompt";
266 TString regions[3] = {
"",
"Peak",
"Sideband"};
269 TH1D* hDeltaInvMass =
new TH1D(
"DeltaInvMass", Form(
"D*-D^{0} invariant mass, %s; #DeltaM [GeV/c^{2}]; Entries", listName.Data()), 700, 0.13, 0.2);
270 hDeltaInvMass->Sumw2();
271 hDeltaInvMass->SetLineColor(4);
272 hDeltaInvMass->SetMarkerColor(4);
273 hDeltaInvMass->SetMarkerStyle(20);
274 hDeltaInvMass->SetMarkerSize(0.6);
275 list->Add(hDeltaInvMass);
278 TH1D* hDeltaInvMassPre =
new TH1D(
"DeltaInvMassPre", Form(
"D*-D^{0} invariant mass pre vtx, %s; #DeltaM [GeV/c^{2}]; Entries", listName.Data()), 700, 0.13, 0.2);
279 hDeltaInvMassPre->Sumw2();
280 hDeltaInvMassPre->SetLineColor(4);
281 hDeltaInvMassPre->SetMarkerColor(4);
282 hDeltaInvMassPre->SetMarkerStyle(20);
283 hDeltaInvMassPre->SetMarkerSize(0.6);
284 list->Add(hDeltaInvMassPre);
287 TH1D* hInvMassD0 =
new TH1D(
"InvMassD0", Form(
"D^{0} invariant mass, %s; M [GeV/c^{2}]; Entries", listName.Data()), 600, 1.6, 2.2);
289 hInvMassD0->SetLineColor(4);
290 hInvMassD0->SetMarkerColor(4);
291 hInvMassD0->SetMarkerStyle(20);
292 hInvMassD0->SetMarkerSize(0.6);
293 list->Add(hInvMassD0);
295 for (
Int_t r=0;r<3;r++) {
296 TString regionTitle(regions[r]);
297 if (!regionTitle.EqualTo(
"")) {
298 regionTitle.ToLower();
299 regionTitle.Prepend(
", ");
300 regionTitle.Append(
" region");
304 TH1D* hImpPar =
new TH1D(Form(
"ImpPar%s", regions[r].
Data()), Form(
"D* impact parameter%s, %s; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data()), 1000, -1000., 1000.);
306 hImpPar->SetLineColor(4);
307 hImpPar->SetMarkerColor(4);
308 hImpPar->SetMarkerStyle(20);
309 hImpPar->SetMarkerSize(0.6);
313 TH1D* hImpParSoftPi =
new TH1D(Form(
"ImpParSoftPi%s", regions[r].
Data()), Form(
"#pi_{s} impact parameter%s, %s; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data()), 1000, -1000., 1000.);
314 hImpParSoftPi->Sumw2();
315 hImpParSoftPi->SetLineColor(4);
316 hImpParSoftPi->SetMarkerColor(4);
317 hImpParSoftPi->SetMarkerStyle(20);
318 hImpParSoftPi->SetMarkerSize(0.6);
319 list->Add(hImpParSoftPi);
322 TH1D* hImpParD0 =
new TH1D(Form(
"ImpParD0%s", regions[r].
Data()), Form(
"D^{0} impact parameter%s, %s; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data()), 1000, -1000., 1000.);
324 hImpParD0->SetLineColor(4);
325 hImpParD0->SetMarkerColor(4);
326 hImpParD0->SetMarkerStyle(20);
327 hImpParD0->SetMarkerSize(0.6);
328 list->Add(hImpParD0);
331 TH1D* hImpParD0K =
new TH1D(Form(
"ImpParD0K%s", regions[r].
Data()), Form(
"K (from D^{0}) impact parameter%s, %s; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data()), 1000, -1000., 1000.);
333 hImpParD0K->SetLineColor(4);
334 hImpParD0K->SetMarkerColor(4);
335 hImpParD0K->SetMarkerStyle(20);
336 hImpParD0K->SetMarkerSize(0.6);
337 list->Add(hImpParD0K);
340 TH1D* hImpParD0K2 =
new TH1D(Form(
"ImpParD0K2%s", regions[r].
Data()), Form(
"K (from D^{0}) impact parameter (no recalc prim vtx)%s, %s; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data()), 1000, -1000., 1000.);
341 hImpParD0K2->Sumw2();
342 hImpParD0K2->SetLineColor(4);
343 hImpParD0K2->SetMarkerColor(4);
344 hImpParD0K2->SetMarkerStyle(20);
345 hImpParD0K2->SetMarkerSize(0.6);
346 list->Add(hImpParD0K2);
349 TH1D* hImpParD0Pi =
new TH1D(Form(
"ImpParD0Pi%s", regions[r].
Data()), Form(
"#pi (from D^{0}) impact parameter%s, %s; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data()), 1000, -1000., 1000.);
350 hImpParD0Pi->Sumw2();
351 hImpParD0Pi->SetLineColor(4);
352 hImpParD0Pi->SetMarkerColor(4);
353 hImpParD0Pi->SetMarkerStyle(20);
354 hImpParD0Pi->SetMarkerSize(0.6);
355 list->Add(hImpParD0Pi);
358 TH1D* hImpParD0Pi2 =
new TH1D(Form(
"ImpParD0Pi2%s", regions[r].
Data()), Form(
"#pi (from D^{0}) impact parameter (no recalc prim vtx)%s, %s; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data()), 1000, -1000., 1000.);
359 hImpParD0Pi2->Sumw2();
360 hImpParD0Pi2->SetLineColor(4);
361 hImpParD0Pi2->SetMarkerColor(4);
362 hImpParD0Pi2->SetMarkerStyle(20);
363 hImpParD0Pi2->SetMarkerSize(0.6);
364 list->Add(hImpParD0Pi2);
371 Float_t ptHigh = ptLimits[(i+1)];
373 TH1D* hDeltaInvMassLoop =
new TH1D(Form(
"DeltaInvMass_%d", i), Form(
"D*-D^{0} invariant mass, %s, %.1f < p_{T} < %.1f GeV/c; #DeltaM [GeV/c^{2}]; Entries", listName.Data(), ptLow, ptHigh), 700, 0.13, 0.2);
374 hDeltaInvMassLoop->Sumw2();
375 hDeltaInvMassLoop->SetLineColor(4);
376 hDeltaInvMassLoop->SetMarkerColor(4);
377 hDeltaInvMassLoop->SetMarkerStyle(20);
378 hDeltaInvMassLoop->SetMarkerSize(0.6);
379 list->Add(hDeltaInvMassLoop);
381 TH1D* hDeltaInvMassPreLoop =
new TH1D(Form(
"DeltaInvMassPre_%d", i), Form(
"D*-D^{0} invariant mass pre vtx, %s, %.1f < p_{T} < %.1f GeV/c; #DeltaM [GeV/c^{2}]; Entries", listName.Data(), ptLow, ptHigh), 700, 0.13, 0.2);
382 hDeltaInvMassPreLoop->Sumw2();
383 hDeltaInvMassPreLoop->SetLineColor(4);
384 hDeltaInvMassPreLoop->SetMarkerColor(4);
385 hDeltaInvMassPreLoop->SetMarkerStyle(20);
386 hDeltaInvMassPreLoop->SetMarkerSize(0.6);
387 list->Add(hDeltaInvMassPreLoop);
389 TH1D* hInvMassD0Loop =
new TH1D(Form(
"InvMassD0_%d", i), Form(
"D^{0} invariant mass, %s, %.1f < p_{T} < %.1f GeV/c; M [GeV/c^{2}]; Entries", listName.Data(), ptLow, ptHigh), 600, 1.6, 2.2);
390 hInvMassD0Loop->Sumw2();
391 hInvMassD0Loop->SetLineColor(4);
392 hInvMassD0Loop->SetMarkerColor(4);
393 hInvMassD0Loop->SetMarkerStyle(20);
394 hInvMassD0Loop->SetMarkerSize(0.6);
395 list->Add(hInvMassD0Loop);
397 for (
Int_t r=0;r<3;r++) {
398 TString regionTitle(regions[r]);
399 if (!regionTitle.EqualTo(
"")) {
400 regionTitle.ToLower();
401 regionTitle.Prepend(
", ");
402 regionTitle.Append(
" region");
406 TH1D* hImpPar =
new TH1D(Form(
"ImpPar%s_%d", regions[r].
Data(), i), Form(
"D* impact parameter%s, %s, %.1f < p_{T} < %.1f GeV/c; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data(), ptLow, ptHigh), 1000, -1000., 1000.);
408 hImpPar->SetLineColor(4);
409 hImpPar->SetMarkerColor(4);
410 hImpPar->SetMarkerStyle(20);
411 hImpPar->SetMarkerSize(0.6);
415 TH1D* hImpParSoftPi =
new TH1D(Form(
"ImpParSoftPi%s_%d", regions[r].
Data(), i), Form(
"#pi_{s} impact parameter%s, %s, %.1f < p_{T} < %.1f GeV/c; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data(), ptLow, ptHigh), 1000, -1000., 1000.);
416 hImpParSoftPi->Sumw2();
417 hImpParSoftPi->SetLineColor(4);
418 hImpParSoftPi->SetMarkerColor(4);
419 hImpParSoftPi->SetMarkerStyle(20);
420 hImpParSoftPi->SetMarkerSize(0.6);
421 list->Add(hImpParSoftPi);
424 TH1D* hImpParD0 =
new TH1D(Form(
"ImpParD0%s_%d", regions[r].
Data(), i), Form(
"D^{0} impact parameter%s, %s, %.1f < p_{T} < %.1f GeV/c; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data(), ptLow, ptHigh), 1000, -1000., 1000.);
426 hImpParD0->SetLineColor(4);
427 hImpParD0->SetMarkerColor(4);
428 hImpParD0->SetMarkerStyle(20);
429 hImpParD0->SetMarkerSize(0.6);
430 list->Add(hImpParD0);
433 TH1D* hImpParD0K =
new TH1D(Form(
"ImpParD0K%s_%d", regions[r].
Data(), i), Form(
"K (from D^{0}) impact parameter%s, %s, %.1f < p_{T} < %.1f GeV/c; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data(), ptLow, ptHigh), 1000, -1000., 1000.);
435 hImpParD0K->SetLineColor(4);
436 hImpParD0K->SetMarkerColor(4);
437 hImpParD0K->SetMarkerStyle(20);
438 hImpParD0K->SetMarkerSize(0.6);
439 list->Add(hImpParD0K);
442 TH1D* hImpParD0K2 =
new TH1D(Form(
"ImpParD0K2%s_%d", regions[r].
Data(), i), Form(
"K (from D^{0}) impact parameter (no recalc prim vtx)%s, %s, %.1f < p_{T} < %.1f GeV/c; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data(), ptLow, ptHigh), 1000, -1000., 1000.);
443 hImpParD0K2->Sumw2();
444 hImpParD0K2->SetLineColor(4);
445 hImpParD0K2->SetMarkerColor(4);
446 hImpParD0K2->SetMarkerStyle(20);
447 hImpParD0K2->SetMarkerSize(0.6);
448 list->Add(hImpParD0K2);
451 TH1D* hImpParD0Pi =
new TH1D(Form(
"ImpParD0Pi%s_%d", regions[r].
Data(), i), Form(
"#pi (from D^{0}) impact parameter%s, %s, %.1f < p_{T} < %.1f GeV/c; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data(), ptLow, ptHigh), 1000, -1000., 1000.);
452 hImpParD0Pi->Sumw2();
453 hImpParD0Pi->SetLineColor(4);
454 hImpParD0Pi->SetMarkerColor(4);
455 hImpParD0Pi->SetMarkerStyle(20);
456 hImpParD0Pi->SetMarkerSize(0.6);
457 list->Add(hImpParD0Pi);
460 TH1D* hImpParD0Pi2 =
new TH1D(Form(
"ImpParD0Pi2%s_%d", regions[r].
Data(), i), Form(
"#pi (from D^{0}) impact parameter (no recalc prim vtx)%s, %s, %.1f < p_{T} < %.1f GeV/c; Impact parameter [#mum]; Entries", regionTitle.Data(), listName.Data(), ptLow, ptHigh), 1000, -1000., 1000.);
461 hImpParD0Pi2->Sumw2();
462 hImpParD0Pi2->SetLineColor(4);
463 hImpParD0Pi2->SetMarkerColor(4);
464 hImpParD0Pi2->SetMarkerStyle(20);
465 hImpParD0Pi2->SetMarkerSize(0.6);
466 list->Add(hImpParD0Pi2);
472 Int_t sparseBins[3] = {1000, 1000, 1000};
Double_t sparseLow[3] = {-0.5, -0.5, -0.5};
Double_t sparseHigh[3] = {999.5, 999.5, 999.5};
473 THnSparseF* hPDG =
new THnSparseF(
"PDGMotherPeak",
"PDG mother, peak region, background", 3, sparseBins, sparseLow, sparseHigh);
481 Float_t ptHigh = ptLimits[(i+1)];
483 TH1D* hImpParTrue =
new TH1D(Form(
"ImpParTrue_%d", i), Form(
"True D* impact parameter, %s, %.1f < p_{T} < %.1f GeV/c; Impact parameter [#mum]; Entries", listName.Data(), ptLow, ptHigh), 1000, -1000., 1000.);
484 hImpParTrue->Sumw2();
485 hImpParTrue->SetLineColor(4);
486 hImpParTrue->SetMarkerColor(4);
487 hImpParTrue->SetMarkerStyle(20);
488 hImpParTrue->SetMarkerSize(0.6);
489 list->Add(hImpParTrue);
496 list->Add(pSingleSideband);
503 list->Add(pSidebandCut);
506 list->Add(pSidebandWindow);
513 Error(
"UserExec",
"NO EVENT FOUND!");
518 TClonesArray *arrayCand = 0;
522 if (!aodEvent && AODEvent() && IsStandardAOD()) {
523 aodEvent =
dynamic_cast<AliAODEvent*
> (AODEvent());
524 AliAODHandler* aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
525 if(aodHandler->GetExtensions()) {
526 AliAODExtension *ext = (AliAODExtension*) aodHandler->GetExtensions()->FindObject(
"AliAOD.VertexingHF.root");
528 arrayCand = (TClonesArray*) aodFromExt->GetList()->FindObject(
"Dstar");
532 arrayCand = (TClonesArray*) aodEvent->GetList()->FindObject(
"Dstar");
535 Int_t pdgDgDStartoD0pi[2] = {421, 211};
536 Int_t pdgDgD0toKpi[2] = {321, 211};
538 TClonesArray *mcArray = 0;
539 AliAODMCHeader *mcHeader = 0;
541 mcArray =
dynamic_cast<TClonesArray*
>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
543 AliError(
"Could not find Monte-Carlo in AOD");
547 mcHeader = (AliAODMCHeader*) aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
549 printf(
"AliAnalysisTaskSEDplus::UserExec: MC header branch not found!\n");
554 if (!aodEvent->GetPrimaryVertex() || TMath::Abs(aodEvent->GetMagneticField()) < 0.001) {
568 AliAODVertex *vtx1 = (AliAODVertex*) aodEvent->GetPrimaryVertex();
569 if (!vtx1 || vtx1->GetNContributors() < 1) {
575 AliInfo(
"Could not find array of HF vertices, skipping the event");
579 AliDebug(2, Form(
"Found %d vertices", arrayCand->GetEntriesFast()));
585 Int_t nSelectedProd = 0;
586 Int_t nSelectedAna = 0;
588 Int_t nCand = arrayCand->GetEntriesFast();
589 for (
Int_t iCand = 0; iCand<nCand; iCand++) {
605 if (ptBin < 0 || ptBin >=
fNPtBins) {
637 FillHistogram(Form(
"DeltaInvMassPre_%d", ptBin), deltaInvMass);
664 d0 = TMath::Abs(d0*1.e4);
672 d0 = TMath::Abs(d0*1.e4);
680 d0 = TMath::Abs(d0*1.e4);
690 AliAODMCParticle *partDSt = 0;
694 Int_t mcLabel = cand->
MatchToMC(413, 421, pdgDgDStartoD0pi, pdgDgD0toKpi, mcArray);
700 partDSt = (AliAODMCParticle*) mcArray->At(mcLabel);
710 if (
IsFromB(mcArray, partDSt)) {
726 AliAODTrack *daughters[3];
727 daughters[0] = candSoftPi;
729 if (((AliAODTrack*) candD0->GetDaughter(0))->Charge()*cand->Charge() > 0) {
731 daughters[1] = (AliAODTrack*) candD0->GetDaughter(0);
732 daughters[2] = (AliAODTrack*) candD0->GetDaughter(1);
735 daughters[1] = (AliAODTrack*) candD0->GetDaughter(1);
736 daughters[2] = (AliAODTrack*) candD0->GetDaughter(0);
739 Double_t PDGCodes[3] = {0., 0., 0.};
741 for (
Int_t iD=0; iD<3; iD++) {
742 AliAODTrack *daughter = daughters[iD];
744 Int_t daughterLabel = daughter->GetLabel();
745 if (daughterLabel >= 0) {
746 AliAODMCParticle *daughterMC = (AliAODMCParticle*) mcArray->At(daughterLabel);
747 Int_t motherLabel = daughterMC->GetMother();
748 if (motherLabel >= 0) {
749 AliAODMCParticle *motherMC = (AliAODMCParticle*) mcArray->At(motherLabel);
750 Int_t motherPDG = TMath::Abs(motherMC->GetPdgCode());
754 PDGCodes[iD] = motherPDG;
759 Int_t grandmotherLabel = motherMC->GetMother();
760 if (grandmotherLabel >= 0) {
761 AliAODMCParticle *grandmotherMC = (AliAODMCParticle*) mcArray->At(grandmotherLabel);
762 Int_t grandmotherPDG = TMath::Abs(grandmotherMC->GetPdgCode());
763 PDGCodes[iD] = grandmotherPDG;
770 ((THnSparseF*)
fListBackground->FindObject(
"PDGMotherPeak"))->Fill(PDGCodes);
803 AliAODVertex *vtxAOD = aod->GetPrimaryVertex();
809 if (!title.Contains(
"VertexerTracks")) {
813 AliVertexerTracks *vertexer =
new AliVertexerTracks(aod->GetMagneticField());
815 vertexer->SetITSMode();
816 vertexer->SetMinClusters(3);
817 vertexer->SetConstraintOff();
819 if (title.Contains(
"WithConstraint")) {
821 aod->GetDiamondCovXY(diamondcovxy);
822 Double_t pos[3] = {aod->GetDiamondX(), aod->GetDiamondY(), 0.};
823 Double_t cov[6] = {diamondcovxy[0], diamondcovxy[1], diamondcovxy[2], 0., 0., 10.*10.};
824 AliESDVertex *diamond =
new AliESDVertex(pos, cov, 1., 1);
825 vertexer->SetVtxStart(diamond);
826 delete diamond; diamond=NULL;
829 Int_t skipped[10];
for(
Int_t i=0; i<10; i++) { skipped[i] = -1; }
830 Int_t nTrksToSkip = 0, id;
833 for (
Int_t i=0; i<3; i++) {
839 t = (AliAODTrack*) twoProng->GetDaughter(i-1);
842 id = (
Int_t) t->GetID();
846 skipped[nTrksToSkip++] = id;
849 vertexer->SetSkipTracks(nTrksToSkip, skipped);
850 AliESDVertex *vtxESDNew = vertexer->FindPrimaryVertex(aod);
852 delete vertexer; vertexer = NULL;
858 if (vtxESDNew->GetNContributors() <= 0) {
859 delete vtxESDNew; vtxESDNew = NULL;
864 Double_t pos[3], cov[6], chi2perNDF;
865 vtxESDNew->GetXYZ(pos);
866 vtxESDNew->GetCovMatrix(cov);
867 chi2perNDF = vtxESDNew->GetChi2toNDF();
868 delete vtxESDNew; vtxESDNew = NULL;
870 AliAODVertex *vtxAODNew =
new AliAODVertex(pos, cov, chi2perNDF);
881 AliNeutralTrackParam *ntpD0 =
new AliNeutralTrackParam(candD0);
884 AliESDtrack *candSoftPiESD =
new AliESDtrack(candSoftPi);
888 tracks->AddAt(candSoftPiESD, 0);
889 tracks->AddAt(ntpD0, 1);
895 AliESDVertex *newPrimVtxESD =
new AliESDVertex(pos, cov, 100., 100,
fNewPrimVtx->GetName());
897 AliVertexerTracks *vertexerTracks =
new AliVertexerTracks(
fMagneticField);
898 vertexerTracks->SetVtxStart(newPrimVtxESD);
899 AliESDVertex *vertexESD = (AliESDVertex*) vertexerTracks->VertexForSelectedESDTracks(tracks);
904 if (vertexESD->GetNContributors() != 2) {
905 delete vertexESD; vertexESD = 0;
909 Double_t vertRadius2 = vertexESD->GetX()*vertexESD->GetX() + vertexESD->GetY()*vertexESD->GetY();
910 if (vertRadius2 > 8.) {
912 delete vertexESD; vertexESD = 0;
916 Double_t pos2[3], cov2[6], chi2perNDF;
917 vertexESD->GetXYZ(pos2);
918 vertexESD->GetCovMatrix(cov2);
919 chi2perNDF = vertexESD->GetChi2toNDF();
921 delete vertexESD; vertexESD = 0;
923 AliAODVertex *vertexAOD =
new AliAODVertex(pos2, cov2, chi2perNDF, 0x0, -1, AliAODVertex::kUndef, 2);
931 Double_t invMassDiffAbs = TMath::Abs(invMassDiff);
945 if (invMassDiffAbs < peakCut) {
951 invMassDiff = invMassDiffAbs;
954 if (invMassDiff > sidebandCut && invMassDiff <= sidebandCut+sidebandWindow) {
961 Int_t mother = mcPartCandidate->GetMother();
963 AliAODMCParticle *mcGranma =
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(mother));
965 Int_t pdgGranma = mcGranma->GetPdgCode();
966 Int_t abspdgGranma = TMath::Abs(pdgGranma);
967 if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) {
970 mother = mcGranma->GetMother();
973 AliError(
"Failed casting the mother particle!");
983 Int_t mother = mcPartCandidate->GetMother();
985 AliAODMCParticle *mcGranma =
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(mother));
987 Int_t pdgGranma = mcGranma->GetPdgCode();
988 Int_t abspdgGranma = TMath::Abs(pdgGranma);
989 if (abspdgGranma == 4 || abspdgGranma == 5) {
992 mother = mcGranma->GetMother();
995 AliError(
"Failed casting the mother particle!");
1005 AliExternalTrackParam etp;
1006 etp.CopyFromVTrack(track);
1011 d0Err = TMath::Sqrt(covdz[0]);
1022 Double_t p[3] = {cand->Px(), cand->Py(), cand->Pz()};
1023 Double_t ptsq = p[0]*p[0] + p[1]*p[1];
1028 Double_t k = - (sec[0]-prim[0])*p[0] - (sec[1]-prim[1])*p[1];
1030 Double_t dx = sec[0] - prim[0] + k*p[0];
1031 Double_t dy = sec[1] - prim[1] + k*p[1];
1032 Double_t absImpPar = TMath::Sqrt(dx*dx+dy*dy);
1034 TVector3 mom(p[0], p[1], p[2]);
1035 TVector3 fline(sec[0]-prim[0], sec[1]-prim[1], sec[2]-prim[2]);
1036 TVector3 cross = mom.Cross(fline);
1038 return (cross.Z() > 0. ? absImpPar : -absImpPar);
1051 FillHistogram(Form(
"DeltaInvMass_%d", ptBin), deltaInvMass);
1082 AliAODTrack *
pi; AliAODTrack *K;
Int_t piId, KId;
1083 if (((AliAODTrack*) candD0->GetDaughter(0))->Charge()*cand->Charge() > 0) {
1091 pi = (AliAODTrack*) candD0->GetDaughter(piId);
1092 K = (AliAODTrack*) candD0->GetDaughter(KId);
1103 d0 = candD0->Getd0Prong(piId);
1118 d0 = candD0->Getd0Prong(KId);
1124 AliAODVertex *origVtx = 0;
1187 AliAODTrack *tr1 = (AliAODTrack*) candD0->GetDaughter(0);
1188 AliAODTrack *tr2 = (AliAODTrack*) candD0->GetDaughter(1);
1189 AliAODTrack *tr3 = (AliAODTrack*) cand->
GetBachelor();
1191 Int_t label1 = tr1->GetLabel();
1192 Int_t label2 = tr2->GetLabel();
1193 Int_t label3 = tr3->GetLabel();
1195 if (label1 < 0 || label2 < 0 || label3 < 0) {
1199 AliAODMCParticle *part1 = (AliAODMCParticle*) arrayMC->At(label1);
1200 AliAODMCParticle *part2 = (AliAODMCParticle*) arrayMC->At(label2);
1201 AliAODMCParticle *part3 = (AliAODMCParticle*) arrayMC->At(label3);
1203 if (part1 == 0 || part2 == 0 || part3 == 0) {
1207 Double_t PxTotal = part1->Px()+part2->Px()+part3->Px();
1208 Double_t PyTotal = part1->Py()+part2->Py()+part3->Py();
1209 Double_t PzTotal = part1->Pz()+part2->Pz()+part3->Pz();
1213 Double_t prim[3] = {headerMC->GetVtxX(), headerMC->GetVtxY(), headerMC->GetVtxZ()};
1214 Double_t sec[3] = {part3->Xv(), part3->Yv(), part3->Zv()};
1215 Double_t p[3] = {PxTotal, PyTotal, PzTotal};
1218 Double_t ptsq = p[0]*p[0] + p[1]*p[1];
1219 Double_t k = - (sec[0]-prim[0])*p[0] - (sec[1]-prim[1])*p[1];
1221 Double_t dx = sec[0] - prim[0] + k*p[0];
1222 Double_t dy = sec[1] - prim[1] + k*p[1];
1223 Double_t absImpPar = TMath::Sqrt(dx*dx+dy*dy)*1.e4;
1225 TVector3 mom(p[0], p[1], p[2]);
1226 TVector3 fline(sec[0]-prim[0], sec[1]-prim[1], sec[2]-prim[2]);
1227 TVector3 cross = mom.Cross(fline);
1229 Double_t impParTrue = cross.Z() > 0. ? absImpPar : -absImpPar;
1232 hImpParTrue->Fill(impParTrue);
Double_t fSidebandCut[30]
Bool_t IsFromHijing(TClonesArray *arrayMC, const AliAODMCParticle *mcPartCandidate)
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
ClassImp(AliAnalysisTaskSEDStarCharmFraction) AliAnalysisTaskSEDStarCharmFraction
Double_t fSidebandWindow[30]
Double_t DeltaInvMass() const
void FillRegionHistogram(const char *name, Double_t value)
Bool_t CalculateImpactParameter(AliAODTrack *track, Double_t &d0, Double_t &d0Err)
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabs2prong, Int_t *pdgDg, Int_t *pdgDg2prong, TClonesArray *mcArray, Bool_t isV0=kFALSE) const
virtual void UserExec(Option_t *option)
void UnsetOwnPrimaryVtx()
Double_t * fImpParForTree
Double_t ImpParXY() const
void FillHistograms(AliAODRecoCascadeHF *cand)
void FillHistogram(const char *name, Double_t value)
virtual ~AliAnalysisTaskSEDStarCharmFraction()
void SetUpList(TList *list)
TList * fListSignalPrompt
Double_t CalculateImpactParameterDStar(AliAODRecoCascadeHF *cand)
AliAODTrack * GetBachelor() const
AliAODVertex * GetOwnPrimaryVtx() const
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel, AliAODEvent *aod)
void CheckInvMassDStar(AliAODRecoCascadeHF *cand)
AliNormalizationCounter * fCounter
AliAODVertex * RemoveDaughtersFromPrimaryVtx(AliAODEvent *aod, AliAODRecoCascadeHF *cand)
AliAODVertex * fNewPrimVtx
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)
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
Double_t * fInvMassForTree
virtual void Terminate(Option_t *option)
Bool_t IsEventSelected(AliVEvent *event)
AliAnalysisTaskSEDStarCharmFraction()
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
AliAODVertex * ReconstructDStarVtx(AliAODRecoCascadeHF *cand)
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
AliRDHFCutsDStartoKpipi * fCuts
Float_t * GetPtBinLimits() const
Double_t InvMassD0() const
Bool_t IsFromB(TClonesArray *arrayMC, const AliAODMCParticle *mcPartCandidate)
AliAODRecoDecayHF2Prong * Get2Prong() const
virtual void UserCreateOutputObjects()
Int_t PtBin(Double_t pt) const
Short_t * fSignalTypeForTree
void FillTrueImpactParameter(AliAODMCHeader *headerMC, TClonesArray *arrayMC, AliAODRecoCascadeHF *cand)