|
ATLAS Offline Software
|
#include <TopFlavorTaggingCPTools.h>
|
| FlavorTaggingCPTools (const std::string &name) |
|
virtual | ~FlavorTaggingCPTools () |
|
StatusCode | initialize () |
| Dummy implementation of the initialisation function. More...
|
|
virtual void | print () const |
| Print the state of the tool. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
StatusCode | setupBtagSelectionTool (const std::pair< std::string, std::string > &btag_algo_WP, const std::string &jetCollection, double jetPtCut, double jetEtaCut, bool trackJets=false) |
| Setup BTaggingSelectionTool for a given WP. More...
|
|
StatusCode | setupBtagEfficiencyTool (const std::pair< std::string, std::string > &btag_algo_WP, const std::string &jetCollection, double jetPtCut, bool trackJets=false) |
|
std::string | erasePV0fromJetsName (std::string jetCollectionName) |
|
StatusCode | checkExcludedSysts (BTaggingEfficiencyTool *, const std::string &) |
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
Definition at line 30 of file TopFlavorTaggingCPTools.h.
◆ StoreGateSvc_t
◆ FlavorTaggingCPTools()
top::FlavorTaggingCPTools::FlavorTaggingCPTools |
( |
const std::string & |
name | ) |
|
|
explicit |
◆ ~FlavorTaggingCPTools()
virtual top::FlavorTaggingCPTools::~FlavorTaggingCPTools |
( |
| ) |
|
|
inlinevirtual |
◆ checkExcludedSysts()
Definition at line 207 of file TopFlavorTaggingCPTools.cxx.
211 if (excludedSysts ==
"")
return StatusCode::SUCCESS;
214 std::vector<std::string> listOfExcludedSysts;
216 ATH_MSG_INFO(
" ------------------------------------------------ ");
217 ATH_MSG_INFO(
" ------------- EXPERIMENTAL FEATURE ------------- ");
218 ATH_MSG_INFO(
" ------ Please provide feedback to TopReco ------ ");
219 ATH_MSG_INFO(
" ------------- EXPERIMENTAL FEATURE ------------- ");
220 ATH_MSG_INFO(
" ------------------------------------------------ ");
221 ATH_MSG_INFO(
" AnalysisTop - Checking excludedSysts for flavour tagging EV");
222 ATH_MSG_INFO(
" This has been split on the semi-colon delimiter to find...");
223 for (
const auto&
s : listOfExcludedSysts)
ATH_MSG_INFO(
"... " +
s);
226 std::vector<std::string> listOfScaleFactorSystematics;
228 for (
auto sys : flavour.second) {
229 listOfScaleFactorSystematics.push_back(
sys);
234 std::set<std::string> setOfExcludedSysts, setOfScaleFactorSystematics;
236 for (
auto sys : listOfExcludedSysts) {
237 setOfExcludedSysts.insert(
sys);
240 for (
auto sys : listOfScaleFactorSystematics) {
241 setOfScaleFactorSystematics.insert(
sys);
245 std::vector<std::string> unionOfSystematics;
247 setOfScaleFactorSystematics.begin(), setOfScaleFactorSystematics.end(),
248 std::back_inserter(unionOfSystematics));
250 if (unionOfSystematics.size() != listOfExcludedSysts.size()) {
251 ATH_MSG_WARNING(
"Have not found all systematics listed to be excluded from b-tagging eigenvector method");
253 for (
const auto&
sys : setOfScaleFactorSystematics) {
256 return StatusCode::FAILURE;
259 for (
const auto& sysRemove : listOfExcludedSysts) {
260 std::string flavourAffected =
"";
262 for (
auto sysCDI : flavour.second) {
263 if (sysRemove == sysCDI) flavourAffected += flavour.first;
266 ATH_MSG_INFO(
" ... " + sysRemove +
" -> Removed from calibration(s) : [" + flavourAffected +
"]");
268 ATH_MSG_INFO(
" These will be dynamically matched to systematic tree names (if available)");
269 ATH_MSG_INFO(
" All systematics are accepted by CDI file ");
273 ATH_MSG_INFO(
" ------------------------------------------------ ");
274 return StatusCode::SUCCESS;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ erasePV0fromJetsName()
std::string top::FlavorTaggingCPTools::erasePV0fromJetsName |
( |
std::string |
jetCollectionName | ) |
|
|
private |
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
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
◆ getKey()
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
-
ptr | The 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.
121 #ifdef XAOD_STANDALONE
124 return evtStore()->event()->getKey( ptr );
127 return (
proxy ==
nullptr ? 0 :
proxy->sgkey() );
128 #endif // XAOD_STANDALONE
◆ 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
-
ptr | The 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.
108 #ifdef XAOD_STANDALONE
111 return evtStore()->event()->getName( ptr );
114 static const std::string
dummy =
"";
116 #endif // XAOD_STANDALONE
◆ getProperty()
template<class T >
const T* asg::AsgTool::getProperty |
( |
const std::string & |
name | ) |
const |
|
inherited |
Get one of the tool's properties.
◆ initialize()
StatusCode top::FlavorTaggingCPTools::initialize |
( |
| ) |
|
|
virtual |
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 29 of file TopFlavorTaggingCPTools.cxx.
33 ATH_MSG_INFO(
"top::FlavorTaggingCPTools: no need to initialise anything on truth DxAOD");
34 return StatusCode::SUCCESS;
38 ATH_MSG_INFO(
"top::FlavorTaggingCPTools: no need to initialise anything since not using jets");
39 return StatusCode::SUCCESS;
43 static const std::string cdi_file_default_MC20 =
44 "xAODBTaggingEfficiency/13TeV/2023-22-13TeV-MC20-CDI-2023-09-13_v1.root ";
45 static const std::string cdi_file_default_MC21 =
46 "xAODBTaggingEfficiency/13p6TeV/2023-22-13TeV-MC21-CDI-2023-09-13_v1.root";
48 if (
m_config->bTaggingCDIPath() !=
"Default") {
50 if (
m_config->bTaggingCDIPath() != cdi_file_default_MC21) {
51 m_config->setPrintCDIpathWarning(
true);
55 if (
m_config->bTaggingCDIPath() != cdi_file_default_MC20) {
56 m_config->setPrintCDIpathWarning(
true);
74 m_efficiency_maps =
"default;default;410470;410250;default;410464;411233;default;700122;600666;700660;412116";
77 m_efficiency_maps =
"default;default;601229;doesnotexist;doesnotexist;doesnotexist;601414;doesnotexist;doesnotexist;doesnotexist;700660;doesnotexist";
80 const std::string caloJets_collection =
m_config->sgKeyJets();
81 const std::string trackJets_collection =
m_config->sgKeyTrackJets();
92 for (
const auto& TaggerBtagWP :
m_config->bTagAlgoWP()) {
94 "Failed to initialize btag selection tool");
96 for (
const auto& TaggerBtagWP :
m_config->bTagAlgoWP_calib()) {
98 "Failed to initialize btag selection tool");
102 for (
const auto& TaggerBtagWP :
m_config->bTagAlgoWP_trkJet()) {
104 "Failed to initialize btag selection tool");
106 for (
const auto& TaggerBtagWP :
m_config->bTagAlgoWP_calib_trkJet()) {
108 "Failed to initialize btag selection tool");
112 return StatusCode::SUCCESS;
◆ inputHandles()
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() [1/2]
◆ msg() [2/2]
◆ 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.
◆ msgLvl()
◆ outputHandles()
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()
void asg::AsgTool::print |
( |
| ) |
const |
|
virtualinherited |
Print the state of the tool.
Implements asg::IAsgTool.
Reimplemented in JetRecTool, JetFinder, JetModifiedMassDrop, JetFromPseudojet, JetReclusterer, JetReclusteringTool, JetTruthLabelingTool, JetPileupLabelingTool, HI::HIPileupTool, top::TopObjectSelection, JetDumper, JetBottomUpSoftDrop, JetRecursiveSoftDrop, JetSoftDrop, JetConstituentsRetriever, JetSubStructureMomentToolsBase, JetSplitter, JetToolRunner, JetPruner, JetPseudojetRetriever, JetTrimmer, AsgHelloTool, and KtDeltaRTool.
Definition at line 131 of file AsgTool.cxx.
◆ renounce()
◆ renounceArray()
◆ setupBtagEfficiencyTool()
StatusCode top::FlavorTaggingCPTools::setupBtagEfficiencyTool |
( |
const std::pair< std::string, std::string > & |
btag_algo_WP, |
|
|
const std::string & |
jetCollection, |
|
|
double |
jetPtCut, |
|
|
bool |
trackJets = false |
|
) |
| |
|
private |
Definition at line 151 of file TopFlavorTaggingCPTools.cxx.
155 const std::string bTagWPName = btag_algo_WP.first +
"_" + btag_algo_WP.second;
156 std::string btageff_tool_name =
"BTaggingEfficiencyTool_" + bTagWPName +
"_" + jetCollection;
158 const std::string jetAuthor = (trackJets ?
erasePV0fromJetsName(jetCollection) : jetCollection);
161 top::check(btageff->setProperty(
"TaggerName", btag_algo_WP.first),
162 "Failed to set b-tagging TaggerName");
163 top::check(btageff->setProperty(
"OperatingPoint", btag_algo_WP.second),
164 "Failed to set b-tagging OperatingPoint");
165 top::check(btageff->setProperty(
"JetAuthor", jetAuthor),
166 "Failed to set b-tagging JetAuthor");
167 top::check(btageff->setProperty(
"MinPt", jetPtCut),
168 "Failed to set b-tagging selection tool MinPt");
170 "Failed to set path to b-tagging CDI file");
172 "Failed to set path to b-tagging CDI file");
173 top::check(btageff->setProperty(
"ScaleFactorBCalibration",
m_config->bTaggingCalibration_B()),
174 "Failed to set b-tagging calibration (B): " +
m_config->bTaggingCalibration_B());
175 top::check(btageff->setProperty(
"ScaleFactorCCalibration",
m_config->bTaggingCalibration_C()),
176 "Failed to set b-tagging calibration (C): " +
m_config->bTaggingCalibration_C());
178 top::check(btageff->setProperty(
"ScaleFactorTCalibration",
m_config->bTaggingCalibration_C()),
179 "Failed to set b-tagging calibration (T): " +
m_config->bTaggingCalibration_C());
180 top::check(btageff->setProperty(
"ScaleFactorLightCalibration",
m_config->bTaggingCalibration_Light()),
181 "Failed to set b-tagging calibration (Light): " +
m_config->bTaggingCalibration_Light());
186 "Failed to set " + jet_flav +
"-calibrations efficiency maps");
189 "Failed to set b-tagging systematics to exclude from EV treatment");
196 return StatusCode::SUCCESS;
◆ setupBtagSelectionTool()
StatusCode top::FlavorTaggingCPTools::setupBtagSelectionTool |
( |
const std::pair< std::string, std::string > & |
btag_algo_WP, |
|
|
const std::string & |
jetCollection, |
|
|
double |
jetPtCut, |
|
|
double |
jetEtaCut, |
|
|
bool |
trackJets = false |
|
) |
| |
|
private |
Setup BTaggingSelectionTool for a given WP.
- Parameters
-
btag_algo_WP | pair of tagger (e.g. DL1r) and WP name (e.g. FixedCutBEff77) |
jetCollection | name of the jet collection for the btagging tool |
jetPtCut | minimum pT cut used for jets |
jetEtaCut | maximum |eta| cut used for jets |
trackJets | true, if btagging for track jets is to be initialized, otherwise false |
Definition at line 115 of file TopFlavorTaggingCPTools.cxx.
119 const std::string bTagWPName = btag_algo_WP.first +
"_" + btag_algo_WP.second;
123 std::string btagsel_tool_name =
"BTaggingSelectionTool_" + bTagWPName +
"_" + jetCollection;
125 const std::string jetAuthor = (trackJets ?
erasePV0fromJetsName(jetCollection) : jetCollection);
128 top::check(btagsel->setProperty(
"TaggerName", btag_algo_WP.first),
129 "Failed to set b-tagging selecton tool TaggerName");
130 top::check(btagsel->setProperty(
"JetAuthor", jetAuthor),
131 "Failed to set b-tagging selection JetAuthor");
133 "Failed to set b-tagging selection tool CDI file");
134 top::check(btagsel->setProperty(
"OperatingPoint", btag_algo_WP.second),
135 "Failed to set b-tagging selection tool OperatingPoint");
136 top::check(btagsel->setProperty(
"MinPt", jetPtCut),
137 "Failed to set b-tagging selection tool MinPt");
138 top::check(btagsel->setProperty(
"MaxEta", jetEtaCut),
139 "Failed to set b-tagging selection tool MaxEta");
141 "Failed to initialize b-tagging selection tool: " + btagsel_tool_name);
146 m_config->addBTagAlgo(btag_algo_WP.first, btagsel_tool_name, trackJets);
148 return StatusCode::SUCCESS;
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_btagging_efficiency_tools
◆ m_btagging_selection_tools
◆ m_calib_file_path
std::string top::FlavorTaggingCPTools::m_calib_file_path |
|
private |
◆ m_cdi_file
std::string top::FlavorTaggingCPTools::m_cdi_file |
|
private |
◆ m_config
◆ m_detStore
◆ m_efficiency_maps
std::string top::FlavorTaggingCPTools::m_efficiency_maps |
|
private |
◆ m_evtStore
◆ m_excluded_systs
std::string top::FlavorTaggingCPTools::m_excluded_systs |
|
private |
◆ m_jet_flavors
const std::vector<std::string> top::FlavorTaggingCPTools::m_jet_flavors |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
void tokenize(const std::string &input, Container &output, const std::string &delimiters=" ", bool trim_empty=false)
Tokenize an input string using a set of delimiters.
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
virtual void setOwner(IDataHandleHolder *o)=0
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
#define ATH_MSG_WARNING(x)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>