62 void MakeSystematicsVector ::
63 testInvariant ()
const
71 MakeSystematicsVector ::
72 MakeSystematicsVector ()
80 const std::vector<SystematicSet>& MakeSystematicsVector ::
81 result (
const std::string&
label)
const
93 void MakeSystematicsVector ::
100 std::map<std::string,std::vector<SystematicSet>> myresult;
102 for (std::size_t group = 0; group !=
m_config.size(); ++ group)
109 auto& subresult = myresult[
config.label];
114 if (baseSys[group].
empty())
119 for (
auto sys : baseSys[group])
122 RCU_ASSERT (!sys.second.front().isToyEnsemble());
123 if (sys.second.front().isContinuousEnsemble())
130 }
else if (sys.second.front().isEnsemble())
134 RCU_THROW_MSG (
"unsupported ensemble systematic: " + sys.first);
138 for (
const auto & mysys : sys.second)
141 subresult.back().insert(mysys);
147 std::vector<CP::SystematicSet> toys (
config.toys);
149 for (
auto sys : baseSys[group])
154 if (sys.second.front().isContinuousEnsemble())
156 std::unique_ptr<TRandom3> random (
new TRandom3);
157 random->SetSeed (hash_string (sys.first));
159 for (
auto& toy : toys)
161 }
else if (sys.second.front().isToyEnsemble())
163 for (
unsigned toy = 0; toy !=
config.toys; ++ toy)
169 RCU_THROW_MSG (
"unsupported ensemble systematic for toys: " + sys.first);
172 for (
auto& toy : toys)
173 subresult.push_back (std::move (toy));
182 void MakeSystematicsVector ::
183 addGroup (
const std::string& val_label)
193 void MakeSystematicsVector ::
194 setPattern (
const std::string& val_pattern)
197 m_config.back().pattern = val_pattern;
202 void MakeSystematicsVector ::
203 setSigma (
float val_sigma)
212 void MakeSystematicsVector ::
213 setToys (
unsigned val_toys)
222 void MakeSystematicsVector ::
231 std::vector<std::map<std::string,std::vector<SystematicVariation>>>
232 MakeSystematicsVector ::
235 std::map<std::string,std::vector<SystematicVariation> > basesys;
236 for (
const auto & sys : sysList)
238 basesys[sys.basename()].push_back (sys);
240 std::vector<std::map<std::string,std::vector<SystematicVariation> >>
242 for (
auto sys : basesys)
246 for (
const auto & mysys : sys.second)
248 if (mysys.isEnsemble())
250 if (!ensemble.
empty())
251 RCU_THROW_MSG (
"inconsistent ensembles requested: " + ensemble.
name() +
" " + mysys.name());
257 std::size_t group =
m_config.size();
258 for (std::size_t iter = 0; iter !=
m_config.size(); ++ iter)
278 RCU_THROW_MSG (
"toys only supported for ensemble systematics");
283 RCU_THROW_MSG (
"no systematics group for systematic: " + sys.first);
285 if (!ensemble.
empty())
287 basesysList[group][sys.first].push_back (std::move(ensemble));
290 basesysList[group][sys.first] = std::move (sys.second);
#define RCU_REQUIRE2(x, y)
#define RCU_CHANGE_INVARIANT(x)
#define RCU_NEW_INVARIANT(x)
#define RCU_READ_INVARIANT(x)
#define RCU_THROW_MSG(message)
static const Attributes_t empty
std::string m_useForNominal
the group for which useForNominal was set
std::vector< std::map< std::string, std::vector< SystematicVariation > > > calcBaseSys(const SystematicSet &sysList)
make the list of base systematics for calc
std::vector< GroupConfig > m_config
the configuration on a per-group basis
std::map< std::string, std::vector< SystematicSet > > m_result
the value of result
Class to wrap a set of SystematicVariations.
static SystematicVariation makeToyVariation(const std::string &basename, unsigned toyIndex, float toyScale)
constructor for toy systematics
bool isToyEnsemble() const
whether this represents a toy ensemble
bool empty() const
returns: whether this is an empty systematic, i.e.
const std::string & name() const
description: the full systematics name, for use in strings, etc.
std::string label(const std::string &format, int i)
Select isolated Photons, Electrons and Muons.
bool match_expr(const std::regex &expr, const std::string &str)
returns: whether we can match the entire string with the regular expression guarantee: strong failure...
std::string str(const TrigT2MbtsBits_v1 &trigT2MbtsBits)
the configuration for the given group