33 ATH_MSG_INFO(
"Attempting to retrieve truth meta data from the first file...");
42 if (!sys.name().empty())
ATH_MSG_WARNING(
"Mapping for " << sys.name() <<
" missing, setting to index 0.");
44 return StatusCode::SUCCESS;
79 return StatusCode::FAILURE;
87 return StatusCode::FAILURE;
95 return StatusCode::FAILURE;
100 return StatusCode::SUCCESS;
113 }
catch (
const std::out_of_range& e) {
115 std::string strippedName = std::regex_replace(weightName, std::regex(
" "),
"_");
116 std::transform(strippedName.begin(), strippedName.end(), strippedName.begin(),
117 [](
unsigned char c){ return std::tolower(c); });
119 std::string modifiedName = std::regex_replace(weight, std::regex(
" "),
"_");
120 std::transform(modifiedName.begin(), modifiedName.end(), modifiedName.begin(),
121 [](
unsigned char c){ return std::tolower(c); });
122 if (strippedName == modifiedName){
123 ATH_MSG_WARNING(
"Using weight name \"" << weight <<
"\" instead of requested \"" << weightName <<
"\"");
127 ATH_MSG_FATAL(
"Weight \"" + weightName +
"\" could not be found");
128 throw std::runtime_error(name() +
": Weight \"" + weightName +
"\" could not be found");
140 const std::size_t *
res;
148 const std::size_t *
res;
167 mcChannelNumber =
static_cast<uint32_t
>(-1);
170 ATH_MSG_INFO(
"Attempting to retrieve MC channel number...");
174 float fltChannelNumber(-1);
176 mcChannelNumber =
static_cast<uint32_t
>(fltChannelNumber);
177 return StatusCode::SUCCESS;
180 return StatusCode::FAILURE;
186 uint32_t mcChannelNumber;
190 ATH_MSG_ERROR(
"MC channel number from a new file does not match the previously processed files.");
191 return StatusCode::FAILURE;
194 return StatusCode::SUCCESS;
201 ATH_MSG_INFO(
"Attempting to load weight meta data from xAOD TruthMetaData for channel " << targetChannelNumber);
203 [targetChannelNumber] (
const auto& it) { return it->mcChannelNumber() == targetChannelNumber; }
209 return StatusCode::FAILURE;
213 const std::vector<std::string> &truthWeightNames = (*itTruthMetaDataPtr)->weightNames();
214 for(std::size_t idx = 0; idx < truthWeightNames.size(); ++idx ) {
219 if (!sysName.empty()) {
231#ifdef XAOD_STANDALONE
232 return StatusCode::SUCCESS;
235 std::map<std::string, int> hepMCWeightNamesMap;
238 return StatusCode::FAILURE;
242 ATH_MSG_INFO(
"Attempting to load weight meta data from HepMC IOVMetaData container");
243 for (
auto& kv : hepMCWeightNamesMap) {
248 if (!sysName.empty()) {
263 return StatusCode::FAILURE;
267 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
std::pair< std::vector< unsigned int >, bool > res
Postprocess generator weight names to be name/ROOT friendly.
static std::string retrieveMetadata(const std::string &folder, const std::string &key, const ServiceHandle< StoreGateSvc > &inputMetaStore)
method that always returns as a string you can use from, e.g, pyROOT with evt = ROOT....
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
This module implements the central registry for handling systematic uncertainties with CP tools.
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
Class to wrap a set of SystematicVariations.
float mcEventWeight(size_t i=0) const
The weight of one specific MC event used in the simulation.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
EventInfo_v1 EventInfo
Definition of the latest event info version.
FileMetaData_v1 FileMetaData
Declare the latest version of the class.