ATLAS Offline Software
Loading...
Searching...
No Matches
PMGTools::PMGHFProductionFractionTool Class Reference

Implementation for xAOD Truth Weight Tool which retrieves the charm / bottom hadron content of an event and derives an event weight based on the HF production fractions. More...

#include <PMGHFProductionFractionTool.h>

Inheritance diagram for PMGTools::PMGHFProductionFractionTool:
Collaboration diagram for PMGTools::PMGHFProductionFractionTool:

Classes

struct  ParameterSet
 Struct for the production fractions. More...

Public Types

Definition of the StoreGate-like object's definition
typedef ServiceHandle< StoreGateSvcMetaStore_t
 Type of the metadata store object in Athena.
typedef const ServiceHandle< StoreGateSvc > & MetaStorePtr_t
 Type of the metadata store pointer in standalone mode.

Public Member Functions

 PMGHFProductionFractionTool (const std::string &name)
 Create a proper constructor for Athena.
virtual StatusCode sysInitialize ()
 Function initialising the tool in the correct way in Athena.
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 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
Function(s) implementing the asg::IAsgTool interface
virtual StatusCode initialize () override
 Function initialising the tool.
Function(s) implementing the ISysTruthWeightTool interface
virtual float getSysWeight (const xAOD::TruthParticleContainer *truthParticles, const CP::SystematicSet &sys) const override
 Implements interface from ISysTruthWeightTool.
virtual CP::SystematicSet affectingSystematics () const override
 Which systematics have an effect on the tool's behaviour?
virtual CP::SystematicSet recommendedSystematics () const override
 Copied from SystematicsTool.cxx.
Functions providing access to the input/output metadata
MetaStorePtr_t inputMetaStore () const
 Accessor for the input metadata store.
MetaStorePtr_t outputMetaStore () const
 Accessor for the output metadata store.
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.
Callback functions helping in metadata reading/writing
void setUseIncidents (const bool flag)
virtual void handle (const Incident &inc)
 Function receiving incidents from IncidentSvc/TEvent.
virtual StatusCode beginInputFile ()
 Function called when a new input file is opened.
virtual StatusCode endInputFile ()
 Function called when the currently open input file got completely processed.
virtual StatusCode beginEvent ()
 Function called when a new events is loaded.
virtual StatusCode metaDataStop ()
 Function called when the tool should write out its metadata.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode setupProductionFractions ()
 Setup weights.
StatusCode readProductionFractionsFile (const std::string &, std::map< CP::SystematicVariation, std::map< unsigned int, float > > &)
 Read production fractions from input file.
bool fromBdecay (const xAOD::TruthParticle *particle) const
 Checks if a particle originates from a bottom decay.
const xAOD::TruthParticlegetInitialParticle (const xAOD::TruthParticle *tp) const
 Loops back the decay chain through particles with the same pdgId (e.g. photon emission)
void printCurrentProdFractions () const
 Print the current production fractions.
float getWeight (const xAOD::TruthParticleContainer *truthParticles, const ParameterSet &prod_fracs) const
StatusCode setSystematicVariation (const CP::SystematicSet &systConfig, ParameterSet &param) const
 calculate the parameter set for the given systematic
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_calibrationAreaPath
 Path to calibration area.
std::map< std::string, std::string > m_showerGeneratorMap
 MC Shower generator map.
std::string m_showerGeneratorMapFile
 MC Shower generator map file name.
std::string m_showerGenerator
 MC Shower generator software (valid options: Pythia8)
std::string m_charmFilename
 Input file with charm production fractions.
std::string m_bottomFilename
 Input file with bottom production fractions.
float m_fiducialPtCut
 The fiducial charm/bottom pT cut (in GeV)
float m_fiducialEtaCut
 The fiducial charm/bottom eta cut.
std::map< CP::SystematicVariation, std::map< unsigned int, float > > m_charmProdFractionWeights
 Charm production fraction weights.
std::map< CP::SystematicVariation, std::map< unsigned int, float > > m_bottomProdFractionWeights
 Bottom production fraction weights.
CP::SystematicsCache< ParameterSetm_Parameters {this}
 The SystematicsCache object.
MetaStore_t m_inputMetaStore
 Object accessing the input metadata store.
MetaStore_t m_outputMetaStore
 Object accessing the output metadata store.
bool m_beginInputFileCalled
 Flag helping to discover when the tool misses the opening of the first input file.
bool m_useIncidents
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

Implementation for xAOD Truth Weight Tool which retrieves the charm / bottom hadron content of an event and derives an event weight based on the HF production fractions.

Author
Miha Muskinja

Definition at line 25 of file PMGHFProductionFractionTool.h.

Member Typedef Documentation

◆ MetaStore_t

Type of the metadata store object in Athena.

