Class to wrap a set of SystematicVariations.
More...
#include <SystematicSet.h>
Class to wrap a set of SystematicVariations.
Definition at line 30 of file SystematicSet.h.
◆ const_iterator
◆ iterator
◆ MATCHTYPE
description: match systematic or continuous version
Enumerator |
---|
FULL | |
FULLORCONTINUOUS | |
Definition at line 90 of file SystematicSet.h.
◆ SystematicSet() [1/5]
CP::SystematicSet::SystematicSet |
( |
| ) |
|
◆ SystematicSet() [2/5]
CP::SystematicSet::SystematicSet |
( |
const std::string & |
systematics | ) |
|
construct set by splitting single systematics string
Definition at line 42 of file SystematicSet.cxx.
46 std::string::size_type
split = 0, split2 = 0;
◆ SystematicSet() [3/5]
CP::SystematicSet::SystematicSet |
( |
const std::vector< std::string > & |
systematics | ) |
|
◆ SystematicSet() [4/5]
◆ SystematicSet() [5/5]
◆ begin()
description: const iterator to the beginning of the set
Definition at line 55 of file SystematicSet.h.
◆ clear()
void CP::SystematicSet::clear |
( |
| ) |
|
◆ computeHash()
std::size_t CP::SystematicSet::computeHash |
( |
| ) |
const |
|
private |
description: compute and store the hash value
Definition at line 313 of file SystematicSet.cxx.
315 static const std::hash<std::string> hashFunction;
317 return hashFunction(
name());
◆ empty()
bool CP::SystematicSet::empty |
( |
| ) |
const |
|
inline |
◆ end()
description: const iterator to the end of the set
Definition at line 59 of file SystematicSet.h.
◆ filterByBaseName()
description: get the subset of systematics matching basename Should this return a StatusCode instead?
Definition at line 146 of file SystematicSet.cxx.
152 filteredSysts.insert(
sys);
154 return filteredSysts;
◆ filterForAffectingSystematics()
description: filter the systematics for the affected systematics returns: success guarantee: strong failures: out of memory II failures: requesting multiple variations on the same systematic (e.g.
up & down) failures: requesting an unsupported variation on an otherwise supported systematic (e.g. a 2 sigma variation and the tool only supports 1 sigma variations)
Definition at line 212 of file SystematicSet.cxx.
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;
◆ find()
description: find an element in the set
Definition at line 63 of file SystematicSet.h.
◆ getBaseNames()
std::set< std::string > CP::SystematicSet::getBaseNames |
( |
| ) |
const |
description: get the set of base systematic names from this set
Definition at line 159 of file SystematicSet.cxx.
161 std::set<std::string> baseNames;
163 baseNames.insert(
sys.basename());
◆ getParameterByBaseName()
float CP::SystematicSet::getParameterByBaseName |
( |
const std::string & |
basename | ) |
const |
returns: the parameter value for the given basename
Definition at line 192 of file SystematicSet.cxx.
◆ getSystematicByBaseName()
description: get the first systematic matching basename
Definition at line 171 of file SystematicSet.cxx.
173 const SystematicVariation* sysMatched = NULL;
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;
188 return SystematicVariation();
◆ getToyVariationByBaseName()
std::pair< unsigned, float > CP::SystematicSet::getToyVariationByBaseName |
( |
const std::string & |
basename | ) |
const |
the toy variation for the given basename
in case there is no toy variation for the given base name, this returns (0,0)
- See also
- SystematicVariation::getToyVariation
- Guarantee
- strong
- Failures
- not a toy variation
parse errors
out of memory II
Definition at line 200 of file SystematicSet.cxx.
205 return std::make_pair (0, 0);
206 return var.getToyVariation();
◆ hash()
std::size_t CP::SystematicSet::hash |
( |
| ) |
const |
returns: hash value for the joined string.
Caches the hash if not already done
Definition at line 289 of file SystematicSet.cxx.
◆ insert() [1/2]
description: insert a systematic set into this set
Definition at line 99 of file SystematicSet.cxx.
◆ insert() [2/2]
◆ joinNames()
std::string CP::SystematicSet::joinNames |
( |
| ) |
const |
|
private |
description: join systematic names into single string
Definition at line 299 of file SystematicSet.cxx.
301 std::string joinedName;
303 if (!joinedName.empty()) {
306 joinedName +=
sys.name();
◆ matchSystematic()
Definition at line 128 of file SystematicSet.cxx.
135 const SystematicVariation continuous(systematic.basename(),
◆ name()
std::string CP::SystematicSet::name |
( |
| ) |
const |
returns: the systematics joined into a single string.
Caches the name if not already done
Definition at line 278 of file SystematicSet.cxx.
◆ size()
size_t CP::SystematicSet::size |
( |
| ) |
const |
|
inline |
◆ swap()
description: swap elements of a set
Definition at line 108 of file SystematicSet.cxx.
112 otherSet.m_joinedName.reset();
114 otherSet.m_hash.reset();
◆ m_hash
description: cached hash value for quick retrieval in unordered containers
Definition at line 169 of file SystematicSet.h.
◆ m_joinedName
description: cache the joined string, useful for hash
Definition at line 165 of file SystematicSet.h.
◆ m_sysVariations
description: the set of systematics encapsulated in this class
Definition at line 162 of file SystematicSet.h.
The documentation for this class was generated from the following files: