Loading [MathJax]/extensions/tex2jax.js
 |
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 737 of file ImportData.cxx.
740 std::set<std::size_t> extraItems;
741 std::vector<ImportData::TrigDef> updatedTriggers;
745 std::size_t
pos = 0, len =
name.find(
"_OR_");
746 if(len == std::string::npos)
748 updatedTriggers.emplace_back(trig);
758 ATH_MSG_ERROR(
"while listing triggers for trigger matching; trigger \"" <<
item <<
"\" extracted from \"" <<
name <<
"\" is not recognized");
761 if(extraItems.emplace(
h).second) updatedTriggers.emplace_back(def->second);
762 if(len == std::string::npos)
break;
765 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 488 of file ImportData.cxx.
494 boundaries = itr->second;
499 if(
sep!=std::string::npos)
501 std::string kwMin =
period.substr(0,
sep);
502 std::string kwMax =
period.substr(
sep+1);
508 boundaries = std::minmax({itrMin->second.first, itrMax->second.first, itrMin->second.second, itrMax->second.second});
514 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 348 of file ImportData.cxx.
353 std::vector<std::string>
config;
354 if(!
readDataFile(
"TrigGlobalEfficiencyCorrection/Hierarchies.cfg",
config))
return false;
355 std::stringstream
ss;
356 std::string token,
unit;
357 std::map<std::size_t, std::vector<std::size_t> > aliases;
366 if(
line[1]==
'-' &&
line[2]==
']')
ss.ignore(3);
370 if(
line[1]==
'>')
ss.ignore(2) >> meta.minPt >>
unit;
371 else if(
line[1]==
'<')
ss.ignore(2) >> meta.maxPt >>
unit;
372 else ss.ignore(1) >> meta.minPt >>
sep >> meta.maxPt >>
unit;
375 ATH_MSG_ERROR(
"Unable to parse pT restrictions in Hierarchies.cfg");
387 auto itr = aliases.find(
h);
388 if(itr == aliases.end())
392 ATH_MSG_ERROR(
"Unknown trigger leg '" << token <<
"' found in Hierarchies.cfg");
399 if(
ss >> token && token!=
">") success =
false;
402 success = success && meta.nLegs;
407 auto& legs = aliases[
m_hasher(token)];
408 if(
ss >> token && token==
":=")
418 ATH_MSG_ERROR(
"Unknown trigger leg '" << token <<
"' found in Hierarchies.cfg");
421 if(
ss >> token && token!=
">") success =
false;
423 success = success && legs.size();
425 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 438 of file ImportData.cxx.
441 std::vector<std::string>
config;
443 std::stringstream
ss;
445 bool reading =
false;
448 std::size_t
pos =
line.find(
"[VERSION]");
449 if(
pos != std::string::npos)
454 while(std::getline(
ss, token,
','))
464 if(!reading)
continue;
477 else insertion.first->second |=
year;
480 if(!keysPerLeg.size())
◆ importPeriods()
bool ImportData::importPeriods |
( |
| ) |
|
Definition at line 325 of file ImportData.cxx.
328 std::vector<std::string>
config;
329 if(!
readDataFile(
"TrigGlobalEfficiencyCorrection/DataPeriods.cfg",
config))
return false;
330 std::stringstream
ss;
332 std::pair<unsigned,unsigned>
runs;
◆ importThresholds()
bool ImportData::importThresholds |
( |
const std::map< std::string, std::string > & |
overridenThresholds = {} | ) |
|
Override thresholds if requested
Definition at line 252 of file ImportData.cxx.
255 std::vector<std::string>
config;
256 if(!
readDataFile(
"TrigGlobalEfficiencyCorrection/Thresholds.cfg",
config))
return false;
257 std::stringstream
ss;
269 if(
unit ==
"GeV")
pt *= 1e3f;
270 else if(
unit !=
"MeV")
272 ATH_MSG_ERROR(
"Unable to import pT threshold for leg \"" <<
leg <<
"\" (missing unit)");
290 bool belowRecommended =
false;
291 for(
auto& kv : overridenThresholds)
297 try {
pt = std::stof(kv.second); }
300 ATH_MSG_ERROR(
"Unable to convert threshold argument \""<<kv.second<<
"\" to floating-point value");
306 ATH_MSG_WARNING(
"Suspiciously low threshold (" <<
pt <<
" MeV) set for trigger leg " << kv.first
307 <<
", please make sure you provided the threshold in MeV and not in GeV!");
309 if(pt < itr->
second) belowRecommended =
true;
314 ATH_MSG_ERROR(
"Can't override threshold for unknown trigger leg " << kv.first);
320 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;
132 for(std::size_t&
leg : def.leg)
134 if(!(
ss >> token))
break;
149 ATH_MSG_ERROR(
"Unknown trigger leg '" << token <<
"' found in Triggers.cfg");
159 ATH_MSG_ERROR(
"Unknown trigger leg '" << triggerName <<
"' (inferred from trigger name) found in Triggers.cfg");
163 if(!success)
continue;
180 if(!ne)
std::swap(def.leg[0],def.leg[1]);
194 if(!ne)
std::swap(def.leg[0], def.leg[2]);
195 else if(ne==1)
std::swap(def.leg[1], def.leg[2]);
201 else if((ne+
nm)==1)
std::swap(def.leg[1], def.leg[2]);
214 else success =
false;
216 else if(ne+
nm==0 || ne==3 ||
nm==3)
222 bool sym = (def.leg[0]==def.leg[1] || def.leg[1]==def.leg[2]);
226 else success =
false;
234 else if(ne==1 &&
nm==1) def.type =
TT_E_MU;
235 else if(ne==1) def.type =
TT_E_G;
246 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 546 of file ImportData.cxx.
549 if(
s.find(
"|||") != std::string::npos)
551 ATH_MSG_ERROR(
"Invalid format for the trigger combination '" << triggerString <<
"'");
558 auto i =
s.find(
"||");
559 if(
i == std::string::npos)
break;
564 ATH_MSG_ERROR(
"Invalid format for the trigger combination '" << triggerString <<
"'");
569 std::set<std::size_t>
hashes;
570 std::stringstream
ss(
s);
571 while(std::getline(
ss,
s,
'|'))
578 ATH_MSG_ERROR(
"Unknown trigger '" <<
s <<
"' found while parsing trigger combination");
582 if(!
hashes.insert(trig).second)
584 ATH_MSG_ERROR(
"The trigger '" <<
s <<
"' is present more than once in the combination");
590 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 594 of file ImportData.cxx.
603 std::map<std::size_t,int> legs;
605 for(
auto& kv : triggerCombination)
615 for(
int k=0;
k<32;++
k)
618 if(itr !=
m_dataPeriods.end() && itrPeriod->second.first <= itr->second.second
619 && itrPeriod->second.second >= itr->second.first)
625 if(!success)
continue;
628 for(std::size_t
leg : trig.leg)
632 auto insertion = legs.emplace(
leg,
years);
633 if(!insertion.second) insertion.first->second |=
years;
638 if(!success)
return false;
642 std::map<std::size_t,std::map<std::size_t,int> > allKeys;
644 std::map<std::size_t,std::vector<std::size_t> > allLegsPerKey;
645 std::set<std::size_t> legsWithMultipleKeys;
646 bool sameKeyForAllyears =
true;
649 allLegsPerKey.clear();
650 for(
auto& kvLegs : legs)
652 std::size_t
leg = kvLegs.first;
653 int years = kvLegs.second;
654 auto itrKeys = allKeys.find(
leg);
655 if(itrKeys != allKeys.end())
657 for(
auto& kvKeys : itrKeys->second)
659 auto y = (kvKeys.second &
years);
660 if((
y==
years) || (!sameKeyForAllyears &&
y!=0))
662 auto insertion = allLegsPerKey.emplace(kvKeys.first,std::vector<std::size_t>{
leg});
663 if(!insertion.second) insertion.first->second.push_back(
leg);
669 ATH_MSG_ERROR(
"Sorry, no idea what the map key should be for the trigger leg '"
676 if(!allLegsPerKey.size())
678 if(sameKeyForAllyears)
680 sameKeyForAllyears =
false;
688 auto itrKey = std::max_element(allLegsPerKey.begin(), allLegsPerKey.end(),
689 [](T&
x,T&
y){return x.second.size()<y.second.size();});
690 std::string& strLegs = legsPerKey[
m_dictionary.at(itrKey->first)];
691 for(std::size_t
leg : itrKey->second)
693 int& wantedYears = legs.at(
leg);
694 int supportedYears = (allKeys.at(
leg).at(itrKey->first)) & wantedYears;
695 if(supportedYears!=wantedYears || legsWithMultipleKeys.count(
leg))
697 legsWithMultipleKeys.insert(
leg);
698 for(
int i=0;
i<32;++
i)
700 if(supportedYears & (1
u<<
i))
702 if(strLegs.length() && strLegs.back()!=
',') strLegs +=
',';
709 if(strLegs.length() && strLegs.back()!=
',') strLegs +=
',';
712 if(supportedYears == wantedYears) legs.erase(
leg);
713 else wantedYears &= ~supportedYears;
725 for (
auto& [
key, legs]: legsPerKey)
730 "a default scale factor of 1 being returned");
733 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