Definition at line 66 of file AsgMetadataTool.h.

◆ MetaStorePtr_t

Type of the metadata store pointer in standalone mode.

Definition at line 68 of file AsgMetadataTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ PMGHFProductionFractionTool()

PMGTools::PMGHFProductionFractionTool::PMGHFProductionFractionTool ( const std::string & name)

Create a proper constructor for Athena.

Create a constructor for standalone usage

Definition at line 25 of file PMGHFProductionFractionTool.cxx.

25 :
26 asg::AsgMetadataTool(name),
35{
36 // Calibration area path
37 declareProperty("CalibrationAreaPath", m_calibrationAreaPath = "xAODBTaggingEfficiency/13TeV/HFReweighting-2022-04-19_v1",
38 "Path to the calibration area");
39
40 // MC Shower generator map
41 declareProperty("ShowerGeneratorMapFile", m_showerGeneratorMapFile = "HFProductionFractionsMap.txt",
42 "Input file name for the MC shower generator map");
43
44 // MC Shower generator software
45 declareProperty("ShowerGenerator", m_showerGenerator = "",
46 "MC Shower generator software");
47
48 // The fiducial charm/bottom pT cut (in MeV)
49 declareProperty("FiducialPtCut", m_fiducialPtCut = 5000,
50 "The fiducial charm/bottom pT cut. The recommended value is 5000 (MeV).");
51
52 // The fiducial charm/bottom eta cut
53 declareProperty("FiducialEtaCut", m_fiducialEtaCut = 2.5,
54 "The fiducial charm/bottom eta cut. The recommended value is 2.5.");
55}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_calibrationAreaPath
Path to calibration area.
std::map< CP::SystematicVariation, std::map< unsigned int, float > > m_charmProdFractionWeights
Charm production fraction weights.
std::string m_showerGenerator
MC Shower generator software (valid options: Pythia8)
float m_fiducialPtCut
The fiducial charm/bottom pT cut (in GeV)
std::map< std::string, std::string > m_showerGeneratorMap
MC Shower generator map.
std::string m_charmFilename
Input file with charm production fractions.
std::string m_showerGeneratorMapFile
MC Shower generator map file name.
std::string m_bottomFilename
Input file with bottom production fractions.
float m_fiducialEtaCut
The fiducial charm/bottom eta cut.
std::map< CP::SystematicVariation, std::map< unsigned int, float > > m_bottomProdFractionWeights
Bottom production fraction weights.

Member Function Documentation

◆ affectingSystematics()

CP::SystematicSet PMGTools::PMGHFProductionFractionTool::affectingSystematics ( ) const
overridevirtual

Which systematics have an effect on the tool's behaviour?

Systematics set of the weight systematics

Implements CP::IReentrantSystematicsTool.

Definition at line 448 of file PMGHFProductionFractionTool.cxx.

449{
450 if (m_showerGenerator == "000000") {
451 ATH_MSG_WARNING("The property `ShowerGenerator' was set to 000000. The tool will now return an empty SystematicsSet and dummy weights of 1.0");
452 return CP::SystematicSet();
453 }
455 ATH_MSG_ERROR("The production fraction weights were not properly initialized!");
456 throw std::runtime_error("Charm or bottom production fraction weight map is empty!");
457 }
458 CP::SystematicSet result;
459 for (const auto &kv : m_charmProdFractionWeights) {
460 if(!kv.first.empty())
461 result.insert(kv.first);
462 }
463 for (const auto &kv : m_bottomProdFractionWeights) {
464 if(!kv.first.empty())
465 result.insert(kv.first);
466 }
467
469 return result;
470}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)

◆ beginEvent()

StatusCode asg::AsgMetadataTool::beginEvent ( )
protectedvirtualinherited

◆ beginInputFile()

StatusCode asg::AsgMetadataTool::beginInputFile ( )
protectedvirtualinherited

Function called when a new input file is opened.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in AsgElectronEfficiencyCorrectionTool, BookkeeperDumperTool, BookkeeperTool, PMGTools::PMGTruthWeightTool, TauAnalysisTools::TauEfficiencyCorrectionsTool, TauAnalysisTools::TauSmearingTool, Trig::TrigDecisionTool, Trig::xAODBunchCrossingTool, TrigConf::xAODConfigTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 185 of file AsgMetadataTool.cxx.

185 {
186
187 // Return gracefully:
188 return StatusCode::SUCCESS;
189 }

◆ 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.

◆ endInputFile()

StatusCode asg::AsgMetadataTool::endInputFile ( )
protectedvirtualinherited

Function called when the currently open input file got completely processed.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperDumperTool, BookkeeperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 193 of file AsgMetadataTool.cxx.

193 {
194
195 // Return gracefully:
196 return StatusCode::SUCCESS;
197 }

