@@ -246,25 +246,35 @@ struct HfCandidateCreatorCharmResoReduced {
246246 bool isV0Selected (V0RedTable const & candV0)
247247 {
248248 int ptBin = findBin (cfgV0Cuts.binsPtV0 , candV0.pt ());
249+ const float invMassLow = cfgV0Cuts.cutsV0 ->get (ptBin, " invMassLow" );
250+ const float invMassHigh = cfgV0Cuts.cutsV0 ->get (ptBin, " invMassHigh" );
249251 if (ptBin == -1 ) {
250252 return false ;
251253 }
252254 if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s
253255 if (!TESTBIT (candV0.v0Type (), V0Type::K0s)) {
254256 return false ;
255257 }
256- if (( candV0.invMassK0s () - MassK0Short) > cfgV0Cuts. cutsV0 -> get (ptBin, " invMassLow" ) && (MassK0Short - candV0.invMassK0s ()) < cfgV0Cuts. cutsV0 -> get (ptBin, " invMassLow " ) ) {
258+ if (candV0.invMassK0s () < invMassLow || candV0.invMassK0s () > invMassHigh ) {
257259 return false ;
258260 }
259261 } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda
260262 if (!TESTBIT (candV0.v0Type (), V0Type::Lambda) && !TESTBIT (candV0.v0Type (), V0Type::AntiLambda)) {
261263 return false ;
262264 }
263- if ((candV0.invMassLambda () - MassLambda) > cfgV0Cuts.cutsV0 ->get (ptBin, " invMassLow" ) && (MassLambda - candV0.invMassLambda ()) < cfgV0Cuts.cutsV0 ->get (ptBin, " invMassLow" )) {
264- return false ;
265+
266+ if (TESTBIT (candV0.v0Type (), V0Type::Lambda)) {
267+ if (candV0.invMassLambda () < invMassLow ||
268+ candV0.invMassLambda () > invMassHigh) {
269+ return false ;
270+ }
265271 }
266- if ((candV0.invMassAntiLambda () - MassLambda) > cfgV0Cuts.cutsV0 ->get (ptBin, " invMassLow" ) && (MassLambda - candV0.invMassAntiLambda ()) < cfgV0Cuts.cutsV0 ->get (ptBin, " invMassLow" )) {
267- return false ;
272+
273+ if (TESTBIT (candV0.v0Type (), V0Type::AntiLambda)) {
274+ if (candV0.invMassAntiLambda () < invMassLow ||
275+ candV0.invMassAntiLambda () > invMassHigh) {
276+ return false ;
277+ }
268278 }
269279 } else {
270280 LOG (error) << " Unsupported V0 type for selection: " << cfgV0Cuts.v0Type ;
@@ -378,10 +388,10 @@ struct HfCandidateCreatorCharmResoReduced {
378388 invMassReso = RecoDecay::m (std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassK0Short});
379389 }
380390 } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda
381- if (candV0Tr.v0Type () == V0Type::Lambda) {
391+ if (TESTBIT ( candV0Tr.v0Type (), V0Type::Lambda) ) {
382392 invMassV0Tr = candV0Tr.invMassLambda ();
383393 signReso = candD.sign ();
384- } else if (candV0Tr.v0Type () == V0Type::AntiLambda) {
394+ } else if (TESTBIT ( candV0Tr.v0Type (), V0Type::AntiLambda) ) {
385395 invMassV0Tr = candV0Tr.invMassAntiLambda ();
386396 signReso = candD.sign ();
387397 isWrongSign = 1 ;
@@ -464,9 +474,9 @@ struct HfCandidateCreatorCharmResoReduced {
464474 invMassReso = RecoDecay::m (std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassK0Short});
465475 }
466476 } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda
467- if (candV0Tr.v0Type () == V0Type::Lambda) {
477+ if (TESTBIT ( candV0Tr.v0Type (), V0Type::Lambda) ) {
468478 invMassV0Tr = candV0Tr.invMassLambda ();
469- } else if (candV0Tr.v0Type () == V0Type::AntiLambda) {
479+ } else if (TESTBIT ( candV0Tr.v0Type (), V0Type::AntiLambda) ) {
470480 invMassV0Tr = candV0Tr.invMassAntiLambda ();
471481 isWrongSign = 1 ;
472482 }
@@ -554,9 +564,9 @@ struct HfCandidateCreatorCharmResoReduced {
554564 invMassReso = RecoDecay::m (std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassK0Short});
555565 }
556566 } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda
557- if (candV0Tr.v0Type () == V0Type::Lambda) {
567+ if (TESTBIT ( candV0Tr.v0Type (), V0Type::Lambda) ) {
558568 invMassV0Tr = candV0Tr.invMassLambda ();
559- } else if (candV0Tr.v0Type () == V0Type::AntiLambda) {
569+ } else if (TESTBIT ( candV0Tr.v0Type (), V0Type::AntiLambda) ) {
560570 invMassV0Tr = candV0Tr.invMassAntiLambda ();
561571 isWrongSign = 1 ;
562572 }
@@ -628,10 +638,10 @@ struct HfCandidateCreatorCharmResoReduced {
628638 invMassReso = RecoDecay::m (std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassK0Short});
629639 }
630640 } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda
631- if (candV0Tr.v0Type () == V0Type::Lambda) {
641+ if (TESTBIT ( candV0Tr.v0Type (), V0Type::Lambda) ) {
632642 invMassV0Tr = candV0Tr.invMassLambda ();
633643 isWrongSign = 1 ;
634- } else if (candV0Tr.v0Type () == V0Type::AntiLambda) {
644+ } else if (TESTBIT ( candV0Tr.v0Type (), V0Type::AntiLambda) ) {
635645 invMassV0Tr = candV0Tr.invMassAntiLambda ();
636646 }
637647 if (useDeltaMass) {
0 commit comments