29 StatusCode SystematicsSvc ::
36 return StatusCode::FAILURE;
43 ANA_MSG_ERROR (
"can't specify both sigmaRecommended and systematicsList");
44 return StatusCode::FAILURE;
47 return StatusCode::SUCCESS;
52 std::vector<CP::SystematicSet> SystematicsSvc ::
53 makeSystematicsVector ()
const
56 std::vector<CP::SystematicSet> systematicsVector;
64 sys.calc (m_recommendedSystematics);
69 if (!regex_match (mysys.name(), expr))
74 systematicsVector.push_back (mysys);
89 assert (!systematicsVector.empty());
90 return systematicsVector;
95 StatusCode SystematicsSvc ::
103 if (affecting.
find (mysys) == affecting.
end())
105 ANA_MSG_ERROR (
"systematic is only registered as recommended, not affecting: " << mysys);
106 return StatusCode::FAILURE;
110 m_affectingSystematics.insert (affecting);
111 m_recommendedSystematics.insert (recommended);
112 return StatusCode::SUCCESS;
118 getObjectSystematics (
const std::string&
name)
const
121 auto iter = m_objectSystematics.find (
name);
122 if (iter != m_objectSystematics.end())
130 StatusCode SystematicsSvc ::
131 setObjectSystematics (
const std::string&
name,
138 if (m_affectingSystematics.find (mysys) == m_affectingSystematics.end())
140 ANA_MSG_ERROR (
"systematic is set as object systematic, but not affecting: " << mysys);
141 return StatusCode::FAILURE;
144 m_objectSystematics[
name] = std::move (mysystematics);
145 return StatusCode::SUCCESS;
151 getDecorSystematics (
const std::string& objectName,
152 const std::string& decorName)
const
154 const std::string
name = objectName +
"." + decorName;
156 auto iter = m_decorSystematics.find (
name);
157 if (iter != m_decorSystematics.end())
159 auto jter = m_copies.find (objectName);
160 if (jter != m_copies.end())
162 const std::string& copyName = jter->second;
171 StatusCode SystematicsSvc ::
172 setDecorSystematics (
const std::string& objectName,
173 const std::string& decorName,
176 const std::string
name = objectName +
"." + decorName;
181 if (m_affectingSystematics.find (mysys) == m_affectingSystematics.end())
183 ANA_MSG_ERROR (
"systematic is set as object systematic, but not affecting: " << mysys);
184 return StatusCode::FAILURE;
187 m_decorSystematics[
name] = std::move (mysystematics);
188 return StatusCode::SUCCESS;
193 StatusCode SystematicsSvc ::
194 registerCopy (
const std::string& fromName,
195 const std::string& toName)
const
198 auto emplace_result = m_copies.try_emplace (toName, fromName);
199 if (emplace_result.second ==
false)
201 ANA_MSG_ERROR (
"duplicate copy registered for name " << toName);
202 return StatusCode::FAILURE;
204 return StatusCode::SUCCESS;
209 std::string SystematicsSvc ::
210 getCopySource (
const std::string& toName)
const
213 auto iter = m_copies.find (toName);
214 if (iter == m_copies.end())
222 StatusCode SystematicsSvc ::
223 makeSystematicsName (std::string&
result,
224 const std::string&
name,
229 ANA_MSG_ERROR (
"not allowed to make systematic name for empty string");
230 return StatusCode::FAILURE;
235 const auto sysSplit =
result.find (
"%SYS%");
236 if (sysSplit == std::string::npos)
240 ANA_MSG_ERROR (
"can't set systematics on name without \"%SYS%\": \"" <<
name <<
"\" sys=" << sys.name());
241 return StatusCode::FAILURE;
245 std::string sysName = sys.name();
248 result.replace (sysSplit, 5, sysName);
251 return StatusCode::SUCCESS;
256 StatusCode SystematicsSvc ::
268 if (m_recommendedSystematics.find (mysys) == m_recommendedSystematics.end())
281 return StatusCode::SUCCESS;
static const std::vector< std::string > systematics
This class handles turning the list of systematics into the actual list of nuisance parameter points ...
Class to wrap a set of SystematicVariations.
const_iterator end() const
description: const iterator to the end of the set
iterator find(const SystematicVariation &sys) const
description: find an element in the set
Gaudi::Property< std::string > m_nominalSystematicsName
nominal systematics name
virtual std::vector< CP::SystematicSet > makeSystematicsVector() const override
Gaudi::Property< std::vector< std::string > > m_systematicsList
the names of the systematics to request
Gaudi::Property< float > m_sigmaRecommended
load all recommended systematics at the given number of sigmas
std::mutex m_systematicsMutex
a mutex for accessing the above mutable members
Gaudi::Property< std::string > m_systematicsRegex
the regular expression for filterinf systematics
virtual CP::SystematicSet getDecorSystematics(const std::string &objectName, const std::string &decorName) const override
Select isolated Photons, Electrons and Muons.