◆ 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.

◆ 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

◆ fromBdecay()

bool PMGTools::PMGHFProductionFractionTool::fromBdecay ( const xAOD::TruthParticle * particle) const
private

Checks if a particle originates from a bottom decay.

Definition at line 283 of file PMGHFProductionFractionTool.cxx.

283 {
284 for (unsigned int i = 0; i < particle->nParents(); i++) {
285 if (particle->parent(i)->isHeavyHadron()) {
286 if (particle->parent(i)->isBottomHadron()) {
287 return true;
288 } else {
289 return fromBdecay(particle->parent(i));
290 }
291 }
292 }
293 return false;
294}
bool fromBdecay(const xAOD::TruthParticle *particle) const
Checks if a particle originates from a bottom decay.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ getInitialParticle()

const xAOD::TruthParticle * PMGTools::PMGHFProductionFractionTool::getInitialParticle ( const xAOD::TruthParticle * tp) const
private

Loops back the decay chain through particles with the same pdgId (e.g. photon emission)

Definition at line 296 of file PMGHFProductionFractionTool.cxx.

296 {
297 if (tp->nParents() < 1) {
298 return tp;
299 }
300
301 const xAOD::TruthParticle *out = nullptr;
302 for (unsigned int i = 0; i < tp->nParents(); i++) {
303 if (tp->parent(i) && (tp->parent(i)->absPdgId() == tp->absPdgId())) {
304 const xAOD::TruthParticle *initialParticle = getInitialParticle(tp->parent(i));
305 if (initialParticle && out && (initialParticle != out)) {
306 // this should never happen, but if it does crash the program
307 throw std::runtime_error("Contradictory information in the truth decay chain!");
308 }
309 out = initialParticle;
310 }
311 }
312
313 if (out) {
314 return out;
315 }
316 return tp;
317}
const xAOD::TruthParticle * getInitialParticle(const xAOD::TruthParticle *tp) const
Loops back the decay chain through particles with the same pdgId (e.g. photon emission)
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ 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.

◆ getSysWeight()

float PMGTools::PMGHFProductionFractionTool::getSysWeight ( const xAOD::TruthParticleContainer * truthParticles,
const CP::SystematicSet & sys ) const
overridevirtual

Implements interface from ISysTruthWeightTool.

Implements PMGTools::ISysTruthWeightTool.

Definition at line 379 of file PMGHFProductionFractionTool.cxx.

379 {
380 if (m_showerGenerator == "000000") { return 1.0; }
381 const ParameterSet *prod_fracs = nullptr;
382 ANA_CHECK_THROW (m_Parameters.get(sys, prod_fracs));
383 return getWeight(truthParticles, *prod_fracs);
384}
#define ANA_CHECK_THROW(EXP)
check whether the given expression was successful, throwing an exception on failure
CP::SystematicsCache< ParameterSet > m_Parameters
The SystematicsCache object.
float getWeight(const xAOD::TruthParticleContainer *truthParticles, const ParameterSet &prod_fracs) const

◆ getWeight()

float PMGTools::PMGHFProductionFractionTool::getWeight ( const xAOD::TruthParticleContainer * truthParticles,
const ParameterSet & prod_fracs ) const
private

Definition at line 319 of file PMGHFProductionFractionTool.cxx.

319 {
320 // Clear vectors
321 std::set<const xAOD::TruthParticle *> bottomHadrons;
322 std::set<const xAOD::TruthParticle *> charmHadrons;
323
324 // Find truth particles hadrons
325 for (const xAOD::TruthParticle *tp : *truthParticles) {
326 // if (!(tp->status() == 2 || tp->status() == 1)) {
327 // continue;
328 // }
329 if (tp->isBottomHadron())
330 {
331 if (tp->pt() >= m_fiducialPtCut && std::abs(tp->eta()) < m_fiducialEtaCut) {
332 bottomHadrons.insert(getInitialParticle(tp));
333 }
334 }
335 if (tp->isCharmHadron()) {
336 if (!fromBdecay(getInitialParticle(tp)) && tp->pt() >= m_fiducialPtCut && std::abs(tp->eta()) < m_fiducialEtaCut) {
337 charmHadrons.insert(getInitialParticle(tp));
338 }
339 }
340 }
341
342 // The weight
343 float weight = 1.0;
344
345 // Calculate the charm weight
346 for (auto *tp : charmHadrons) {
347 int pdgId = tp->absPdgId();
348 float w = 1.0;
349 if (tp->isCharmMeson() && prod_fracs.charmWeights.find(pdgId) != prod_fracs.charmWeights.end()) {
350 w = prod_fracs.charmWeights.at(pdgId);
351 } else if (pdgId == 4122 || // Lambda_c+
352 pdgId == 4232 || // Xi_c+
353 pdgId == 4132 || // Xi_c0
354 pdgId == 4332) { // Omega_c0
355 w = prod_fracs.charmWeights.at(4000);
356 }
357 ATH_MSG_DEBUG("Charm weight for pdgId " << pdgId << ", pT " << tp->pt() << ", eta " << tp->eta() << ": " << w);
358 weight *= w;
359 }
360
361 // Calculate the bottom weight
362 for (auto *tp : bottomHadrons) {
363 int pdgId = tp->absPdgId();
364 float w = 1.0;
365 if (tp->isBottomMeson() && prod_fracs.bottomWeights.find(pdgId) != prod_fracs.bottomWeights.end()) {
366 w = prod_fracs.bottomWeights.at(pdgId);
367 } else if (pdgId == 5122 || // Lambda_b0
368 pdgId == 5132 || // Xi_b-
369 pdgId == 5232 || // Xi_b0
370 pdgId == 5332) { // Omega_b-
371 w = prod_fracs.bottomWeights.at(5000);
372 }
373 ATH_MSG_DEBUG("Bottom weight for pdgId " << pdgId << ", pT " << tp->pt() << ", eta " << tp->eta() << ": " << w);
374 weight *= w;
375 }
376 return weight;
377}
#define ATH_MSG_DEBUG(x)

