|
ATLAS Offline Software
|
#include <ImportData.h>
|
| ImportData () |
|
| 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 87 of file ImportData.h.
◆ Hierarchy
◆ ImportData() [1/2]
ImportData::ImportData |
( |
| ) |
|
◆ 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;
737 std::size_t
pos = 0, len =
name.find(
"_OR_");
738 if(len == std::string::npos)
740 updatedTriggers.emplace_back(trig);
750 ATH_MSG_ERROR(
"while listing triggers for trigger matching; trigger \"" <<
item <<
"\" extracted from \"" <<
name <<
"\" is not recognized");
753 if(extraItems.emplace(
h).second) updatedTriggers.emplace_back(def->second);
754 if(len == std::string::npos)
break;
757 if(len != std::string::npos) len -=
pos;
◆ associatedLeptonFlavour() [1/2]
◆ 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 480 of file ImportData.cxx.
486 boundaries = itr->second;
491 if(
sep!=std::string::npos)
493 std::string kwMin =
period.substr(0,
sep);
494 std::string kwMax =
period.substr(
sep+1);
500 boundaries = std::minmax({itrMin->second.first, itrMax->second.first, itrMin->second.second, itrMax->second.second});
506 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 340 of file ImportData.cxx.
345 std::vector<std::string>
config;
346 if(!
readDataFile(
"TrigGlobalEfficiencyCorrection/Hierarchies.cfg",
config))
return false;
347 std::stringstream
ss;
348 std::string token,
unit;
349 std::map<std::size_t, std::vector<std::size_t> > aliases;
358 if(
line[1]==
'-' &&
line[2]==
']')
ss.ignore(3);
362 if(
line[1]==
'>')
ss.ignore(2) >> meta.minPt >>
unit;
363 else if(
line[1]==
'<')
ss.ignore(2) >> meta.maxPt >>
unit;
364 else ss.ignore(1) >> meta.minPt >>
sep >> meta.maxPt >>
unit;
367 ATH_MSG_ERROR(
"Unable to parse pT restrictions in Hierarchies.cfg");
379 auto itr = aliases.find(
h);
380 if(itr == aliases.end())
384 ATH_MSG_ERROR(
"Unknown trigger leg '" << token <<
"' found in Hierarchies.cfg");
391 if(
ss >> token && token!=
">") success =
false;
394 success = success && meta.nLegs;
399 auto& legs = aliases[
m_hasher(token)];
400 if(
ss >> token && token==
":=")
410 ATH_MSG_ERROR(
"Unknown trigger leg '" << token <<
"' found in Hierarchies.cfg");
413 if(
ss >> token && token!=
">") success =
false;
415 success = success && legs.size();
417 else success =
false;
◆ importMapKeys()
bool ImportData::importMapKeys |
( |
const std::string & |
tag, |
|
|
std::map< std::size_t, std::map< std::size_t, int > > & |
keysPerLeg |
|
) |
| |
Definition at line 430 of file ImportData.cxx.
433 std::vector<std::string>
config;
435 std::stringstream
ss;
437 bool reading =
false;
440 std::size_t
pos =
line.find(
"[VERSION]");
441 if(
pos != std::string::npos)
446 while(std::getline(
ss, token,
','))
456 if(!reading)
continue;
469 else insertion.first->second |=
year;
472 if(!keysPerLeg.size())
◆ importPeriods()
bool ImportData::importPeriods |
( |
| ) |
|
Definition at line 317 of file ImportData.cxx.
320 std::vector<std::string>
config;
321 if(!
readDataFile(
"TrigGlobalEfficiencyCorrection/DataPeriods.cfg",
config))
return false;
322 std::stringstream
ss;
324 std::pair<unsigned,unsigned>
runs;
◆ importThresholds()
bool ImportData::importThresholds |
( |
const std::map< std::string, std::string > & |
overridenThresholds = {} | ) |
|
Override thresholds if requested
Definition at line 244 of file ImportData.cxx.
247 std::vector<std::string>
config;
248 if(!
readDataFile(
"TrigGlobalEfficiencyCorrection/Thresholds.cfg",
config))
return false;
249 std::stringstream
ss;
261 if(
unit ==
"GeV")
pt *= 1e3f;
262 else if(
unit !=
"MeV")
264 ATH_MSG_ERROR(
"Unable to import pT threshold for leg \"" <<
leg <<
"\" (missing unit)");
282 bool belowRecommended =
false;
283 for(
auto& kv : overridenThresholds)
289 try {
pt = std::stof(kv.second); }
292 ATH_MSG_ERROR(
"Unable to convert threshold argument \""<<kv.second<<
"\" to floating-point value");
298 ATH_MSG_WARNING(
"Suspiciously low threshold (" <<
pt <<
" MeV) set for trigger leg " << kv.first
299 <<
", please make sure you provided the threshold in MeV and not in GeV!");
301 if(pt < itr->
second) belowRecommended =
true;
306 ATH_MSG_ERROR(
"Can't override threshold for unknown trigger leg " << kv.first);
312 ATH_MSG_WARNING(
"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 106 of file ImportData.cxx.
110 std::vector<std::string>
config;
111 if(!
readDataFile(
"TrigGlobalEfficiencyCorrection/Triggers.cfg",
config))
return false;
112 std::stringstream
ss;
113 std::string triggerName, token;
125 bool found_tau_leg =
false;
127 while((
ss >> token) && !found_tau_leg)
132 if(found_tau_leg)
continue;
139 for(std::size_t&
leg : def.leg)
141 if(!(
ss >> token))
break;
147 ATH_MSG_ERROR(
"Unknown trigger leg '" << token <<
"' found in Triggers.cfg");
156 ATH_MSG_ERROR(
"Unknown trigger leg '" << triggerName <<
"' (inferred from trigger name) found in Triggers.cfg");
160 if(!success)
continue;
172 if(!ne)
std::swap(def.leg[0],def.leg[1]);
186 if(!ne)
std::swap(def.leg[0], def.leg[2]);
187 else if(ne==1)
std::swap(def.leg[1], def.leg[2]);
193 else if((ne+
nm)==1)
std::swap(def.leg[1], def.leg[2]);
206 else success =
false;
208 else if(ne+
nm==0 || ne==3 ||
nm==3)
214 bool sym = (def.leg[0]==def.leg[1] || def.leg[1]==def.leg[2]);
218 else success =
false;
226 else if(ne==1 &&
nm==1) def.type =
TT_E_MU;
227 else if(ne==1) def.type =
TT_E_G;
238 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 538 of file ImportData.cxx.
541 if(
s.find(
"|||") != std::string::npos)
543 ATH_MSG_ERROR(
"Invalid format for the trigger combination '" << triggerString <<
"'");
550 auto i =
s.find(
"||");
551 if(
i == std::string::npos)
break;
556 ATH_MSG_ERROR(
"Invalid format for the trigger combination '" << triggerString <<
"'");
561 std::set<std::size_t>
hashes;
562 std::stringstream
ss(
s);
563 while(std::getline(
ss,
s,
'|'))
570 ATH_MSG_ERROR(
"Unknown trigger '" <<
s <<
"' found while parsing trigger combination");
574 if(!
hashes.insert(trig).second)
576 ATH_MSG_ERROR(
"The trigger '" <<
s <<
"' is present more than once in the combination");
582 success = success &&
triggers.size();
◆ readDataFile()
bool ImportData::readDataFile |
( |
const char * |
filename, |
|
|
std::vector< std::string > & |
contents |
|
) |
| |
|
protected |
Definition at line 52 of file ImportData.cxx.
59 std::ifstream
f(
name.c_str(),std::ios_base::in);
65 if(std::getline(
f,
line))
67 const std::string::size_type
i =
line.find(
'#');
68 if(
i != std::string::npos)
line.resize(
i);
◆ setLevel()
void AthMessaging::setLevel |
( |
MSG::Level |
lvl | ) |
|
|
inherited |
◆ setNonMixed3LType()
swap legs so that the last two are identical, for later convenience
Definition at line 94 of file ImportData.cxx.
97 else if(def.leg[0]!=def.leg[1] && def.leg[1]!=def.leg[2] && def.leg[0]!=def.leg[2]) def.type =
static_cast<TriggerType>(
TT_TRILEPTON_ASYM | flavourFlag);
100 if(def.leg[1]!=def.leg[0] && def.leg[1]!=def.leg[2])
std::swap(def.leg[0],def.leg[1]);
101 else if(def.leg[2]!=def.leg[0] && def.leg[2]!=def.leg[1])
std::swap(def.leg[0],def.leg[2]);
◆ 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 586 of file ImportData.cxx.
595 std::map<std::size_t,int> legs;
597 for(
auto& kv : triggerCombination)
607 for(
int k=0;
k<32;++
k)
610 if(itr !=
m_dataPeriods.end() && itrPeriod->second.first <= itr->second.second
611 && itrPeriod->second.second >= itr->second.first)
617 if(!success)
continue;
620 for(std::size_t
leg : trig.leg)
624 auto insertion = legs.emplace(
leg,
years);
625 if(!insertion.second) insertion.first->second |=
years;
630 if(!success)
return false;
634 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;
641 allLegsPerKey.clear();
642 for(
auto& kvLegs : legs)
644 std::size_t
leg = kvLegs.first;
645 int years = kvLegs.second;
646 auto itrKeys = allKeys.find(
leg);
647 if(itrKeys != allKeys.end())
649 for(
auto& kvKeys : itrKeys->second)
651 auto y = (kvKeys.second &
years);
652 if((
y==
years) || (!sameKeyForAllyears &&
y!=0))
654 auto insertion = allLegsPerKey.emplace(kvKeys.first,std::vector<std::size_t>{
leg});
655 if(!insertion.second) insertion.first->second.push_back(
leg);
661 ATH_MSG_ERROR(
"Sorry, no idea what the map key should be for the trigger leg '"
668 if(!allLegsPerKey.size())
670 if(sameKeyForAllyears)
672 sameKeyForAllyears =
false;
680 auto itrKey = std::max_element(allLegsPerKey.begin(), allLegsPerKey.end(),
681 [](T&
x,T&
y){return x.second.size()<y.second.size();});
682 std::string& strLegs = legsPerKey[
m_dictionary.at(itrKey->first)];
683 for(std::size_t
leg : itrKey->second)
685 int& wantedYears = legs.at(
leg);
686 int supportedYears = (allKeys.at(
leg).at(itrKey->first)) & wantedYears;
687 if(supportedYears!=wantedYears || legsWithMultipleKeys.count(
leg))
689 legsWithMultipleKeys.insert(
leg);
690 for(
int i=0;
i<32;++
i)
692 if(supportedYears & (1
u<<
i))
694 if(strLegs.length() && strLegs.back()!=
',') strLegs +=
',';
701 if(strLegs.length() && strLegs.back()!=
',') strLegs +=
',';
704 if(supportedYears == wantedYears) legs.erase(
leg);
705 else wantedYears &= ~supportedYears;
717 for (
auto& [
key, legs]: legsPerKey)
722 "a default scale factor of 1 being returned");
725 if(!success) legsPerKey.clear();
◆ 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.
bool importMapKeys(const std::string &tag, std::map< std::size_t, std::map< std::size_t, int > > &keysPerLeg)
Electron_v1 Electron
Definition of the current "egamma version".
std::map< std::string, std::pair< unsigned, unsigned > > m_dataPeriods
TrigGlobalEfficiencyCorrectionTool::Hierarchy Hierarchy
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)
std::map< std::size_t, float > m_triggerThresholds
std::map< std::size_t, TrigDef > m_triggerDefs
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
#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)
std::map< std::size_t, std::string > & m_dictionary
void setNonMixed3LType(TrigDef &def, TriggerType flavourFlag)
TrigGlobalEfficiencyCorrectionTool * m_parent