ATLAS Offline Software
Loading...
Searching...
No Matches
BTaggingSelectionTool Class Reference

#include <BTaggingSelectionTool.h>

Inheritance diagram for BTaggingSelectionTool:
Collaboration diagram for BTaggingSelectionTool:

Classes

struct  taggerproperties

Public Member Functions

 BTaggingSelectionTool (const std::string &name)
 Create a proper constructor for Athena.
StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual asg::AcceptData accept (const xAOD::IParticle *p) const override
 Get the decision using a generic IParticle pointer.
virtual asg::AcceptData accept (const xAOD::Jet &jet) const override
virtual asg::AcceptData accept (double, double, double) const override
 Get the decision using thet jet's pt and tag weight values.
virtual asg::AcceptData accept (double, double, double, double) const override
virtual asg::AcceptData accept (double, double, double, double, double) const override
virtual asg::AcceptData accept (double, double, double, double, double, double) const override
virtual int getQuantile (const xAOD::IParticle *) const override
 Decide in which quantile of the tag weight distribution the jet belongs (continuous tagging) The return value represents the bin index of the quantile distribution.
virtual int getQuantile (const xAOD::Jet &) const override
virtual int getQuantile (double, double, double) const override
virtual int getQuantile (double, double, double, double) const override
virtual CP::CorrectionCode getCutValue (double, double &cutval) const override
virtual CP::CorrectionCode getTaggerWeight (const xAOD::Jet &jet, double &tagweight) const override
virtual CP::CorrectionCode getTaggerWeight (double pb, double pc, double pu, double &tagweight) const override
virtual CP::CorrectionCode getTaggerWeight (double pb, double pc, double pu, double &tagweight, double ptau) const override
virtual CP::CorrectionCode getTaggerWeight (const xAOD::Jet &jet, double &weight, bool getCTagW) const override
virtual CP::CorrectionCode getTaggerWeight (double, double, double, double &weight, bool getCTagW, double=0.) const override
const asg::AcceptInfogetAcceptInfo () const override
 Declare the interface ID for this pure-virtual interface class to the Athena framework.
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

enum  Tagger {
  UNKNOWN , DL1 , GN1 , GN2 ,
  MV2c10
}
typedef double(xAOD::BTagging::* tagWeight_member_t) () const
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

virtual bool checkRange (double, double, asg::AcceptData &) const
 Helper function that decides whether a jet belongs to the correct jet selection for b-tagging.
void InitializeTaggerVariables (std::string taggerName, std::string OP, TSpline3 *spline, TVector *constcut, double &fraction)
Tagger SetTaggerEnum (const std::string &taggerName)
StatusCode ExtractTaggerProperties (taggerproperties &tagger, const std::string &taggerName, const std::string &OP)
std::vector< std::string > split (const std::string &input, const char &delimiter)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_initialised = false
bool m_ErrorOnTagWeightFailure = true
bool m_continuous = false
bool m_continuous2D = false
bool m_useCTag = false
bool m_readFromBTaggingObject = true
asg::AcceptInfo m_acceptinfo
 Object used to store the last decision.
double m_maxEta {}
double m_minPt {}
double m_maxRangePt {}
std::string m_CutFileName
std::string m_taggerName
std::string m_OP
std::string m_jetAuthor
std::string m_ContinuousBenchmarks
std::string m_wps_raw
TFile * m_inf {}
std::vector< double > m_continuouscuts
SG::AuxElement::ConstAccessor< float > m_accessor_pb
SG::AuxElement::ConstAccessor< float > m_accessor_pc
SG::AuxElement::ConstAccessor< float > m_accessor_pu
SG::AuxElement::ConstAccessor< float > m_accessor_ptau
taggerproperties m_tagger
Tagger m_taggerEnum {UNKNOWN}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 24 of file BTaggingSelectionTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

◆ tagWeight_member_t

typedef double(xAOD::BTagging::* BTaggingSelectionTool::tagWeight_member_t) () const
private

Definition at line 27 of file BTaggingSelectionTool.h.

Member Enumeration Documentation

◆ Tagger

Constructor & Destructor Documentation

◆ BTaggingSelectionTool()

BTaggingSelectionTool::BTaggingSelectionTool ( const std::string & name)

Create a proper constructor for Athena.

Create a constructor for standalone usage

Definition at line 43 of file BTaggingSelectionTool.cxx.

44 : asg::AsgTool( name ), m_acceptinfo( "JetSelection" ), m_accessor_pb( "pb" ), m_accessor_pc( "pc" ), m_accessor_pu( "pu" ), m_accessor_ptau( "ptau" )
45{
46 namespace def = ftag::defaults;
47 m_initialised = false;
48 declareProperty( "MaxEta", m_maxEta = 2.5 );
49 declareProperty( "MinPt", m_minPt = 0 /*MeV*/);
50 declareProperty( "MaxRangePt", m_maxRangePt = 3000000 /*MeV*/);
51 declareProperty( "FlvTagCutDefinitionsFileName", m_CutFileName=def::cdi_path, "name of the files containing official cut definitions (uses PathResolver)");
52 declareProperty( "TaggerName", m_taggerName=def::tagger, "tagging algorithm name");
53 declareProperty( "OperatingPoint", m_OP="", "operating point");
54 declareProperty( "JetAuthor", m_jetAuthor=def::jet_collection, "jet collection");
55 declareProperty( "WorkingPointDefinitions", m_wps_raw="FixedCutBEff_85,FixedCutBEff_77,FixedCutBEff_70,FixedCutBEff_60", "Comma-separated list of tagger working points (in decreasing order of efficiency!) - required for 1D tagging purposes");
56 declareProperty( "ErrorOnTagWeightFailure", m_ErrorOnTagWeightFailure=true, "optionally ignore cases where the tagweight cannot be retrieved. default behaviour is to give an error, switching to false will turn it into a warning");
57 declareProperty( "CutBenchmarksContinuousWP", m_ContinuousBenchmarks="", "comma separated list of tag bins that will be accepted as tagged: 1,2,3 etc.. ");
58 declareProperty( "useCTagging", m_useCTag=false, "Enabled only for FixedCut or Continuous WPs: define wether the cuts refer to b-tagging or c-tagging");
59 declareProperty( "readFromBTaggingObject", m_readFromBTaggingObject=false, "Enabled to access btagging scores from xAOD::BTagging object; Can be disabled for GN2v01 to access the scores from the jet itself.");
60}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::AuxElement::ConstAccessor< float > m_accessor_pu
SG::AuxElement::ConstAccessor< float > m_accessor_ptau
SG::AuxElement::ConstAccessor< float > m_accessor_pc
asg::AcceptInfo m_acceptinfo
Object used to store the last decision.
SG::AuxElement::ConstAccessor< float > m_accessor_pb