◆ handle()

void asg::AsgMetadataTool::handle ( const Incident & inc)
protectedvirtualinherited

Function receiving incidents from IncidentSvc/TEvent.

Reimplemented in Trig::TrigDecisionTool.

Definition at line 135 of file AsgMetadataTool.cxx.

135 {
136
137 // Tell the user what's happening:
138 ATH_MSG_VERBOSE( "Callback received with incident: " << inc.type() );
139
140 // Call the appropriate member function:
141 if( inc.type() == IncidentType::BeginInputFile ) {
143 if( beginInputFile().isFailure() ) {
144 ATH_MSG_FATAL( "Failed to call beginInputFile()" );
145 throw std::runtime_error( "Couldn't call beginInputFile()" );
146 }
147 } else if( inc.type() == IncidentType::EndInputFile ) {
148 if( endInputFile().isFailure() ) {
149 ATH_MSG_FATAL( "Failed to call endInputFile()" );
150 throw std::runtime_error( "Couldn't call endInputFile()" );
151 }
152 } else if( inc.type() == IncidentType::BeginEvent ) {
153 // If the tool didn't catch the begin input file incident for the
154 // first input file of the job, then call the appropriate function
155 // now.
156 if( ! m_beginInputFileCalled ) {
158 if( beginInputFile().isFailure() ) {
159 ATH_MSG_FATAL( "Failed to call beginInputFile()" );
160 throw std::runtime_error( "Couldn't call beginInputFile()" );
161 }
162 }
163 if( beginEvent().isFailure() ) {
164 ATH_MSG_FATAL( "Failed to call beginEvent()" );
165 throw std::runtime_error( "Couldn't call beginEvent()" );
166 }
167
168 #ifdef XAOD_STANDALONE
169 } else if( inc.type() == IncidentType::MetaDataStop ) {
170 if( metaDataStop().isFailure() ) {
171 ATH_MSG_FATAL( "Failed to call metaDataStop()" );
172 throw std::runtime_error( "Couldn't call metaDataStop()" );
173 }
174
175 #endif // XAOD_STANDALONE
176 } else {
177 ATH_MSG_WARNING( "Unknown incident type received in AsgMetaDataTool: " << inc.type() );
178 }
179
180 return;
181 }
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
virtual StatusCode beginInputFile()
Function called when a new input file is opened.
virtual StatusCode beginEvent()
Function called when a new events is loaded.
bool m_beginInputFileCalled
Flag helping to discover when the tool misses the opening of the first input file.
virtual StatusCode endInputFile()
Function called when the currently open input file got completely processed.
virtual StatusCode metaDataStop()
Function called when the tool should write out its metadata.

◆ initialize()

StatusCode PMGTools::PMGHFProductionFractionTool::initialize ( void )
overridevirtual

Function initialising the tool.

Reimplemented from asg::AsgTool.

Definition at line 57 of file PMGHFProductionFractionTool.cxx.

57 {
58 // Tell the user what's happening:
59 ATH_MSG_INFO("Initializing " << name() << "...");
60
61 // Check for correct settings
62 if (m_showerGenerator.empty())
63 {
64 ATH_MSG_WARNING("The property `ShowerGenerator' was not set!");
65 return StatusCode::FAILURE;
66 }
67
68 // read input files and calculate weights
69 // populates m_charmProdFractionWeights and m_bottomProdFractionWeights
70 if (m_showerGenerator != "000000") {
72
73 // setup the SystematicsCache object
75 [this](const CP::SystematicSet &sys, ParameterSet &prod_fracs) {
76 return setSystematicVariation(sys, prod_fracs);
77 }
78 );
79
80 // Register systematics with the registry
81 CP::SystematicRegistry &registry = CP::SystematicRegistry::getInstance();
82 if (registry.registerSystematics(*this) != StatusCode::SUCCESS) {
83 ATH_MSG_ERROR("Unknown systematic list");
84 return StatusCode::FAILURE;
85 }
86
87 // print
89
90 } else {
91 ATH_MSG_WARNING("The property `ShowerGenerator' was set to 000000, which means that the tool will return dummy weights of 1.0");
92 }
93
94 // Return gracefully
95 return StatusCode::SUCCESS;
96}
#define ATH_MSG_INFO(x)
#define ANA_CHECK(EXP)
check whether the given expression was successful
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
StatusCode registerSystematics(const IReentrantSystematicsTool &tool)
effects: register all the systematics from the tool
StatusCode setSystematicVariation(const CP::SystematicSet &systConfig, ParameterSet &param) const
calculate the parameter set for the given systematic
virtual CP::SystematicSet affectingSystematics() const override
Which systematics have an effect on the tool's behaviour?
void printCurrentProdFractions() const
Print the current production fractions.

◆ 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.

◆ inputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::inputMetaStore ( ) const
inherited

Accessor for the input metadata store.

Definition at line 93 of file AsgMetadataTool.cxx.

93 {
94
95#ifdef XAOD_STANDALONE
96 return &m_inputMetaStore;
97#else // XAOD_STANDALONE
98 return m_inputMetaStore;
99#endif // XAOD_STANDALONE
100 }
MetaStore_t m_inputMetaStore
Object accessing the input metadata store.

◆ metaDataStop()

StatusCode asg::AsgMetadataTool::metaDataStop ( )
protectedvirtualinherited

Function called when the tool should write out its metadata.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperDumperTool, BookkeeperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 209 of file AsgMetadataTool.cxx.

209 {
210
211 // Return gracefully:
212 return StatusCode::SUCCESS;
213 }

◆ 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.

◆ outputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::outputMetaStore ( ) const
inherited

Accessor for the output metadata store.

Definition at line 102 of file AsgMetadataTool.cxx.

102 {
103
104#ifdef XAOD_STANDALONE
105 return &m_outputMetaStore;
106#else // XAOD_STANDALONE
107 return m_outputMetaStore;
108#endif // XAOD_STANDALONE
109 }
MetaStore_t m_outputMetaStore
Object accessing the output metadata store.

◆ print()

◆ printCurrentProdFractions()

void PMGTools::PMGHFProductionFractionTool::printCurrentProdFractions ( ) const
private

Print the current production fractions.

Definition at line 386 of file PMGHFProductionFractionTool.cxx.

386 {
387 // MC Shower
388 ATH_MSG_INFO("The tool is currently configured to give weights for " << m_showerGenerator);
389
390 // Charm production fraction weights
391 ATH_MSG_INFO("Currently set weights for charm production fractions:");
392 for (auto const &generator : m_charmProdFractionWeights) {
393 ATH_MSG_INFO("sys: " << generator.first.name());
394 for (auto const &kv : generator.second) {
395 ATH_MSG_INFO(" - " << kv.first << " " << kv.second);
396 }
397 }
398
399 // Bottom production fraction weights
400 ATH_MSG_INFO("Currently set weights for bottom production fractions:");
401 for (auto const &generator : m_bottomProdFractionWeights) {
402 ATH_MSG_INFO("sys: " << generator.first.name());
403 for (auto const &kv : generator.second) {
404 ATH_MSG_INFO(" - " << kv.first << " " << kv.second);
405 }
406 }
407}
generator
Configure Herwig7 These are the commands corresponding to what would go into the regular Herwig infil...

◆ readProductionFractionsFile()

StatusCode PMGTools::PMGHFProductionFractionTool::readProductionFractionsFile ( const std::string & filename,
std::map< CP::SystematicVariation, std::map< unsigned int, float > > & weights )
private

Read production fractions from input file.

Definition at line 98 of file PMGHFProductionFractionTool.cxx.

