31 #include <TParticle.h>
32 #include <TParticlePDG.h>
38 #include <TDatabasePDG.h>
41 #include <AliAnalysisDataSlot.h>
42 #include <AliAnalysisDataContainer.h>
44 #include "AliMCEvent.h"
45 #include "AliAnalysisManager.h"
46 #include "AliAODMCHeader.h"
47 #include "AliAODHandler.h"
49 #include "AliAODVertex.h"
50 #include "AliAODRecoDecay.h"
54 #include "AliESDtrack.h"
55 #include "AliAODTrack.h"
57 #include "AliAODMCParticle.h"
58 #include "AliAnalysisTaskSE.h"
62 #include "AliPIDResponse.h"
63 #include "AliPIDCombined.h"
64 #include "AliTOFPIDResponse.h"
65 #include "AliInputEventHandler.h"
67 #include "AliKFParticle.h"
68 #include "AliKFVertex.h"
69 #include "AliExternalTrackParam.h"
70 #include "AliESDtrack.h"
87 fIsK0sAnalysis(kFALSE),
91 fUseOnTheFlyV0(kFALSE),
92 fIsEventSelected(kFALSE),
95 fCandidateVariables(),
100 fFillOnlySgn(kFALSE),
101 fHistoLcBeforeCuts(0),
102 fHistoFiducialAcceptance(0),
105 fHistoLcpKpiBeforeCuts(0),
108 fHistoDistanceLcToPrimVtx(0),
109 fHistoDistanceV0ToPrimVtx(0),
110 fHistoDistanceV0ToLc(0),
112 fHistoDistanceLcToPrimVtxSgn(0),
113 fHistoDistanceV0ToPrimVtxSgn(0),
114 fHistoDistanceV0ToLcSgn(0),
116 fHistoVtxLcResidualToPrimVtx(0),
117 fHistoVtxV0ResidualToPrimVtx(0),
118 fHistoVtxV0ResidualToLc(0),
121 fHistoDecayLengthV0All(0),
122 fHistoLifeTimeV0All(0),
125 fHistoDecayLengthV0True(0),
126 fHistoLifeTimeV0True(0),
128 fHistoMassV0TrueFromAOD(0),
130 fHistoMassV0TrueK0S(0),
131 fHistoDecayLengthV0TrueK0S(0),
132 fHistoLifeTimeV0TrueK0S(0),
134 fHistoMassV0TrueK0SFromAOD(0),
137 fHistoDecayLengthLcAll(0),
138 fHistoLifeTimeLcAll(0),
141 fHistoDecayLengthLcTrue(0),
142 fHistoLifeTimeLcTrue(0),
144 fHistoMassLcTrueFromAOD(0),
146 fHistoMassV0fromLcAll(0),
147 fHistoDecayLengthV0fromLcAll(0),
148 fHistoLifeTimeV0fromLcAll(0),
150 fHistoMassV0fromLcTrue(0),
151 fHistoDecayLengthV0fromLcTrue(0),
152 fHistoLifeTimeV0fromLcTrue(0),
155 fHistoMassLcSgnFromAOD(0),
156 fHistoDecayLengthLcSgn(0),
157 fHistoLifeTimeLcSgn(0),
159 fHistoMassV0fromLcSgn(0),
160 fHistoDecayLengthV0fromLcSgn(0),
161 fHistoLifeTimeV0fromLcSgn(0),
168 fHistoDecayLengthKFV0(0),
169 fHistoLifeTimeKFV0(0),
172 fHistoDecayLengthKFLc(0),
173 fHistoLifeTimeKFLc(0),
175 fHistoArmenterosPodolanskiV0KF(0),
176 fHistoArmenterosPodolanskiV0KFSgn(0),
177 fHistoArmenterosPodolanskiV0AOD(0),
178 fHistoArmenterosPodolanskiV0AODSgn(0),
182 ftopoConstraint(kTRUE),
183 fCallKFVertexing(kFALSE),
184 fKeepingOnlyHIJINGBkg(kFALSE),
187 fCutKFChi2NDF(999999.),
188 fCutKFDeviationFromVtx(999999.),
189 fCutKFDeviationFromVtxV0(0.),
192 fKeepingOnlyPYTHIABkg(kFALSE),
193 fHistoMCLcK0SpGen(0x0),
194 fHistoMCLcK0SpGenAcc(0x0),
195 fHistoMCLcK0SpGenLimAcc(0x0),
205 AliAnalysisTaskSE(name),
211 fIsK0sAnalysis(kFALSE),
215 fUseOnTheFlyV0(useOnTheFly),
216 fIsEventSelected(kFALSE),
217 fVariablesTreeSgn(0),
218 fVariablesTreeBkg(0),
219 fCandidateVariables(),
224 fFillOnlySgn(kFALSE),
225 fHistoLcBeforeCuts(0),
226 fHistoFiducialAcceptance(0),
229 fHistoLcpKpiBeforeCuts(0),
232 fHistoDistanceLcToPrimVtx(0),
233 fHistoDistanceV0ToPrimVtx(0),
234 fHistoDistanceV0ToLc(0),
236 fHistoDistanceLcToPrimVtxSgn(0),
237 fHistoDistanceV0ToPrimVtxSgn(0),
238 fHistoDistanceV0ToLcSgn(0),
240 fHistoVtxLcResidualToPrimVtx(0),
241 fHistoVtxV0ResidualToPrimVtx(0),
242 fHistoVtxV0ResidualToLc(0),
245 fHistoDecayLengthV0All(0),
246 fHistoLifeTimeV0All(0),
249 fHistoDecayLengthV0True(0),
250 fHistoLifeTimeV0True(0),
252 fHistoMassV0TrueFromAOD(0),
254 fHistoMassV0TrueK0S(0),
255 fHistoDecayLengthV0TrueK0S(0),
256 fHistoLifeTimeV0TrueK0S(0),
258 fHistoMassV0TrueK0SFromAOD(0),
261 fHistoDecayLengthLcAll(0),
262 fHistoLifeTimeLcAll(0),
265 fHistoDecayLengthLcTrue(0),
266 fHistoLifeTimeLcTrue(0),
268 fHistoMassLcTrueFromAOD(0),
270 fHistoMassV0fromLcAll(0),
271 fHistoDecayLengthV0fromLcAll(0),
272 fHistoLifeTimeV0fromLcAll(0),
274 fHistoMassV0fromLcTrue(0),
275 fHistoDecayLengthV0fromLcTrue(0),
276 fHistoLifeTimeV0fromLcTrue(0),
279 fHistoMassLcSgnFromAOD(0),
280 fHistoDecayLengthLcSgn(0),
281 fHistoLifeTimeLcSgn(0),
283 fHistoMassV0fromLcSgn(0),
284 fHistoDecayLengthV0fromLcSgn(0),
285 fHistoLifeTimeV0fromLcSgn(0),
292 fHistoDecayLengthKFV0(0),
293 fHistoLifeTimeKFV0(0),
296 fHistoDecayLengthKFLc(0),
297 fHistoLifeTimeKFLc(0),
299 fHistoArmenterosPodolanskiV0KF(0),
300 fHistoArmenterosPodolanskiV0KFSgn(0),
301 fHistoArmenterosPodolanskiV0AOD(0),
302 fHistoArmenterosPodolanskiV0AODSgn(0),
306 ftopoConstraint(kTRUE),
307 fCallKFVertexing(kFALSE),
308 fKeepingOnlyHIJINGBkg(kFALSE),
311 fCutKFChi2NDF(999999.),
312 fCutKFDeviationFromVtx(999999.),
313 fCutKFDeviationFromVtxV0(0.),
316 fKeepingOnlyPYTHIABkg(kFALSE),
317 fHistoMCLcK0SpGen(0x0),
318 fHistoMCLcK0SpGenAcc(0x0),
319 fHistoMCLcK0SpGenLimAcc(0x0),
325 Info(
"AliAnalysisTaskSELc2V0bachelorTMVA",
"Calling Constructor");
327 DefineOutput(1, TList::Class());
328 DefineOutput(2, AliNormalizationCounter::Class());
329 DefineOutput(3, TList::Class());
330 DefineOutput(4, TTree::Class());
331 DefineOutput(5, TTree::Class());
332 DefineOutput(6, TList::Class());
341 Info(
"~AliAnalysisTaskSELc2V0bachelorTMVA",
"Calling Destructor");
400 if (fDebug > 1) AliInfo(
"Init");
419 AliInfo(
"Terminate");
420 AliAnalysisTaskSE::Terminate();
422 fOutput =
dynamic_cast<TList*
> (GetOutputData(1));
424 AliError(
"fOutput not available");
433 AliInfo(Form(
"At MC level, %f Lc --> K0S + p were found",
fHistoMCLcK0SpGen->GetEntries()));
435 AliInfo(
"fHistoMCLcK0SpGen not available");
438 AliInfo(Form(
"At MC level, %f Lc --> K0S + p were found in the acceptance",
fHistoMCLcK0SpGenAcc->GetEntries()));
440 AliInfo(
"fHistoMCLcK0SpGenAcc not available");
443 AliInfo(Form(
"At Reco level, %lld Lc --> K0S + p were found",
fVariablesTreeSgn->GetEntries()));
445 AliInfo(
"fVariablesTreeSgn not available");
448 fOutputKF =
dynamic_cast<TList*
> (GetOutputData(6));
450 AliError(
"fOutputKF not available");
460 AliInfo(Form(
"CreateOutputObjects of task %s\n", GetName()));
469 const char* nameoutput = GetOutputSlot(1)->GetContainer()->GetName();
470 fVariablesTreeSgn =
new TTree(Form(
"%s_Sgn", nameoutput),
"Candidates variables tree, Signal");
471 fVariablesTreeBkg =
new TTree(Form(
"%s_Bkg", nameoutput),
"Candidates variables tree, Background");
474 TString * fCandidateVariableNames =
new TString[nVar];
475 fCandidateVariableNames[0]=
"massLc2K0Sp";
476 fCandidateVariableNames[1]=
"massLc2Lambdapi";
477 fCandidateVariableNames[2]=
"massK0S";
478 fCandidateVariableNames[3]=
"massLambda";
479 fCandidateVariableNames[4]=
"massLambdaBar";
480 fCandidateVariableNames[5]=
"cosPAK0S";
481 fCandidateVariableNames[6]=
"dcaV0";
482 fCandidateVariableNames[7]=
"tImpParBach";
483 fCandidateVariableNames[8]=
"tImpParV0";
484 fCandidateVariableNames[9]=
"nSigmaTPCpr";
485 fCandidateVariableNames[10]=
"nSigmaTPCpi";
486 fCandidateVariableNames[11]=
"nSigmaTPCka";
487 fCandidateVariableNames[12]=
"nSigmaTOFpr";
488 fCandidateVariableNames[13]=
"nSigmaTOFpi";
489 fCandidateVariableNames[14]=
"nSigmaTOFka";
490 fCandidateVariableNames[15]=
"bachelorPt";
491 fCandidateVariableNames[16]=
"V0positivePt";
492 fCandidateVariableNames[17]=
"V0negativePt";
493 fCandidateVariableNames[18]=
"dcaV0pos";
494 fCandidateVariableNames[19]=
"dcaV0neg";
495 fCandidateVariableNames[20]=
"v0Pt";
496 fCandidateVariableNames[21]=
"massGamma";
497 fCandidateVariableNames[22]=
"LcPt";
498 fCandidateVariableNames[23]=
"combinedProtonProb";
499 fCandidateVariableNames[24]=
"LcEta";
500 fCandidateVariableNames[25]=
"V0positiveEta";
501 fCandidateVariableNames[26]=
"V0negativeEta";
502 fCandidateVariableNames[27]=
"TPCProtonProb";
503 fCandidateVariableNames[28]=
"TOFProtonProb";
504 fCandidateVariableNames[29]=
"bachelorEta";
505 fCandidateVariableNames[30]=
"LcP";
506 fCandidateVariableNames[31]=
"bachelorP";
507 fCandidateVariableNames[32]=
"v0P";
508 fCandidateVariableNames[33]=
"V0positiveP";
509 fCandidateVariableNames[34]=
"V0negativeP";
510 fCandidateVariableNames[35]=
"LcY";
511 fCandidateVariableNames[36]=
"v0Y";
512 fCandidateVariableNames[37]=
"bachelorY";
513 fCandidateVariableNames[38]=
"V0positiveY";
514 fCandidateVariableNames[39]=
"V0negativeY";
515 fCandidateVariableNames[40]=
"v0Eta";
516 fCandidateVariableNames[41]=
"DecayLengthLc";
517 fCandidateVariableNames[42]=
"DecayLengthK0S";
518 fCandidateVariableNames[43]=
"CtLc";
519 fCandidateVariableNames[44]=
"CtK0S";
520 fCandidateVariableNames[45]=
"bachCode";
521 fCandidateVariableNames[46]=
"k0SCode";
523 fCandidateVariableNames[47]=
"V0KFmass";
524 fCandidateVariableNames[48]=
"V0KFdecayLength";
525 fCandidateVariableNames[49]=
"V0KFlifeTime";
527 fCandidateVariableNames[50]=
"V0KFmassErr";
528 fCandidateVariableNames[51]=
"V0KFdecayTimeErr";
529 fCandidateVariableNames[52]=
"V0KFlifeTimeErr";
531 fCandidateVariableNames[53]=
"LcKFmass";
532 fCandidateVariableNames[54]=
"LcKFdecayLength";
533 fCandidateVariableNames[55]=
"LcKFlifeTime";
535 fCandidateVariableNames[56]=
"LcKFmassErr";
536 fCandidateVariableNames[57]=
"LcKFdecayTimeErr";
537 fCandidateVariableNames[58]=
"LcKFlifeTimeErr";
539 fCandidateVariableNames[59]=
"LcKFDistToPrimVtx";
540 fCandidateVariableNames[60]=
"V0KFDistToPrimVtx";
541 fCandidateVariableNames[61]=
"V0KFDistToLc";
542 fCandidateVariableNames[62]=
"alphaArmKF";
543 fCandidateVariableNames[63]=
"ptArmKF";
544 fCandidateVariableNames[64]=
"alphaArm";
545 fCandidateVariableNames[65]=
"ptArm";
547 fCandidateVariableNames[66]=
"ITSrefitV0pos";
548 fCandidateVariableNames[67]=
"ITSrefitV0neg";
550 fCandidateVariableNames[68]=
"TPCClV0pos";
551 fCandidateVariableNames[69]=
"TPCClV0neg";
553 fCandidateVariableNames[70]=
"v0Xcoord";
554 fCandidateVariableNames[71]=
"v0Ycoord";
555 fCandidateVariableNames[72]=
"v0Zcoord";
556 fCandidateVariableNames[73]=
"primVtxX";
557 fCandidateVariableNames[74]=
"primVtxY";
558 fCandidateVariableNames[75]=
"primVtxZ";
560 fCandidateVariableNames[76]=
"ITSclBach";
561 fCandidateVariableNames[77]=
"SPDclBach";
563 fCandidateVariableNames[78]=
"ITSclV0pos";
564 fCandidateVariableNames[79]=
"SPDclV0pos";
565 fCandidateVariableNames[80]=
"ITSclV0neg";
566 fCandidateVariableNames[81]=
"SPDclV0neg";
568 fCandidateVariableNames[82]=
"alphaArmLc";
569 fCandidateVariableNames[83]=
"alphaArmLcCharge";
570 fCandidateVariableNames[84]=
"ptArmLc";
572 fCandidateVariableNames[85]=
"CosThetaStar";
575 for(Int_t ivar=0; ivar<nVar; ivar++){
580 fHistoEvents =
new TH1F(
"fHistoEvents",
"fHistoEvents", 2, -0.5, 1.5);
581 TString labelEv[2] = {
"NotSelected",
"Selected"};
582 for (Int_t ibin = 1; ibin <=
fHistoEvents->GetNbinsX(); ibin++){
586 fHistoLc =
new TH1F(
"fHistoLc",
"fHistoLc", 2, -0.5, 1.5);
588 fHistoLcOnTheFly =
new TH1F(
"fHistoLcOnTheFly",
"fHistoLcOnTheFly", 4, -0.5, 3.5);
589 TString labelOnTheFly[4] = {
"OnTheFly-Bkg",
"OfflineBkg",
"OnTheFly-Sgn",
"OfflineSgn"};
594 fHistoLcBeforeCuts =
new TH1F(
"fHistoLcBeforeCuts",
"fHistoLcBeforeCuts", 2, -0.5, 1.5);
595 TString labelBeforeCuts[2] = {
"Bkg",
"Sgn"};
598 fHistoLc->GetXaxis()->SetBinLabel(ibin, labelBeforeCuts[ibin-1].
Data());
602 TString labelAcc[4] = {
"NotOk-Bkg",
"Ok-Bkg",
"NotOk-Sgn",
"Ok-Sgn"};
607 fHistoCodesSgn =
new TH2F(
"fHistoCodesSgn",
"fHistoCodes for Signal; bachelor; K0S", 7, -1.5, 5.5, 9, -1.5, 7.5);
608 fHistoCodesBkg =
new TH2F(
"fHistoCodesBkg",
"fHistoCodes for Background; bachelor; K0S", 7, -1.5, 5.5, 9, -1.5, 7.5);
610 TString labelx[7] = {
"kBachInvalid",
"kBachFake",
"kBachNoProton",
"kBachPrimary",
"kBachNoLambdaMother",
611 "kBachDifferentLambdaMother",
"kBachCorrectLambdaMother"};
612 TString labely[9] = {
"kK0SInvalid",
"kK0SFake",
"kK0SNoK0S",
"kK0SWithoutMother",
"kK0SNotFromK0",
613 "kK0Primary",
"kK0NoLambdaMother",
"kK0DifferentLambdaMother",
"kK0CorrectLambdaMother"};
615 for (Int_t ibin = 1; ibin <=
fHistoCodesSgn->GetNbinsX(); ibin++){
619 for (Int_t ibin = 1; ibin <=
fHistoCodesSgn->GetNbinsY(); ibin++){
629 fHistoBackground =
new TH1F(
"fHistoBackground",
"fHistoBackground", 4, -0.5, 3.5);
630 TString labelBkg[4] = {
"Injected",
"Non-injected",
"Non-PYTHIA",
"PYTHIA"};
638 const Float_t ptbins[15] = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 12., 17., 25., 35.};
640 fHistoMCLcK0SpGen =
new TH1F(
"fHistoMCLcK0SpGen",
"fHistoMCLcK0SpGen", 14, ptbins);
660 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
661 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
679 fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
689 fHistoDistanceLcToPrimVtx =
new TH1D(
"fHistoDistanceLcToPrimVtx",
"Lc distance to Prim Vertex from KF; distance [cm]", 1000, 0., 1);
690 fHistoDistanceV0ToPrimVtx =
new TH1D(
"fHistoDistanceV0ToPrimVtx",
"V0 distance to Prim Vertex from KF; distance [cm]", 1000, 0., 100.);
691 fHistoDistanceV0ToLc =
new TH1D(
"fHistoDistanceV0ToLc",
"V0 distance to Lc Vertex from KF; distance [cm]", 1000, 0., 100.);
693 fHistoDistanceLcToPrimVtxSgn =
new TH1D(
"fHistoDistanceLcToPrimVtxSgn",
"Lc Sgn distance to Prim Vertex from KF; distance [cm]", 1000, 0., 1);
694 fHistoDistanceV0ToPrimVtxSgn =
new TH1D(
"fHistoDistanceV0ToPrimVtxSgn",
"V0 Sgn distance to Prim Vertex from KF; distance [cm]", 1000, 0., 100.);
695 fHistoDistanceV0ToLcSgn =
new TH1D(
"fHistoDistanceV0ToLcSgn",
"V0 Sgn distance to Lc Vertex from KF; distance [cm]", 1000, 0., 100.);
697 fHistoVtxLcResidualToPrimVtx =
new TH1D(
"fHistoVtxLcResidualToPrimVtx",
"Residual between MC and KF (MC - KF): Lc to Prim Vtx; distance [cm]", 1000, -5., 5.);
698 fHistoVtxV0ResidualToPrimVtx =
new TH1D(
"fHistoVtxV0ResidualToPrimVtx",
"Residual between MC and KF (MC - KF): V0 to Prim Vtx; distance [cm]", 1000, -5., 5.);
699 fHistoVtxV0ResidualToLc =
new TH1D(
"fHistoVtxV0ResidualToLc",
"Residual between MC and KF: V0 to Lc (MC - KF); distance [cm]", 1000, -5., 5.);
701 fHistoMassV0All =
new TH1D(
"fHistoMassV0All",
"V0 Mass; mass", 500, 0.4, 0.6);
702 fHistoDecayLengthV0All =
new TH1D(
"fHistoDecayLengthV0All",
"V0 Decay Length; decayLength", 500, -10, 10.0);
703 fHistoLifeTimeV0All =
new TH1D(
"fHistoLifeTimeV0All",
"V0 Life Time; lifeTime", 500, -10.0, 10.0);
705 fHistoMassV0True =
new TH1D(
"fHistoMassV0True",
"True V0 Mass; mass", 500, 0.4, 0.6);
706 fHistoDecayLengthV0True =
new TH1D(
"fHistoDecayLengthV0True",
"True V0 Decay Length; decayLength", 500, -10, 10.0);
707 fHistoLifeTimeV0True =
new TH1D(
"fHistoLifeTimeV0True",
"True V0 Life Time; lifeTime", 500, -10.0, 10.0);
711 fHistoMassV0TrueK0S =
new TH1D(
"fHistoMassV0TrueK0S",
"True V0-K0S Mass; mass", 500, 0.4, 0.6);
713 fHistoLifeTimeV0TrueK0S =
new TH1D(
"fHistoLifeTimeV0TrueK0S",
"True V0-K0S Life Time; lifeTime", 500, -10.0, 10.0);
717 fHistoMassLcAll =
new TH1D(
"fHistoMassLcAll",
"Lc Mass; mass", 500, 2.0, 3.0);
718 fHistoDecayLengthLcAll =
new TH1D(
"fHistoDecayLengthLcAll",
"Lc Decay Length; decayLenght", 100000, -0.1, 0.1);
719 fHistoLifeTimeLcAll =
new TH1D(
"fHistoLifeTimeLcAll",
"Lc Life Time; lifeTime", 100000, -0.1, 0.1);
721 fHistoMassLcTrue =
new TH1D(
"fHistoMassLcTrue",
"True Lc Mass; mass", 500, 2.0, 3.0);
722 fHistoDecayLengthLcTrue =
new TH1D(
"fHistoDecayLengthLcTrue",
"True Lc Decay Length; decayLength", 100000, -0.1, 0.1);
723 fHistoLifeTimeLcTrue =
new TH1D(
"fHistoLifeTimeLcTrue",
"True Lc Life Time; lifeTime", 100000, -0.1, 0.1);
727 fHistoMassV0fromLcAll =
new TH1D(
"fHistoMassV0fromLcAll",
"V0 mass from Lc built in KF; mass", 500, 0.4, 0.6);
728 fHistoDecayLengthV0fromLcAll =
new TH1D(
"fHistoDecayLengthV0fromLcAll",
"V0 Decay Length from Lc built in KF; decayLength", 500, 0, 10.0);
729 fHistoLifeTimeV0fromLcAll =
new TH1D(
"fHistoLifeTimeV0fromLcAll",
"V0 Life Time from Lc built in KF; lifeTime", 500, 0.0, 3.0);
731 fHistoMassV0fromLcTrue =
new TH1D(
"fHistoMassV0fromLcTrue",
"V0 mass from true Lc built in KF; mass", 500, 0.4, 0.6);
732 fHistoDecayLengthV0fromLcTrue=
new TH1D(
"fHistoDecayLengthV0fromLcTrue",
"V0 Decay Length from true Lc built in KF; decayLength", 500, 0, 10.0);
733 fHistoLifeTimeV0fromLcTrue =
new TH1D(
"fHistoLifeTimeV0fromLcTrue",
"V0 Life Time from true Lc built in KF; lifeTime", 500, 0.0, 3.0);
735 fHistoMassLcSgn =
new TH1D(
"fHistoMassLcSgn",
"True Lc Signal Mass; mass", 500, 2.0, 3.0);
736 fHistoMassLcSgnFromAOD =
new TH1D(
"fHistoMassLcSgnFromAOD",
"True Lc Signal Mass (AOD); mass", 500, 2.0, 3.0);
737 fHistoDecayLengthLcSgn =
new TH1D(
"fHistoDecayLengthLcSgn",
"True Lc Signal Decay Length; decayLength", 100000, -0.1, 0.1);
738 fHistoLifeTimeLcSgn =
new TH1D(
"fHistoLifeTimeLcSgn",
"True Lc Signal Life Time; lifeTime", 100000, -0.1, 0.1);
740 fHistoMassV0fromLcSgn =
new TH1D(
"fHistoMassV0fromLcSgn",
"V0 from True Lc Signal Mass; mass", 500, 0.4, 0.6);
742 fHistoLifeTimeV0fromLcSgn =
new TH1D(
"fHistoLifeTimeV0fromLcSgn",
"V0 True Lc Signal Life Time; lifeTime", 500, 0.0, 3.0);
744 fHistoKF =
new TH2D(
"fHistoKF",
"Summary from KF; V0 KF; Lc KF", 16, -0.5, 15.5, 16, -0.5, 15.5);
745 fHistoKFV0 =
new TH1D(
"fHistoKFV0",
"Summary from KF; V0 KF", 16, -0.5, 15.5);
746 fHistoKFLc =
new TH1D(
"fHistoKFLc",
"Summary from KF; V0 KF", 16, -0.5, 15.5);
747 TString axisLabel[16] = {
"AllOk",
"M_NotOk",
"Sm_NotOk",
"Dl_NotOk",
748 "Lt_NotOk",
"M_Sm_NotOk",
"M_Dl_NotOk",
"M_Lt_NotOk",
749 "Dl_Sm_NotOk",
"Dl_Lt_NotOk",
"Sm_Lt_NotOk",
"M_Sm_Dl_NotOk",
750 "M_Sm_Lt_NotOk",
"Sm_Dl_Lt_NotOk",
"M_Dl_Lt_NotOk",
"All_NotOk"};
752 for (Int_t ibin = 1; ibin <=16; ibin++){
753 fHistoKF->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].
Data());
754 fHistoKF->GetYaxis()->SetBinLabel(ibin, axisLabel[ibin-1].
Data());
755 fHistoKFV0->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].
Data());
756 fHistoKFLc->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].
Data());
759 fHistoMassKFV0 =
new TH2D(
"fHistoMassKFV0",
"mass vs sigmaMass for V0; mass; sigmaMass", 500, 0.4, 0.6, 500, 0., 10);
760 fHistoDecayLengthKFV0 =
new TH2D(
"fHistoDecayLengthKFV0",
"decayLength vs sigmaDecayLength for V0; decayLength; sigmaDecayLength", 500, -10, 10, 500, 0., 10);
761 fHistoLifeTimeKFV0 =
new TH2D(
"fHistoLifeTimeKFV0",
"lifeTime vs sigmalifeTime for V0; lifeTime; sigmaLifeTime", 500, -10, 10, 500, 0., 10);
763 fHistoMassKFLc =
new TH2D(
"fHistoMassKFLc",
"mass vs sigmaMass for Lc; mass; sigmaMass", 500, 0.4, 0.6, 500, 0., 10);
764 fHistoDecayLengthKFLc =
new TH2D(
"fHistoDecayLengthKFLc",
"decayLength vs sigmaDecayLength for Lc; decayLength; sigmaDecayLength", 500, -10, 10, 500, 0., 10);
765 fHistoLifeTimeKFLc =
new TH2D(
"fHistoLifeTimeKFLc",
"lifeTime vs sigmalifeTime for Lc; lifeTime; sigmaLifeTime", 500, -10, 10, 500, 0., 10);
767 fHistoArmenterosPodolanskiV0KF =
new TH2D(
"fHistoArmenterosPodolanskiV0KF",
"V0 ArmenterosPodolanski from KF; #alpha; Qt", 1000, -1, 1, 1000, 0, 1);
768 fHistoArmenterosPodolanskiV0KFSgn =
new TH2D(
"fHistoArmenterosPodolanskiV0KFSgn",
"V0 (signal) ArmenterosPodolanski from KF; #alpha; Qt", 1000, -1, 1, 1000, 0, 1);
769 fHistoArmenterosPodolanskiV0AOD =
new TH2D(
"fHistoArmenterosPodolanskiV0AOD",
"V0 ArmenterosPodolanski from AOD; #alpha; Qt", 1000, -1, 1, 1000, 0, 1);
770 fHistoArmenterosPodolanskiV0AODSgn =
new TH2D(
"fHistoArmenterosPodolanskiV0AODSgn",
"V0 (signal) ArmenterosPodolanski from AOD; #alpha; Qt", 1000, -1, 1, 1000, 0, 1);
861 AliError(
"NO EVENT FOUND!");
867 AliAODEvent* aodEvent =
dynamic_cast<AliAODEvent*
>(fInputEvent);
868 TClonesArray *arrayLctopKos=0;
870 TClonesArray *array3Prong = 0;
872 if (!aodEvent && AODEvent() && IsStandardAOD()) {
875 aodEvent =
dynamic_cast<AliAODEvent*
> (AODEvent());
878 AliAODHandler* aodHandler = (AliAODHandler*)
879 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
881 if (aodHandler->GetExtensions()) {
882 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(
"AliAOD.VertexingHF.root");
883 AliAODEvent *aodFromExt = ext->GetAOD();
884 arrayLctopKos=(TClonesArray*)aodFromExt->GetList()->FindObject(
"CascadesHF");
886 array3Prong=(TClonesArray*)aodFromExt->GetList()->FindObject(
"Charm3Prong");
889 arrayLctopKos=(TClonesArray*)aodEvent->GetList()->FindObject(
"CascadesHF");
891 array3Prong=(TClonesArray*)aodEvent->GetList()->FindObject(
"Charm3Prong");
899 Int_t runnumber = aodEvent->GetRunNumber();
900 if (aodEvent->GetTriggerMask() == 0 && (runnumber >= 195344 && runnumber <= 195677)){
901 AliDebug(3,
"Event rejected because of null trigger mask");
908 TClonesArray *mcArray = 0;
909 AliAODMCHeader *mcHeader=0;
913 mcArray =
dynamic_cast<TClonesArray*
>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
915 AliError(
"Could not find Monte-Carlo in AOD");
919 mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
921 AliError(
"AliAnalysisTaskSELc2V0bachelorTMVA::UserExec: MC header branch not found!\n");
925 Double_t zMCVertex = mcHeader->GetVtxZ();
937 fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
939 if (
fVtx1->GetNContributors()<1)
return;
950 fBField = aodEvent->GetMagneticField();
951 AliKFParticle::SetField(
fBField);
953 Int_t nSelectedAnal = 0;
957 array3Prong, mcHeader);
972 for (Int_t iPart=0; iPart<mcArray->GetEntriesFast(); iPart++) {
973 AliAODMCParticle* mcPart =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(iPart));
975 AliError(
"Failed casting particle from MC array!, Skipping particle");
978 Int_t
pdg = mcPart->GetPdgCode();
979 if (TMath::Abs(pdg) != 4122){
980 AliDebug(2, Form(
"MC particle %d is not a Lc: its pdg code is %d", iPart, pdg));
983 AliDebug(2, Form(
"Step 0 ok: MC particle %d is a Lc: its pdg code is %d", iPart, pdg));
984 Int_t labeldaugh0 = mcPart->GetDaughter(0);
985 Int_t labeldaugh1 = mcPart->GetDaughter(1);
986 if (labeldaugh0 <= 0 || labeldaugh1 <= 0){
987 AliDebug(2, Form(
"The MC particle doesn't have correct daughters, skipping!!"));
990 else if (labeldaugh1 - labeldaugh0 == 1){
991 AliDebug(2, Form(
"Step 1 ok: The MC particle has correct daughters!!"));
992 AliAODMCParticle* daugh0 =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labeldaugh0));
993 AliAODMCParticle* daugh1 =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labeldaugh1));
994 if(!daugh0 || !daugh1){
995 AliDebug(2,
"Particle daughters not properly retrieved!");
998 Int_t pdgCodeDaugh0 = TMath::Abs(daugh0->GetPdgCode());
999 Int_t pdgCodeDaugh1 = TMath::Abs(daugh1->GetPdgCode());
1000 AliAODMCParticle* bachelorMC = daugh0;
1001 AliAODMCParticle* v0MC = daugh1;
1002 AliDebug(2, Form(
"pdgCodeDaugh0 = %d, pdgCodeDaugh1 = %d", pdgCodeDaugh0, pdgCodeDaugh1));
1003 if ((pdgCodeDaugh0 == 311 && pdgCodeDaugh1 == 2212) || (pdgCodeDaugh0 == 2212 && pdgCodeDaugh1 == 311)){
1006 if (pdgCodeDaugh0 == 311 && pdgCodeDaugh1 == 2212) {
1007 bachelorMC = daugh1;
1010 AliDebug(2, Form(
"Number of Daughters of v0 = %d", v0MC->GetNDaughters()));
1011 if (v0MC->GetNDaughters() != 1) {
1012 AliDebug(2,
"The K0 does not decay in 1 body only! Impossible... Continuing...");
1016 AliDebug(2,
"Step 2 ok: The K0 does decay in 1 body only! ");
1017 Int_t labelK0daugh = v0MC->GetDaughter(0);
1018 AliAODMCParticle* partK0S =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelK0daugh));
1020 AliError(
"Error while casting particle! returning a NULL array");
1024 if (partK0S->GetNDaughters() != 2 || TMath::Abs(partK0S->GetPdgCode() != 310)){
1025 AliDebug(2,
"The K0 daughter is not a K0S or does not decay in 2 bodies");
1029 AliDebug(2,
"Step 3 ok: The K0 daughter is a K0S and does decay in 2 bodies");
1030 Int_t labelK0Sdaugh0 = partK0S->GetDaughter(0);
1031 Int_t labelK0Sdaugh1 = partK0S->GetDaughter(1);
1032 AliAODMCParticle* daughK0S0 =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelK0Sdaugh0));
1033 AliAODMCParticle* daughK0S1 =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelK0Sdaugh1));
1034 if (!daughK0S0 || ! daughK0S1){
1035 AliDebug(2,
"Could not access K0S daughters, continuing...");
1039 AliDebug(2,
"Step 4 ok: Could access K0S daughters, continuing...");
1040 Int_t pdgK0Sdaugh0 = daughK0S0->GetPdgCode();
1041 Int_t pdgK0Sdaugh1 = daughK0S1->GetPdgCode();
1042 if (TMath::Abs(pdgK0Sdaugh0) != 211 || TMath::Abs(pdgK0Sdaugh1) != 211){
1043 AliDebug(2,
"The K0S does not decay in pi+pi-, continuing");
1048 AliDebug(2, Form(
"----> Filling histo with pt = %f", mcPart->Pt()));
1052 if(!(TMath::Abs(bachelorMC->Eta()) > 0.9 || bachelorMC->Pt() < 0.1 ||
1053 TMath::Abs(daughK0S0->Eta()) > 0.9 || daughK0S0->Pt() < 0.1 ||
1054 TMath::Abs(daughK0S1->Eta()) > 0.9 || daughK0S1->Pt() < 0.1)) {
1059 AliDebug(2,
"not in fiducial acceptance! Skipping");
1077 TClonesArray *mcArray,
1078 Int_t &nSelectedAnal,
1080 AliAODMCHeader* aodheader){
1083 Int_t pdgCand = 4122;
1084 Int_t pdgDgLctoV0bachelor[2]={2212, 310};
1085 Int_t pdgDgV0toDaughters[2]={211, 211};
1087 Int_t pdgDgLctopKpi[3]={2212, 321, 211};
1090 Int_t n3Prong = array3Prong->GetEntriesFast();
1091 Int_t nCascades= arrayLctopKos->GetEntriesFast();
1094 for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
1100 Int_t mcLabel = d->MatchToMC(4122, mcArray, 3, pdgDgLctopKpi);
1105 AliAODMCParticle *partLcpKpi =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(mcLabel));
1107 Int_t pdgCode = partLcpKpi->GetPdgCode();
1108 AliDebug(2,Form(
" ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ MClabel=%d ~~~~~~~~~~ pdgCode=%d", mcLabel, pdgCode));
1123 for (Int_t iLctopK0s = 0; iLctopK0s < nCascades; iLctopK0s++) {
1128 AliDebug(2,Form(
"Cascade %d doens't exist, skipping",iLctopK0s));
1138 fmcLabelLc = lcK0spr->
MatchToMC(pdgCand, pdgDgLctoV0bachelor[1], pdgDgLctoV0bachelor, pdgDgV0toDaughters, mcArray, kTRUE);
1140 AliDebug(2, Form(
"----> cascade number %d (total cascade number = %d) is a Lc!", iLctopK0s, nCascades));
1142 AliAODMCParticle *partLc =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(
fmcLabelLc));
1144 pdgCode = partLc->GetPdgCode();
1145 if (pdgCode<0) AliDebug(2,Form(
" ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ MClabel=%d ~~~~~~~~~~ pdgCode=%d",
fmcLabelLc, pdgCode));
1146 pdgCode = TMath::Abs(pdgCode);
1162 if (lcK0spr->GetNDaughters()!=2) {
1163 AliDebug(2,Form(
"Cascade %d has not 2 daughters (nDaughters=%d)",iLctopK0s,lcK0spr->GetNDaughters()));
1167 AliAODv0 * v0part =
dynamic_cast<AliAODv0*
>(lcK0spr->
Getv0());
1168 AliAODTrack * bachPart =
dynamic_cast<AliAODTrack*
>(lcK0spr->
GetBachelor());
1169 if (!v0part || !bachPart) {
1170 AliDebug(2,Form(
"Cascade %d has no V0 or no bachelor object",iLctopK0s));
1175 if (!v0part->GetSecondaryVtx()) {
1176 AliDebug(2,Form(
"No secondary vertex for V0 by cascade %d",iLctopK0s));
1180 if (v0part->GetNDaughters()!=2) {
1181 AliDebug(2,Form(
"current V0 has not 2 daughters (onTheFly=%d, nDaughters=%d)",v0part->GetOnFlyStatus(),v0part->GetNDaughters()));
1187 if (!v0Neg || !v0Pos) {
1188 AliDebug(2,Form(
"V0 by cascade %d has no V0positive of V0negative object",iLctopK0s));
1193 if (v0Pos->Charge() == v0Neg->Charge()) {
1194 AliDebug(2,Form(
"V0 by cascade %d has daughters with the same sign: IMPOSSIBLE!",iLctopK0s));
1205 Int_t mcLabel = lcK0spr->
MatchToMC(pdgCand, pdgDgLctoV0bachelor[1], pdgDgLctoV0bachelor, pdgDgV0toDaughters, mcArray, kTRUE);
1207 AliDebug(2,Form(
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cascade number %d (total cascade number = %d)", iLctopK0s, nCascades));
1209 AliAODMCParticle *partLc =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(mcLabel));
1211 pdgCode = partLc->GetPdgCode();
1212 if (pdgCode<0) AliDebug(2,Form(
" ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ MClabel=%d ~~~~~~~~~~ pdgCode=%d", mcLabel, pdgCode));
1213 pdgCode = TMath::Abs(pdgCode);
1224 AliDebug(2, Form(
"\n\n\n Analysing candidate %d\n", iLctopK0s));
1225 AliDebug(2, Form(
">>>>>>>>>> Candidate is background, fFillOnlySgn = %d --> SKIPPING",
fFillOnlySgn));
1234 if (!isCandidateInjected){
1235 AliDebug(2,
"The candidate is from HIJING (i.e. not injected), keeping it to fill background");
1239 AliDebug(2,
"The candidate is NOT from HIJING, we skip it when filling background");
1246 AliAODTrack *bachelor = (AliAODTrack*)lcK0spr->
GetBachelor();
1249 if (!bachelor || !v0pos || !v0neg) {
1250 AliDebug(2,
"Cannot retrieve one of the tracks while checking origin, continuing");
1254 Int_t labelbachelor = TMath::Abs(bachelor->GetLabel());
1255 Int_t labelv0pos = TMath::Abs(v0pos->GetLabel());
1256 Int_t labelv0neg = TMath::Abs(v0neg->GetLabel());
1257 AliAODMCParticle* MCbachelor = (AliAODMCParticle*)mcArray->At(labelbachelor);
1258 AliAODMCParticle* MCv0pos = (AliAODMCParticle*)mcArray->At(labelv0pos);
1259 AliAODMCParticle* MCv0neg = (AliAODMCParticle*)mcArray->At(labelv0neg);
1260 if (!MCbachelor || !MCv0pos || !MCv0neg) {
1261 AliDebug(2,
"Cannot retrieve MC particle for one of the tracks while checking origin, continuing");
1268 if (isBachelorFromPythia != 0 && isv0posFromPythia != 0 && isv0negFromPythia != 0){
1269 AliDebug(2,
"The candidate is from PYTHIA (i.e. all daughters originate from a quark), keeping it to fill background");
1273 AliDebug(2,
"The candidate is NOT from PYTHIA, we skip it when filling background");
1293 Int_t &nSelectedAnal,
1295 TClonesArray *mcArray, Int_t iLctopK0s){
1311 AliAODv0 * v0part = part->
Getv0();
1312 Bool_t onFlyV0 = v0part->GetOnFlyStatus();
1330 Double_t dcaV0 = v0part->GetDCA();
1331 Double_t invmassK0s = v0part->MassK0Short();
1352 if (isInV0window == 0) {
1353 AliDebug(2,
"No: The candidate has NOT passed the V0 window cuts!");
1354 if (isLc) Printf(
"SIGNAL candidate rejected: V0 window cuts");
1357 else AliDebug(2,
"Yes: The candidate has passed the mass cuts!");
1361 if (!isInCascadeWindow) {
1362 AliDebug(2,
"No: The candidate has NOT passed the cascade window cuts!");
1363 if (isLc) Printf(
"SIGNAL candidate rejected: cascade window cuts");
1366 else AliDebug(2,
"Yes: The candidate has passed the cascade window cuts!");
1370 if (!isCandidateSelectedCuts){
1371 AliDebug(2,
"No: Analysis cuts kCandidate level NOT passed");
1372 if (isLc) Printf(
"SIGNAL candidate rejected");
1376 AliDebug(2,
"Yes: Analysis cuts kCandidate level passed");
1379 AliAODTrack *bachelor = (AliAODTrack*)part->
GetBachelor();
1381 AliDebug(2, Form(
"Very weird, the bachelor is not there... returning for this candidate"));
1386 Double_t probTPCTOF[AliPID::kSPECIES]={-1.};
1389 AliDebug(2, Form(
"detUsed (TPCTOF case) = %d", detUsed));
1390 Double_t probProton = -1.;
1393 if (detUsed == (UInt_t)
fPIDCombined->GetDetectorMask() ) {
1394 AliDebug(2, Form(
"We have found the detector mask for TOF + TPC: probProton will be set to %f", probTPCTOF[AliPID::kProton]));
1395 probProton = probTPCTOF[AliPID::kProton];
1400 fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC);
1401 AliDebug(2,
"We did not find the detector mask for TOF + TPC, let's see only TPC");
1403 AliDebug(2,Form(
" detUsed (TPC case) = %d", detUsed));
1404 if (detUsed == (UInt_t)
fPIDCombined->GetDetectorMask()) {
1405 probProton = probTPCTOF[AliPID::kProton];
1408 AliDebug(2, Form(
"TPC only worked: probProton will be set to %f", probTPCTOF[AliPID::kProton]));
1411 AliDebug(2,
"Only TPC did not work...");
1414 fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
1416 AliDebug(2, Form(
"probProton = %f", probProton));
1419 Double_t probProtonTPC = -1.;
1420 Double_t probProtonTOF = -1.;
1421 Double_t pidTPC[AliPID::kSPECIES]={-1.};
1422 Double_t pidTOF[AliPID::kSPECIES]={-1.};
1423 Int_t respTPC =
fPIDResponse->ComputePIDProbability(AliPIDResponse::kDetTPC, bachelor, AliPID::kSPECIES, pidTPC);
1424 Int_t respTOF =
fPIDResponse->ComputePIDProbability(AliPIDResponse::kDetTOF, bachelor, AliPID::kSPECIES, pidTOF);
1425 if (respTPC == AliPIDResponse::kDetPidOk) probProtonTPC = pidTPC[AliPID::kProton];
1426 if (respTOF == AliPIDResponse::kDetPidOk) probProtonTOF = pidTOF[AliPID::kProton];
1430 AliDebug(2,
"On-the-fly discarded");
1441 if (isLc) Printf(
"SIGNAL candidate rejected");
1442 AliDebug(2,
"No: Analysis cuts kTracks level NOT passed");
1446 AliDebug(2,
"Yes: Analysis cuts kTracks level passed");
1449 Int_t pdgCand = 4122;
1450 Int_t pdgDgLctoV0bachelor[2]={211, 3122};
1451 Int_t pdgDgV0toDaughters[2]={2212, 211};
1452 Int_t isLc2LBarpi=0, isLc2Lpi=0;
1453 Int_t currentLabel = part->GetLabel();
1456 mcLabel = part->
MatchToMC(pdgCand, pdgDgLctoV0bachelor[1], pdgDgLctoV0bachelor, pdgDgV0toDaughters, mcArray, kTRUE);
1458 if (bachelor->Charge()==-1) isLc2LBarpi=1;
1459 if (bachelor->Charge()==+1) isLc2Lpi=1;
1463 Int_t pdgDg2prong[2] = {211, 211};
1467 labelK0S = v0part->MatchToMC(310, mcArray, 2, pdgDg2prong);
1468 if (labelK0S>=0) isK0S = 1;
1471 pdgDg2prong[0] = 211;
1472 pdgDg2prong[1] = 2212;
1474 Int_t isLambdaBar = 0;
1475 Int_t lambdaLabel = 0;
1477 lambdaLabel = v0part->MatchToMC(3122, mcArray, 2, pdgDg2prong);
1478 if (lambdaLabel>=0) {
1479 AliAODMCParticle *lambdaTrack = (AliAODMCParticle*)mcArray->At(lambdaLabel);
1480 if (lambdaTrack->GetPdgCode()==3122) isLambda = 1;
1481 else if (lambdaTrack->GetPdgCode()==-3122) isLambdaBar = 1;
1485 pdgDg2prong[0] = 11;
1486 pdgDg2prong[1] = 11;
1488 Int_t gammaLabel = 0;
1490 gammaLabel = v0part->MatchToMC(22, mcArray, 2, pdgDg2prong);
1491 if (gammaLabel>=0) {
1492 AliAODMCParticle *gammaTrack = (AliAODMCParticle*)mcArray->At(gammaLabel);
1493 if (gammaTrack->GetPdgCode()==22) isGamma = 1;
1498 if (currentLabel != -1){
1499 AliAODMCParticle *tempPart = (AliAODMCParticle*)mcArray->At(currentLabel);
1500 pdgTemp = tempPart->GetPdgCode();
1502 if (isLc) AliDebug(2, Form(
"Signal: Candidate is a Lc in K0s+p"));
1503 else if (isLc2LBarpi) AliDebug(2, Form(
"Background: Candidate is a Lc in Lbar + pi"));
1504 else if (isLc2Lpi) AliDebug(2, Form(
"Background: Candidate is a Lc in L + pi"));
1505 else AliDebug(2, Form(
"Pure bkg: Candidate has pdg = %d", pdgTemp));
1506 if (isK0S) AliDebug(2, Form(
"V0 is a K0S"));
1507 else if (isLambda) AliDebug(2, Form(
"V0 is a Lambda"));
1508 else if (isLambdaBar) AliDebug(2, Form(
"V0 is a LambdaBar"));
1509 else if (isGamma) AliDebug(2, Form(
"V0 is a Gamma"));
1513 Double_t invmassLambda = v0part->MassLambda();
1514 Double_t invmassLambdaBar = v0part->MassAntiLambda();
1517 Double_t nSigmaTPCpr=-999.;
1518 Double_t nSigmaTOFpr=-999.;
1521 Double_t nSigmaTPCpi=-999.;
1522 Double_t nSigmaTOFpi=-999.;
1525 Double_t nSigmaTPCka=-999.;
1526 Double_t nSigmaTOFka=-999.;
1540 nSigmaTPCpi =
fPIDResponse->NumberOfSigmasTPC(bachelor,(AliPID::kPion));
1541 nSigmaTPCka =
fPIDResponse->NumberOfSigmasTPC(bachelor,(AliPID::kKaon));
1542 nSigmaTPCpr =
fPIDResponse->NumberOfSigmasTPC(bachelor,(AliPID::kProton));
1543 nSigmaTOFpi =
fPIDResponse->NumberOfSigmasTOF(bachelor,(AliPID::kPion));
1544 nSigmaTOFka =
fPIDResponse->NumberOfSigmasTOF(bachelor,(AliPID::kKaon));
1545 nSigmaTOFpr =
fPIDResponse->NumberOfSigmasTOF(bachelor,(AliPID::kProton));
1549 if (!onFlyV0 && isInV0window && isInCascadeWindow && part->
CosV0PointingAngle()>0.99 && TMath::Abs(nSigmaTPCpr) <= 3 && v0part->Getd0Prong(0) < 20 && v0part->Getd0Prong(1) < 20) {
1607 k0SCode =
CheckK0S(part, v0part, mcArray);
1613 Double_t V0KF[3] = {-999999, -999999, -999999};
1614 Double_t errV0KF[3] = {-999999, -999999, -999999};
1615 Double_t LcKF[3] = {-999999, -999999, -999999};
1616 Double_t errLcKF[3] = {-999999, -999999, -999999};
1617 Double_t distances[3] = {-999999, -999999, -999999};
1618 Double_t armPolKF[2] = {-999999, -999999};
1621 Int_t kfResult =
CallKFVertexing(part, v0part, bachelor, mcArray, &V0KF[0], &errV0KF[0], &LcKF[0], &errLcKF[0], &distances[0], &armPolKF[0]);
1622 AliDebug(2, Form(
"Result from KF = %d", kfResult));
1655 AliDebug(2, Form(
"v0pos->GetStatus() & AliESDtrack::kITSrefit= %d, v0neg->GetStatus() & AliESDtrack::kITSrefit = %d, v0pos->GetTPCClusterInfo(2, 1)= %f, v0neg->GetTPCClusterInfo(2, 1) = %f", (Int_t)(v0pos->GetStatus() & AliESDtrack::kITSrefit), (Int_t)(v0pos->GetStatus() & AliESDtrack::kITSrefit), v0pos->GetTPCClusterInfo(2, 1), v0neg->GetTPCClusterInfo(2, 1)));
1670 fCandidateVariables[77] = bachelor->HasPointOnITSLayer(0) + bachelor->HasPointOnITSLayer(1);
1678 TVector3 mom1(bachelor->Px(), bachelor->Py(), bachelor->Pz());
1679 TVector3 mom2(v0part->Px(), v0part->Py(), v0part->Pz());
1680 TVector3 momTot(part->Px(), part->Py(), part->Pz());
1682 Double_t Ql1 = mom1.Dot(momTot)/momTot.Mag();
1683 Double_t Ql2 = mom2.Dot(momTot)/momTot.Mag();
1685 Double_t alphaArmLc = (Ql1 - Ql2)/(Ql1 + Ql2);
1686 Double_t alphaArmLcCharge = ( bachelor->Charge() > 0 ? (Ql1 - Ql2)/(Ql1 + Ql2) : (Ql2 - Ql1)/(Ql1 + Ql2) );
1687 Double_t ptArmLc = mom1.Perp(momTot);
1693 Double_t massK0SPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
1694 Double_t massPrPDG = TDatabasePDG::Instance()->GetParticle(2212)->Mass();
1695 Double_t massLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
1697 Double_t pStar = TMath::Sqrt((massLcPDG*massLcPDG-massPrPDG*massPrPDG-massK0SPDG*massK0SPDG)*(massLcPDG*massLcPDG-massPrPDG*massPrPDG-massK0SPDG*massK0SPDG)-4.*massPrPDG*massPrPDG*massK0SPDG*massK0SPDG)/(2.*massLcPDG);
1698 Double_t e = part->E(4122);
1699 Double_t beta = part->P()/e;
1700 Double_t gamma = e/massLcPDG;
1702 Double_t cts = (Ql1/gamma-beta*TMath::Sqrt(pStar*pStar+massPrPDG*massPrPDG))/pStar;
1708 AliDebug(2, Form(
"Reco particle %d --> Filling Sgn", iLctopK0s));
1714 AliDebug(2,
"Filling Bkg");
1731 Double_t* V0KF, Double_t* errV0KF, Double_t* LcKF, Double_t* errLcKF,
1732 Double_t* distances, Double_t* armPolKF) {
1739 Int_t codeKFV0 = -1, codeKFLc = -1;
1741 AliKFVertex primVtxCopy;
1742 Int_t nt = 0, ntcheck = 0;
1743 Double_t pos[3] = {0., 0., 0.};
1746 Int_t contr =
fVtx1->GetNContributors();
1747 Double_t covmatrix[6] = {0.};
1748 fVtx1->GetCovarianceMatrix(covmatrix);
1749 Double_t chi2 =
fVtx1->GetChi2();
1750 AliESDVertex primaryESDVtxCopy(pos, covmatrix, chi2, contr,
"Vertex");
1753 primVtxCopy = AliKFVertex(primaryESDVtxCopy);
1754 nt = primaryESDVtxCopy.GetNContributors();
1757 Int_t
pdg[2] = {211, -211};
1758 Int_t pdgLc[2] = {2212, 310};
1760 Int_t pdgDgV0toDaughters[2] = {211, 211};
1762 Int_t mcLabelV0 = v0part->MatchToMC(310, mcArray, 2, pdgDgV0toDaughters);
1765 Bool_t isMCokV0 = kTRUE, isBkgV0 = kFALSE;
1766 AliKFParticle V0, positiveV0KF, negativeV0KF;
1767 Int_t labelsv0daugh[2] = {-1, -1};
1768 Int_t idv0daugh[2] = {-1, -1};
1769 AliExternalTrackParam* esdv0Daugh1 = 0x0;
1770 AliExternalTrackParam* esdv0Daugh2 = 0x0;
1771 for(Int_t ipr= 0; ipr < 2; ipr++){
1772 AliAODTrack *aodTrack = (AliAODTrack*)v0part->GetDaughter(ipr);
1774 AliDebug(2,
"No V0 daughters available");
1777 Double_t xyz[3], pxpypz[3], cv[21];
1779 aodTrack->GetXYZ(xyz);
1780 aodTrack->PxPyPz(pxpypz);
1781 aodTrack->GetCovarianceXYZPxPyPz(cv);
1782 sign = aodTrack->Charge();
1783 AliExternalTrackParam tmp1( xyz, pxpypz, cv, sign);
1785 if (ipr == 0) esdv0Daugh1 =
new AliExternalTrackParam( xyz, pxpypz, cv, sign);
1786 else esdv0Daugh2 =
new AliExternalTrackParam( xyz, pxpypz, cv, sign);
1787 labelsv0daugh[ipr] = TMath::Abs(aodTrack->GetLabel());
1788 idv0daugh[ipr] = aodTrack->GetID();
1789 if (labelsv0daugh[ipr] == -1) isBkgV0 = kTRUE;
1793 AliKFParticle daughterKF(*aodTrack, pdg[ipr]);
1794 if (aodTrack->Charge() > 0) {
1795 positiveV0KF = daughterKF;
1798 negativeV0KF = daughterKF;
1802 Double_t xn=0., xp=0.;
1803 AliDebug(2, Form(
"bField = %f, esdv0Daugh1 = %p, esdv0Daugh2 = %p",
fBField, esdv0Daugh1, esdv0Daugh2));
1806 AliExternalTrackParam tr1(*esdv0Daugh1);
1807 AliExternalTrackParam tr2(*esdv0Daugh2);
1811 AliKFParticle daughterKF1(tr1, 211);
1812 AliKFParticle daughterKF2(tr2, 211);
1813 V0.AddDaughter(positiveV0KF);
1814 V0.AddDaughter(negativeV0KF);
1823 if( V0.GetNDF() < 1 ) {
1827 if( TMath::Sqrt(TMath::Abs(V0.GetChi2()/V0.GetNDF())) >
fCutKFChi2NDF ) {
1833 for(Int_t ipr = 0; ipr < 2; ipr++){
1834 AliAODTrack *aodTrack = (AliAODTrack*)v0part->GetDaughter(ipr);
1836 if(!aodTrack->GetUsedForPrimVtxFit()) {
1840 AliKFParticle daughterKF(*aodTrack, pdg[ipr]);
1841 primVtxCopy -= daughterKF;
1855 Double_t massV0 = 999999, sigmaMassV0 = 999999;
1856 Int_t retMV0 = V0.GetMass( massV0, sigmaMassV0 );
1860 if (sigmaMassV0 > 1e19) codeKFV0 = 5;
1862 else if (sigmaMassV0 > 1e19) codeKFV0 = 2;
1866 if (massV0 < 0.4) Printf(
"\n\n>>>>>>>>>> Found the Funny V0 (mass = %f, sigma = %f, AOD mass = %f): labels of the tracks = %d, %d, id = %d and %d", massV0, sigmaMassV0, v0part->MassK0Short(), labelsv0daugh[0], labelsv0daugh[1], idv0daugh[0], idv0daugh[1]);
1867 if (massV0 > 0.55) Printf(
"\n\n>>>>>>>>>> Found the Funny V0 (mass = %f, , sigma = %f, AOD mass = %f): labels of the tracks = %d, %d, id = %d and %d", massV0, sigmaMassV0, v0part->MassK0Short(), labelsv0daugh[0], labelsv0daugh[1], idv0daugh[0], idv0daugh[1]);
1869 Printf(
"Vertices: KF: x = %f, y = %f, z = %f", V0.GetX(), V0.GetY(), V0.GetZ());
1870 Printf(
"Vertices: AOD: x = %f, y = %f, z = %f", v0part->Xv(), v0part->Yv(), v0part->Zv());
1873 if (
fUseMCInfo && TMath::Abs(labelsv0daugh[0] - labelsv0daugh[1]) == 1) {
1874 AliAODMCParticle* tmpdaughv01 =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelsv0daugh[0]));
1875 AliAODMCParticle* tmpdaughv02 =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelsv0daugh[1]));
1876 if (!tmpdaughv01 && labelsv0daugh[0] > 0){
1877 AliDebug(2,
"Could not access MC info for first daughter of V0, continuing");
1879 if (!tmpdaughv02 && labelsv0daugh[1] > 0){
1880 AliDebug(2,
"Could not access MC info for second daughter of V0, continuing");
1883 Double_t xPionMC = tmpdaughv01->Xv();
1884 Double_t yPionMC = tmpdaughv01->Yv();
1885 Double_t zPionMC = tmpdaughv01->Zv();
1887 Printf(
"Vertices: MC: x = %f, y = %f, z = %f", xPionMC, yPionMC, zPionMC);
1891 Printf(
"Not a true V0");
1898 nt = primVtxCopy.GetNContributors();
1901 Bool_t isMCokLc = kTRUE, isBkgLc = kFALSE;
1903 Int_t labelsLcdaugh[2] = {-1, -1};
1904 labelsLcdaugh[0] = TMath::Abs(bach->GetLabel());
1905 labelsLcdaugh[1] = mcLabelV0;
1907 if (bach->Charge() < 0) pdgLc[0] = -pdgLc[0];
1908 AliKFParticle daughterKFLc(*bach, pdgLc[0]);
1909 Lc.AddDaughter(daughterKFLc);
1910 TParticlePDG* particlePDG = TDatabasePDG::Instance()->GetParticle(310);
1911 Double_t massPDGK0S = particlePDG->Mass();
1912 V0.SetMassConstraint(massPDGK0S);
1914 if( Lc.GetNDF() < 1 ) {
1915 AliDebug(2, Form(
"Lc: Number of degrees of freedom < 1 (%d), continuing", Lc.GetNDF()));
1918 if( TMath::Sqrt(TMath::Abs(Lc.GetChi2()/Lc.GetNDF())) >
fCutKFChi2NDF) {
1919 AliDebug(2, Form(
"Lc: Chi2 per DOF too big, continuing (%f)", TMath::Sqrt(TMath::Abs(Lc.GetChi2()/Lc.GetNDF()))));
1925 if(!bach->GetUsedForPrimVtxFit()) {
1926 AliDebug(3,
"Lc: Bachelor was not used for primary vertex, not subtracting it from primary vertex");
1929 primVtxCopy -= daughterKFLc;
1958 if( TMath::Sqrt( TMath::Abs(Lc.GetChi2()/Lc.GetNDF())) >
fCutKFChi2NDF) {
1959 AliDebug(2, Form(
"Lc: Final Chi2 per DOF too big, continuing (%f)", TMath::Sqrt( TMath::Abs(Lc.GetChi2()/Lc.GetNDF()))));
1964 V0.SetProductionVertex(Lc);
1970 Double_t decayLengthV0 = 999999, sigmaDecayLengthV0 = 999999;
1971 Int_t retDLV0 = V0.GetDecayLength( decayLengthV0, sigmaDecayLengthV0 );
1973 if (sigmaDecayLengthV0 > 1e19) {
1977 if (sigmaMassV0 > 1e19) codeKFV0 = 11;
1979 else if (sigmaMassV0 > 1e19) codeKFV0 = 8;
1985 Double_t lifeTimeV0 = 999999, sigmaLifeTimeV0 = 999999;
1986 Int_t retTLV0 = V0.GetLifeTime( lifeTimeV0, sigmaLifeTimeV0 );
1988 if (sigmaLifeTimeV0 > 1e19) {
1990 if (sigmaDecayLengthV0 > 1e19) {
1994 if (sigmaMassV0 > 1e19) codeKFV0 = 15;
1996 else if (sigmaMassV0 > 1e19) codeKFV0 = 13;
1998 else if (massV0 < 0) {
2000 if (sigmaMassV0 > 1e19) codeKFV0 = 12;
2002 else if (sigmaMassV0 > 1e19) codeKFV0 = 10;
2007 if (codeKFV0 == -1) codeKFV0 = 0;
2010 AliDebug(2, Form(
"V0: mass = %f, decay length = %f, life time = %f", massV0, decayLengthV0, lifeTimeV0 ));
2016 Double_t qtAlphaV0[2] = {0., 0.};
2017 Double_t vtxV0KF[3] = {V0.GetX(), V0.GetY(), V0.GetZ()};
2018 positiveV0KF.TransportToPoint(vtxV0KF);
2019 negativeV0KF.TransportToPoint(vtxV0KF);
2020 V0.GetArmenterosPodolanski(positiveV0KF, negativeV0KF, qtAlphaV0);
2021 AliDebug(2, Form(
"Armenteros-Podolanski variables: alpha = %f, qt = %f", qtAlphaV0[1], qtAlphaV0[0]));
2024 armPolKF[0] = qtAlphaV0[1];
2025 armPolKF[1] = qtAlphaV0[0];
2029 AliAODMCParticle *motherV0 = 0x0;
2030 AliAODMCParticle *daughv01 = 0x0;
2031 AliAODMCParticle *daughv02 = 0x0;
2034 daughv01 =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelsv0daugh[0]));
2035 daughv02 =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelsv0daugh[1]));
2036 if (!daughv01 && labelsv0daugh[0] > 0){
2037 AliDebug(2,
"Could not access MC info for first daughter of V0, continuing");
2040 if (!daughv02 && labelsv0daugh[1] > 0){
2041 AliDebug(2,
"Could not access MC info for second daughter of V0, continuing");
2045 if( daughv01->GetMother() == daughv02->GetMother() && daughv01->GetMother()>=0 ){
2046 AliDebug(3, Form(
"The mother has label %d", daughv01->GetMother()));
2047 motherV0 =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(daughv01->GetMother()));
2048 if( motherV0 && TMath::Abs(motherV0->GetPdgCode()) != 21 ){
2049 if( motherV0->GetNDaughters() == 2 ){
2054 if (TMath::Abs(motherV0->GetPdgCode()) == 310){
2061 AliDebug(2, Form(
"PDG V0 = %d, pi = %d, pj = %d, ndaughters = %d, mc mass = %f, reco mass = %f, v0 mass = %f", motherV0->GetPdgCode(), daughv01->GetPdgCode(), daughv02->GetPdgCode(), motherV0->GetNDaughters(), motherV0->GetCalcMass(), massV0, v0part->MassK0Short()));
2063 else if (!motherV0){
2064 AliDebug(3,
"could not access MC info for mother, continuing");
2067 AliDebug(3,
"MC mother is a gluon, continuing");
2071 AliDebug(3,
"Background V0!");
2077 AliDebug(2, Form(
"isMCokV0 = %d, isBkgV0 = %d", (Int_t)isMCokV0, (Int_t)isBkgV0));
2082 Double_t massLc = 999999, sigmaMassLc= 999999;
2083 Int_t retMLc = Lc.GetMass( massLc, sigmaMassLc );
2085 AliDebug(3, Form(
"----> Could not get mass (%e), and sigma(%e) for Lc, continuing", massLc, sigmaMassLc));
2088 if (sigmaMassLc > 1e19) codeKFLc = 5;
2090 else if (sigmaMassLc > 1e19) codeKFLc = 2;
2095 Double_t decayLengthLc = 999999, sigmaDecayLengthLc = 999999;
2096 Int_t retDLLc = Lc.GetDecayLength( decayLengthLc, sigmaDecayLengthLc );
2098 AliDebug(3,
"----> Lc: Could not get decay length, and sigma");
2099 if (sigmaDecayLengthLc > 1e19) {
2103 if (sigmaMassLc > 1e19) codeKFLc = 11;
2105 else if (sigmaMassLc > 1e19) codeKFLc = 8;
2108 AliDebug(3, Form(
"retDLLc = %d, with decayLength = %f and error = %e", retDLLc, decayLengthLc, sigmaDecayLengthLc));
2113 Double_t lifeTimeLc = 999999, sigmaLifeTimeLc = 999999;
2114 Int_t retTLLc = Lc.GetLifeTime( lifeTimeLc, sigmaLifeTimeLc );
2116 AliDebug(3,
"----> Lc: Could not get lifeTime, and sigma");
2117 if (sigmaLifeTimeLc > 1e19) {
2119 if (sigmaDecayLengthLc > 1e19) {
2123 if (sigmaMassLc > 1e19) codeKFLc = 15;
2125 else if (sigmaMassLc > 1e19) codeKFLc = 13;
2127 else if (massLc < 0) {
2129 if (sigmaMassLc > 1e19) codeKFLc = 12;
2131 else if (sigmaMassLc > 1e19) codeKFLc = 10;
2137 AliDebug(2, Form(
"Lc: mass = %f (error = %e), decay length = %f (error = %e), life time = %f (error = %e) --> codeKFLc = %d", massLc, sigmaMassLc, decayLengthLc, sigmaDecayLengthLc, lifeTimeLc, sigmaLifeTimeLc, codeKFLc));
2139 if (codeKFLc == -1) codeKFLc = 0;
2142 fHistoKF->Fill(codeKFV0, codeKFLc);
2153 Double_t xV0 = V0.GetX();
2154 Double_t yV0 = V0.GetY();
2155 Double_t zV0 = V0.GetZ();
2157 Double_t xLc = Lc.GetX();
2158 Double_t yLc = Lc.GetY();
2159 Double_t zLc = Lc.GetZ();
2161 Double_t xPrimVtx = primVtxCopy.GetX();
2162 Double_t yPrimVtx = primVtxCopy.GetY();
2163 Double_t zPrimVtx = primVtxCopy.GetZ();
2165 Double_t distanceLcToPrimVtx = TMath::Sqrt((xPrimVtx - xLc) * (xPrimVtx - xLc) +
2166 (yPrimVtx - yLc) * (yPrimVtx - yLc) +
2167 (zPrimVtx - zLc) * (zPrimVtx - zLc));
2169 Double_t distanceV0ToPrimVtx = TMath::Sqrt((xPrimVtx - xV0) * (xPrimVtx - xV0) +
2170 (yPrimVtx - yV0) * (yPrimVtx - yV0) +
2171 (zPrimVtx - zV0) * (zPrimVtx - zV0));
2173 Double_t distanceV0ToLc = TMath::Sqrt((xLc - xV0)*(xLc - xV0) +
2174 (yLc - yV0)*(yLc - yV0) +
2175 (zLc - zV0)*(zLc - zV0));
2183 distances[0] = distanceLcToPrimVtx;
2184 distances[1] = distanceV0ToPrimVtx;
2185 distances[2] = distanceV0ToLc;
2189 AliAODMCParticle *daughv01Lc = 0x0;
2190 AliAODMCParticle *K0S = 0x0;
2191 AliAODMCParticle *daughv02Lc = 0x0;
2193 if (labelsLcdaugh[0] >= 0) {
2195 daughv01Lc =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelsLcdaugh[0]));
2197 AliDebug(3,
"Could not access MC info for first daughter of Lc");
2201 AliDebug(2, Form(
"The bachelor has label = %d", daughv01Lc->GetLabel()));
2202 if (TMath::Abs(daughv01Lc->GetPdgCode()) != 2212) isBkgLc = kTRUE;
2209 if (labelsLcdaugh[1] >= 0) {
2211 K0S =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelsLcdaugh[1]));
2213 AliDebug(3,
"Could not access MC info for second daughter of Lc");
2217 if (TMath::Abs(K0S->GetPdgCode()) != 310) isBkgLc = kTRUE;
2221 AliDebug(2,
"The K0S is not true --> it does not have a label, continuing...");
2227 Int_t iK0 = K0S->GetMother();
2229 Printf(
"The K0S has no mother... IMPOSSIBLE");
2232 daughv02Lc =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(iK0));
2234 AliDebug(3,
"Could not access MC info for second daughter of Lc");
2237 if( daughv01Lc && (daughv01Lc->GetMother() == daughv02Lc->GetMother()) && (daughv01Lc->GetMother()>=0) ){
2239 AliAODMCParticle *motherLc =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(daughv01Lc->GetMother()));
2240 Int_t pdgMum = 0, pdgBach = 0, pdgV0 = 0;
2241 if (motherLc) pdgMum = motherLc->GetPdgCode();
2242 if (daughv01Lc) pdgBach = daughv01Lc->GetPdgCode();
2243 if (daughv02Lc) pdgV0 = daughv02Lc->GetPdgCode();
2244 AliDebug(2, Form(
"pdgMum = %d, pdgBach = %d, pdgV0 = %d", pdgMum, pdgBach, pdgV0));
2246 if( motherLc && TMath::Abs(motherLc->GetPdgCode()) != 21 ){
2256 if (TMath::Abs(motherLc->GetPdgCode()) == 4122 && TMath::Abs(motherV0->GetPdgCode()) == 310 && TMath::Abs(daughv01Lc->GetPdgCode()) == 2212){
2257 AliDebug(2, Form(
"IT IS SIGNAL!!! with label = %d", motherLc->GetLabel()));
2282 Double_t xLcMC = motherLc->Xv();
2283 Double_t yLcMC = motherLc->Yv();
2284 Double_t zLcMC = motherLc->Zv();
2286 Double_t xProtonMC = daughv01Lc->Xv();
2287 Double_t yProtonMC = daughv01Lc->Yv();
2288 Double_t zProtonMC = daughv01Lc->Zv();
2291 Double_t vtxLcResidualToPrimVtx = TMath::Sqrt((xLcMC - xProtonMC) * (xLcMC - xProtonMC) +
2292 (yLcMC - yProtonMC) * (yLcMC - yProtonMC) +
2293 (zLcMC - zProtonMC) * (zLcMC - zProtonMC)) - distanceLcToPrimVtx;
2296 Double_t xV0MC = motherV0->Xv();
2297 Double_t yV0MC = motherV0->Yv();
2298 Double_t zV0MC = motherV0->Zv();
2301 Double_t xPionMC = daughv01->Xv();
2302 Double_t yPionMC = daughv01->Yv();
2303 Double_t zPionMC = daughv01->Zv();
2305 Printf(
"Vertices: MC: x = %f, y = %f, z = %f", xPionMC, yPionMC, zPionMC);
2307 Double_t vtxV0ResidualToLc = TMath::Sqrt((xV0MC - xPionMC) * (xV0MC - xPionMC) +
2308 (yV0MC - yPionMC) * (yV0MC - yPionMC) +
2309 (zV0MC - zPionMC) * (zV0MC - zPionMC)) - distanceV0ToLc;
2313 Double_t vtxV0ResidualToPrimVtx = TMath::Sqrt((xPionMC - xLcMC) * (xPionMC - xLcMC) +
2314 (yPionMC - yLcMC) * (yPionMC - yLcMC) +
2315 (zPionMC - zLcMC) * (zPionMC - zLcMC)) - distanceV0ToPrimVtx;
2322 else if (!motherLc){
2323 AliDebug(2,
"We could not access MC info for Lc mother, so we did nothing");
2326 AliDebug(2,
"MC Lc mother is a gluon, so we did nothing");
2339 if ( retMV0 == 0 && retMLc == 0){
2341 errV0KF[0] = sigmaMassV0;
2342 V0KF[1] = decayLengthV0;
2343 errV0KF[1] = sigmaDecayLengthV0;
2344 V0KF[2] = lifeTimeV0;
2345 errV0KF[2] = sigmaLifeTimeV0;
2347 errLcKF[0] = sigmaMassLc;
2348 LcKF[1] = decayLengthLc;
2349 errLcKF[1] = sigmaDecayLengthLc;
2350 LcKF[2] = lifeTimeLc;
2351 errLcKF[2] = sigmaLifeTimeLc;
2359 AliAODTrack* bachelor,
2360 TClonesArray *mcArray ){
2367 Int_t label = bachelor->GetLabel();
2372 AliAODMCParticle *mcpart =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(TMath::Abs(label)));
2374 Int_t
pdg = mcpart->PdgCode();
2375 if (TMath::Abs(pdg) != 2212) {
2376 AliDebug(2, Form(
"Bachelor is not a p, but a particle with pdg code = %d", pdg));
2383 Int_t bachelorMotherLabel = mcpart->GetMother();
2385 if (bachelorMotherLabel == -1) {
2388 AliAODMCParticle *bachelorMother =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(bachelorMotherLabel));
2390 Int_t pdgMother = bachelorMother->PdgCode();
2391 if (TMath::Abs(pdgMother) != 4122) {
2392 AliDebug(2, Form(
"The proton does not come from a Lc, but from a particle with pdgcode = %d", pdgMother));
2396 if (labelLc != bachelorMotherLabel){
2398 AliDebug(2, Form(
"The proton comes from a Lc, but it is not the candidate we are analyzing"));
2402 AliDebug(2, Form(
"The proton comes from a Lc, and it is EXACTLY the candidate we are analyzing"));
2416 TClonesArray *mcArray ){
2427 if (labelFind == -1) {
2431 AliAODMCParticle *mcpart =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(labelFind));
2433 Int_t
pdg = mcpart->PdgCode();
2434 if (TMath::Abs(pdg) != 310) {
2435 AliDebug(2, Form(
"K0Spart is not a K0S, but a particle with pdg code = %d", pdg));
2442 Int_t K0SpartMotherLabel = mcpart->GetMother();
2443 if (K0SpartMotherLabel == -1) {
2446 AliAODMCParticle *K0SpartMother =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(K0SpartMotherLabel));
2448 Int_t pdgMotherK0S = K0SpartMother->PdgCode();
2449 if (TMath::Abs(pdgMotherK0S) != 311) {
2450 AliDebug(2, Form(
"The K0S does not come from a K0, but from a particle with pdgcode = %d", pdgMotherK0S));
2455 Int_t K0MotherLabel = K0SpartMother->GetMother();
2456 if (K0MotherLabel == -1) {
2459 AliAODMCParticle *K0Mother =
dynamic_cast<AliAODMCParticle*
>(mcArray->At(K0MotherLabel));
2461 Int_t pdgK0Mother = K0Mother->PdgCode();
2462 if (TMath::Abs(pdgK0Mother) != 4122) {
2463 AliDebug(2, Form(
"The K0 does not come from a Lc, but from a particle with pdgcode = %d", pdgK0Mother));
2468 if (labelLc != K0MotherLabel){
2469 AliDebug(2, Form(
"The K0S comes from a Lc, but it is not the candidate we are analyzing"));
2474 AliDebug(2, Form(
"The K0S comes from a Lc, and it is EXACTLY the candidate we are analyzing"));
2494 Int_t labMother[2]={-1, -1};
2495 AliAODMCParticle *part=0;
2496 AliAODMCParticle *mother=0;
2497 Int_t dgLabels = -1;
2499 Int_t ndg = v0part->GetNDaughters();
2501 AliFatal(Form(
"IMPOSSIBLE!! There are %d daughters, but they should be 2!", ndg));
2504 for(Int_t i = 0; i < 2; i++) {
2505 AliAODTrack *trk = (AliAODTrack*)v0part->GetDaughter(i);
2506 dgLabels = trk->GetLabel();
2507 if (dgLabels == -1) {
2511 part = (AliAODMCParticle*)mcArray->At(TMath::Abs(dgLabels));
2516 labMother[i] = part->GetMother();
2517 if (labMother[i] != -1){
2518 mother = (AliAODMCParticle*)mcArray->At(labMother[i]);
2529 if (labMother[0] == labMother[1])
return labMother[0];
2543 AliAODMCParticle *part=0;
2544 AliAODMCParticle *mother=0;
2545 AliAODMCParticle *grandmother=0;
2546 Int_t dgLabels = -1;
2548 Int_t ndg = cascade->GetNDaughters();
2550 AliFatal(Form(
"IMPOSSIBLE!! There are %d daughters, but they should be 2!", ndg));
2554 AliAODTrack *trk = (AliAODTrack*)cascade->GetDaughter(0);
2555 dgLabels = trk->GetLabel();
2556 if (dgLabels == -1 ) {
2560 part = (AliAODMCParticle*)mcArray->At(TMath::Abs(dgLabels));
2565 Int_t labMotherBach = part->GetMother();
2566 if (labMotherBach == -1){
2569 mother = (AliAODMCParticle*)mcArray->At(labMotherBach);
2575 AliAODv0 *v0 = (AliAODv0*)cascade->GetDaughter(1);
2577 if (dgLabels == -1 ) {
2581 part = (AliAODMCParticle*)mcArray->At(TMath::Abs(dgLabels));
2586 Int_t labMotherv0 = part->GetMother();
2587 if (labMotherv0 == -1){
2590 mother = (AliAODMCParticle*)mcArray->At(labMotherv0);
2595 Int_t labGrandMotherv0 = mother->GetMother();
2596 if (labGrandMotherv0 == -1){
2599 grandmother = (AliAODMCParticle*)mcArray->At(labGrandMotherv0);
2606 if (labGrandMotherv0 == labMotherBach)
return labMotherBach;
Int_t IsSelectedSingleCut(TObject *obj, Int_t selectionLevel, Int_t cutIndex)
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
TH1D * fHistoDistanceV0ToLc
! KF: distance V0 vertex from Lc vertex
TH2D * fHistoArmenterosPodolanskiV0KFSgn
! KF: Armeteros-Podolanski plot for V0 from signal Lc from KF
void FillMCHisto(TClonesArray *mcArray)
TH1D * fHistoKFV0
! KF: V0 code from KF (mass, decaylength, lifetime considered)
TH1D * fHistoDecayLengthLcTrue
! KF: decay length for true cascades reconstructed with KF
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
TH1F * fHistoLc
! histogram with number of Lc
Double_t Ct(UInt_t pdg) const
TTree * fVariablesTreeSgn
flag for event selected
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabs2prong, Int_t *pdgDg, Int_t *pdgDg2prong, TClonesArray *mcArray, Bool_t isV0=kFALSE) const
AliAODTrack * Getv0NegativeTrack() const
TH2D * fHistoLifeTimeKFLc
! KF: life time vs life time error for Lc from KF
AliPIDCombined * fPIDCombined
! combined PID response object
TH2D * fHistoArmenterosPodolanskiV0AODSgn
! KF: AOD Armeteros-Podolanski plot for V0 from signal Lc from KF
TH1D * fHistoVtxV0ResidualToPrimVtx
! KF: residual wrt MC of distance V0 vertex from primary vertex (MC - KF)
TH1F * fHistoLcpKpiBeforeCuts
! histogram number of true Lc–>pKpi (3 prong) before any cut
Bool_t fKeepingOnlyPYTHIABkg
magnetic field of current event
Double_t InvMassLctoLambdaPi() const
TH1D * fHistoDecayLengthV0All
! KF: decay length for all V0 reconstructed with KF
virtual void UserCreateOutputObjects()
Implementation of interface methods.
virtual void Terminate(Option_t *option)
TH1D * fHistoDecayLengthLcAll
! KF: decay length for all Lc reconstructed with KF
Bool_t fKeepingOnlyHIJINGBkg
flag to decide whether to call or not KF
TH1D * fHistoLifeTimeV0All
! KF: life time for all V0 reconstructed with KF
AliRDHFCutsLctoV0 * fAnalCuts
Float_t * fCandidateVariables
! variables to be written to the tree
TH1D * fHistoMassV0TrueK0S
! KF: mass for true V0 which are really K0S reconstructed with KF
TH2D * fHistoDecayLengthKFLc
! KF: decay length vs decay length error for Lc from KF
TList * fOutputKF
! User output1: list of histograms from KF
AliNormalizationCounter * fCounter
switch between Lpi and K0sp
Bool_t fIsEventSelected
flag to analyze also on-the-fly V0 candidates
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
Double_t GetMaxVtxZ() const
Bool_t ftopoConstraint
label of candidate
TH1D * fHistoDecayLengthV0fromLcAll
! KF: decay length of V0 for all cascades reconstructed with KF
Double_t InvMassLctoK0sP() const
TH1D * fHistoMassV0TrueK0SFromAOD
! KF: AOD mass for true V0 which are really K0S reconstructed with KF
TH1F * fHistoLcOnTheFly
! histogram with number of Lc with on-the-fly V0
TH1D * fHistoLifeTimeLcTrue
! KF: life time for true cascades reconstructed with KF
TH1D * fHistoKFLc
! KF: Lc code from KF (mass, decaylength, lifetime considered)
TH2D * fHistoKF
! KF: V0 code vs Lc code from KF (mass, decaylength, lifetime considered)
Int_t CallKFVertexing(AliAODRecoCascadeHF *cascade, AliAODv0 *v0part, AliAODTrack *bach, TClonesArray *mcArray, Double_t *V0KF, Double_t *errV0KF, Double_t *LcKF, Double_t *errLcKF, Double_t *distances, Double_t *armPolKF)
AliAODTrack * Getv0PositiveTrack() const
TH1D * fHistoLifeTimeLcSgn
! KF: life time of signal Lc reconstructed with KF
TH1D * fHistoDistanceV0ToPrimVtx
! KF: distance V0 vertex from primary vertex
TH1D * fHistoMassLcSgnFromAOD
! KF: AOD mass of signal Lc reconstructed with KF
Bool_t fUseOnTheFlyV0
list of cuts
TH1D * fHistoMassLcAll
! KF: mass for all Lc reconstructed with KF
TH1D * fHistoDistanceV0ToLcSgn
! KF: distance for signal Lc of V0 vertex from Lc vertex
TH1D * fHistoMassV0fromLcAll
! KF: mass of V0 for all cascades reconstructed with KF
TH1D * fHistoDecayLengthLcSgn
! KF: decay length of signal Lc reconstructed with KF
TH1F * fHistoMCLcK0SpGenAcc
! histo with MC Lc –> K0S + p
virtual ~AliAnalysisTaskSELc2V0bachelorTMVA()
TH1D * fHistoMassLcTrueFromAOD
! KF: AOD mass for true cascades reconstructed with KF
TH1D * fHistoMassV0fromLcSgn
! KF: mass of V0 for signal Lc reconstructed with KF
AliAODTrack * GetBachelor() const
Int_t FindLcLabel(AliAODRecoCascadeHF *cascade, TClonesArray *mcArray) const
TList * fOutput
Use MC info.
TH1D * fHistoLifeTimeV0fromLcAll
! KF: life time of V0 for all cascades reconstructed with KF
virtual void UserExec(Option_t *option)
TH2D * fHistoLifeTimeKFV0
! KF: life time vs life time error for V0 from KF
TH1D * fHistoMassV0TrueFromAOD
! KF: AOD mass for true V0 reconstructed with KF
Double_t fBField
current event number - for debug purposes
TH2D * fHistoDecayLengthKFV0
! KF: decay length vs decay length error for V0 from KF
Bool_t HasCascadeCandidateAnyDaughInjected(AliAODRecoCascadeHF *cand, AliAODMCHeader *header, TClonesArray *arrayMC)
TH1D * fHistoDecayLengthV0True
! KF: decay length for true V0 reconstructed with KF
TH1F * fHistoFiducialAcceptance
! histogram to check FiducialAcceptance cut
TH2F * fHistoCodesBkg
! histogram with codes for bachelor and V0 for background
Double_t CosV0PointingAngle() const
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)
TH1D * fHistoLifeTimeV0fromLcTrue
! KF: life time of V0 for true cascades reconstructed with KF
AliVertexingHFUtils * fUtils
flag to fill bkg with only candidates that have daughters generated by HIJING (to be used for enriche...
EBachelor CheckBachelor(AliAODRecoCascadeHF *part, AliAODTrack *bachelor, TClonesArray *mcArray)
TH1D * fHistoDecayLengthV0fromLcSgn
! KF: decay length of V0 for signal Lc reconstructed with KF
void MakeAnalysisForLc2prK0S(TClonesArray *arrayLctopK0s, TClonesArray *mcArray, Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal, TClonesArray *array3Prong, AliAODMCHeader *aodheader)
Bool_t IsEventSelected(AliVEvent *event)
TH1F * fHistoLcBeforeCuts
flag to fill only signal (speeding up processing)
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
TH1D * fHistoDecayLengthV0TrueK0S
! KF: decay length for true V0 which are really K0S reconstructed with KF
void SetUsePID(Bool_t flag=kTRUE)
TH1D * fHistoLifeTimeLcAll
! KF: life time for all Lc reconstructed with KF
TH1D * fHistoMassV0All
! KF: mass for all V0 reconstructed with KF
TH1D * fHistoMassLcTrue
! KF: mass for true cascades reconstructed with KF
TH1D * fHistoLifeTimeV0True
! KF: life time for true V0 reconstructed with KF
TH1F * fHistoMCLcK0SpGenLimAcc
! histo with MC Lc –> K0S + p
TH2D * fHistoArmenterosPodolanskiV0AOD
! KF: AOD Armeteros-Podolanski plot for all V0 from KF
TH1D * fHistoVtxV0ResidualToLc
! KF: residual wrt MC of distance V0 vertex from Lc vertex (MC - KF)
TH1D * fHistoDistanceV0ToPrimVtxSgn
! KF: distance for signal Lc of V0 vertex from primary vertex
TH2D * fHistoArmenterosPodolanskiV0KF
! KF: Armeteros-Podolanski plot for all V0 from KF
TH1D * fHistoDecayLengthV0fromLcTrue
! KF: decay length of V0 for true cascades reconstructed with KF
Bool_t GetIsUsePID() const
TH1D * fHistoLifeTimeV0fromLcSgn
! KF: life time of V0 for signal Lc reconstructed with KF
TTree * fVariablesTreeBkg
! tree of the candidate variables after track selection (Background)
TH1D * fHistoDistanceLcToPrimVtx
primary vertex
Double_t DecayLengthV0() const
void SetTriggerClass(TString trclass0, TString trclass1="")
TH1D * fHistoDistanceLcToPrimVtxSgn
! KF: distance of signal Lc vertex from primary vertex
AliPIDResponse * fPIDResponse
! PID response object
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
TList * fListCuts
Cuts - sent to output slot 5.
EK0S CheckK0S(AliAODRecoCascadeHF *part, AliAODv0 *v0part, TClonesArray *mcArray)
TH1D * fHistoLifeTimeV0TrueK0S
! KF: life time for true V0 which are really K0S reconstructed with KF
TH1F * fHistoMCLcK0SpGen
flag to allow to use only PYTHIA tracks for background
Double_t DecayLength() const
AliAnalysisTaskSELc2V0bachelorTMVA()
TH2D * fHistoMassKFLc
! KF: mass vs mass error for Lc from KF
Bool_t fCallKFVertexing
flag to use topological constraints in KF
Int_t fCurrentEvent
cut for KF on distance to primary vtx for V0
void FillLc2pK0Sspectrum(AliAODRecoCascadeHF *part, Int_t isLc, Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal, TClonesArray *mcArray, Int_t iLctopK0s)
histos
TH1F * fHistoEvents
flag for running on pA
TH1D * fHistoVtxLcResidualToPrimVtx
! KF: residual wrt MC of distance Lc vertex from primary vertex (MC - KF)
void SetTriggerMask(ULong64_t mask=0)
TH1D * fHistoMassV0True
! KF: mass for true V0 reconstructed with KF
TH2D * fHistoMassKFV0
! KF: mass vs mass error for V0 from KF
Int_t FindV0Label(AliAODRecoDecay *v0part, TClonesArray *mcArray) const
TH1D * fHistoMassLcSgn
! KF: mass of signal Lc reconstructed with KF
TH2F * fHistoCodesSgn
! histogram with codes for bachelor and V0 for signal
TH1D * fHistoMassV0fromLcTrue
! KF: mass of V0 for true cascades reconstructed with KF
Class with functions useful for different D2H analyses //.
TH1F * fHistoBackground
AliVertexingHFUtils used to check the generator of a specific candidate.