Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
12 static const std::vector<std::string> ToRemove {
"GeV",
"MeV",
"[",
"]",
"{",
"}",
"(",
")",
"#",
" " };
13 typedef std::pair<std::string,std::string> stringpair;
14 static const std::vector<stringpair> ToReplace { stringpair(
"-",
"minus"), stringpair(
".",
"p")};
22 m_lowpt_central_eff(),
25 m_lrt_lowpt_central_eff(),
74 m_lowpt_central_eff(),
77 m_lrt_lowpt_central_eff(),
83 if (syst_bit_map &
type) {
84 return std::make_shared<CollectionContainer>(ref_tool,
85 Nominal->retrieveContainer(
type).get(),
86 syst, syst_bit_map); }
89 return Nominal->retrieveContainer(
type);
110 return std::shared_ptr<CollectionContainer>();
114 Error(
"EffiCollection()",
"Consistency check for central file failed");
118 Error(
"EffiCollection()",
"Consistency check for calo file failed");
122 Error(
"EffiCollection()",
"Consistency check for forward file failed");
126 Error(
"EffiCollection()",
"Consistency check for low-pt file failed");
130 Error(
"EffiCollection()",
"Consistency check for low-pt calo file failed");
135 Error(
"EffiCollection()",
"Consistency check for LRT central file failed");
139 Error(
"EffiCollection()",
"Consistency check for LRT low-pt file failed");
148 if (container !=
m_central_eff.get() && container->separateBinSyst()){
149 container->SetGlobalOffSet(
n);
150 n += container->nBins();
167 m_syst_set = std::make_unique<CP::SystematicSet>();
170 Error(
"EffiCollection()",
"Invalid position in the list of systematics. It seems that I'm not part of the referring ScaleFactorTool.");
177 if (container->isNominal())
continue;
178 if (container->separateBinSyst()){
181 for (
unsigned int b = container->nBins() - 1;
b > 0 ; --
b){
182 unsigned int bin =
b + container->globalOffSet();
183 if (container->isOverFlowBin(
bin))
continue;
205 Error(
"CollectionContainer",
"No information available to tell if the muon is LRT or standard. Either run MuonLRTMergingAlg to decorate with `isLRT` flag, or supply the patternRecoInfo for the original ID track.");
207 std::bitset<xAOD::NumberOfTrackRecoInfo> patternBitSet(patternAcc(*idtrack));
213 if (std::abs(
mu.eta()) >= 2.5) {
216 if (
mu.muonType() == xAOD::Muon::CaloTagged) {
221 if (
mu.muonType() == xAOD::Muon::CaloTagged) {
223 }
else if (std::abs(
mu.eta()) < 2.5) {
248 Warning(
"EffiCollection::retrieveSF()",
"Invalid muon");
252 unsigned int Nbins = 0;
280 if (!Cont)
return false;
292 if (T == CollectionType::Central)
return "Central";
294 if (T == CollectionType::Forward)
return "Forward";
295 if (T == CollectionType::CentralLowPt)
return "CentralLowPt";
296 if (T == CollectionType::CaloLowPt)
return "CaloLowPt";
297 return "EffiCollection::FileTypeName() - WARNING: Unknown EffiCollection::CollectionType!";
304 for (
const std::string& R : ToRemove) {
307 for (
const stringpair& R : ToReplace) {
312 Warning(
"EffiCollection::GetBinName()",
"Unknown bin %u",
bin);
314 return "UNKNOWN_BIN";
341 m_currentSF(nullptr),
342 m_FileType(FileType),
345 std::map<std::string, std::pair<unsigned int, unsigned int>> map =
findPeriods(ref_tool);
346 for (
auto&
period : map) {
347 m_SF.push_back(std::make_shared<EfficiencyScaleFactor>(ref_tool,
fileName(ref_tool),
period.first));
353 m_currentSF(nullptr),
354 m_FileType(Nominal->
type()),
356 std::map<std::string, std::pair<unsigned int, unsigned int>> map =
findPeriods(ref_tool);
357 for (
auto&
period : map) {
358 std::vector< std::shared_ptr<EfficiencyScaleFactor>>::const_iterator itr = std::find_if( Nominal->m_SF.begin(),
360 [&
period](
const std::shared_ptr<EfficiencyScaleFactor>&
a){
361 return a->coversRunNumber(period.second.first);
363 m_SF.push_back(std::make_shared<EfficiencyScaleFactor>(*itr, ref_tool,
fileName(ref_tool),
period.first, syst_name, syst_bit_map));
370 std::map<std::string, std::pair<unsigned int, unsigned int>> map;
372 std::unique_ptr<TFile>
fin (TFile::Open(
file_name.c_str()));
373 if (!
fin || !
fin->IsOpen()) {
374 Error(
"CollectionContainer",
"Unable to open file %s",
file_name.c_str());
378 fin->GetObject(
"LumiData", intree);
382 map[
"All"] = std::pair<unsigned int,unsigned int>(1, 999999);
385 unsigned int firstRun = 0;
387 intree->SetBranchAddress(
"Period", &
period);
388 intree->SetBranchAddress(
"FirstRun", &firstRun);
389 intree->SetBranchAddress(
"LastRun", &
lastRun);
390 for (
int t = 0; intree->GetEntry(
t);
t++) {
391 map[*
period] = std::pair<unsigned int, unsigned int>(firstRun,
lastRun);
399 if (
type() == EffiCollection::CollectionType::CentralLowPt)
return ref_tool.
filename_LowPt();
406 Error(
"CollectionContainer",
"Could not retrieve any SFs from the input file");
410 for (std::vector< std::shared_ptr<EfficiencyScaleFactor>>::const_iterator first_sf =
m_SF.begin() ; first_sf !=
m_SF.end(); ++first_sf) {
411 if (!(*first_sf)->CheckConsistency())
return false;
412 for (std::vector< std::shared_ptr<EfficiencyScaleFactor>>::const_iterator second_sf =
m_SF.begin(); second_sf != first_sf; ++second_sf) {
413 if ( (*first_sf)->coversRunNumber( (*second_sf)->firstRun()) || (*first_sf)->coversRunNumber((*second_sf)->lastRun()) ||
414 (*second_sf)->coversRunNumber( (*first_sf)->firstRun()) || (*second_sf)->coversRunNumber((*first_sf)->lastRun())){
415 Error(
"CollectionContainer",
"Overlapping periods observed in file type %s. As run %i is in period %i - %i. Please check your SF file!",
422 std::sort(
m_SF.begin(),
m_SF.end(), [](
const std::shared_ptr<EfficiencyScaleFactor>&
a,
const std::shared_ptr<EfficiencyScaleFactor>&
b){
423 return a->firstRun() < b->firstRun();});
440 return (*
m_SF.begin()).get();
445 for ( std::shared_ptr<EfficiencyScaleFactor>&
Period :
m_SF) {
471 if (
m_SF.empty() )
return -1;
482 if (
m_SF.empty())
return false;
483 return (*
m_SF.begin())->sysname(
false).empty();
486 if (
m_SF.empty())
return false;
487 return (*
m_SF.begin())->IsUpVariation();
490 if (
m_SF.empty())
return false;
491 return (*
m_SF.begin())->separateBinSyst();
494 if (
m_SF.empty())
return "UNKNOWN SYST";
495 return (*
m_SF.begin())->sysname(
false);
std::string filename_Calo() const
Reconstruction scale-factors have a dedicated map for calo-tag muons around |\eta|<0....
std::string filename_Central() const
The following methods are meant to propagate information from the central tool to the subtool managin...
std::string filename_LRTLowPt() const
The EffiCollection class handles the 5 different scale-factor maps binned in time.
bool IsForwardBin(unsigned int Bin) const
Checks whether the i-th bin belongs to the forward map.
float lowPtTransition() const
If the pt of the muon is below that threshold the J/Psi or Upsilon map is used given that it's availa...
static SystematicVariation makeToyVariation(const std::string &basename, unsigned toyIndex, float toyScale)
constructor for toy systematics
bool LoadPeriod(unsigned int RunNumber)
SystematicSet * getSystSet() const
Returns the systematic set affecting this collection.
int Period
--> Execution phase:
Helper class to provide type-safe access to aux data.
bool IsLowPtBin(unsigned int Bin) const
Checks whether the i-th bin belongs to the low-pt map...
std::shared_ptr< CollectionContainer > m_lowpt_central_eff
@ Central
The five different scale-factor maps.
bool separateBinSyst() const
Class to wrap a set of SystematicVariations.
bool isBinInMap(unsigned int bin) const
Checks if the global bin number belongs to this map.
unsigned int globalOffSet() const
Global offset of the bin numbers.
EffiCollection(const MuonEfficiencyScaleFactors &ref_tool)
bool isOverFlowBin(int b) const
Check whether the bin is overflow or not.
EfficiencyScaleFactor * retrieve(unsigned int RunNumer)
Retrieve the scale-factor map belonging to that particular run of data-taking.
The collection container manages the time binning of a particular scale-factor map.
Select isolated Photons, Electrons and Muons.
std::shared_ptr< CollectionContainer > m_lrt_central_eff
std::string filename_LRTCentral() const
LRT muons have their own efficiency maps.
bool coversRunNumber(unsigned int run) const
Check if a run of data-taking is covered by this map.
std::shared_ptr< CollectionContainer > m_lowpt_calo_eff
size_t getPosition(const EffiCollection *coll) const
Returns the position of the collection in the syst set vector.
std::string filename_LowPt() const
Returns the scale-factor maps from a complementary scale-factor measurement using the J/Psi or Upsilo...
unsigned int nBins() const
Get the number of all bins in the scale-factor maps including the overflow & underflow bins.
std::shared_ptr< CollectionContainer > retrieveContainer(CollectionType Type) const
Method to retrieve a container from the class ordered by a collection type This method is mainly used...
std::string GetBinName(unsigned int Bin) const
Name of the i-th bin.
bool SetSystematicBin(unsigned int Bin)
Activate this bin to run in the uncorrelated systematic mode.
CollectionContainer * FindLRTContainer(const xAOD::Muon &mu) const
unsigned int nBins() const
Number of bins of the map itself.
std::string GetBinName(unsigned int bin) const
Returns the global bin name conststucted from the axis titles and the bin borders.
bool isUpVariation() const
CollectionContainer(const MuonEfficiencyScaleFactors &ref_tool, EffiCollection::CollectionType FileType)
Nominal constructor... Only needs to know about it's type and the file to load.
@ SiSpacePointsSeedMaker_LargeD0
std::string filename_HighEta() const
High-eta reconstruction scale-factors are not obtained by the means of are not obtained by the means ...
int FindBinSF(const xAOD::Muon &mu) const
Returns the global bin number corresponding to the muon kinematics.
const MuonEfficiencyScaleFactors & m_ref_tool
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
EfficiencyScaleFactor * retrieveSF(const xAOD::Muon &mu, unsigned int RunNumber) const
return the correct SF type to provide, depending on eta and the author
std::shared_ptr< CollectionContainer > m_forward_eff
EffiCollection::CollectionType type() const
File type of the map.
std::string sysname() const
Returns MUON_EFF_<sysname()>
size_t getNCollections() const
Returns the number of EffiCollections stored in this class.
std::shared_ptr< CollectionContainer > m_calo_eff
static std::string FileTypeName(EffiCollection::CollectionType T)
void SetGlobalOffSet(unsigned int OffSet)
Sets the global offset to align the order in the map into a global numbering scheme.
CollectionContainer * FindContainer(unsigned int bin) const
std::string ReplaceExpInString(std::string str, const std::string &exp, const std::string &rep)
Replaces all expressions an string by something else.
std::map< std::string, std::pair< unsigned int, unsigned int > > findPeriods(const MuonEfficiencyScaleFactors &ref_tool) const
std::shared_ptr< CollectionContainer > m_lrt_lowpt_central_eff
bool use_lrt() const
option to set if we want to use LRT muons
std::vector< std::shared_ptr< EfficiencyScaleFactor > > m_SF
bool CheckConsistency()
Consistency check of all scale-factor maps managed by the container instance.
unsigned int nOverFlowBins() const
Number of overflow bins in the map.
bool CheckConsistency()
a consistency check of the scale-factor maps.
std::unique_ptr< SystematicSet > m_syst_set
The systematic set is returned back to the MuonEfficiencyScaleFactors instance to register The known ...
bool isAffectedBySystematic(const SystematicVariation &variation) const
Returns whether the given set has variations affecting this Collection.
EfficiencyScaleFactor * m_currentSF
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
unsigned int m_binOffSet
Offset to translate between the bin-numbers in the bin numbers of each file against the global bin-nu...
Class describing a TrackParticle.
std::string filename_LowPtCalo() const
int getUnCorrelatedSystBin(const xAOD::Muon &mu) const
Returns the bin number from which the scale-factor of the muon is going to be retrieved....
EffiCollection::CollectionType m_FileType
std::string fileName(const MuonEfficiencyScaleFactors &ref_tool) const
std::shared_ptr< CollectionContainer > m_central_eff
Make the collection container shared ptr to allow that a systematic EffiCollection can use the same c...
bool SetSystematicBin(unsigned int Bin)
If systematic decorrelation is activated then the user needs to loop manually over the syst bins.
CP::MuonEfficiencyType measurement() const
Returns the type of the measurement to be carried out... E.g. Reco/TTVA/Iso.