98 {
99 /* Example file structure:
100 # Charm production fraction from literature (Eur. Phys. J. C (2016) 76:397)
101 411 421 431 4000
102 NOSYS 0.2404 0.6086 0.0802 0.0623
103 PROD_FRAC_CHARM_EIG_1 0.2405 0.6087 0.0770 0.0650
104 PROD_FRAC_CHARM_EIG_2 0.2439 0.6108 0.0779 0.0593
105 PROD_FRAC_CHARM_EIG_3 0.2461 0.6013 0.0808 0.0632
106 */
107 std::ifstream infile(filename);
108 std::string line;
109 int pdg1 = -1, pdg2 = -1, pdg3 = -1, pdg4 = -1;
110 while (std::getline(infile, line)) {
111 std::istringstream iss(line);
112 if (line.rfind("#", 0) == 0 || line.empty()) {
113 continue;
114 }
115 if (pdg1 < 0) {
116 if (!(iss >> pdg1 >> pdg2 >> pdg3 >> pdg4)) {
117 ATH_MSG_ERROR("Invalid formatting: " << line);
118 return StatusCode::FAILURE;
119 }
120 } else {
121 std::string sys;
122 float f1, f2, f3, f4;
123 if (!(iss >> sys >> f1 >> f2 >> f3 >> f4)) {
124 ATH_MSG_ERROR("Invalid formatting: " << line);
125 return StatusCode::FAILURE;
126 }
127 if (sys == "NOSYS") {
128 sys = "";
129 }
130 weights.insert({CP::SystematicVariation(sys), {{pdg1, f1}, {pdg2, f2}, {pdg3, f3}, {pdg4, f4}}});
131 }
132 }
133
134 // Close file
135 infile.close();
136
137 // return
138 return StatusCode::SUCCESS;
139}
str infile
Definition run.py:13
@ f3
fraction of energy reconstructed in 3rd sampling
Definition EgammaEnums.h:55

◆ recommendedSystematics()

virtual CP::SystematicSet PMGTools::PMGHFProductionFractionTool::recommendedSystematics ( ) const
inlineoverridevirtual

Copied from SystematicsTool.cxx.

Implements CP::IReentrantSystematicsTool.

Definition at line 52 of file PMGHFProductionFractionTool.h.

52{ return affectingSystematics(); };

◆ 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 }

◆ setSystematicVariation()

StatusCode PMGTools::PMGHFProductionFractionTool::setSystematicVariation ( const CP::SystematicSet & systConfig,
ParameterSet & param ) const
private

calculate the parameter set for the given systematic

Definition at line 409 of file PMGHFProductionFractionTool.cxx.

409 {
410 if (systConfig.size() > 1) {
411 ATH_MSG_ERROR("Multiple systematic variations in one SystematicsSet are not supported");
412 return StatusCode::FAILURE;
413 }
414
415 // set charm and bottom weights to nominal by default
416 if (m_charmProdFractionWeights.find(CP::SystematicVariation("")) == m_charmProdFractionWeights.end()) {
417 ATH_MSG_ERROR("Nominal charm weights not found");
418 return StatusCode::FAILURE;
419 }
420
421 if (m_bottomProdFractionWeights.find(CP::SystematicVariation("")) == m_bottomProdFractionWeights.end()) {
422 ATH_MSG_ERROR("Nominal bottom weights not found");
423 return StatusCode::FAILURE;
424 }
425
426 auto charmWeights = m_charmProdFractionWeights.at(CP::SystematicVariation(""));
427 auto bottomWeights = m_bottomProdFractionWeights.at(CP::SystematicVariation(""));
428
429 // if a sys variation is passed that affects the weights, choose the appropriate weight set
430 if (systConfig.size() == 1) {
431 const CP::SystematicVariation &current_variation = *(systConfig.begin());
432 if (m_charmProdFractionWeights.find(current_variation) != m_charmProdFractionWeights.end()) {
433 charmWeights = m_charmProdFractionWeights.at(current_variation);
434 }
435
436 if (m_bottomProdFractionWeights.find(current_variation) != m_bottomProdFractionWeights.end()) {
437 bottomWeights = m_bottomProdFractionWeights.at(current_variation);
438 }
439 }
440
441 // set the ParameterSet (weights set) for use in weight calculation
442 param.charmWeights = std::move(charmWeights);
443 param.bottomWeights = std::move(bottomWeights);
444
445 return StatusCode::SUCCESS;
446}
const_iterator begin() const
description: const iterator to the beginning of the set
size_t size() const
returns: size of the set

◆ setupProductionFractions()

StatusCode PMGTools::PMGHFProductionFractionTool::setupProductionFractions ( )
private

Setup weights.

Definition at line 141 of file PMGHFProductionFractionTool.cxx.