Member Function Documentation

◆ accept() [1/6]

asg::AcceptData BTaggingSelectionTool::accept ( const xAOD::IParticle * p) const
overridevirtual

Get the decision using a generic IParticle pointer.

Implements IBTaggingSelectionTool.

Definition at line 437 of file BTaggingSelectionTool.cxx.

437 {
438
439 // Check if this is a jet:
440 if( p->type() != xAOD::Type::Jet ) {
441 ATH_MSG_ERROR( "accept(...) Function received a non-jet" );
442 return asg::AcceptData (&m_acceptinfo);
443 }
444
445 // Cast it to a jet:
446 const xAOD::Jet* jet = dynamic_cast< const xAOD::Jet* >( p );
447 if( ! jet ) {
448 ATH_MSG_FATAL( "accept(...) Failed to cast particle to jet" );
449 return asg::AcceptData (&m_acceptinfo);
450 }
451
452 // Let the specific function do the work:
453 return accept( *jet );
454}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
virtual asg::AcceptData accept(const xAOD::IParticle *p) const override
Get the decision using a generic IParticle pointer.
@ Jet
The object is a jet.
Definition ObjectType.h:40
Jet_v1 Jet
Definition of the current "jet version".

◆ accept() [2/6]

asg::AcceptData BTaggingSelectionTool::accept ( const xAOD::Jet & jet) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 456 of file BTaggingSelectionTool.cxx.

456 {
457 asg::AcceptData acceptData (&m_acceptinfo);
458
459 if (! m_initialised) {
460 ATH_MSG_ERROR("BTaggingSelectionTool has not been initialised");
461 return acceptData;
462 }
463
464 double pT = jet.pt();
465 double eta = jet.eta();
466
467 if(m_continuous2D){
468 double taggerweight_b(-100);
469 double taggerweight_c(-100);
470 if( (getTaggerWeight( jet, taggerweight_b, false)!=CorrectionCode::Ok) ||
471 (getTaggerWeight( jet, taggerweight_c, true )!=CorrectionCode::Ok) )
472 return acceptData;
473
474 return accept(pT, eta, taggerweight_b,taggerweight_c);
475 }
476 else{ //if here, we are in 1D mode
477 double taggerweight(-100);
478 if( getTaggerWeight( jet ,taggerweight, m_useCTag)!=CorrectionCode::Ok)
479 return acceptData;
480
481 return accept(pT, eta, taggerweight);
482 }
483}
Scalar eta() const
pseudorapidity method
virtual CP::CorrectionCode getTaggerWeight(const xAOD::Jet &jet, double &tagweight) const override
@ Ok
The correction was done successfully.
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition Jet_v1.cxx:49

◆ accept() [3/6]

asg::AcceptData BTaggingSelectionTool::accept ( double pT,
double eta,
double tag_weight ) const
overridevirtual

Get the decision using thet jet's pt and tag weight values.

Implements IBTaggingSelectionTool.

Definition at line 485 of file BTaggingSelectionTool.cxx.

486{
487
488 asg::AcceptData acceptData (&m_acceptinfo);
489
490 if (! m_initialised) {
491 ATH_MSG_ERROR("BTaggingSelectionTool has not been initialised");
492 return acceptData;
493 }
494
495 eta = std::abs(eta);
496 if (! checkRange(pT, eta, acceptData))
497 return acceptData;
498
499 // After initialization, either m_tagger.spline or m_tagger.constcut should be non-zero
500 // Else, the initialization was incorrect and should be revisited
501 if(m_continuous){
502 for(size_t bin : m_tagger.benchmarks){
503 if(bin == 0){
504 throw std::logic_error("bin == 0 in the list of tagged bins. you should not be here. Wrong convention");
505 } else if ( bin == 1 ) {
506 if ( tag_weight < m_continuouscuts.at(bin-1) ) {
507 acceptData.setCutResult( "WorkingPoint", true );
508 }
509 } else if (bin > 1 && bin <= m_continuouscuts.size()){
510 if ( tag_weight > m_continuouscuts.at(bin-2) && tag_weight < m_continuouscuts.at(bin-1) ) {
511 acceptData.setCutResult( "WorkingPoint", true );
512 }
513 } else {
514 if ( tag_weight > m_continuouscuts.at(bin-2) ) {
515 acceptData.setCutResult( "WorkingPoint", true );
516 }
517 }
518 }
519 }
520 else{ //FixedCut
521 double cutvalue(DBL_MAX);
522 if( getCutValue(pT, cutvalue )!=CorrectionCode::Ok ){
523 return acceptData;
524 }
525
526 if ( tag_weight < cutvalue ){
527 return acceptData;
528 }
529
530 acceptData.setCutResult( "WorkingPoint", true );
531 }
532
533 // Return the result:
534 return acceptData;
535}
virtual CP::CorrectionCode getCutValue(double, double &cutval) const override
std::vector< double > m_continuouscuts
virtual bool checkRange(double, double, asg::AcceptData &) const
Helper function that decides whether a jet belongs to the correct jet selection for b-tagging.

◆ accept() [4/6]

asg::AcceptData BTaggingSelectionTool::accept ( double pT,
double eta,
double taggerWeight_b,
double taggerWeight_c ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 537 of file BTaggingSelectionTool.cxx.

538{
539 asg::AcceptData acceptData (&m_acceptinfo);
540
541 if (! m_initialised) {
542 ATH_MSG_ERROR("BTaggingSelectionTool has not been initialised");
543 return acceptData;
544 }
545
546 eta = std::abs(eta);
547
548 if (! checkRange(pT, eta, acceptData))
549 return acceptData;
550
551 for(auto bin : m_tagger.benchmarks){
552
553 ATH_MSG_DEBUG("bin" <<bin <<" taggerWeight_c "
554 <<taggerWeight_c <<" taggerWeight_b "
555 <<taggerWeight_b);
556
557 ATH_MSG_DEBUG(" c-cuts : " <<m_tagger.get2DCutValue(bin,0) <<" "
558 <<m_tagger.get2DCutValue(bin,1) <<" b-cuts : "
559 <<m_tagger.get2DCutValue(bin,2) <<" "
560 <<m_tagger.get2DCutValue(bin,3));
561
562 if (taggerWeight_c > m_tagger.get2DCutValue(bin,0) && //ctag low
563 taggerWeight_c <= m_tagger.get2DCutValue(bin,1) && //ctag max
564 taggerWeight_b > m_tagger.get2DCutValue(bin,2) && //btag low
565 taggerWeight_b <= m_tagger.get2DCutValue(bin,3) ) //btag max
566 {
567 acceptData.setCutResult( "WorkingPoint", true ); // IF we arrived here, the jet is tagged
568 break;
569 }
570 } //for loop
571
572 // Return the result:
573 return acceptData;
574}
#define ATH_MSG_DEBUG(x)

◆ accept() [5/6]

asg::AcceptData BTaggingSelectionTool::accept ( double pT,
double eta,
double pb,
double pc,
double pu ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 576 of file BTaggingSelectionTool.cxx.

577{
578 if (m_tagger.name == "GN2v01"){
579 asg::AcceptData acceptData (&m_acceptinfo);
580 ATH_MSG_ERROR("For GN2v01 tagger, there is a new tau claass in the NN output. Please update the accept() to accept(double pT, double eta, double pb, double pc, double pu, double ptau)");
581 return acceptData;
582 } else {
583 return accept(pT, eta, pb, pc, pu, 0.);
584 }
585}

◆ accept() [6/6]

asg::AcceptData BTaggingSelectionTool::accept ( double pT,
double eta,
double pb,
double pc,
double pu,
double ptau ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 587 of file BTaggingSelectionTool.cxx.

588 {
589 asg::AcceptData acceptData (&m_acceptinfo);
590
591 if (! m_initialised) {
592 ATH_MSG_ERROR("BTaggingSelectionTool has not been initialised");
593 return acceptData;
594 }
595
596 eta = std::abs(eta);
597 if (! checkRange(pT, eta, acceptData))
598 return acceptData;
599
600 // After initialization, either m_tagger.spline or m_tagger.constcut should be non-zero
601 // Else, the initialization was incorrect and should be revisited
602 double cutvalue(DBL_MAX);
603
604 if( getCutValue(pT, cutvalue)!=CorrectionCode::Ok){
605 return acceptData;
606 };
607
608 if(m_continuous2D){
609 double tagger_weight_b(-100);
610 double tagger_weight_c(-100);
611 if( ( getTaggerWeight(pb, pc, pu, tagger_weight_b, false, ptau)!=CorrectionCode::Ok) ||
612 ( getTaggerWeight(pb, pc, pu, tagger_weight_c, true, ptau)!=CorrectionCode::Ok) )
613 return acceptData;
614 return accept(pT, eta, tagger_weight_b, tagger_weight_c);
615 }
616 else{
617 double tagger_weight(-100);
618 if( getTaggerWeight(pb, pc, pu, tagger_weight, m_useCTag, ptau)!=CorrectionCode::Ok)
619 return acceptData;
620 if ( tagger_weight < cutvalue )
621 return acceptData;
622 }
623 //if you made it here, the jet is tagged
624 acceptData.setCutResult( "WorkingPoint", true );
625 return acceptData;
626 }

◆ checkRange()

bool BTaggingSelectionTool::checkRange ( double pT,
double eta,
asg::AcceptData & acceptData ) const
privatevirtual

Helper function that decides whether a jet belongs to the correct jet selection for b-tagging.

Definition at line 762 of file BTaggingSelectionTool.cxx.

763{
764 // Do the |eta| cut:
765 if( std::abs(eta) > m_maxEta ) {
766 return false;
767 }
768 acceptData.setCutResult( "Eta", true );
769
770 // Do the pT cut:
771 ATH_MSG_VERBOSE( "Jet pT: " << pT );
772 if( pT < m_minPt ) {
773 return false;
774 }
775 acceptData.setCutResult( "Pt", true );
776
777 return true;
778}
#define ATH_MSG_VERBOSE(x)
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
Definition AcceptData.h:134

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ ExtractTaggerProperties()

StatusCode BTaggingSelectionTool::ExtractTaggerProperties ( taggerproperties & tagger,
const std::string & taggerName,
const std::string & OP )
private

Definition at line 223 of file BTaggingSelectionTool.cxx.

223 {
224
225 TString cutname = OP;
226
227 //set the name
228 tagger.name = taggerName;
229
230 if ("FlatBEff"==cutname(0,8) || "HybBEff"==cutname(0,7) ){
231 cutname = taggerName+"/"+m_jetAuthor+"/"+OP+"/cutprofile";
232 tagger.spline = dynamic_cast<TSpline3*> (m_inf->Get(cutname));
233 if (tagger.spline == nullptr){
234 ATH_MSG_ERROR( "Invalid operating point" );
235 return StatusCode::FAILURE;
236 }
237 tagger.constcut = nullptr;
238 }
239 else {
240 cutname = taggerName+"/"+m_jetAuthor+"/"+OP+"/cutvalue";
241 tagger.constcut = dynamic_cast<TVector*> (m_inf->Get(cutname));
242 if (tagger.constcut == nullptr){
243 ATH_MSG_ERROR( "Invalid operating point" );
244 return StatusCode::FAILURE;
245 }
246 tagger.spline = nullptr;
247 }
248
249 //retrieve the "fraction" used in the DL1 log likelihood from the CDI, if its not there, use the hard coded values
250 // (backwards compatibility)
252
253 double fraction_b = -1;
254 const TString basePath = taggerName + "/" + m_jetAuthor + "/" + OP;
255 TVector* fraction_b_data = dynamic_cast<TVector*>( m_inf->Get(basePath + "/fraction_b") );
256 if (fraction_b_data) {
257 fraction_b = (*fraction_b_data)(0);
258 }
259
260 TVector* fraction_c_data = dynamic_cast<TVector*>( m_inf->Get(basePath + "/fraction") );
261 if (!fraction_c_data) {
262 fraction_c_data = dynamic_cast<TVector*>( m_inf->Get(basePath + "/fraction_c") );
263 }
264 double fraction_c = -1;
265 if (fraction_c_data) {
266 fraction_c = (*fraction_c_data)(0);
267 } else{
268 if("DL1" ==taggerName){ fraction_c = 0.08; }
269 if("DL1mu" ==taggerName){ fraction_c = 0.08; }
270 if("DL1rnn" ==taggerName){ fraction_c = 0.03; }
271 else {
272 ATH_MSG_ERROR("Failed to retrieve fraction_c");
273 }
274 }
275
276 double fraction_tau = 0.;
277 double fraction_tau_cTag = 0.;
278 TVector* fraction_tau_data = dynamic_cast<TVector*>( m_inf->Get(basePath + "/fraction_tau") );
279 TVector* fraction_tau_cTag_data = dynamic_cast<TVector*>( m_inf->Get(basePath + "/fraction_tau_cTag") );
280 if (m_taggerEnum == Tagger::GN2 && !(taggerName.find("GN2v00") != std::string::npos)){
281 if( fraction_tau_data ) {
282 fraction_tau = fraction_tau_data[0](0);
283 }
284 if ( m_useCTag && !fraction_tau_cTag_data) {
285 ATH_MSG_ERROR("Runnint c-tagging WP, but failed to retrive fraction_tau_cTag");
286 }
287 fraction_tau_cTag = fraction_tau_cTag_data[0](0);
288 }
289
290 tagger.fraction_b = fraction_b;
291 tagger.fraction_c = fraction_c;
292 tagger.fraction_tau = fraction_tau;
293 tagger.fraction_tau_cTag = fraction_tau_cTag;
294
295 delete fraction_b_data;
296 delete fraction_c_data;
297 delete fraction_tau_data;
298 delete fraction_tau_cTag_data;
299 }
300 return StatusCode::SUCCESS;
301}
const std::string tagger

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getAcceptInfo()

const asg::AcceptInfo & BTaggingSelectionTool::getAcceptInfo ( ) const
inlineoverridevirtual

Declare the interface ID for this pure-virtual interface class to the Athena framework.

Method to get the AcceptInfo to query what cuts are defined.

Implements IAsgSelectionTool.

Definition at line 63 of file BTaggingSelectionTool.h.

63{return m_acceptinfo;}

◆ getCutValue()

CorrectionCode BTaggingSelectionTool::getCutValue ( double pT,
double & cutval ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 780 of file BTaggingSelectionTool.cxx.

781{
782 cutval = DBL_MAX;
783
784 // flat cut for out of range pTs
785 if (pT>m_maxRangePt)
787
789
790 if (tagger.spline != nullptr && tagger.constcut == nullptr) {
791 pT = pT/1000.0;
792 double maxsplinept = tagger.spline->GetXmax();
793 if (pT>maxsplinept){ pT = maxsplinept; }
794 cutval = tagger.spline->Eval(pT);
795 }
796
797 else if (tagger.constcut != nullptr && tagger.spline == nullptr) {
798 cutval = tagger.constcut[0](0);
799 }
800 else{
801 ATH_MSG_ERROR( "Bad cut configuration!" );
803 }
804
805
806 ATH_MSG_VERBOSE( "Cut value " << cutval );
807
808 return CorrectionCode::Ok;
809}
#define ATLAS_THREAD_SAFE
@ Error
Some error happened during the object correction.

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getQuantile() [1/4]

int BTaggingSelectionTool::getQuantile ( const xAOD::IParticle * p) const
overridevirtual

Decide in which quantile of the tag weight distribution the jet belongs (continuous tagging) The return value represents the bin index of the quantile distribution.

Implements IBTaggingSelectionTool.

Definition at line 628 of file BTaggingSelectionTool.cxx.

628 {
629 // Check if this is a jet:
630
631
632 if( p->type() != xAOD::Type::Jet ) {
633 ATH_MSG_ERROR( "accept(...) Function received a non-jet" );
634 return -1;
635 }
636
637 // Cast it to a jet:
638 const xAOD::Jet* jet = dynamic_cast< const xAOD::Jet* >( p );
639 if( ! jet ) {
640 ATH_MSG_FATAL( "accept(...) Failed to cast particle to jet" );
641 return -1;
642 }
643
644 // Let the specific function do the work:
645 return getQuantile( *jet );
646}
virtual int getQuantile(const xAOD::IParticle *) const override
Decide in which quantile of the tag weight distribution the jet belongs (continuous tagging) The retu...

◆ getQuantile() [2/4]

int BTaggingSelectionTool::getQuantile ( const xAOD::Jet & jet) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 648 of file BTaggingSelectionTool.cxx.

648 {
649 double pT = jet.pt();
650 double eta = std::abs( jet.eta() );
651 int quantile = -1;
652
653 if (m_continuous2D){
654 double tag_weight_b(-100.);
655 double tag_weight_c(-100.);
656 if ( (getTaggerWeight(jet, tag_weight_b, false) == CP::CorrectionCode::Error) ||
657 (getTaggerWeight(jet, tag_weight_c, true ) == CP::CorrectionCode::Error) ){
658 ATH_MSG_WARNING("getQuantile: Failed to retrieve tag weight for Continuous2D!");
659 return -1;
660 }
661 quantile = getQuantile(pT, eta, tag_weight_b, tag_weight_c );
662 }
663 else{
664 // Retrieve the tagger weight which was assigned to the jet
665 double tag_weight(-100.);
666 if (getTaggerWeight(jet, tag_weight, m_useCTag)==CorrectionCode::Error){
667 ATH_MSG_WARNING("getQuantile: Failed to retrieve "+m_taggerName+" weight!");
668 return -1;
669 }
670 ATH_MSG_VERBOSE( m_taggerName << " " << tag_weight);
671 quantile = getQuantile(pT, eta, tag_weight);
672 }
673 return quantile;
674}
#define ATH_MSG_WARNING(x)
@ Error
Some error happened during the object correction.

◆ getQuantile() [3/4]

int BTaggingSelectionTool::getQuantile ( double pT,
double eta,
double tag_weight ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 677 of file BTaggingSelectionTool.cxx.

678{
679 if (! m_initialised) {
680 ATH_MSG_ERROR("BTaggingSelectionTool has not been initialised");
681 }
683 // Cheatsheet:
684 // With n WPs, (from highest to lowest) A1 , A2, A3, ..., An
685 // return -1 if not in b-tagging acceptance
686 // return 1 if between 100% and A1 (untagged)
687 // return 2 if between A1 and A2 (tagged at the A1 WP)
688 // return 3 if between A2 and A3 (tagged at the A2 WP)
689 // ...
690 // return n if between An-1 and An (tagged at the An-1 WP)
691 // return n+1 if between An and 0% (tagged at the An WP)
693
694 int bin_index = -1;
695
696 // First, check if the jet is in acceptance
697 asg::AcceptData acceptData (&m_acceptinfo);
698 if (! checkRange(pT, eta,acceptData)) {
699 return bin_index;
700 }
701
702 // Now we need to check each threshold in the PCBT vector
703 // and return the maximum WP bin index (1,2,...,n).
704 // Instead of checking low<tag_weight<high for each bin,
705 // we simply check tag_weight<high and therefore range
706 // from vector indices 1 to vector.size()
707 bin_index = 1; // setting the ones that pass selection you have default as 1
708 for (std::size_t i=0; i<m_continuouscuts.size(); i++) {
709 if ( tag_weight > m_continuouscuts.at(i) ) {
710 bin_index++;
711 } else {
712 break;
713 }
714 }
715 return bin_index;
716}

◆ getQuantile() [4/4]

int BTaggingSelectionTool::getQuantile ( double pT,
double eta,
double tag_weight_b,
double tag_weight_c ) const
overridevirtual

Cheatsheet: returns 4 if pass B_tight (?) returns 3 if pass B_loose returns 2 if pass C_tight + fail B_loose returns 1 if pass C_loose + fail C_tight + fail B_loose returns 0 if fail C_loose + fail B_loose return -1 not in b-tagging acceptance

Implements IBTaggingSelectionTool.

Definition at line 718 of file BTaggingSelectionTool.cxx.

719{
729
730 //More details here: https://indico.cern.ch/event/1116952/#4-mr49953-implements-the-conti
731
732 ATH_MSG_DEBUG("inside getQuantile 2D " <<pT <<" " <<eta <<" " <<tag_weight_b <<" " <<tag_weight_c);
733 int bin_index(-1);
734
735 asg::AcceptData acceptData (&m_acceptinfo);
736 if (! checkRange(pT, eta, acceptData)) return bin_index;
737
738 int ncuts = m_tagger.cuts2D->GetNrows();
739 ATH_MSG_VERBOSE("ncuts: " <<ncuts);
740
741 //loop over all the cuts
742 for(int i = 0; i < ncuts ; i++){
743 double c_cut_low = m_tagger.get2DCutValue(i,0);
744 double c_cut_hig = m_tagger.get2DCutValue(i,1);
745 double b_cut_low = m_tagger.get2DCutValue(i,2);
746 double b_cut_hig = m_tagger.get2DCutValue(i,3);
747
748 ATH_MSG_DEBUG("bin " <<i <<" c_cut low " <<c_cut_low <<" c_cut hig " <<c_cut_hig <<" c_cut low " <<b_cut_low <<" b_ct hig" <<b_cut_hig);
749 if (tag_weight_c > c_cut_low &&
750 tag_weight_c <= c_cut_hig &&
751 tag_weight_b > b_cut_low &&
752 tag_weight_b <= b_cut_hig){
753 bin_index = i;
754 break;
755 }
756 }
757
758 ATH_MSG_VERBOSE("bin_index " <<bin_index);
759 return bin_index;
760}

◆ getTaggerWeight() [1/5]

CorrectionCode BTaggingSelectionTool::getTaggerWeight ( const xAOD::Jet & jet,
double & tagweight ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 303 of file BTaggingSelectionTool.cxx.

303 {
304 return getTaggerWeight(jet, tagweight, m_useCTag);
305}

◆ getTaggerWeight() [2/5]

CorrectionCode BTaggingSelectionTool::getTaggerWeight ( const xAOD::Jet & jet,
double & weight,
bool getCTagW ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 307 of file BTaggingSelectionTool.cxx.

307 {
308
309 std::string taggerName = m_tagger.name;
310 // following taggerName change is needed given different name is used for GN2v00 in derivation and in CDI
311 if (taggerName == "GN2v00LegacyWP" || taggerName == "GN2v00NewAliasWP"){
312 taggerName = "GN2v00";
313 }
314
315 tagweight = -100.;
316
317 if(!m_continuous2D && (getCTagW != m_useCTag) ){
318 ATH_MSG_ERROR("Difference between initialisation and getTaggerWeight request! useCTagging property set to " <<m_useCTag <<" while getTaggerWeight use c-tag is set to " <<getCTagW <<".");
320 }
321
323
325
326 if ((!btag) || (!btag->MVx_discriminant(taggerName, tagweight))){
328 ATH_MSG_ERROR("Failed to retrieve "+taggerName+" weight!");
330 }else{
331 ATH_MSG_WARNING("Failed to retrieve "+taggerName+" weight!");
332 return CorrectionCode::Ok;
333 }
334 }
335 ATH_MSG_VERBOSE( taggerName << " " << tagweight );
336 return CorrectionCode::Ok;
337 } //MV2
338 else{
339 //DL1r or DL1 or GN2v01
340 double tagger_pb(-10.);
341 double tagger_pc(-10.);
342 double tagger_pu(-10.);
343 double tagger_ptau(0.);
344
345 const SG::AuxElement* btagInfo = &jet;
348
349 if(!btagInfo){
351 ATH_MSG_ERROR("Failed to retrieve "+taggerName+" weight!");
353 }else{
354 ATH_MSG_WARNING("Failed to retrieve "+taggerName+" weight!");
355 return CorrectionCode::Ok;
356 }
357 }
358
359 tagger_pb = m_accessor_pb(*btagInfo);
360 tagger_pc = m_accessor_pc(*btagInfo);
361 tagger_pu = m_accessor_pu(*btagInfo);
362 if(m_taggerName == "GN2v01")
363 tagger_ptau = m_accessor_ptau(*btagInfo);
364
365
366 return getTaggerWeight(tagger_pb, tagger_pc, tagger_pu, tagweight, getCTagW, tagger_ptau);
367
368 }
369
370 //if we got here the tagger name is not configured properly
371 ATH_MSG_ERROR("BTaggingSelectionTool doesn't support tagger: "+m_taggerName);
373
374}
bool MVx_discriminant(const std::string &taggername, double &value) const
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
BTagging_v1 BTagging
Definition of the current "BTagging version".
Definition BTagging.h:17

◆ getTaggerWeight() [3/5]

CorrectionCode BTaggingSelectionTool::getTaggerWeight ( double pb,
double pc,
double pu,
double & tagweight ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 376 of file BTaggingSelectionTool.cxx.

376 {
377 if (m_tagger.name == "GN2v01"){
378 ATH_MSG_ERROR("For GN2v01 tagger, there is a new tau claass in the NN output. Please update your getTaggerWeight() to getTaggerWeight( double pb, double pc, double pu, double & tagweight, double ptau)");
380 } else {
381 return getTaggerWeight(pb, pc, pu, tagweight, m_useCTag, 0.);
382 }
383}

◆ getTaggerWeight() [4/5]

CorrectionCode BTaggingSelectionTool::getTaggerWeight ( double pb,
double pc,
double pu,
double & tagweight,
double ptau ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 385 of file BTaggingSelectionTool.cxx.

385 {
386 return getTaggerWeight(pb, pc, pu, tagweight, m_useCTag, ptau);
387}

◆ getTaggerWeight() [5/5]

CorrectionCode BTaggingSelectionTool::getTaggerWeight ( double pb,
double pc,
double pu,
double & weight,
bool getCTagW,
double ptau = 0. ) const
overridevirtual

Implements IBTaggingSelectionTool.

Definition at line 389 of file BTaggingSelectionTool.cxx.

389 {
390
391 std::string taggerName = m_tagger.name;
392
393 if(!m_continuous2D && (getCTagW != m_useCTag) ){
394 ATH_MSG_ERROR("Difference between initialisation and getTaggerWeight request! useCTagging property set to " <<m_useCTag <<" while getTaggerWeight use c-tag is set to " <<getCTagW <<".");
396 }
397
398 tagweight = -100.;
400
401 bool valid_input = (!std::isnan(pu) && pb>=0 && pc>=0 && pu>=0 && ptau>=0);
402
403 if (!valid_input){
405 ATH_MSG_ERROR("Invalid inputs for "+taggerName+" pb " << pb << " pc " << pc << " pu " << pu << " ptau " << ptau << " ");
407 }else{
408 ATH_MSG_WARNING("Invalid inputs for "+taggerName+" pb " << pb << " pc " << pc << " pu " << pu << " ptau " << ptau << " ");
409 return CorrectionCode::Ok;
410 }
411 }
412
413 if(getCTagW){
414 tagweight = log(pc / (m_tagger.fraction_b * pb + (1. - m_tagger.fraction_b - m_tagger.fraction_tau_cTag) * pu + m_tagger.fraction_tau_cTag * ptau) );
415 }
416 else{
417 tagweight = log(pb / (m_tagger.fraction_c * pc + (1. - m_tagger.fraction_c - m_tagger.fraction_tau) * pu + m_tagger.fraction_tau * ptau) );
418 }
419
420 ATH_MSG_VERBOSE( "pb " << pb );
421 ATH_MSG_VERBOSE( "pc " << pc );
422 ATH_MSG_VERBOSE( "pu " << pu );
423 ATH_MSG_VERBOSE( "ptau" << ptau );
424 ATH_MSG_VERBOSE( "tagweight " << tagweight );
425
426 return CorrectionCode::Ok;
427 }
428
429 //if we got here the tagger name is not configured properly
430 ATH_MSG_ERROR("this call to getTaggerWeight only works for DL1/GNx taggers");
432
433}

◆ initialize()

StatusCode BTaggingSelectionTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 62 of file BTaggingSelectionTool.cxx.

62 {
63 m_initialised = true;
64
65 if (""==m_OP){
66 ATH_MSG_ERROR( "BTaggingSelectionTool wasn't given a working point name" );
67 return StatusCode::FAILURE;
68 }
69
70 TString pathtofile = PathResolverFindCalibFile(m_CutFileName);
71 m_inf = TFile::Open(pathtofile, "read");
72 if (0==m_inf) {
73 ATH_MSG_ERROR( "BTaggingSelectionTool couldn't access the CDI file" );
74 return StatusCode::FAILURE;
75 }
76
77 // check the CDI file for the selected tagger and jet collection
78 TString check_CDI = m_taggerName;
79 if(!m_inf->Get(check_CDI)){
80 ATH_MSG_ERROR( "Tagger: "+m_taggerName+" not found in this CDI file: "+m_CutFileName);
81 return StatusCode::FAILURE;
82 }
83 check_CDI = m_taggerName+"/"+m_jetAuthor;
84 if(!m_inf->Get(check_CDI)){
85 ATH_MSG_ERROR( "Tagger: "+m_taggerName+" and Jet Collection : "+m_jetAuthor+" not found in this CDI file: "+m_CutFileName);
86 return StatusCode::FAILURE;
87 }
88
89 //set taggerEnum to avid string comparison:
91
92 // Change the minPt cut if the user didn't touch it
93 if (m_minPt < 0){
94 ATH_MSG_ERROR( "Tagger: "+m_taggerName+" and Jet Collection : "+m_jetAuthor+" do not have a minimum jet pT cut set.");
95 return StatusCode::FAILURE;
96 }
97
98 // Operating point reading
99 TString cutname = m_OP;
100 m_continuous = false;
101 m_continuous2D = false;
102
103 if(cutname.Contains("Continuous2D")){
104 ATH_MSG_INFO("Working with Continuous2D WP.");
105 m_continuous = true;
106 m_continuous2D = true;
107 m_useCTag = false; //important for backward compatibility in getTaggerWeight methods.
108 cutname = m_taggerName+"/"+m_jetAuthor+"/Continuous2D/cutvalue";
109 m_tagger.name = m_taggerName;
110 TMatrixD* matrix = dynamic_cast<TMatrixD*> (m_inf->Get(cutname));
111 m_tagger.cuts2D = matrix;
112
113 for (int bin = 0; bin < m_tagger.cuts2D->GetNrows(); bin++)
114 ATH_MSG_DEBUG("INITIALIZATION c-cuts : " <<m_tagger.get2DCutValue(bin,0) <<" "
115 <<m_tagger.get2DCutValue(bin,1) <<" b-cuts : "
116 <<m_tagger.get2DCutValue(bin,2) <<" "
117 <<m_tagger.get2DCutValue(bin,3));
118
119 if (m_tagger.cuts2D == nullptr){
120 ATH_MSG_ERROR( "Invalid operating point" );
121 return StatusCode::FAILURE;
122 }
123
124 m_tagger.spline = nullptr;
125
126 TString fraction_data_name = m_taggerName+"/"+m_jetAuthor+"/Continuous2D/fraction_b";
127 TVector *fraction_data = dynamic_cast<TVector*> (m_inf->Get(fraction_data_name));
128 if(fraction_data!=nullptr){
129 m_tagger.fraction_b = fraction_data[0](0);
130 }
131 else{
132 ATH_MSG_ERROR("Tagger fraction_b in Continuous2D WP not available");
133 return StatusCode::FAILURE;
134 }
135
136 //now the c-fraction:
137 fraction_data_name = m_taggerName+"/"+m_jetAuthor+"/Continuous2D/fraction_c";
138 fraction_data = dynamic_cast<TVector*> (m_inf->Get(fraction_data_name));
139 if(fraction_data!=nullptr){
140 m_tagger.fraction_c = fraction_data[0](0);}
141 else{
142 ATH_MSG_ERROR("Tagger fraction_c in Continuous2D WP not available");
143 return StatusCode::FAILURE;
144 }
145 //now the tau-fraction if the tagger is GN2*:
146 if ( m_taggerName == "GN2v01" ){
147 fraction_data_name = m_taggerName+"/"+m_jetAuthor+"/Continuous2D/fraction_tau";
148 TString fraction_data_name_cTag = m_taggerName+"/"+m_jetAuthor+"/Continuous2D/fraction_tau_cTag";
149 fraction_data = dynamic_cast<TVector*> (m_inf->Get(fraction_data_name));
150 TVector *fraction_data_cTag = dynamic_cast<TVector*> (m_inf->Get(fraction_data_name_cTag));
151 if(fraction_data!=nullptr){
152 m_tagger.fraction_tau = fraction_data[0](0);
153 }else{
154 ATH_MSG_ERROR("Tagger fraction_tau in Continuous2D WP not available");
155 return StatusCode::FAILURE;
156 }
157 if(fraction_data_cTag!=nullptr){
158 m_tagger.fraction_tau_cTag = fraction_data_cTag[0](0);
159 }else{
160 ATH_MSG_ERROR("Tagger fraction_tau_cTag in Continuous2D WP not available");
161 return StatusCode::FAILURE;
162 }
163 delete fraction_data_cTag;
164 }
165 delete fraction_data;
166 } //Continuous2D
167 else if ("Continuous"==cutname(0,10)){ // For continuous tagging load all flat-cut WPs
168 if(m_useCTag)
169 ATH_MSG_WARNING( "Running in Continuous WP and using 1D c-tagging");
170 m_continuous = true;
171 // For GN2v01, we have different WPs than the default ones.
172 if ( m_taggerName == "GN2v01" )
173 m_wps_raw="FixedCutBEff_90,FixedCutBEff_85,FixedCutBEff_77,FixedCutBEff_70,FixedCutBEff_65";
174 std::vector<std::string> workingpoints = split(m_wps_raw, ',');
175 std::sort(workingpoints.begin(), workingpoints.end());
176 std::reverse(workingpoints.begin(), workingpoints.end()); // put in descending order
177 for(const std::string& wp : workingpoints){
178 cutname = m_taggerName + "/" + m_jetAuthor + "/" + wp + "/cutvalue";
179 m_tagger.constcut = dynamic_cast<TVector*> (m_inf->Get(cutname));
180 if (m_tagger.constcut != nullptr) {
181 m_continuouscuts.push_back(m_tagger.constcut[0](0));
182 } else {
183 ATH_MSG_ERROR( "Continuous tagging is trying to use an invalid operating point: " + wp );
184 return StatusCode::FAILURE;
185 }
186 }
187
188 //The WP is not important. This is just to retrieve the c-fraction.
190
191 } else {
192 if(m_useCTag){
193 ATH_MSG_WARNING( "Running in FixedCut WP for c-tagging, make sure to use b-veto to select c-tagged jet properly.");
194 }
196 }
197
198 //set the accept working points, jets in these pseudo-continuous bins will be accepted
199 if(m_continuous){
200 std::vector<std::string> tag_benchmarks_names = split(m_ContinuousBenchmarks, ',');
201 std::vector<int> tag_benchmarks;
202 for (const std::string& tagbin : tag_benchmarks_names){
203 tag_benchmarks.push_back(std::atoi(tagbin.c_str()));
204 ATH_MSG_INFO("adding " <<tag_benchmarks.back() <<" as tagged bin ");
205 }
206 m_tagger.benchmarks = tag_benchmarks;
207 }
208
209 m_inf->Close();
210
211 m_acceptinfo.addCut( "Eta", "Selection of jets according to their pseudorapidity" );
212 m_acceptinfo.addCut( "Pt", "Selection of jets according to their transverse momentum" );
213 m_acceptinfo.addCut( "WorkingPoint", "Working point for flavour-tagging of jets according to their b-tagging weight" );
214
215 m_accessor_pb = SG::AuxElement::ConstAccessor<float>(m_taggerName+ "_pb");
216 m_accessor_pc = SG::AuxElement::ConstAccessor<float>(m_taggerName+ "_pc");
217 m_accessor_pu = SG::AuxElement::ConstAccessor<float>(m_taggerName+ "_pu");
218 m_accessor_ptau = SG::AuxElement::ConstAccessor<float>(m_taggerName+ "_ptau");
219
220 return StatusCode::SUCCESS;
221}
#define ATH_MSG_INFO(x)
#define ANA_CHECK(EXP)
check whether the given expression was successful
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
StatusCode ExtractTaggerProperties(taggerproperties &tagger, const std::string &taggerName, const std::string &OP)
std::vector< std::string > split(const std::string &input, const char &delimiter)
Tagger SetTaggerEnum(const std::string &taggerName)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void reverse(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of reverse for DataVector/List.

◆ InitializeTaggerVariables()

void BTaggingSelectionTool::InitializeTaggerVariables ( std::string taggerName,
std::string OP,
TSpline3 * spline,
TVector * constcut,
double & fraction )
private

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ SetTaggerEnum()

Tagger BTaggingSelectionTool::SetTaggerEnum ( const std::string & taggerName)
inlineprivate

Definition at line 122 of file BTaggingSelectionTool.h.

122 {
123 if(taggerName.find("DL1") != std::string::npos) return Tagger::DL1;
124 else if(taggerName.find("GN1") != std::string::npos) return Tagger::GN1;
125 else if(taggerName.find("GN2") != std::string::npos) return Tagger::GN2;
126 else if(taggerName == "MV2c10") return Tagger::MV2c10;
127 else
128 ATH_MSG_ERROR("Tagger Name NOT supported.");
129 return Tagger::UNKNOWN;
130 };

◆ split()

std::vector< std::string > BTaggingSelectionTool::split ( const std::string & input,
const char & delimiter )
private

Definition at line 811 of file BTaggingSelectionTool.cxx.

811 {
812 std::vector<std::string> v;
813 std::istringstream buf(input);
814 for(std::string token; std::getline(buf, token, delimiter); )
815 v.push_back(token);
816 return v;
817}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_acceptinfo

asg::AcceptInfo BTaggingSelectionTool::m_acceptinfo
private

Object used to store the last decision.

Definition at line 77 of file BTaggingSelectionTool.h.

◆ m_accessor_pb

SG::AuxElement::ConstAccessor<float> BTaggingSelectionTool::m_accessor_pb
private

Definition at line 93 of file BTaggingSelectionTool.h.

◆ m_accessor_pc

SG::AuxElement::ConstAccessor<float> BTaggingSelectionTool::m_accessor_pc
private

Definition at line 94 of file BTaggingSelectionTool.h.

◆ m_accessor_ptau

SG::AuxElement::ConstAccessor<float> BTaggingSelectionTool::m_accessor_ptau
private

Definition at line 96 of file BTaggingSelectionTool.h.

◆ m_accessor_pu

SG::AuxElement::ConstAccessor<float> BTaggingSelectionTool::m_accessor_pu
private

Definition at line 95 of file BTaggingSelectionTool.h.

◆ m_continuous

bool BTaggingSelectionTool::m_continuous = false
private

Definition at line 72 of file BTaggingSelectionTool.h.

◆ m_continuous2D

bool BTaggingSelectionTool::m_continuous2D = false
private

Definition at line 73 of file BTaggingSelectionTool.h.

◆ m_ContinuousBenchmarks

std::string BTaggingSelectionTool::m_ContinuousBenchmarks
private

Definition at line 87 of file BTaggingSelectionTool.h.

◆ m_continuouscuts

std::vector<double> BTaggingSelectionTool::m_continuouscuts
private

Definition at line 91 of file BTaggingSelectionTool.h.

◆ m_CutFileName

std::string BTaggingSelectionTool::m_CutFileName
private

Definition at line 83 of file BTaggingSelectionTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_ErrorOnTagWeightFailure

bool BTaggingSelectionTool::m_ErrorOnTagWeightFailure = true
private

Definition at line 71 of file BTaggingSelectionTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_inf

TFile* BTaggingSelectionTool::m_inf {}
private

Definition at line 90 of file BTaggingSelectionTool.h.

90{};

◆ m_initialised

bool BTaggingSelectionTool::m_initialised = false
private

Definition at line 70 of file BTaggingSelectionTool.h.

◆ m_jetAuthor

std::string BTaggingSelectionTool::m_jetAuthor
private

Definition at line 86 of file BTaggingSelectionTool.h.

◆ m_maxEta

double BTaggingSelectionTool::m_maxEta {}
private

Definition at line 79 of file BTaggingSelectionTool.h.

79{};

◆ m_maxRangePt

double BTaggingSelectionTool::m_maxRangePt {}
private

Definition at line 81 of file BTaggingSelectionTool.h.

81{};

◆ m_minPt

double BTaggingSelectionTool::m_minPt {}
private

Definition at line 80 of file BTaggingSelectionTool.h.

80{};

◆ m_OP

std::string BTaggingSelectionTool::m_OP
private

Definition at line 85 of file BTaggingSelectionTool.h.

◆ m_readFromBTaggingObject

bool BTaggingSelectionTool::m_readFromBTaggingObject = true
private

Definition at line 75 of file BTaggingSelectionTool.h.

◆ m_tagger

taggerproperties BTaggingSelectionTool::m_tagger
private

Definition at line 117 of file BTaggingSelectionTool.h.

◆ m_taggerEnum

Tagger BTaggingSelectionTool::m_taggerEnum {UNKNOWN}
private

Definition at line 120 of file BTaggingSelectionTool.h.

120{UNKNOWN};

◆ m_taggerName

std::string BTaggingSelectionTool::m_taggerName
private

Definition at line 84 of file BTaggingSelectionTool.h.

◆ m_useCTag

bool BTaggingSelectionTool::m_useCTag = false
private

Definition at line 74 of file BTaggingSelectionTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_wps_raw

std::string BTaggingSelectionTool::m_wps_raw
private

Definition at line 88 of file BTaggingSelectionTool.h.


The documentation for this class was generated from the following files: