|
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include <boost/functional/hash.hpp>
19 return a.name() <
b.name();
25 return a.name() ==
b.name();
46 std::string::size_type
split = 0, split2 = 0;
67 (
const std::vector<SystematicVariation>&
systematics)
78 (
const std::initializer_list<SystematicVariation>&
systematics)
154 return filteredSysts;
161 std::set<std::string> baseNames;
163 baseNames.insert(
sys.basename());
176 if(!sysMatched) sysMatched = &
sys;
178 std::string
error =
"SystematicSet::getSystematicByBaseName ERROR: ";
179 error +=
"Multiple matches for requested basename ";
183 throw std::runtime_error(
error);
187 if(sysMatched)
return *sysMatched;
205 return std::make_pair (0, 0);
206 return var.getToyVariation();
216 using namespace msgSystematics;
222 std::map<std::string,SystematicVariation> requestedMap;
225 std::set<SystematicVariation> inconsistentList;
228 for (
auto&
sys : systConfig)
231 auto iter = requestedMap.find (
basename);
232 if (iter != requestedMap.end())
234 ANA_MSG_ERROR (
"inconsistent systematic variations requested: " <<
sys <<
" and " << iter->second);
235 return StatusCode::FAILURE;
237 requestedMap.insert (std::make_pair (
basename,
sys));
241 for (
auto&
sys : affectingSysts)
244 auto iter = requestedMap.find (
basename);
245 if (iter != requestedMap.end())
247 if (iter->second ==
sys ||
248 sys.ensembleContains (iter->second))
250 result.insert (iter->second);
254 inconsistentList.insert (iter->second);
262 for (
auto&
sys : inconsistentList)
266 ANA_MSG_ERROR (
"unsupported systematic variation " <<
sys <<
" requested for systematic " <<
sys.basename());
267 return StatusCode::FAILURE;
272 result.swap (filteredSysts);
273 return StatusCode::SUCCESS;
301 std::string joinedName;
303 if (!joinedName.empty()) {
306 joinedName +=
sys.name();
315 static const std::hash<std::string> hashFunction;
317 return hashFunction(
name());
323 return sysSet.
hash();
void reset()
Reset the value to invalid.
std::pair< unsigned, float > getToyVariationByBaseName(const std::string &basename) const
the toy variation for the given basename
const T * ptr() const
Return a pointer to the cached value.
void swap(SystematicSet &otherSet)
description: swap elements of a set
std::string basename() const
description: the base name, i.e.
bool operator<(const CP::SystematicSet &a, const CP::SystematicSet &b)
std::string joinNames() const
description: join systematic names into single string
bool isValid() const
Test to see if the value is valid.
std::size_t computeHash() const
description: compute and store the hash value
CxxUtils::CachedValue< std::size_t > m_hash
description: cached hash value for quick retrieval in unordered containers
Class to wrap a set of SystematicVariations.
std::string name() const
returns: the systematics joined into a single string.
SystematicSet filterByBaseName(const std::string &basename) const
description: get the subset of systematics matching basename Should this return a StatusCode instead?
MATCHTYPE
description: match systematic or continuous version
Select isolated Photons, Electrons and Muons.
float getParameterByBaseName(const std::string &basename) const
returns: the parameter value for the given basename
std::set< SystematicVariation > m_sysVariations
description: the set of systematics encapsulated in this class
std::size_t hash() const
returns: hash value for the joined string.
SystematicVariation getSystematicByBaseName(const std::string &basename) const
description: get the first systematic matching basename
::StatusCode StatusCode
StatusCode definition for legacy code.
std::set< std::string > getBaseNames() const
description: get the set of base systematic names from this set
CxxUtils::CachedValue< std::string > m_joinedName
description: cache the joined string, useful for hash
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
void set(const T &val) const
Set the value, assuming it is currently invalid.
void clear()
description: clear the set
SystematicSet()
construct an empty set
bool matchSystematic(const SystematicVariation &systematic, MATCHTYPE type=FULL) const
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
float parameter() const
description: the numeric parameter contained in the subvariation(), or 0 if the subvariation can't be...
std::size_t hash_value(const SystematicSet &)
Hash function specifically for boost::hash.
bool operator==(const CP::SystematicSet &a, const CP::SystematicSet &b)