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(),
28 ref_tool.addSubtool (*
this);
81 m_lowpt_central_eff(),
84 m_lrt_lowpt_central_eff(),
87 ref_tool.addSubtool (*
this);
92 if (syst_bit_map &
type) {
93 return std::make_shared<CollectionContainer>(ref_tool,
94 Nominal->retrieveContainer(
type).get(),
95 syst, syst_bit_map); }
98 return Nominal->retrieveContainer(
type);
123 return std::shared_ptr<CollectionContainer>();
127 Error(
"EffiCollection()",
"Consistency check for central file failed");
131 Error(
"EffiCollection()",
"Consistency check for calo file failed");
135 Error(
"EffiCollection()",
"Consistency check for forward file failed");
139 Error(
"EffiCollection()",
"Consistency check for low-pt file failed");
143 Error(
"EffiCollection()",
"Consistency check for low-pt calo file failed");
148 Error(
"EffiCollection()",
"Consistency check for LRT central file failed");
152 Error(
"EffiCollection()",
"Consistency check for LRT low-pt file failed");
161 if (container !=
m_central_eff.get() && container->separateBinSyst()){
162 container->SetGlobalOffSet(
n);
163 n += container->nBins();
180 m_syst_set = std::make_unique<CP::SystematicSet>();
183 Error(
"EffiCollection()",
"Invalid position in the list of systematics. It seems that I'm not part of the referring ScaleFactorTool.");
190 if (container->isNominal())
continue;
191 if (container->separateBinSyst()){
194 for (
unsigned int b = container->nBins() - 1;
b > 0 ; --
b){
195 unsigned int bin =
b + container->globalOffSet();
196 if (container->isOverFlowBin(
bin))
continue;
214 const xAOD::TrackParticle* idtrack =
mu.getXAODObject().trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
217 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.");
219 std::bitset<xAOD::NumberOfTrackRecoInfo> patternBitSet(patternAcc(*idtrack));
235 }
else if (std::abs(
etaAcc(
mu)) < 2.5) {
263 Warning(
"EffiCollection::retrieveSF()",
"Invalid muon");
267 unsigned int Nbins = 0;
295 if (!Cont)
return false;
307 if (T == CollectionType::Central)
return "Central";
309 if (T == CollectionType::Forward)
return "Forward";
310 if (T == CollectionType::CentralLowPt)
return "CentralLowPt";
311 if (T == CollectionType::CaloLowPt)
return "CaloLowPt";
312 return "EffiCollection::FileTypeName() - WARNING: Unknown EffiCollection::CollectionType!";
319 for (
const std::string& R : ToRemove) {
322 for (
const stringpair& R : ToReplace) {
327 Warning(
"EffiCollection::GetBinName()",
"Unknown bin %u",
bin);
329 return "UNKNOWN_BIN";
356 m_currentSF(nullptr),
357 m_FileType(FileType),
360 std::map<std::string, std::pair<unsigned int, unsigned int>> map =
findPeriods(ref_tool);
361 for (
auto&
period : map) {
362 m_SF.push_back(std::make_shared<EfficiencyScaleFactor>(ref_tool,
fileName(ref_tool),
period.first));
368 m_currentSF(nullptr),
369 m_FileType(Nominal->
type()),
371 std::map<std::string, std::pair<unsigned int, unsigned int>> map =
findPeriods(ref_tool);
372 for (
auto&
period : map) {
373 std::vector< std::shared_ptr<EfficiencyScaleFactor>>::const_iterator itr = std::find_if( Nominal->m_SF.begin(),
375 [&
period](
const std::shared_ptr<EfficiencyScaleFactor>&
a){
376 return a->coversRunNumber(period.second.first);
378 m_SF.push_back(std::make_shared<EfficiencyScaleFactor>(*itr, ref_tool,
fileName(ref_tool),
period.first, syst_name, syst_bit_map));
385 std::map<std::string, std::pair<unsigned int, unsigned int>> map;
387 std::unique_ptr<TFile>
fin (TFile::Open(
file_name.c_str()));
388 if (!
fin || !
fin->IsOpen()) {
389 Error(
"CollectionContainer",
"Unable to open file %s",
file_name.c_str());
393 fin->GetObject(
"LumiData", intree);
397 map[
"All"] = std::pair<unsigned int,unsigned int>(1, 999999);
400 unsigned int firstRun = 0;
402 intree->SetBranchAddress(
"Period", &
period);
403 intree->SetBranchAddress(
"FirstRun", &firstRun);
404 intree->SetBranchAddress(
"LastRun", &
lastRun);
405 for (
int t = 0; intree->GetEntry(
t);
t++) {
406 map[*
period] = std::pair<unsigned int, unsigned int>(firstRun,
lastRun);
414 if (
type() == EffiCollection::CollectionType::CentralLowPt)
return ref_tool.
filename_LowPt();
421 Error(
"CollectionContainer",
"Could not retrieve any SFs from the input file");
425 for (std::vector< std::shared_ptr<EfficiencyScaleFactor>>::const_iterator first_sf =
m_SF.begin() ; first_sf !=
m_SF.end(); ++first_sf) {
426 if (!(*first_sf)->CheckConsistency())
return false;
427 for (std::vector< std::shared_ptr<EfficiencyScaleFactor>>::const_iterator second_sf =
m_SF.begin(); second_sf != first_sf; ++second_sf) {
428 if ( (*first_sf)->coversRunNumber( (*second_sf)->firstRun()) || (*first_sf)->coversRunNumber((*second_sf)->lastRun()) ||
429 (*second_sf)->coversRunNumber( (*first_sf)->firstRun()) || (*second_sf)->coversRunNumber((*first_sf)->lastRun())){
430 Error(
"CollectionContainer",
"Overlapping periods observed in file type %s. As run %i is in period %i - %i. Please check your SF file!",
437 std::sort(
m_SF.begin(),
m_SF.end(), [](
const std::shared_ptr<EfficiencyScaleFactor>&
a,
const std::shared_ptr<EfficiencyScaleFactor>&
b){
438 return a->firstRun() < b->firstRun();});
455 return (*
m_SF.begin()).get();
460 for ( std::shared_ptr<EfficiencyScaleFactor>&
Period :
m_SF) {
486 if (
m_SF.empty() )
return -1;
497 if (
m_SF.empty())
return false;
498 return (*
m_SF.begin())->sysname(
false).empty();
501 if (
m_SF.empty())
return false;
502 return (*
m_SF.begin())->IsUpVariation();
505 if (
m_SF.empty())
return false;
506 return (*
m_SF.begin())->separateBinSyst();
509 if (
m_SF.empty())
return "UNKNOWN SYST";
510 return (*
m_SF.begin())->sysname(
false);
514 parentTool.addSubtool(*
SF);
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.
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > etaAcc
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.
CollectionContainer * FindLRTContainer(columnar::MuonId mu) const
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
const float SF[NF]
Cross sections for Fluor.
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.
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.
EffiCollection(MuonEfficiencyScaleFactors &ref_tool)
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.
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
columnar::MuonAccessor< columnar::RetypeColumn< xAOD::Muon::MuonType, std::uint16_t > > muonTypeAcc
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
columnar::MuonAccessor< char > isLRTmuon
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
a class representing a single object (electron, muons, etc.)
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.
void addSubtoolsTo(columnar::ColumnarTool<> &parentTool)
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.
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > ptAcc