 |
ATLAS Offline Software
|
#include <ImportData.h>
|
| ImportData () |
| the following two variables are owned by this tool and released in the destructor More...
|
|
| ImportData (TrigGlobalEfficiencyCorrectionTool &parent) |
|
| ~ImportData () |
|
bool | importHierarchies () |
|
bool | importTriggers () |
|
bool | importThresholds (const std::map< std::string, std::string > &overridenThresholds={}) |
|
bool | importPeriods () |
|
bool | importMapKeys (const std::string &tag, std::map< std::size_t, std::map< std::size_t, int >> &keysPerLeg) |
|
bool | importAll (const std::map< std::string, std::string > &overridenThresholds={}) |
|
bool | getPeriodBoundaries (const std::string &period, std::pair< unsigned, unsigned > &boundaries) |
|
bool | suggestEgammaMapKeys (const std::map< std::string, std::string > &triggerCombination, const std::string &version, std::map< std::string, std::string > &legsPerKey, xAOD::Type::ObjectType type) |
|
const std::map< std::size_t, TrigDef > & | getTriggerDefs () const |
|
const std::map< std::size_t, float > & | getTriggerThresholds () const |
|
const std::map< std::string, std::pair< unsigned, unsigned > > & | getDataPeriods () const |
|
const std::vector< Hierarchy > & | getHierarchyMeta () const |
|
const std::vector< std::size_t > & | getHierarchyData () const |
|
const std::map< std::size_t, std::string > & | getDictionary () const |
|
xAOD::Type::ObjectType | associatedLeptonFlavour (std::size_t leg, bool &success) |
|
std::vector< TrigDef > | parseTriggerString (const std::string &triggerString, bool &success) |
|
TrigGlobalEfficiencyCorrectionTool * | getParent () |
|
bool | adaptTriggerListForTriggerMatching (std::vector< ImportData::TrigDef > &triggers) |
|
void | setLevel (MSG::Level lvl) |
| Change the current logging level. More...
|
|
|
std::string | m_nm |
| Message source name. More...
|
|
boost::thread_specific_ptr< MsgStream > | m_msg_tls |
| MsgStream instance (a std::cout like with print-out levels) More...
|
|
std::atomic< IMessageSvc * > | m_imsg { nullptr } |
| MessageSvc pointer. More...
|
|
std::atomic< MSG::Level > | m_lvl { MSG::NIL } |
| Current logging level. More...
|
|
std::atomic_flag m_initialized | ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
| Messaging initialized (initMessaging) More...
|
|
Definition at line 86 of file ImportData.h.
◆ Hierarchy
◆ ImportData() [1/2]
ImportData::ImportData |
( |
| ) |
|
the following two variables are owned by this tool and released in the destructor
Definition at line 18 of file ImportData.cxx.
24 m_hasher(*
new std::hash<std::string>) {}
◆ ImportData() [2/2]
◆ ~ImportData()
ImportData::~ImportData |
( |
| ) |
|
◆ adaptTriggerListForTriggerMatching()
bool ImportData::adaptTriggerListForTriggerMatching |
( |
std::vector< ImportData::TrigDef > & |
triggers | ) |
|
This essentially splits OR single lepton triggers into independent items
to prevent duplicates
Definition at line 729 of file ImportData.cxx.
732 std::set<std::size_t> extraItems;
733 std::vector<ImportData::TrigDef> updatedTriggers;
736 std::size_t
pos = 0, len =
name.find(
"_OR_");
737 if (len == std::string::npos) {
738 updatedTriggers.emplace_back(trig);
746 ATH_MSG_ERROR(
"while listing triggers for trigger matching; trigger \""
747 <<
item <<
"\" extracted from \"" <<
name
748 <<
"\" is not recognized");
751 if (extraItems.emplace(
h).second)
752 updatedTriggers.emplace_back(def->second);
753 if (len == std::string::npos)
757 if (len != std::string::npos)
◆ associatedLeptonFlavour() [1/2]
Definition at line 514 of file ImportData.cxx.
517 if (
leg.length() >= 2 &&
leg[0] ==
'e' &&
leg[1] >=
'1' &&
leg[1] <=
'9')
519 else if (
leg.length() >= 3 &&
leg[0] ==
'm' &&
leg[1] ==
'u' &&
520 leg[2] >=
'1' &&
leg[2] <=
'9')
522 else if (
leg.length() >= 3 &&
leg[0] ==
'g' &&
leg[1] >=
'1' &&
leg[1] <=
'9')
524 else if (
leg.length() >= 4 &&
leg[0] ==
't' &&
leg[1] ==
'a' &&
525 leg[2] ==
'u' &&
leg[3] >=
'1' &&
leg[3] <=
'9')
528 return xAOD::Type::Other;
◆ associatedLeptonFlavour() [2/2]
◆ getDataPeriods()
const std::map<std::string, std::pair<unsigned, unsigned> >& TrigGlobEffCorr::ImportData::getDataPeriods |
( |
| ) |
const |
|
inline |
◆ getDictionary()
const std::map<std::size_t, std::string>& TrigGlobEffCorr::ImportData::getDictionary |
( |
| ) |
const |
|
inline |
◆ getHierarchyData()
const std::vector<std::size_t>& TrigGlobEffCorr::ImportData::getHierarchyData |
( |
| ) |
const |
|
inline |
◆ getHierarchyMeta()
const std::vector<Hierarchy>& TrigGlobEffCorr::ImportData::getHierarchyMeta |
( |
| ) |
const |
|
inline |
◆ getParent()
◆ getPeriodBoundaries()
bool ImportData::getPeriodBoundaries |
( |
const std::string & |
period, |
|
|
std::pair< unsigned, unsigned > & |
boundaries |
|
) |
| |
Definition at line 482 of file ImportData.cxx.
487 boundaries = itr->second;
492 if (
sep != std::string::npos) {
493 std::string kwMin =
period.substr(0,
sep);
494 std::string kwMax =
period.substr(
sep + 1);
499 boundaries = std::minmax({itrMin->second.first, itrMax->second.first,
500 itrMin->second.second, itrMax->second.second});
505 boundaries = std::minmax(std::stoi(kwMin), std::stoi(kwMax));
◆ getTriggerDefs()
const std::map<std::size_t, TrigDef>& TrigGlobEffCorr::ImportData::getTriggerDefs |
( |
| ) |
const |
|
inline |
◆ getTriggerThresholds()
const std::map<std::size_t, float>& TrigGlobEffCorr::ImportData::getTriggerThresholds |
( |
| ) |
const |
|
inline |
◆ importAll()
bool ImportData::importAll |
( |
const std::map< std::string, std::string > & |
overridenThresholds = {} | ) |
|
◆ importHierarchies()
bool ImportData::importHierarchies |
( |
| ) |
|
Definition at line 342 of file ImportData.cxx.
347 std::vector<std::string>
config;
350 std::stringstream
ss;
351 std::string token,
unit;
352 std::map<std::size_t, std::vector<std::size_t> > aliases;
357 if (
line[0] ==
'[') {
360 Hierarchy{(short)m_hierarchyData.size(), 0, 0.f,
361 std::numeric_limits<float>::max()});
362 if (
line[1] ==
'-' &&
line[2] ==
']')
367 ss.ignore(2) >> meta.minPt >>
unit;
368 else if (
line[1] ==
'<')
369 ss.ignore(2) >> meta.maxPt >>
unit;
371 ss.ignore(1) >> meta.minPt >>
sep >> meta.maxPt >>
unit;
372 if (!
ss ||
sep !=
'-' || (
unit !=
"GeV]" &&
unit !=
"MeV]")) {
373 ATH_MSG_ERROR(
"Unable to parse pT restrictions in Hierarchies.cfg");
376 if (
unit ==
"GeV]") {
382 while (
ss >> token) {
384 auto itr = aliases.find(
h);
385 if (itr == aliases.end()) {
388 << token <<
"' found in Hierarchies.cfg");
396 if (
ss >> token && token !=
">")
400 success = success && meta.nLegs;
403 auto& legs = aliases[
m_hasher(token)];
404 if (
ss >> token && token ==
":=") {
406 while (
ss >> token) {
412 << token <<
"' found in Hierarchies.cfg");
415 if (
ss >> token && token !=
">")
418 success = success && legs.size();
◆ importMapKeys()
bool ImportData::importMapKeys |
( |
const std::string & |
tag, |
|
|
std::map< std::size_t, std::map< std::size_t, int >> & |
keysPerLeg |
|
) |
| |
Definition at line 432 of file ImportData.cxx.
436 std::vector<std::string>
config;
439 std::stringstream
ss;
441 bool reading =
false;
443 std::size_t
pos =
line.find(
"[VERSION]");
444 if (
pos != std::string::npos) {
448 while (std::getline(
ss, token,
',')) {
465 while (
ss >> token) {
468 if (insertion.second)
471 insertion.first->second |=
year;
474 if (!keysPerLeg.size()) {
475 ATH_MSG_ERROR(
"Unable to import the available map keys for the version "
◆ importPeriods()
bool ImportData::importPeriods |
( |
| ) |
|
Definition at line 321 of file ImportData.cxx.
323 std::vector<std::string>
config;
326 std::stringstream
ss;
328 std::pair<unsigned, unsigned>
runs;
◆ importThresholds()
bool ImportData::importThresholds |
( |
const std::map< std::string, std::string > & |
overridenThresholds = {} | ) |
|
Override thresholds if requested
Definition at line 251 of file ImportData.cxx.
254 std::vector<std::string>
config;
257 std::stringstream
ss;
269 else if (
unit !=
"MeV") {
271 <<
leg <<
"\" (missing unit)");
286 bool belowRecommended =
false;
287 for (
auto& kv : overridenThresholds) {
292 pt = std::stof(kv.second);
295 << kv.second <<
"\" to floating-point value");
301 <<
pt <<
" MeV) set for trigger leg " << kv.first
302 <<
", please make sure you provided the threshold in "
303 "MeV and not in GeV!");
306 belowRecommended =
true;
309 ATH_MSG_ERROR(
"Can't override threshold for unknown trigger leg "
314 if (belowRecommended) {
316 "Tool configured to use trigger thresholds below those recommended!");
◆ importTriggers()
bool ImportData::importTriggers |
( |
| ) |
|
default: assume the leg's name is the same as the full trigger name
Classify trigger and re-arrange legs (if needed) so that all electron legs come before muon legs, and muon legs before photon legs
symmetric tetralepton triggers
single-flavour trilepton triggers
mixed-flavour trilepton triggers
dilepton triggers
single lepton triggers
Definition at line 99 of file ImportData.cxx.
103 std::vector<std::string>
config;
106 std::stringstream
ss;
107 std::string triggerName, token;
125 for (std::size_t&
leg : def.leg) {
139 <<
"' found in Triggers.cfg");
149 "Unknown trigger leg '"
151 <<
"' (inferred from trigger name) found in Triggers.cfg");
192 else if ((ne +
nm) == 1)
199 if (
std::count(def.leg.cbegin(), def.leg.cend(), def.leg[0]) == 4) {
203 }
else if (ne +
nm == 0 || ne == 3 ||
211 bool sym = (def.leg[0] == def.leg[1] || def.leg[1] == def.leg[2]);
218 else if (ne +
nm == 1)
230 else if (ne +
nm == 0)
232 else if (ne == 1 &&
nm == 1)
245 ATH_MSG_ERROR(
"Configuration issue for trigger " << triggerName);
◆ initMessaging()
void AthMessaging::initMessaging |
( |
| ) |
const |
|
privateinherited |
Initialize our message level and MessageSvc.
This method should only be called once.
Definition at line 39 of file AthMessaging.cxx.
◆ msg() [1/2]
MsgStream & asg::AsgMessaging::msg |
( |
| ) |
const |
|
inherited |
The standard message stream.
- Returns
- A reference to the default message stream of this object.
Definition at line 49 of file AsgMessaging.cxx.
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
54 #endif // not XAOD_STANDALONE
◆ msg() [2/2]
MsgStream & asg::AsgMessaging::msg |
( |
const MSG::Level |
lvl | ) |
const |
|
inherited |
The standard message stream.
- Parameters
-
lvl | The message level to set the stream to |
- Returns
- A reference to the default message stream, set to level "lvl"
Definition at line 57 of file AsgMessaging.cxx.
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
63 #endif // not XAOD_STANDALONE
◆ msgLvl()
bool asg::AsgMessaging::msgLvl |
( |
const MSG::Level |
lvl | ) |
const |
|
inherited |
Test the output level of the object.
- Parameters
-
lvl | The message level to test against |
- Returns
- boolean Indicting if messages at given level will be printed
-
true
If messages at level "lvl" will be printed
Definition at line 41 of file AsgMessaging.cxx.
42 #ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44 #else // not XAOD_STANDALONE
45 return m_msg.msgLevel( lvl );
46 #endif // not XAOD_STANDALONE
◆ parseTriggerString()
Replace all || by |
Definition at line 542 of file ImportData.cxx.
545 if (
s.find(
"|||") != std::string::npos) {
547 << triggerString <<
"'");
553 auto i =
s.find(
"||");
554 if (
i == std::string::npos)
558 if (
s ==
"" ||
s ==
"|") {
560 << triggerString <<
"'");
565 std::set<std::size_t>
hashes;
566 std::stringstream
ss(
s);
567 while (std::getline(
ss,
s,
'|')) {
573 <<
s <<
"' found while parsing trigger combination");
577 if (!
hashes.insert(trig).second) {
579 <<
s <<
"' is present more than once in the combination");
585 success = success &&
triggers.size();
◆ readDataFile()
bool ImportData::readDataFile |
( |
const char * |
filename, |
|
|
std::vector< std::string > & |
contents |
|
) |
| |
|
protected |
Definition at line 47 of file ImportData.cxx.
53 std::ifstream
f(
name.c_str(), std::ios_base::in);
57 if (std::getline(
f,
line)) {
58 const std::string::size_type
i =
line.find(
'#');
59 if (
i != std::string::npos)
61 if (
line.length() >= 3)
66 ATH_MSG_ERROR(
"Issue encountered while reading configuration file "
◆ setLevel()
void AthMessaging::setLevel |
( |
MSG::Level |
lvl | ) |
|
|
inherited |
◆ setNonMixed3LType()
swap legs so that the last two are identical, for later convenience
Definition at line 83 of file ImportData.cxx.
84 if (def.leg[0] == def.leg[1] && def.leg[1] == def.leg[2])
86 else if (def.leg[0] != def.leg[1] && def.leg[1] != def.leg[2] &&
87 def.leg[0] != def.leg[2])
91 if (def.leg[1] != def.leg[0] && def.leg[1] != def.leg[2])
93 else if (def.leg[2] != def.leg[0] && def.leg[2] != def.leg[1])
◆ suggestEgammaMapKeys()
bool ImportData::suggestEgammaMapKeys |
( |
const std::map< std::string, std::string > & |
triggerCombination, |
|
|
const std::string & |
version, |
|
|
std::map< std::string, std::string > & |
legsPerKey, |
|
|
xAOD::Type::ObjectType |
type |
|
) |
| |
If no version is specified, the list of trigger legs is returned
Definition at line 589 of file ImportData.cxx.
598 std::map<std::size_t, int> legs;
600 for (
auto& kv : triggerCombination) {
608 for (
int k = 0;
k < 32; ++
k) {
611 itrPeriod->second.first <= itr->second.second &&
612 itrPeriod->second.second >= itr->second.first) {
620 for (std::size_t
leg : trig.leg) {
622 auto insertion = legs.emplace(
leg,
years);
623 if (!insertion.second)
624 insertion.first->second |=
years;
633 std::map<std::size_t, std::map<std::size_t, int> > allKeys;
636 std::map<std::size_t, std::vector<std::size_t> > allLegsPerKey;
637 std::set<std::size_t> legsWithMultipleKeys;
638 bool sameKeyForAllyears =
true;
639 while (legs.size()) {
640 allLegsPerKey.clear();
641 for (
auto& kvLegs : legs)
643 std::size_t
leg = kvLegs.first;
644 int years = kvLegs.second;
645 auto itrKeys = allKeys.find(
leg);
646 if (itrKeys != allKeys.end()) {
647 for (
auto& kvKeys : itrKeys->second)
649 auto y = (kvKeys.second &
years);
651 (!sameKeyForAllyears &&
655 auto insertion = allLegsPerKey.emplace(
656 kvKeys.first, std::vector<std::size_t>{
leg});
657 if (!insertion.second)
658 insertion.first->second.push_back(
leg);
663 "Sorry, no idea what the map key should be for the trigger leg '"
671 if (!allLegsPerKey.size()) {
672 if (sameKeyForAllyears) {
673 sameKeyForAllyears =
false;
681 auto itrKey = std::max_element(
682 allLegsPerKey.begin(), allLegsPerKey.end(),
683 [](T&
x, T&
y) { return x.second.size() < y.second.size(); });
684 std::string& strLegs = legsPerKey[
m_dictionary.at(itrKey->first)];
685 for (std::size_t
leg : itrKey->second) {
686 int& wantedYears = legs.at(
leg);
687 int supportedYears = (allKeys.at(
leg).at(itrKey->first)) & wantedYears;
688 if (supportedYears != wantedYears || legsWithMultipleKeys.count(
leg)) {
689 legsWithMultipleKeys.insert(
leg);
690 for (
int i = 0;
i < 32; ++
i) {
691 if (supportedYears & (1
u <<
i)) {
692 if (strLegs.length() && strLegs.back() !=
',')
699 if (strLegs.length() && strLegs.back() !=
',')
703 if (supportedYears == wantedYears)
706 wantedYears &= ~supportedYears;
711 for (
auto& kv : legs) {
716 for (
auto& [
key, legs] : legsPerKey) {
720 "Some of the requested triggers will result in "
721 "a default scale factor of 1 being returned");
◆ ATLAS_THREAD_SAFE
std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
|
mutableprivateinherited |
◆ m_dataPeriods
std::map<std::string, std::pair<unsigned, unsigned> > TrigGlobEffCorr::ImportData::m_dataPeriods |
|
protected |
◆ m_dictionary
std::map<std::size_t, std::string>& TrigGlobEffCorr::ImportData::m_dictionary |
|
protected |
◆ m_hasher
std::hash<std::string>& TrigGlobEffCorr::ImportData::m_hasher |
|
protected |
◆ m_hierarchyData
std::vector<std::size_t> TrigGlobEffCorr::ImportData::m_hierarchyData |
|
protected |
◆ m_hierarchyMeta
std::vector<Hierarchy> TrigGlobEffCorr::ImportData::m_hierarchyMeta |
|
protected |
◆ m_imsg
std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr } |
|
mutableprivateinherited |
◆ m_lvl
std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL } |
|
mutableprivateinherited |
◆ m_msg_tls
boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls |
|
mutableprivateinherited |
MsgStream instance (a std::cout like with print-out levels)
Definition at line 132 of file AthMessaging.h.
◆ m_nm
std::string AthMessaging::m_nm |
|
privateinherited |
◆ m_parent
◆ m_triggerDefs
std::map<std::size_t, TrigDef> TrigGlobEffCorr::ImportData::m_triggerDefs |
|
protected |
◆ m_triggerThresholds
std::map<std::size_t, float> TrigGlobEffCorr::ImportData::m_triggerThresholds |
|
protected |
The documentation for this class was generated from the following files:
std::atomic< MSG::Level > m_lvl
Current logging level.
std::map< std::size_t, TrigDef > m_triggerDefs
Electron_v1 Electron
Definition of the current "egamma version".
std::map< std::size_t, std::string > & m_dictionary
TrigGlobalEfficiencyCorrectionTool::Hierarchy Hierarchy
std::map< std::string, std::pair< unsigned, unsigned > > m_dataPeriods
bool importMapKeys(const std::string &tag, std::map< std::size_t, std::map< std::size_t, int >> &keysPerLeg)
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
@ u
Enums for curvilinear frames.
IMessageSvc * getMessageSvc(bool quiet=false)
std::vector< TrigDef > parseTriggerString(const std::string &triggerString, bool &success)
std::vector< std::size_t > m_hierarchyData
bool importThresholds(const std::map< std::string, std::string > &overridenThresholds={})
std::vector< Hierarchy > m_hierarchyMeta
xAOD::Type::ObjectType associatedLeptonFlavour(std::size_t leg, bool &success)
MsgStream & msg() const
The standard message stream.
std::hash< std::string > & m_hasher
void contents(std::vector< std::string > &keys, TDirectory *td, const std::string &directory, const std::string &pattern, const std::string &path)
Class mimicking the AthMessaging class from the offline software.
std::string to_string(const DetectorType &type)
bool readDataFile(const char *filename, std::vector< std::string > &contents)
Photon_v1 Photon
Definition of the current "egamma version".
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
struct TBPatternUnitContext Muon
std::map< std::size_t, float > m_triggerThresholds
#define ATH_MSG_WARNING(x)
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
std::string m_nm
Message source name.
bool importAll(const std::map< std::string, std::string > &overridenThresholds={})
@ Tau
The object is a tau (jet)
std::string removeWhitespaces(const std::string &s)
void setNonMixed3LType(TrigDef &def, TriggerType flavourFlag)
TrigGlobalEfficiencyCorrectionTool * m_parent