@@ -44,11 +44,13 @@ enum JetTaggingSpecies {
4444 gluon = 5
4545};
4646
47- enum TaggingMethodNonML {
48- IPs = 0 ,
49- IPs3D = 1 ,
50- SV = 2 ,
51- SV3D = 3
47+ enum BJetTaggingMethod {
48+ IPsN2 = 0 ,
49+ IPsN3 = 1 ,
50+ IPs3DN2 = 2 ,
51+ IPs3DN3 = 3 ,
52+ SV = 4 ,
53+ SV3D = 5
5254};
5355
5456namespace jettaggingutilities
@@ -443,21 +445,17 @@ bool prongAcceptance(T const& prong, float prongChi2PCAMin, float prongChi2PCAMa
443445 return false ;
444446 if (prong.chi2PCA () > prongChi2PCAMax)
445447 return false ;
448+ if (std::abs (prong.impactParameterXY ()) < prongIPxyMin)
449+ return false ;
450+ if (std::abs (prong.impactParameterXY ()) > prongIPxyMax)
451+ return false ;
452+
446453 if (!doXYZ) {
447454 if (prong.errorDecayLengthXY () > prongsigmaLxyMax)
448455 return false ;
449- if (std::abs (prong.impactParameterXY ()) < prongIPxyMin)
450- return false ;
451- if (std::abs (prong.impactParameterXY ()) > prongIPxyMax)
452- return false ;
453456 } else {
454457 if (prong.errorDecayLength () > prongsigmaLxyMax)
455458 return false ;
456- // TODO
457- if (std::abs (prong.impactParameterXY ()) < prongIPxyMin)
458- return false ;
459- if (std::abs (prong.impactParameterXY ()) > prongIPxyMax)
460- return false ;
461459 }
462460 return true ;
463461}
@@ -514,25 +512,26 @@ void orderForIPJetTracks(T const& jet, U const& /*jtracks*/, float trackDcaXYMax
514512
515513/* *
516514 * Checks if a jet is greater than the given tagging working point based on the signed impact parameter significances
515+ * return (true, true) if the jet is tagged by the 2nd and 3rd largest IPs
517516 */
518517template <typename T, typename U>
519- bool isGreaterThanTaggingPoint (T const & jet, U const & jtracks, float trackDcaXYMax, float trackDcaZMax, float taggingPoint = 1.0 , int cnt = 1 , bool useIPxyz = false )
518+ std::tuple< bool , bool > isGreaterThanTaggingPoint (T const & jet, U const & jtracks, float trackDcaXYMax, float trackDcaZMax, float taggingPoint = 1.0 , bool useIPxyz = false )
520519{
521- if (cnt == 0 ) {
522- return true ; // untagged
523- }
520+ bool taggedIPsN2 = false ;
521+ bool taggedIPsN3 = false ;
524522 std::vector<float > vecSignImpSig;
525523 orderForIPJetTracks (jet, jtracks, trackDcaXYMax, trackDcaZMax, vecSignImpSig, useIPxyz);
526- if (vecSignImpSig.size () > static_cast <std::vector<float >::size_type>(cnt) - 1 ) {
527- for (int i = 0 ; i < cnt; i++) {
528- if (vecSignImpSig[i] < taggingPoint) { // tagger point set
529- return false ;
530- }
524+ if (vecSignImpSig.size () > 1 ) {
525+ if (vecSignImpSig[1 ] > taggingPoint) { // tagger point set
526+ taggedIPsN2 = true ;
531527 }
532- } else {
533- return false ;
534528 }
535- return true ;
529+ if (vecSignImpSig.size () > 2 ) {
530+ if (vecSignImpSig[2 ] > taggingPoint) { // tagger point set
531+ taggedIPsN3 = true ;
532+ }
533+ }
534+ return std::make_tuple (taggedIPsN2, taggedIPsN3);
536535}
537536
538537/* *
@@ -648,6 +647,7 @@ typename ProngType::iterator jetFromProngMaxDecayLength(const JetType& jet, floa
648647 sxy = prong.decayLength () / prong.errorDecayLength ();
649648 }
650649 if (maxSxy < sxy) {
650+ maxSxy = sxy;
651651 bjetCand = prong;
652652 }
653653 }
@@ -674,14 +674,23 @@ bool isTaggedJetSV(T const jet, U const& /*prongs*/, float prongChi2PCAMin, floa
674674}
675675
676676template <typename T, typename U, typename V = float >
677- uint8_t setTaggingIPBit (T const & jet, U const & jtracks, V trackDcaXYMax, V trackDcaZMax, V tagPointForIP, int minIPCount )
677+ uint8_t setTaggingIPBit (T const & jet, U const & jtracks, V trackDcaXYMax, V trackDcaZMax, V tagPointForIP)
678678{
679679 uint8_t bit = 0 ;
680- if (isGreaterThanTaggingPoint (jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, false )) {
681- SETBIT (bit, TaggingMethodNonML::IPs);
680+ auto [taggedIPsN2, taggedIPsN3] = isGreaterThanTaggingPoint (jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, false );
681+ if (taggedIPsN2) {
682+ SETBIT (bit, BJetTaggingMethod::IPsN2);
683+ }
684+ if (taggedIPsN3) {
685+ SETBIT (bit, BJetTaggingMethod::IPsN3);
686+ }
687+
688+ auto [taggedIPs3DN2, taggedIPs3DN3] = isGreaterThanTaggingPoint (jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, true );
689+ if (taggedIPs3DN2) {
690+ SETBIT (bit, BJetTaggingMethod::IPs3DN2);
682691 }
683- if (isGreaterThanTaggingPoint (jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, true ) ) {
684- SETBIT (bit, TaggingMethodNonML::IPs3D );
692+ if (taggedIPs3DN3 ) {
693+ SETBIT (bit, BJetTaggingMethod::IPs3DN3 );
685694 }
686695 return bit;
687696}
@@ -691,10 +700,10 @@ uint8_t setTaggingSVBit(T const& jet, U const& prongs, V prongChi2PCAMin, V pron
691700{
692701 uint8_t bit = 0 ;
693702 if (isTaggedJetSV (jet, prongs, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, svDispersionMax, false , tagPointForSV)) {
694- SETBIT (bit, TaggingMethodNonML ::SV);
703+ SETBIT (bit, BJetTaggingMethod ::SV);
695704 }
696705 if (isTaggedJetSV (jet, prongs, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, svDispersionMax, true , tagPointForSV)) {
697- SETBIT (bit, TaggingMethodNonML ::SV3D);
706+ SETBIT (bit, BJetTaggingMethod ::SV3D);
698707 }
699708 return bit;
700709}
0 commit comments