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),
85 fTrueImpParForTree(0),
97 fSingleSideband(kFALSE),
105 fListSignalPrompt(0),
111 fIsSignalPrompt(kFALSE),
112 fIsSignalFromB(kFALSE),
113 fIsBackground(kFALSE),
120 fTrueImpParForTree(0),
122 fSignalTypeForTree(0)
133 DefineOutput(1, TH1D::Class());
134 DefineOutput(2, TList::Class());
135 DefineOutput(3, TList::Class());
136 DefineOutput(4, TList::Class());
137 DefineOutput(5, TList::Class());
138 DefineOutput(6, TList::Class());
139 DefineOutput(7, AliRDHFCutsDStartoKpipi::Class());
140 DefineOutput(8, AliNormalizationCounter::Class());
141 DefineOutput(9, TTree::Class());
143 for (
Int_t i=0;i<30;i++) {
172 const char* name = GetOutputSlot(7)->GetContainer()->GetName();
173 copyCuts->SetName(name);
175 PostData(7, copyCuts);
177 fPDGMDStarD0 = TDatabasePDG::Instance()->GetParticle(413)->Mass() - TDatabasePDG::Instance()->GetParticle(421)->Mass();
182 fNEvents =
new TH1D(GetOutputSlot(1)->GetContainer()->GetName(),
"Counter", 21, -0.5, 20.5);
183 fNEvents->GetXaxis()->SetBinLabel(1,
"Events");
184 fNEvents->GetXaxis()->SetBinLabel(2,
"Magnetic field");
185 fNEvents->GetXaxis()->SetBinLabel(3,
"Selected");
186 fNEvents->GetXaxis()->SetBinLabel(4,
"Primary vertex");
187 fNEvents->GetXaxis()->SetBinLabel(5,
"Candidates");
188 fNEvents->GetXaxis()->SetBinLabel(6,
"Passed track cuts");
189 fNEvents->GetXaxis()->SetBinLabel(7,
"Passed fiducial acc cuts");
190 fNEvents->GetXaxis()->SetBinLabel(8,
"Passed cand cuts");
191 fNEvents->GetXaxis()->SetBinLabel(9,
"Recalc prim vtx");
192 fNEvents->GetXaxis()->SetBinLabel(10,
"Calc D* vtx");
193 fNEvents->GetXaxis()->SetBinLabel(11,
"Pass daught imppar cut");
194 fNEvents->GetXaxis()->SetBinLabel(12,
"Real D* (MC)");
195 fNEvents->GetXaxis()->SetBinLabel(13,
"Skip from Hijing (MC)");
233 fTreeCandidate =
new TTree(GetOutputSlot(9)->GetContainer()->GetName(), GetOutputSlot(9)->GetContainer()->GetName());
254 TString listName = list->GetName();
255 listName.ReplaceAll(
"list",
"");
257 if (listName.EqualTo(
"signalfromb")) {
258 listName =
"signal from B";
260 if (listName.EqualTo(
"signalprompt")) {
261 listName =
"signal prompt";
264 TString regions[3] = {
"",
"Peak",
"Sideband"};
267 TH1D* hDeltaInvMass =
new TH1D(
"DeltaInvMass", Form(
"D*-D^{0} invariant mass, %s; #DeltaM [GeV/c^{2}]; Entries", listName.Data()), 700, 0.13, 0.2);
268 hDeltaInvMass->Sumw2();
269 hDeltaInvMass->SetLineColor(4);
270 hDeltaInvMass->SetMarkerColor(4);
271 hDeltaInvMass->SetMarkerStyle(20);
272 hDeltaInvMass->SetMarkerSize(0.6);
273 list->Add(hDeltaInvMass);
276 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);
277 hDeltaInvMassPre->Sumw2();
278 hDeltaInvMassPre->SetLineColor(4);
279 hDeltaInvMassPre->SetMarkerColor(4);
280 hDeltaInvMassPre->SetMarkerStyle(20);
281 hDeltaInvMassPre->SetMarkerSize(0.6);
282 list->Add(hDeltaInvMassPre);
285 TH1D* hInvMassD0 =
new TH1D(
"InvMassD0", Form(
"D^{0} invariant mass, %s; M [GeV/c^{2}]; Entries", listName.Data()), 600, 1.6, 2.2);
287 hInvMassD0->SetLineColor(4);
288 hInvMassD0->SetMarkerColor(4);
289 hInvMassD0->SetMarkerStyle(20);
290 hInvMassD0->SetMarkerSize(0.6);
291 list->Add(hInvMassD0);
293 for (
Int_t r=0;r<3;r++) {
294 TString regionTitle(regions[r]);
295 if (!regionTitle.EqualTo(
"")) {
296 regionTitle.ToLower();
297 regionTitle.Prepend(
", ");
298 regionTitle.Append(
" region");
302 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.);
304 hImpPar->SetLineColor(4);
305 hImpPar->SetMarkerColor(4);
306 hImpPar->SetMarkerStyle(20);
307 hImpPar->SetMarkerSize(0.6);
311 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.);
312 hImpParSoftPi->Sumw2();
313 hImpParSoftPi->SetLineColor(4);
314 hImpParSoftPi->SetMarkerColor(4);
315 hImpParSoftPi->SetMarkerStyle(20);
316 hImpParSoftPi->SetMarkerSize(0.6);
317 list->Add(hImpParSoftPi);
320 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.);
322 hImpParD0->SetLineColor(4);
323 hImpParD0->SetMarkerColor(4);
324 hImpParD0->SetMarkerStyle(20);
325 hImpParD0->SetMarkerSize(0.6);
326 list->Add(hImpParD0);
329 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.);
331 hImpParD0K->SetLineColor(4);
332 hImpParD0K->SetMarkerColor(4);
333 hImpParD0K->SetMarkerStyle(20);
334 hImpParD0K->SetMarkerSize(0.6);
335 list->Add(hImpParD0K);
338 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.);
339 hImpParD0K2->Sumw2();
340 hImpParD0K2->SetLineColor(4);
341 hImpParD0K2->SetMarkerColor(4);
342 hImpParD0K2->SetMarkerStyle(20);
343 hImpParD0K2->SetMarkerSize(0.6);
344 list->Add(hImpParD0K2);
347 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.);
348 hImpParD0Pi->Sumw2();
349 hImpParD0Pi->SetLineColor(4);
350 hImpParD0Pi->SetMarkerColor(4);
351 hImpParD0Pi->SetMarkerStyle(20);
352 hImpParD0Pi->SetMarkerSize(0.6);
353 list->Add(hImpParD0Pi);
356 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.);
357 hImpParD0Pi2->Sumw2();
358 hImpParD0Pi2->SetLineColor(4);
359 hImpParD0Pi2->SetMarkerColor(4);
360 hImpParD0Pi2->SetMarkerStyle(20);
361 hImpParD0Pi2->SetMarkerSize(0.6);
362 list->Add(hImpParD0Pi2);
369 Float_t ptHigh = ptLimits[(i+1)];
371 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);
372 hDeltaInvMassLoop->Sumw2();
373 hDeltaInvMassLoop->SetLineColor(4);
374 hDeltaInvMassLoop->SetMarkerColor(4);
375 hDeltaInvMassLoop->SetMarkerStyle(20);
376 hDeltaInvMassLoop->SetMarkerSize(0.6);
377 list->Add(hDeltaInvMassLoop);
379 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);
380 hDeltaInvMassPreLoop->Sumw2();
381 hDeltaInvMassPreLoop->SetLineColor(4);
382 hDeltaInvMassPreLoop->SetMarkerColor(4);
383 hDeltaInvMassPreLoop->SetMarkerStyle(20);
384 hDeltaInvMassPreLoop->SetMarkerSize(0.6);
385 list->Add(hDeltaInvMassPreLoop);
387 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);
388 hInvMassD0Loop->Sumw2();
389 hInvMassD0Loop->SetLineColor(4);
390 hInvMassD0Loop->SetMarkerColor(4);
391 hInvMassD0Loop->SetMarkerStyle(20);
392 hInvMassD0Loop->SetMarkerSize(0.6);
393 list->Add(hInvMassD0Loop);
395 for (
Int_t r=0;r<3;r++) {
396 TString regionTitle(regions[r]);
397 if (!regionTitle.EqualTo(
"")) {
398 regionTitle.ToLower();
399 regionTitle.Prepend(
", ");
400 regionTitle.Append(
" region");
404 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.);
406 hImpPar->SetLineColor(4);
407 hImpPar->SetMarkerColor(4);
408 hImpPar->SetMarkerStyle(20);
409 hImpPar->SetMarkerSize(0.6);
413 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.);
414 hImpParSoftPi->Sumw2();
415 hImpParSoftPi->SetLineColor(4);
416 hImpParSoftPi->SetMarkerColor(4);
417 hImpParSoftPi->SetMarkerStyle(20);
418 hImpParSoftPi->SetMarkerSize(0.6);
419 list->Add(hImpParSoftPi);
422 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.);
424 hImpParD0->SetLineColor(4);
425 hImpParD0->SetMarkerColor(4);
426 hImpParD0->SetMarkerStyle(20);
427 hImpParD0->SetMarkerSize(0.6);
428 list->Add(hImpParD0);
431 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.);
433 hImpParD0K->SetLineColor(4);
434 hImpParD0K->SetMarkerColor(4);
435 hImpParD0K->SetMarkerStyle(20);
436 hImpParD0K->SetMarkerSize(0.6);
437 list->Add(hImpParD0K);
440 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.);
441 hImpParD0K2->Sumw2();
442 hImpParD0K2->SetLineColor(4);
443 hImpParD0K2->SetMarkerColor(4);
444 hImpParD0K2->SetMarkerStyle(20);
445 hImpParD0K2->SetMarkerSize(0.6);
446 list->Add(hImpParD0K2);
449 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.);
450 hImpParD0Pi->Sumw2();
451 hImpParD0Pi->SetLineColor(4);
452 hImpParD0Pi->SetMarkerColor(4);
453 hImpParD0Pi->SetMarkerStyle(20);
454 hImpParD0Pi->SetMarkerSize(0.6);
455 list->Add(hImpParD0Pi);
458 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.);
459 hImpParD0Pi2->Sumw2();
460 hImpParD0Pi2->SetLineColor(4);
461 hImpParD0Pi2->SetMarkerColor(4);
462 hImpParD0Pi2->SetMarkerStyle(20);
463 hImpParD0Pi2->SetMarkerSize(0.6);
464 list->Add(hImpParD0Pi2);
470 TH1D* hProdd0d0All =
new TH1D(Form(
"Prodd0d0All_%d", i), Form(
"d0d0, no cut, %s; d0d0 [cm^{2}]; Entries", listName.Data()), 2000, -0.0002, 0.0002);
471 hProdd0d0All->Sumw2();
472 hProdd0d0All->SetLineColor(4);
473 hProdd0d0All->SetMarkerColor(4);
474 hProdd0d0All->SetMarkerStyle(20);
475 hProdd0d0All->SetMarkerSize(0.6);
476 list->Add(hProdd0d0All);
478 TH1D* hCosPntAngleAll =
new TH1D(Form(
"CosPntAngleAll_%d", i), Form(
"cos #theta_{point}, no cut, %s; cos #theta_{point}; Entries", listName.Data()), 2000, -1, 1);
479 hCosPntAngleAll->Sumw2();
480 hCosPntAngleAll->SetLineColor(4);
481 hCosPntAngleAll->SetMarkerColor(4);
482 hCosPntAngleAll->SetMarkerStyle(20);
483 hCosPntAngleAll->SetMarkerSize(0.6);
484 list->Add(hCosPntAngleAll);
486 TH1D* hNormDecLenAll =
new TH1D(Form(
"NormDecLenAll_%d", i), Form(
"Normalized decay length, no cut, %s; Normalized decay length; Entries", listName.Data()), 2000, 0, 20);
487 hNormDecLenAll->Sumw2();
488 hNormDecLenAll->SetLineColor(4);
489 hNormDecLenAll->SetMarkerColor(4);
490 hNormDecLenAll->SetMarkerStyle(20);
491 hNormDecLenAll->SetMarkerSize(0.6);
492 list->Add(hNormDecLenAll);
498 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};
499 THnSparseF* hPDG =
new THnSparseF(
"PDGMotherPeak",
"PDG mother, peak region, background", 3, sparseBins, sparseLow, sparseHigh);
507 Float_t ptHigh = ptLimits[(i+1)];
509 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.);
510 hImpParTrue->Sumw2();
511 hImpParTrue->SetLineColor(4);
512 hImpParTrue->SetMarkerColor(4);
513 hImpParTrue->SetMarkerStyle(20);
514 hImpParTrue->SetMarkerSize(0.6);
515 list->Add(hImpParTrue);
522 list->Add(pSingleSideband);
529 list->Add(pSidebandCut);
532 list->Add(pSidebandWindow);
539 Error(
"UserExec",
"NO EVENT FOUND!");
544 TClonesArray *arrayCand = 0;
548 if (!aodEvent && AODEvent() && IsStandardAOD()) {
549 aodEvent =
dynamic_cast<AliAODEvent*
> (AODEvent());
550 AliAODHandler* aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
551 if(aodHandler->GetExtensions()) {
552 AliAODExtension *ext = (AliAODExtension*) aodHandler->GetExtensions()->FindObject(
"AliAOD.VertexingHF.root");
554 arrayCand = (TClonesArray*) aodFromExt->GetList()->FindObject(
"Dstar");
558 arrayCand = (TClonesArray*) aodEvent->GetList()->FindObject(
"Dstar");
561 Int_t pdgDgDStartoD0pi[2] = {421, 211};
562 Int_t pdgDgD0toKpi[2] = {321, 211};
564 TClonesArray *mcArray = 0;
565 AliAODMCHeader *mcHeader = 0;
567 mcArray =
dynamic_cast<TClonesArray*
>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
569 AliError(
"Could not find Monte-Carlo in AOD");
573 mcHeader = (AliAODMCHeader*) aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
575 printf(
"AliAnalysisTaskSEDplus::UserExec: MC header branch not found!\n");
580 if (!aodEvent->GetPrimaryVertex() || TMath::Abs(aodEvent->GetMagneticField()) < 0.001) {
594 AliAODVertex *vtx1 = (AliAODVertex*) aodEvent->GetPrimaryVertex();
595 if (!vtx1 || vtx1->GetNContributors() < 1) {
601 AliInfo(
"Could not find array of HF vertices, skipping the event");
605 AliDebug(2, Form(
"Found %d vertices", arrayCand->GetEntriesFast()));
611 Int_t nSelectedProd = 0;
612 Int_t nSelectedAna = 0;
614 Int_t nCand = arrayCand->GetEntriesFast();
615 for (
Int_t iCand = 0; iCand<nCand; iCand++) {
631 if (ptBin < 0 || ptBin >=
fNPtBins) {
656 AliAODMCParticle *partDSt = 0;
658 Int_t mcLabel = cand->
MatchToMC(413, 421, pdgDgDStartoD0pi, pdgDgD0toKpi, mcArray);
664 partDSt = (AliAODMCParticle*) mcArray->At(mcLabel);
671 if (
IsFromB(mcArray, partDSt)) {
703 ((
TH1D*)
fListBackground->FindObject(Form(
"CosPntAngleAll_%d", ptBin)))->Fill(cosPntAngle);
716 FillHistogram(Form(
"DeltaInvMassPre_%d", ptBin), deltaInvMass);
743 d0 = TMath::Abs(d0*1.e4);
751 d0 = TMath::Abs(d0*1.e4);
759 d0 = TMath::Abs(d0*1.e4);
775 AliAODTrack *daughters[3];
776 daughters[0] = candSoftPi;
778 if (((AliAODTrack*) candD0->GetDaughter(0))->Charge()*cand->Charge() > 0) {
780 daughters[1] = (AliAODTrack*) candD0->GetDaughter(0);
781 daughters[2] = (AliAODTrack*) candD0->GetDaughter(1);
784 daughters[1] = (AliAODTrack*) candD0->GetDaughter(1);
785 daughters[2] = (AliAODTrack*) candD0->GetDaughter(0);
788 Double_t PDGCodes[3] = {0., 0., 0.};
790 for (
Int_t iD=0; iD<3; iD++) {
791 AliAODTrack *daughter = daughters[iD];
793 Int_t daughterLabel = daughter->GetLabel();
794 if (daughterLabel >= 0) {
795 AliAODMCParticle *daughterMC = (AliAODMCParticle*) mcArray->At(daughterLabel);
796 Int_t motherLabel = daughterMC->GetMother();
797 if (motherLabel >= 0) {
798 AliAODMCParticle *motherMC = (AliAODMCParticle*) mcArray->At(motherLabel);
799 Int_t motherPDG = TMath::Abs(motherMC->GetPdgCode());
803 PDGCodes[iD] = motherPDG;
808 Int_t grandmotherLabel = motherMC->GetMother();
809 if (grandmotherLabel >= 0) {
810 AliAODMCParticle *grandmotherMC = (AliAODMCParticle*) mcArray->At(grandmotherLabel);
811 Int_t grandmotherPDG = TMath::Abs(grandmotherMC->GetPdgCode());
812 PDGCodes[iD] = grandmotherPDG;
819 ((THnSparseF*)
fListBackground->FindObject(
"PDGMotherPeak"))->Fill(PDGCodes);
852 AliAODVertex *vtxAOD = aod->GetPrimaryVertex();
858 if (!title.Contains(
"VertexerTracks")) {
862 AliVertexerTracks *vertexer =
new AliVertexerTracks(aod->GetMagneticField());
864 vertexer->SetITSMode();
865 vertexer->SetMinClusters(3);
866 vertexer->SetConstraintOff();
868 if (title.Contains(
"WithConstraint")) {
870 aod->GetDiamondCovXY(diamondcovxy);
871 Double_t pos[3] = {aod->GetDiamondX(), aod->GetDiamondY(), 0.};
872 Double_t cov[6] = {diamondcovxy[0], diamondcovxy[1], diamondcovxy[2], 0., 0., 10.*10.};
873 AliESDVertex *diamond =
new AliESDVertex(pos, cov, 1., 1);
874 vertexer->SetVtxStart(diamond);
875 delete diamond; diamond=NULL;
878 Int_t skipped[10];
for(
Int_t i=0; i<10; i++) { skipped[i] = -1; }
879 Int_t nTrksToSkip = 0, id;
882 for (
Int_t i=0; i<3; i++) {
888 t = (AliAODTrack*) twoProng->GetDaughter(i-1);
891 id = (
Int_t) t->GetID();
895 skipped[nTrksToSkip++] = id;
898 vertexer->SetSkipTracks(nTrksToSkip, skipped);
899 AliESDVertex *vtxESDNew = vertexer->FindPrimaryVertex(aod);
901 delete vertexer; vertexer = NULL;
907 if (vtxESDNew->GetNContributors() <= 0) {
908 delete vtxESDNew; vtxESDNew = NULL;
913 Double_t pos[3], cov[6], chi2perNDF;
914 vtxESDNew->GetXYZ(pos);
915 vtxESDNew->GetCovMatrix(cov);
916 chi2perNDF = vtxESDNew->GetChi2toNDF();
917 delete vtxESDNew; vtxESDNew = NULL;
919 AliAODVertex *vtxAODNew =
new AliAODVertex(pos, cov, chi2perNDF);
930 AliNeutralTrackParam *ntpD0 =
new AliNeutralTrackParam(candD0);
933 AliESDtrack *candSoftPiESD =
new AliESDtrack(candSoftPi);
937 tracks->AddAt(candSoftPiESD, 0);
938 tracks->AddAt(ntpD0, 1);
944 AliESDVertex *newPrimVtxESD =
new AliESDVertex(pos, cov, 100., 100,
fNewPrimVtx->GetName());
946 AliVertexerTracks *vertexerTracks =
new AliVertexerTracks(
fMagneticField);
947 vertexerTracks->SetVtxStart(newPrimVtxESD);
948 AliESDVertex *vertexESD = (AliESDVertex*) vertexerTracks->VertexForSelectedESDTracks(tracks);
953 if (vertexESD->GetNContributors() != 2) {
954 delete vertexESD; vertexESD = 0;
958 Double_t vertRadius2 = vertexESD->GetX()*vertexESD->GetX() + vertexESD->GetY()*vertexESD->GetY();
959 if (vertRadius2 > 8.) {
961 delete vertexESD; vertexESD = 0;
965 Double_t pos2[3], cov2[6], chi2perNDF;
966 vertexESD->GetXYZ(pos2);
967 vertexESD->GetCovMatrix(cov2);
968 chi2perNDF = vertexESD->GetChi2toNDF();
970 delete vertexESD; vertexESD = 0;
972 AliAODVertex *vertexAOD =
new AliAODVertex(pos2, cov2, chi2perNDF, 0x0, -1, AliAODVertex::kUndef, 2);
980 Double_t invMassDiffAbs = TMath::Abs(invMassDiff);
994 if (invMassDiffAbs < peakCut) {
1000 invMassDiff = invMassDiffAbs;
1003 if (invMassDiff > sidebandCut && invMassDiff <= sidebandCut+sidebandWindow) {
1010 Int_t mother = mcPartCandidate->GetMother();
1011 while (mother > 0) {
1012 AliAODMCParticle *mcGranma =
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(mother));
1014 Int_t pdgGranma = mcGranma->GetPdgCode();
1015 Int_t abspdgGranma = TMath::Abs(pdgGranma);
1016 if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) {
1019 mother = mcGranma->GetMother();
1022 AliError(
"Failed casting the mother particle!");
1032 Int_t mother = mcPartCandidate->GetMother();
1033 while (mother > 0) {
1034 AliAODMCParticle *mcGranma =
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(mother));
1036 Int_t pdgGranma = mcGranma->GetPdgCode();
1037 Int_t abspdgGranma = TMath::Abs(pdgGranma);
1038 if (abspdgGranma == 4 || abspdgGranma == 5) {
1041 mother = mcGranma->GetMother();
1044 AliError(
"Failed casting the mother particle!");
1054 AliExternalTrackParam etp;
1055 etp.CopyFromVTrack(track);
1060 d0Err = TMath::Sqrt(covdz[0]);
1071 Double_t p[3] = {cand->Px(), cand->Py(), cand->Pz()};
1072 Double_t ptsq = p[0]*p[0] + p[1]*p[1];
1077 Double_t k = - (sec[0]-prim[0])*p[0] - (sec[1]-prim[1])*p[1];
1079 Double_t dx = sec[0] - prim[0] + k*p[0];
1080 Double_t dy = sec[1] - prim[1] + k*p[1];
1081 Double_t absImpPar = TMath::Sqrt(dx*dx+dy*dy);
1083 TVector3 mom(p[0], p[1], p[2]);
1084 TVector3 fline(sec[0]-prim[0], sec[1]-prim[1], sec[2]-prim[2]);
1085 TVector3 cross = mom.Cross(fline);
1087 return (cross.Z() > 0. ? absImpPar : -absImpPar);
1093 AliAODTrack *tr1 = (AliAODTrack*) candD0->GetDaughter(0);
1094 AliAODTrack *tr2 = (AliAODTrack*) candD0->GetDaughter(1);
1095 AliAODTrack *tr3 = (AliAODTrack*) cand->
GetBachelor();
1097 Int_t label1 = tr1->GetLabel();
1098 Int_t label2 = tr2->GetLabel();
1099 Int_t label3 = tr3->GetLabel();
1101 if (label1 < 0 || label2 < 0 || label3 < 0) {
1105 AliAODMCParticle *part1 = (AliAODMCParticle*) arrayMC->At(label1);
1106 AliAODMCParticle *part2 = (AliAODMCParticle*) arrayMC->At(label2);
1107 AliAODMCParticle *part3 = (AliAODMCParticle*) arrayMC->At(label3);
1109 if (part1 == 0 || part2 == 0 || part3 == 0) {
1113 Double_t PxTotal = part1->Px()+part2->Px()+part3->Px();
1114 Double_t PyTotal = part1->Py()+part2->Py()+part3->Py();
1115 Double_t PzTotal = part1->Pz()+part2->Pz()+part3->Pz();
1119 Double_t prim[3] = {headerMC->GetVtxX(), headerMC->GetVtxY(), headerMC->GetVtxZ()};
1120 Double_t sec[3] = {part3->Xv(), part3->Yv(), part3->Zv()};
1121 Double_t p[3] = {PxTotal, PyTotal, PzTotal};
1124 Double_t ptsq = p[0]*p[0] + p[1]*p[1];
1125 Double_t k = - (sec[0]-prim[0])*p[0] - (sec[1]-prim[1])*p[1];
1127 Double_t dx = sec[0] - prim[0] + k*p[0];
1128 Double_t dy = sec[1] - prim[1] + k*p[1];
1129 Double_t absImpPar = TMath::Sqrt(dx*dx+dy*dy)*1.e4;
1131 TVector3 mom(p[0], p[1], p[2]);
1132 TVector3 fline(sec[0]-prim[0], sec[1]-prim[1], sec[2]-prim[2]);
1133 TVector3 cross = mom.Cross(fline);
1135 return cross.Z() > 0. ? absImpPar : -absImpPar;
1148 FillHistogram(Form(
"DeltaInvMass_%d", ptBin), deltaInvMass);
1180 AliAODTrack *
pi; AliAODTrack *K;
Int_t piId, KId;
1181 if (((AliAODTrack*) candD0->GetDaughter(0))->Charge()*cand->Charge() > 0) {
1189 pi = (AliAODTrack*) candD0->GetDaughter(piId);
1190 K = (AliAODTrack*) candD0->GetDaughter(KId);
1201 d0 = candD0->Getd0Prong(piId);
1216 d0 = candD0->Getd0Prong(KId);
1222 AliAODVertex *origVtx = 0;
Double_t NormalizedDecayLengthXY() const
Double_t fSidebandCut[30]
Bool_t IsFromHijing(TClonesArray *arrayMC, const AliAODMCParticle *mcPartCandidate)
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
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 ImpParXY() const
void FillHistograms(AliAODRecoCascadeHF *cand)
void FillHistogram(const char *name, Double_t value)
Double_t Prodd0d0() const
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)
Short_t fSignalTypeForTree
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 CalculateTrueImpactParameterDStar(AliAODMCHeader *headerMC, TClonesArray *arrayMC, AliAODRecoCascadeHF *cand)
Double_t fTrueImpParForTree
Double_t InvMassD0() const
void FillTrueImpactParameter(AliAODRecoCascadeHF *cand)
Bool_t IsFromB(TClonesArray *arrayMC, const AliAODMCParticle *mcPartCandidate)
Double_t CosPointingAngle() const
AliAODRecoDecayHF2Prong * Get2Prong() const
virtual void UserCreateOutputObjects()
Int_t PtBin(Double_t pt) const