4#ifndef EFFICOLLECTION_H_
5#define EFFICOLLECTION_H_
29namespace ADD_CMODE(CP) {
30 class MuonEfficiencyScaleFactors;
31 class EfficiencyScaleFactor;
32 class CollectionContainer;
37 class EffiCollection
final :
public columnar::ColumnarTool<> {
39 explicit EffiCollection(MuonEfficiencyScaleFactors& ref_tool);
41 EffiCollection(
const EffiCollection* Nominal, MuonEfficiencyScaleFactors& ref_tool,
const std::string& syst,
int syst_bit_map,
bool is_up);
44 EfficiencyScaleFactor* retrieveSF(
const xAOD::Muon & mu,
unsigned int RunNumber)
const;
45 EfficiencyScaleFactor* retrieveSF(
columnar::MuonId mu,
unsigned int RunNumber)
const;
55 LRTCentralLowPt = 1<<11,
60 JPsiAnalysis = CentralLowPt | CaloLowPt | LRTCentralLowPt,
70 static std::string FileTypeName(EffiCollection::CollectionType T);
75 bool CheckConsistency();
79 unsigned int nBins()
const;
85 bool SetSystematicBin(
unsigned int Bin);
88 bool IsLowPtBin(
unsigned int Bin)
const;
90 bool IsForwardBin(
unsigned int Bin)
const;
94 std::string GetBinName(
unsigned int bin)
const;
98 int getUnCorrelatedSystBin(
const xAOD::Muon& mu)
const;
102 CP::SystematicSet* getSystSet()
const;
104 bool isAffectedBySystematic(
const CP::SystematicVariation& variation)
const;
105 bool isAffectedBySystematic(
const CP::SystematicSet& set)
const;
111 std::shared_ptr<CollectionContainer> retrieveContainer(CollectionType
Type)
const;
114 CollectionContainer* FindContainer(
unsigned int bin)
const;
118 const MuonEfficiencyScaleFactors& m_ref_tool;
123 std::shared_ptr<CollectionContainer> m_central_eff;
124 std::shared_ptr<CollectionContainer> m_calo_eff;
125 std::shared_ptr<CollectionContainer> m_forward_eff;
126 std::shared_ptr<CollectionContainer> m_lowpt_central_eff;
127 std::shared_ptr<CollectionContainer> m_lowpt_calo_eff;
128 std::shared_ptr<CollectionContainer> m_lrt_central_eff;
129 std::shared_ptr<CollectionContainer> m_lrt_lowpt_central_eff;
133 std::unique_ptr<CP::SystematicSet> m_syst_set;
146 class CollectionContainer
final {
149 CollectionContainer(
const MuonEfficiencyScaleFactors& ref_tool, EffiCollection::CollectionType FileType);
150 CollectionContainer(
const MuonEfficiencyScaleFactors& ref_tool, CollectionContainer* Nominal,
const std::string& syst_name,
unsigned int syst_bit_map);
153 EfficiencyScaleFactor* retrieve(
unsigned int RunNumer);
156 bool isBinInMap (
unsigned int bin)
const;
158 bool CheckConsistency();
161 std::string sysname()
const;
164 bool SetSystematicBin(
unsigned int Bin);
168 void SetGlobalOffSet(
unsigned int OffSet);
171 unsigned int nBins()
const;
173 unsigned int nOverFlowBins()
const;
175 bool isOverFlowBin(
int b)
const;
179 unsigned int globalOffSet()
const;
182 std::string GetBinName(
unsigned int Bin)
const;
189 EffiCollection::CollectionType
type()
const;
191 bool isNominal()
const;
192 bool isUpVariation()
const;
193 bool separateBinSyst()
const;
196 std::map<std::string, std::pair<unsigned int, unsigned int>> findPeriods(
const MuonEfficiencyScaleFactors& ref_tool)
const;
197 std::string
fileName(
const MuonEfficiencyScaleFactors& ref_tool)
const;
199 bool LoadPeriod(
unsigned int RunNumber);
201 std::vector<std::shared_ptr<EfficiencyScaleFactor>> m_SF;
202 EfficiencyScaleFactor* m_currentSF;
203 std::unordered_set<unsigned int> m_warnedForRunNumber;
205 EffiCollection::CollectionType m_FileType;
208 unsigned int m_binOffSet;
211 void addSubtoolsTo (columnar::ColumnarTool<>& parentTool);