141 {
142 // Step 0: find available files
143 // ________________________________________________________________
144
145 // Charm production fractions data file
146 std::string mapFilename = PathResolverFindCalibFile((fs::path(m_calibrationAreaPath) / fs::path(m_showerGeneratorMapFile)).string());
147 if (mapFilename.empty()) {
148 ATH_MSG_ERROR("Input file not found " << m_showerGeneratorMapFile);
149 return StatusCode::FAILURE;
150 }
151 ATH_MSG_INFO("Found input file " << mapFilename);
152
153 // Find all available MC generators
154 std::ifstream infile(mapFilename);
155 std::string line;
156 while (std::getline(infile, line)) {
157 std::istringstream iss(line);
158 if (line.rfind("#", 0) == 0 || line.empty()) {
159 continue;
160 }
161
162 std::string id, name;
163 if (!(iss >> id >> name)) {
164 ATH_MSG_ERROR("Invalid formatting: " << line);
165 return StatusCode::FAILURE;
166 } if (id == "4") {
167 m_charmFilename = std::move(name);
168 } else if (id == "5") {
169 m_bottomFilename = std::move(name);
170 } else {
171 m_showerGeneratorMap[id] = std::move(name);
172 }
173 }
174
175 // Close file
176 infile.close();
177
178 // Check if the requested MC shower version is available
180 ATH_MSG_ERROR("MC shower generator " << m_showerGenerator << " not found!");
181 ATH_MSG_INFO("Available generators are:");
182 for (auto &gen : m_showerGeneratorMap) {
183 ATH_MSG_INFO(gen.first);
184 }
185 return StatusCode::FAILURE;
186 }
187
188 // Step 1: read HF production fractions from literature
189 // ________________________________________________________________
190
191 // Charm production fractions data file
192 std::string charmFilename = PathResolverFindCalibFile((fs::path(m_calibrationAreaPath) / fs::path(m_charmFilename)).string());
193 if (charmFilename.empty()) {
194 ATH_MSG_ERROR("Input file not found " << m_charmFilename);
195 return StatusCode::FAILURE;
196 }
197 ATH_MSG_INFO("Found input file " << charmFilename);
198
199 // Bottom production fractions data file
200 std::string bottomFilename = PathResolverFindCalibFile((fs::path(m_calibrationAreaPath) / fs::path(m_bottomFilename)).string());
201 if (bottomFilename.empty()) {
202 ATH_MSG_ERROR("Input file not found " << m_bottomFilename);
203 return StatusCode::FAILURE;
204 }
205 ATH_MSG_INFO("Found input file " << bottomFilename);
206
207 // Configure the production fractions from files
210
211 // Step 2: read HF production fractions for a given MC shower
212 // ________________________________________________________________
213
214 // Read the config files from cvmfs
216 if (filename.empty()) {
217 ATH_MSG_ERROR("Input file not found " << m_showerGeneratorMap[m_showerGenerator]);
218 return StatusCode::FAILURE;
219 }
220 ATH_MSG_INFO("Found input file " << filename);
221
222 // Configure the weights from the file
223 /* Example file structure:
224 #Sherpa(v2.2.1) (DSID 410250)
225 #PDG ID | Production Fraction
226 511 0.27243
227 521 0.273029
228 531 0.0893853
229 5000 0.365034
230 411 0.142884
231 421 0.379585
232 431 0.113005
233 4000 0.364526
234 */
235 infile = std::ifstream(filename);
236 std::map<unsigned int, float> charm;
237 std::map<unsigned int, float> bottom;
238 while (std::getline(infile, line)) {
239 std::istringstream iss(line);
240 if (line.rfind("#", 0) == 0 || line.empty()) {
241 continue;
242 }
243
244 int pdgId;
245 float fraction;
246 if (!(iss >> pdgId >> fraction)) {
247 ATH_MSG_ERROR("Invalid formatting: " << line);
248 return StatusCode::FAILURE;
249 }
250 if (pdgId == 4000 || pdgId < 500) {
251 ATH_MSG_DEBUG("Charm meson " << pdgId << " has a fraction of " << fraction);
252 charm[pdgId] = fraction;
253 } else {
254 ATH_MSG_DEBUG("Bottom meson " << pdgId << " has a fraction of " << fraction);
255 bottom[pdgId] = fraction;
256 }
257 }
258
259 // Close file
260 infile.close();
261
262 // Step 3: calculate the weight as `w = f(literature) / f(MC)'
263 // ________________________________________________________________
264
265 // charm weights
266 for (auto &sys : m_charmProdFractionWeights) {
267 for (auto &kv : charm) {
268 m_charmProdFractionWeights[sys.first][kv.first] /= kv.second;
269 }
270 }
271
272 // bottom weights
273 for (auto &sys : m_bottomProdFractionWeights) {
274 for (auto &kv : bottom) {
275 m_bottomProdFractionWeights[sys.first][kv.first] /= kv.second;
276 }
277 }
278
279 // Return gracefully
280 return StatusCode::SUCCESS;
281}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
StatusCode readProductionFractionsFile(const std::string &, std::map< CP::SystematicVariation, std::map< unsigned int, float > > &)
Read production fractions from input file.

◆ setUseIncidents()

void asg::AsgMetadataTool::setUseIncidents ( const bool flag)
inlineprotectedinherited

Definition at line 132 of file AsgMetadataTool.h.

133 {
135 }
bool flag
Definition master.py:29

◆ sysInitialize()

StatusCode asg::AsgMetadataTool::sysInitialize ( )
virtualinherited

Function initialising the tool in the correct way in Athena.

This function is used to set up the callbacks from IncidentSvc in Athena at the right time during initialisation, without the user having to do anything special in his/her code.

Reimplemented from AthCommonDataStore< AthCommonMsg< AlgTool > >.

Definition at line 115 of file AsgMetadataTool.cxx.

115 {
116
117#ifndef XAOD_STANDALONE
118 if (m_useIncidents) {
119 // Connect to the IncidentSvc:
120 ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
121 ATH_CHECK( incSvc.retrieve() );
122
123 // Set up the right callbacks: don't rethrow exceptions, any failure and we should end
124 incSvc->addListener( this, IncidentType::BeginEvent, 0, false );
125 }
126 // Let the base class do its thing:
127 ATH_CHECK( AlgTool::sysInitialize() );
128
129#endif // not XAOD_STANDALONE
130
131 // Return gracefully:
132 return StatusCode::SUCCESS;
133 }

◆ 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_beginInputFileCalled

bool asg::AsgMetadataTool::m_beginInputFileCalled
privateinherited

Flag helping to discover when the tool misses the opening of the first input file.

Definition at line 126 of file AsgMetadataTool.h.

◆ m_bottomFilename

std::string PMGTools::PMGHFProductionFractionTool::m_bottomFilename
private

Input file with bottom production fractions.

Definition at line 96 of file PMGHFProductionFractionTool.h.

◆ m_bottomProdFractionWeights

std::map<CP::SystematicVariation, std::map<unsigned int, float> > PMGTools::PMGHFProductionFractionTool::m_bottomProdFractionWeights
private

Bottom production fraction weights.

Definition at line 108 of file PMGHFProductionFractionTool.h.

◆ m_calibrationAreaPath

std::string PMGTools::PMGHFProductionFractionTool::m_calibrationAreaPath
private

Path to calibration area.

Definition at line 81 of file PMGHFProductionFractionTool.h.

◆ m_charmFilename

std::string PMGTools::PMGHFProductionFractionTool::m_charmFilename
private

Input file with charm production fractions.

Definition at line 93 of file PMGHFProductionFractionTool.h.

◆ m_charmProdFractionWeights

std::map<CP::SystematicVariation, std::map<unsigned int, float> > PMGTools::PMGHFProductionFractionTool::m_charmProdFractionWeights
private

Charm production fraction weights.

Definition at line 105 of file PMGHFProductionFractionTool.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_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_fiducialEtaCut

float PMGTools::PMGHFProductionFractionTool::m_fiducialEtaCut
private

The fiducial charm/bottom eta cut.

Definition at line 102 of file PMGHFProductionFractionTool.h.

◆ m_fiducialPtCut

float PMGTools::PMGHFProductionFractionTool::m_fiducialPtCut
private

The fiducial charm/bottom pT cut (in GeV)

Definition at line 99 of file PMGHFProductionFractionTool.h.

◆ m_inputMetaStore

MetaStore_t asg::AsgMetadataTool::m_inputMetaStore
privateinherited

Object accessing the input metadata store.

Definition at line 119 of file AsgMetadataTool.h.

◆ m_outputMetaStore

MetaStore_t asg::AsgMetadataTool::m_outputMetaStore
privateinherited

Object accessing the output metadata store.

Definition at line 121 of file AsgMetadataTool.h.

◆ m_Parameters

CP::SystematicsCache<ParameterSet> PMGTools::PMGHFProductionFractionTool::m_Parameters {this}
private

The SystematicsCache object.

Definition at line 114 of file PMGHFProductionFractionTool.h.

114{this};

◆ m_showerGenerator

std::string PMGTools::PMGHFProductionFractionTool::m_showerGenerator
private

MC Shower generator software (valid options: Pythia8)

Definition at line 90 of file PMGHFProductionFractionTool.h.

◆ m_showerGeneratorMap

std::map<std::string, std::string> PMGTools::PMGHFProductionFractionTool::m_showerGeneratorMap
private

MC Shower generator map.

Definition at line 84 of file PMGHFProductionFractionTool.h.

◆ m_showerGeneratorMapFile

std::string PMGTools::PMGHFProductionFractionTool::m_showerGeneratorMapFile
private

MC Shower generator map file name.

Definition at line 87 of file PMGHFProductionFractionTool.h.

◆ m_useIncidents

bool asg::AsgMetadataTool::m_useIncidents
privateinherited

Definition at line 128 of file AsgMetadataTool.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.


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