ATLAS Offline Software
Loading...
Searching...
No Matches
EffiCollection.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4#ifndef EFFICOLLECTION_H_
5#define EFFICOLLECTION_H_
6
7// @class EffiCollection
10
11
14#include <xAODMuon/Muon.h>
15#include <map>
16#include <string>
17#include <iostream>
18
23
24namespace CP {
27 class SystematicSet;
34 class EffiCollection final : public columnar::ColumnarTool<> {
35 public:
38 EffiCollection(const EffiCollection* Nominal, MuonEfficiencyScaleFactors& ref_tool, const std::string& syst, int syst_bit_map, bool is_up);
39
41 EfficiencyScaleFactor* retrieveSF(const xAOD::Muon & mu, unsigned int RunNumber) const;
42 EfficiencyScaleFactor* retrieveSF(columnar::MuonId mu, unsigned int RunNumber) const;
59 Symmetric = 1<<6,
63 };
64 static std::string FileTypeName(EffiCollection::CollectionType T);
65
66
69 bool CheckConsistency();
70
73 unsigned int nBins() const;
74
79 bool SetSystematicBin(unsigned int Bin);
80
82 bool IsLowPtBin(unsigned int Bin) const;
84 bool IsForwardBin(unsigned int Bin) const;
85
88 std::string GetBinName(unsigned int bin) const;
89
92 int getUnCorrelatedSystBin(const xAOD::Muon& mu) const;
93
94
98 bool isAffectedBySystematic(const SystematicVariation& variation) const;
99 bool isAffectedBySystematic(const SystematicSet& set) const;
100
101
105 std::shared_ptr<CollectionContainer> retrieveContainer(CollectionType Type) const;
106
107 private:
108 CollectionContainer* FindContainer(unsigned int bin) const;
111
113
117 std::shared_ptr<CollectionContainer> m_central_eff;
118 std::shared_ptr<CollectionContainer> m_calo_eff;
119 std::shared_ptr<CollectionContainer> m_forward_eff;
120 std::shared_ptr<CollectionContainer> m_lowpt_central_eff;
121 std::shared_ptr<CollectionContainer> m_lowpt_calo_eff;
122 std::shared_ptr<CollectionContainer> m_lrt_central_eff;
123 std::shared_ptr<CollectionContainer> m_lrt_lowpt_central_eff;
124
127 std::unique_ptr<SystematicSet> m_syst_set;
128
129 public:
130
135 columnar::MuonAccessor<char> isLRTmuon {*this, "isLRT", {.isOptional = true}};
136 };
137
141 public:
144 CollectionContainer(const MuonEfficiencyScaleFactors& ref_tool, CollectionContainer* Nominal, const std::string& syst_name, unsigned int syst_bit_map);
145
147 EfficiencyScaleFactor* retrieve(unsigned int RunNumer);
148
150 bool isBinInMap (unsigned int bin) const;
152 bool CheckConsistency();
153
155 std::string sysname() const;
156
158 bool SetSystematicBin(unsigned int Bin);
159
162 void SetGlobalOffSet(unsigned int OffSet);
163
165 unsigned int nBins() const;
167 unsigned int nOverFlowBins() const;
169 bool isOverFlowBin(int b) const;
170
171
173 unsigned int globalOffSet() const;
174
176 std::string GetBinName(unsigned int Bin) const;
177
180 int FindBinSF(const xAOD::Muon &mu) const;
181
184
185 bool isNominal() const;
186 bool isUpVariation() const;
187 bool separateBinSyst() const;
188
189 private:
190 std::map<std::string, std::pair<unsigned int, unsigned int>> findPeriods(const MuonEfficiencyScaleFactors& ref_tool) const;
191 std::string fileName(const MuonEfficiencyScaleFactors& ref_tool) const;
192
193 bool LoadPeriod(unsigned int RunNumber);
194
195 std::vector<std::shared_ptr<EfficiencyScaleFactor>> m_SF;
197
201 unsigned int m_binOffSet;
202
203 public:
204 void addSubtoolsTo (columnar::ColumnarTool<>& parentTool);
205
206 };
207
208}
209#endif /* EFFICOLLECTION_H_ */
The collection container manages the time binning of a particular scale-factor map.
std::map< std::string, std::pair< unsigned int, unsigned int > > findPeriods(const MuonEfficiencyScaleFactors &ref_tool) const
unsigned int nOverFlowBins() const
Number of overflow bins in the map.
EffiCollection::CollectionType m_FileType
void addSubtoolsTo(columnar::ColumnarTool<> &parentTool)
std::vector< std::shared_ptr< EfficiencyScaleFactor > > m_SF
bool isBinInMap(unsigned int bin) const
Checks if the global bin number belongs to this map.
bool isOverFlowBin(int b) const
Check whether the bin is overflow or not.
std::string GetBinName(unsigned int Bin) const
Name of the i-th bin.
EffiCollection::CollectionType type() const
File type of the map.
std::string fileName(const MuonEfficiencyScaleFactors &ref_tool) const
std::string sysname() const
Returns MUON_EFF_<sysname()>
int FindBinSF(const xAOD::Muon &mu) const
Returns the global bin number corresponding to the muon kinematics.
EfficiencyScaleFactor * m_currentSF
bool LoadPeriod(unsigned int RunNumber)
void SetGlobalOffSet(unsigned int OffSet)
Sets the global offset to align the order in the map into a global numbering scheme.
EfficiencyScaleFactor * retrieve(unsigned int RunNumer)
Retrieve the scale-factor map belonging to that particular run of data-taking.
unsigned int nBins() const
Number of bins of the map itself.
unsigned int m_binOffSet
Offset to translate between the bin-numbers in the bin numbers of each file against the global bin-nu...
unsigned int globalOffSet() const
Global offset of the bin numbers.
CollectionContainer(const MuonEfficiencyScaleFactors &ref_tool, EffiCollection::CollectionType FileType)
Nominal constructor... Only needs to know about it's type and the file to load.
bool SetSystematicBin(unsigned int Bin)
Activate this bin to run in the uncorrelated systematic mode.
bool CheckConsistency()
Consistency check of all scale-factor maps managed by the container instance.
columnar::MuonAccessor< columnar::ObjectColumn > m_muons
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > etaAcc
columnar::MuonAccessor< columnar::RetypeColumn< xAOD::Muon::MuonType, std::uint16_t > > muonTypeAcc
std::shared_ptr< CollectionContainer > m_forward_eff
bool isAffectedBySystematic(const SystematicVariation &variation) const
Returns whether the given set has variations affecting this Collection.
CollectionContainer * FindContainer(unsigned int bin) 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...
int getUnCorrelatedSystBin(const xAOD::Muon &mu) const
Returns the bin number from which the scale-factor of the muon is going to be retrieved....
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_calo_eff
std::shared_ptr< CollectionContainer > m_lrt_central_eff
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > ptAcc
@ JPsiAnalysis
Distinguish these two because the systematics are named with an extra LOWPT.
@ Central
The five different scale-factor maps.
bool CheckConsistency()
a consistency check of the scale-factor maps.
columnar::MuonAccessor< char > isLRTmuon
std::string GetBinName(unsigned int bin) const
Returns the global bin name conststucted from the axis titles and the bin borders.
EfficiencyScaleFactor * retrieveSF(const xAOD::Muon &mu, unsigned int RunNumber) const
return the correct SF type to provide, depending on eta and the author
static std::string FileTypeName(EffiCollection::CollectionType T)
bool IsForwardBin(unsigned int Bin) const
Checks whether the i-th bin belongs to the forward map.
std::shared_ptr< CollectionContainer > m_lowpt_central_eff
std::shared_ptr< CollectionContainer > m_lowpt_calo_eff
std::unique_ptr< SystematicSet > m_syst_set
The systematic set is returned back to the MuonEfficiencyScaleFactors instance to register The known ...
bool SetSystematicBin(unsigned int Bin)
If systematic decorrelation is activated then the user needs to loop manually over the syst bins.
unsigned int nBins() const
Get the number of all bins in the scale-factor maps including the overflow & underflow bins.
EffiCollection(MuonEfficiencyScaleFactors &ref_tool)
const MuonEfficiencyScaleFactors & m_ref_tool
std::shared_ptr< CollectionContainer > m_lrt_lowpt_central_eff
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...
SystematicSet * getSystSet() const
Returns the systematic set affecting this collection.
Class to wrap a set of SystematicVariations.
the base class for all columnar components
STL class.
Select isolated Photons, Electrons and Muons.
ObjectId< ContainerId::muon > MuonId
Definition MuonDef.h:25
AccessorTemplate< ContainerId::muon, CT, ColumnAccessMode::input, CM > MuonAccessor
Definition MuonDef.h:27
Muon_v1 Muon
Reference the current persistent version: