@@ -196,6 +196,11 @@ struct HfDataCreatorCharmHadPiReduced {
196196 Configurable<std::vector<double >> binsPtPion{" binsPtPion" , std::vector<double >{hf_cuts_single_track::vecBinsPtTrack}, " track pT bin limits for pion DCA XY pT-dependent cut" };
197197 Configurable<LabeledArray<double >> cutsTrackPionDCA{" cutsTrackPionDCA" , {hf_cuts_single_track::CutsTrack[0 ], hf_cuts_single_track::NBinsPtTrack, hf_cuts_single_track::NCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, " Single-track selections per pT bin for pions" };
198198 } trackPionConfigurations;
199+ // B hadron selection
200+ struct : o2::framework::ConfigurableGroup {
201+ Configurable<double > cpaMin{" cpaMin" , 0 ., " Minimum cosine of pointing angle for B candidates" };
202+ Configurable<double > decLenMin{" decLenMin" , 0 ., " Minimum decay length for B candidates" };
203+ } bhadronConfigurations;
199204 // HF flags
200205 struct : o2::framework::ConfigurableGroup {
201206 Configurable<int > selectionFlagDplus{" selectionFlagDplus" , 7 , " Selection Flag for D+" };
@@ -272,7 +277,7 @@ struct HfDataCreatorCharmHadPiReduced {
272277 PresliceUnsorted<CollisionsWCentAndMcLabels> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
273278 } preslices;
274279
275- std::shared_ptr<TH1 > hCandidatesD0, hCandidatesDPlus, hCandidatesDs, hCandidatesLc, hCandidatesD0FromDstar;
280+ std::shared_ptr<TH1 > hCandidatesD0, hCandidatesDPlus, hCandidatesDs, hCandidatesLc, hCandidatesD0FromDstar, hCandidatesBHadron ;
276281 HistogramRegistry registry{" registry" };
277282 OutputObj<ZorroSummary> zorroSummary{" zorroSummary" };
278283
@@ -311,6 +316,15 @@ struct HfDataCreatorCharmHadPiReduced {
311316 invMass2ChHadPiMax = (massB + configs.invMassWindowCharmHadPi ) * (massB + configs.invMassWindowCharmHadPi );
312317
313318 // Initialize fitter
319+ // D0 + B hadrons
320+ df2.setPropagateToPCA (vertexConfigurations.propagateToPCA );
321+ df2.setMaxR (vertexConfigurations.maxR );
322+ df2.setMaxDZIni (vertexConfigurations.maxDZIni );
323+ df2.setMinParamChange (vertexConfigurations.minParamChange );
324+ df2.setMinRelChi2Change (vertexConfigurations.minRelChi2Change );
325+ df2.setUseAbsDCA (vertexConfigurations.useAbsDCA );
326+ df2.setWeightedFinalPCA (vertexConfigurations.useWeightedFinalPCA );
327+ df2.setMatCorrType (noMatCorr);
314328 if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiDataWithQvec || doprocessDplusPiDataWithMlAndQvec || doprocessDplusPiMc || doprocessDplusPiMcWithMl ||
315329 doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiDataWithQvec || doprocessDsPiDataWithMlAndQvec || doprocessDsPiMc || doprocessDsPiMcWithMl ||
316330 doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl) {
@@ -322,16 +336,6 @@ struct HfDataCreatorCharmHadPiReduced {
322336 df3.setUseAbsDCA (vertexConfigurations.useAbsDCA );
323337 df3.setWeightedFinalPCA (vertexConfigurations.useWeightedFinalPCA );
324338 df3.setMatCorrType (noMatCorr);
325- } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiDataWithQvec || doprocessD0PiDataWithMlAndQvec || doprocessD0PiMc || doprocessD0PiMcWithMl ||
326- doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiDataWithQvec || doprocessDstarPiDataWithMlAndQvec || doprocessDstarPiMc || doprocessDstarPiMcWithMl) {
327- df2.setPropagateToPCA (vertexConfigurations.propagateToPCA );
328- df2.setMaxR (vertexConfigurations.maxR );
329- df2.setMaxDZIni (vertexConfigurations.maxDZIni );
330- df2.setMinParamChange (vertexConfigurations.minParamChange );
331- df2.setMinRelChi2Change (vertexConfigurations.minRelChi2Change );
332- df2.setUseAbsDCA (vertexConfigurations.useAbsDCA );
333- df2.setWeightedFinalPCA (vertexConfigurations.useWeightedFinalPCA );
334- df2.setMatCorrType (noMatCorr);
335339 }
336340
337341 // Configure CCDB access
@@ -389,12 +393,14 @@ struct HfDataCreatorCharmHadPiReduced {
389393 hCandidatesDs = registry.add <TH1 >(" hCandidatesDs" , " Ds candidate counter" , {HistType::kTH1D , {axisCands}});
390394 hCandidatesLc = registry.add <TH1 >(" hCandidatesLc" , " Lc candidate counter" , {HistType::kTH1D , {axisCands}});
391395 hCandidatesD0FromDstar = registry.add <TH1 >(" hCandidatesD0FromDstar" , " D0 from D* candidate counter" , {HistType::kTH1D , {axisCands}});
396+ hCandidatesBHadron = registry.add <TH1 >(" hCandidatesBHadron" , " B hadron candidate counter" , {HistType::kTH1D , {axisCands}});
392397
393398 setLabelHistoCands (hCandidatesD0);
394399 setLabelHistoCands (hCandidatesDPlus);
395400 setLabelHistoCands (hCandidatesDs);
396401 setLabelHistoCands (hCandidatesLc);
397402 setLabelHistoCands (hCandidatesD0FromDstar);
403+ setLabelHistoCands (hCandidatesBHadron);
398404
399405 // init HF event selection helper
400406 hfEvSel.init (registry, &zorroSummary);
@@ -1017,6 +1023,26 @@ struct HfDataCreatorCharmHadPiReduced {
10171023 }
10181024 }
10191025
1026+ // / B hadron preselections
1027+ // / \param momentum is the B meson momentum
1028+ // / \param secondaryVertex is the reconstructed secondary vertex
1029+ // / \param collision is the reconstructed collision
1030+ template <typename T1 , typename T2 , typename T3 >
1031+ bool isBHadronSelected (const T1 & momentum, const T2 & secondaryVertex, const T3 & collision)
1032+ {
1033+ // B candidate CPA
1034+ if (RecoDecay::cpa (std::array{collision.posX (), collision.posY (), collision.posZ ()}, secondaryVertex, momentum) < bhadronConfigurations.cpaMin ) {
1035+ return false ;
1036+ }
1037+
1038+ // B candidate decay length
1039+ if (RecoDecay::distance (std::array{collision.posX (), collision.posY (), collision.posZ ()}, secondaryVertex) < bhadronConfigurations.decLenMin ) {
1040+ return false ;
1041+ }
1042+
1043+ return true ;
1044+ }
1045+
10201046 template <bool DoMc, bool WithMl, uint8_t DecChannel, bool WithQvec, typename PParticles, typename TTracks, typename CCharmCands, typename Coll, typename BBCs>
10211047 void runDataCreation (Coll const & collision,
10221048 CCharmCands const & candsC,
@@ -1307,12 +1333,33 @@ struct HfDataCreatorCharmHadPiReduced {
13071333 }
13081334
13091335 registry.fill (HIST (" hPtPion" ), trackParCovPion.getPt ());
1336+
13101337 // compute invariant mass square and apply selection
13111338 auto invMass2DPi = RecoDecay::m2 (std::array{pVecCharm, pVecPion}, std::array{massC, MassPiPlus});
13121339 if ((invMass2DPi < invMass2ChHadPiMin) || (invMass2DPi > invMass2ChHadPiMax)) {
13131340 continue ;
13141341 }
13151342
1343+ std::array<float , 3 > pVecBHad{}, pVecDHad{}, pVecDau{};
1344+
1345+ hCandidatesBHadron->Fill (SVFitting::BeforeFit);
1346+ try {
1347+ if (df2.process (trackParCovCharmHad, trackParCovPion) == 0 ) {
1348+ continue ;
1349+ }
1350+ } catch (const std::runtime_error& error) {
1351+ LOG (info) << " Run time error found: " << error.what () << " . DCAFitterN cannot work, skipping the candidate." ;
1352+ hCandidatesBHadron->Fill (SVFitting::Fail);
1353+ continue ;
1354+ }
1355+ hCandidatesBHadron->Fill (SVFitting::FitOk);
1356+ auto secondaryVertexBHad = df2.getPCACandidate ();
1357+ df2.getTrack (0 ).getPxPyPzGlo (pVecDHad);
1358+ df2.getTrack (1 ).getPxPyPzGlo (pVecDau);
1359+ pVecBHad = RecoDecay::pVec (pVecDHad, pVecDau);
1360+ if (!isBHadronSelected (pVecBHad, secondaryVertexBHad, collision)) {
1361+ continue ;
1362+ }
13161363 // fill Pion tracks table
13171364 // if information on track already stored, go to next track
13181365 if (!selectedTracksPion.count (trackPion.globalIndex ())) {
0 commit comments