1818// / \author Annalena Kalteyer <annalena.sophie.kalteyer@cern.ch>, GSI Darmstadt
1919// / \author Biao Zhang <biao.zhang@cern.ch>, Heidelberg University
2020// / \author Ran Tu <ran.tu@cern.ch>, Fudan University
21+ // / \author Oleksii Lubynets <oleksii.lubynets@cern.ch>, Heidelberg University, GSI Darmstadt
2122
2223#include " PWGHF/Core/CentralityEstimation.h"
2324#include " PWGHF/Core/DecayChannels.h"
@@ -145,12 +146,13 @@ struct HfTaskLc {
145146
146147 void init (InitContext&)
147148 {
148- std::array<bool , 14 > doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M, doprocessDataWithMl, doprocessDataWithMlWithFT0C, doprocessDataWithMlWithFT0M, doprocessMcStd, doprocessMcStdWithFT0C, doprocessMcStdWithFT0M, doprocessMcWithMl, doprocessMcWithMlWithFT0C, doprocessMcWithMlWithFT0M, doprocessDataWithMlWithUpc , doprocessDataStdWithUpc};
149+ const std::array<bool , 14 > doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M, doprocessDataWithMl, doprocessDataWithMlWithFT0C, doprocessDataWithMlWithFT0M, doprocessDataWithMlWithUpc, doprocessMcStd, doprocessMcStdWithFT0C, doprocessMcStdWithFT0M, doprocessMcWithMl, doprocessMcWithMlWithFT0C, doprocessMcWithMlWithFT0M, doprocessDataStdWithUpc};
149150 if ((std::accumulate (doprocess.begin (), doprocess.end (), 0 )) != 1 ) {
150151 LOGP (fatal, " no or more than one process function enabled! Please check your configuration!" );
151152 }
152153
153- const bool isData = doprocessDataStd || doprocessDataStdWithFT0C || doprocessDataStdWithFT0M || doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M;
154+ const bool isData = doprocessDataStd || doprocessDataStdWithFT0C || doprocessDataStdWithFT0M || doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M || doprocessDataWithMlWithUpc;
155+ const bool isUpc = doprocessDataWithMlWithUpc || doprocessDataStdWithUpc;
154156
155157 auto addHistogramsRec = [&](const std::string& histoName, const std::string& xAxisTitle, const std::string& yAxisTitle, const HistogramConfigSpec& configSpec) {
156158 if (isData) {
@@ -253,12 +255,14 @@ struct HfTaskLc {
253255 // / decay length error
254256 addHistogramsRec (" hDecLenErrVsPt" , " decay length error (cm)" , " #it{p}_{T} (GeV/#it{c})" , {HistType::kTH2F , {{100 , 0 ., 1 .}, {vbins}}});
255257
256- qaRegistry.add (" Data/fitInfo/ampFT0A_vs_ampFT0C" , " FT0-A vs FT0-C amplitude;FT0-A amplitude (a.u.);FT0-C amplitude (a.u.)" , {HistType::kTH2F , {{2500 , 0 ., 250 }, {2500 , 0 ., 250 }}});
257- qaRegistry.add (" Data/zdc/energyZNA_vs_energyZNC" , " ZNA vs ZNC common energy;E_{ZNA}^{common} (a.u.);E_{ZNC}^{common} (a.u.)" , {HistType::kTH2F , {{200 , 0 ., 20 }, {200 , 0 ., 20 }}});
258- qaRegistry.add (" Data/hUpcGapAfterSelection" , " UPC gap type after selection;Gap side;Counts" , {HistType::kTH1F , {{3 , -0.5 , 2.5 }}});
259- qaRegistry.get <TH1>(HIST (" Data/hUpcGapAfterSelection" ))->GetXaxis ()->SetBinLabel (static_cast <int >(GapType::GapA) + 1 , " A" );
260- qaRegistry.get <TH1>(HIST (" Data/hUpcGapAfterSelection" ))->GetXaxis ()->SetBinLabel (static_cast <int >(GapType::GapC) + 1 , " C" );
261- qaRegistry.get <TH1>(HIST (" Data/hUpcGapAfterSelection" ))->GetXaxis ()->SetBinLabel (static_cast <int >(GapType::DoubleGap) + 1 , " Double" );
258+ if (isUpc) {
259+ qaRegistry.add (" Data/fitInfo/ampFT0A_vs_ampFT0C" , " FT0-A vs FT0-C amplitude;FT0-A amplitude (a.u.);FT0-C amplitude (a.u.)" , {HistType::kTH2F , {{2500 , 0 ., 250 }, {2500 , 0 ., 250 }}});
260+ qaRegistry.add (" Data/zdc/energyZNA_vs_energyZNC" , " ZNA vs ZNC common energy;E_{ZNA}^{common} (a.u.);E_{ZNC}^{common} (a.u.)" , {HistType::kTH2F , {{200 , 0 ., 20 }, {200 , 0 ., 20 }}});
261+ qaRegistry.add (" Data/hUpcGapAfterSelection" , " UPC gap type after selection;Gap side;Counts" , {HistType::kTH1F , {{3 , -0.5 , 2.5 }}});
262+ qaRegistry.get <TH1>(HIST (" Data/hUpcGapAfterSelection" ))->GetXaxis ()->SetBinLabel (static_cast <int >(GapType::GapA) + 1 , " A" );
263+ qaRegistry.get <TH1>(HIST (" Data/hUpcGapAfterSelection" ))->GetXaxis ()->SetBinLabel (static_cast <int >(GapType::GapC) + 1 , " C" );
264+ qaRegistry.get <TH1>(HIST (" Data/hUpcGapAfterSelection" ))->GetXaxis ()->SetBinLabel (static_cast <int >(GapType::DoubleGap) + 1 , " Double" );
265+ }
262266 if (fillTHn) {
263267 const AxisSpec thnAxisMass{thnConfigAxisMass, " inv. mass (p K #pi) (GeV/#it{c}^{2})" };
264268 const AxisSpec thnAxisPt{thnConfigAxisPt, " #it{p}_{T}(#Lambda_{c}^{+}) (GeV/#it{c})" };
@@ -330,7 +334,9 @@ struct HfTaskLc {
330334 }
331335 }
332336
333- hfEvSel.addHistograms (qaRegistry); // collision monitoring
337+ if (isUpc) {
338+ hfEvSel.addHistograms (qaRegistry); // collision monitoring
339+ }
334340
335341 ccdb->setURL (ccdbUrl);
336342 ccdb->setCaching (true );
@@ -400,8 +406,8 @@ struct HfTaskLc {
400406 template <bool FillMl, typename CollType, typename CandLcMcRec, typename CandLcMcGen>
401407 void fillHistosMcRec (CollType const & collision, CandLcMcRec const & candidates, CandLcMcGen const & mcParticles)
402408 {
403- auto thisCollId = collision.globalIndex ();
404- auto groupedLcCandidates = candidates.sliceBy (candLcPerCollision, thisCollId);
409+ const auto thisCollId = collision.globalIndex ();
410+ const auto & groupedLcCandidates = candidates.sliceBy (candLcPerCollision, thisCollId);
405411
406412 for (const auto & candidate : groupedLcCandidates) {
407413 // / Select Lc
@@ -415,22 +421,22 @@ struct HfTaskLc {
415421
416422 if (std::abs (candidate.flagMcMatchRec ()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) {
417423 // Get the corresponding MC particle.
418- auto mcParticleProng0 = candidate.template prong0_as <aod::TracksWMc>().template mcParticle_as <soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>();
419- auto pdgCodeProng0 = std::abs (mcParticleProng0.pdgCode ());
420- auto indexMother = RecoDecay::getMother (mcParticles, mcParticleProng0, o2::constants::physics::Pdg::kLambdaCPlus , true );
421- auto particleMother = mcParticles.rawIteratorAt (indexMother);
424+ const auto & mcParticleProng0 = candidate.template prong0_as <aod::TracksWMc>().template mcParticle_as <soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>();
425+ const auto pdgCodeProng0 = std::abs (mcParticleProng0.pdgCode ());
426+ const auto indexMother = RecoDecay::getMother (mcParticles, mcParticleProng0, o2::constants::physics::Pdg::kLambdaCPlus , true );
427+ const auto particleMother = mcParticles.rawIteratorAt (indexMother);
422428 registry.fill (HIST (" MC/generated/signal/hPtGenSig" ), particleMother.pt ()); // gen. level pT
423429
424- auto pt = candidate.pt ();
425- auto ptProng0 = candidate.ptProng0 ();
426- auto ptProng1 = candidate.ptProng1 ();
427- auto ptProng2 = candidate.ptProng2 ();
428- auto decayLength = candidate.decayLength ();
429- auto chi2PCA = candidate.chi2PCA ();
430- auto cpa = candidate.cpa ();
431- auto originType = candidate.originMcRec ();
432- auto numPvContributors = collision.numContrib ();
433- auto ptRecB = candidate.ptBhadMotherPart ();
430+ const auto pt = candidate.pt ();
431+ const auto ptProng0 = candidate.ptProng0 ();
432+ const auto ptProng1 = candidate.ptProng1 ();
433+ const auto ptProng2 = candidate.ptProng2 ();
434+ const auto decayLength = candidate.decayLength ();
435+ const auto chi2PCA = candidate.chi2PCA ();
436+ const auto cpa = candidate.cpa ();
437+ const auto originType = candidate.originMcRec ();
438+ const auto numPvContributors = collision.numContrib ();
439+ const auto ptRecB = candidate.ptBhadMotherPart ();
434440
435441 // / MC reconstructed signal
436442 fillHistogramsRecSig<Signal>(candidate);
@@ -520,8 +526,8 @@ struct HfTaskLc {
520526 if (yCandGenMax >= 0 . && std::abs (yGen) > yCandGenMax) {
521527 continue ;
522528 }
523- auto ptGen = particle.pt ();
524- auto originType = particle.originMcGen ();
529+ const auto ptGen = particle.pt ();
530+ const auto originType = particle.originMcGen ();
525531 float ptGenB = -1 .;
526532 unsigned int numPvContributors = 0 ;
527533 const auto & recoCollsPerMcColl = recoCollisions.sliceBy (colPerMcCollision, particle.mcCollision ().globalIndex ());
@@ -534,7 +540,7 @@ struct HfTaskLc {
534540 occ = o2::hf_occupancy::getOccupancyGenColl (recoCollsPerMcColl, occEstimator);
535541 }
536542
537- const auto mcDaughter0 = particle.template daughters_as <soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>().begin ();
543+ const auto & mcDaughter0 = particle.template daughters_as <soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>().begin ();
538544 const float p2m = particle.p () / o2::constants::physics::MassLambdaCPlus;
539545 const float gamma = std::sqrt (1 + p2m * p2m); // mother's particle Lorentz factor
540546 const float properLifetime = mcDaughter0.vt () * NanoToPico / gamma; // from ns to ps * from lab time to proper time
@@ -572,9 +578,9 @@ struct HfTaskLc {
572578 template <bool FillMl, typename CollType, typename CandType>
573579 void fillHistosData (CollType const & collision, CandType const & candidates)
574580 {
575- auto thisCollId = collision.globalIndex ();
576- auto groupedLcCandidates = candidates.sliceBy (candLcPerCollision, thisCollId);
577- auto numPvContributors = collision.numContrib ();
581+ const auto thisCollId = collision.globalIndex ();
582+ const auto & groupedLcCandidates = candidates.sliceBy (candLcPerCollision, thisCollId);
583+ const auto numPvContributors = collision.numContrib ();
578584
579585 for (const auto & candidate : groupedLcCandidates) {
580586 if (!(candidate.hfflag () & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) {
@@ -583,15 +589,15 @@ struct HfTaskLc {
583589 if (yCandRecoMax >= 0 . && std::abs (hfHelper.yLc (candidate)) > yCandRecoMax) {
584590 continue ;
585591 }
586- auto pt = candidate.pt ();
587- auto ptProng0 = candidate.ptProng0 ();
588- auto ptProng1 = candidate.ptProng1 ();
589- auto ptProng2 = candidate.ptProng2 ();
590- auto decayLength = candidate.decayLength ();
591- auto decayLengthXY = candidate.decayLengthXY ();
592- auto chi2PCA = candidate.chi2PCA ();
593- auto cpa = candidate.cpa ();
594- auto cpaXY = candidate.cpaXY ();
592+ const auto pt = candidate.pt ();
593+ const auto ptProng0 = candidate.ptProng0 ();
594+ const auto ptProng1 = candidate.ptProng1 ();
595+ const auto ptProng2 = candidate.ptProng2 ();
596+ const auto decayLength = candidate.decayLength ();
597+ const auto decayLengthXY = candidate.decayLengthXY ();
598+ const auto chi2PCA = candidate.chi2PCA ();
599+ const auto cpa = candidate.cpa ();
600+ const auto cpaXY = candidate.cpaXY ();
595601
596602 if (candidate.isSelLcToPKPi () >= selectionFlagLc) {
597603 registry.fill (HIST (" Data/hMass" ), hfHelper.invMassLcToPKPi (candidate));
@@ -716,13 +722,13 @@ struct HfTaskLc {
716722 // / at least one event selection not satisfied --> reject the candidate
717723 continue ;
718724 }
719- auto bc = collision.template bc_as <BCsType>();
725+ const auto & bc = collision.template bc_as <BCsType>();
720726 upchelpers::FITInfo fitInfo{};
721727 udhelpers::getFITinfo (fitInfo, bc, bcs, ft0s, fv0as, fdds);
722728
723729 GapType gap = GapType::DoubleGap;
724730 if (bc.has_zdc ()) {
725- auto zdc = bc.zdc ();
731+ const auto zdc = bc.zdc ();
726732 qaRegistry.fill (HIST (" Data/fitInfo/ampFT0A_vs_ampFT0C" ), fitInfo.ampFT0A , fitInfo.ampFT0C );
727733 qaRegistry.fill (HIST (" Data/zdc/energyZNA_vs_energyZNC" ), zdc.energyCommonZNA (), zdc.energyCommonZNC ());
728734 gap = determineGapType (fitInfo.ampFT0A , fitInfo.ampFT0C , zdc.energyCommonZNA (), zdc.energyCommonZNC ());
0 commit comments