ATLAS Offline Software
Loading...
Searching...
No Matches
InDetEtaDependentCutsSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// InDetEtaDependentCutsSvc includes
8
9#include <algorithm>
10#include <cmath>
11#include <functional>
12#include <variant>
13
14namespace InDet {
15
17 // Constructors
20 ISvcLocator* sl):
21 base_class(name, sl)
22 {}
23
25 // Destructor
28
29
31 // Initialize
33 StatusCode
35 ATH_MSG_DEBUG ("Initializing " << name() << "...");
36 if (m_etaBins.empty()) {
37 ATH_MSG_ERROR( "Wrong initialisation of eta bins. Check the eta bin values in " << name() );
38 return StatusCode::FAILURE;
39 }
40
41 // expecting eta bins in ascending order
42 if (not std::is_sorted(m_etaBins.value().begin(), m_etaBins.value().end())) {
43 ATH_MSG_ERROR( "Wrong initialisation of eta bins in " << name() << ". Values are not sorted!" );
44 return StatusCode::FAILURE;
45 }
46
47 using setOfCuts = std::variant< std::reference_wrapper<std::vector <double>>, std::reference_wrapper<std::vector <int>> >;
48
49 std::vector < setOfCuts> allCuts { m_etaWidthBrem.value() ,
50 m_maxdImpactSSSSeeds.value() ,
51 m_maxPrimaryImpact.value() ,
52 m_maxZImpact.value() ,
53 m_minPT.value() ,
54 m_minPTBrem.value() ,
55 m_phiWidthBrem.value() ,
56 m_Xi2max.value() ,
57 m_Xi2maxNoAdd.value() ,
58 m_maxDoubleHoles.value() ,
59 m_maxHoles.value() ,
60 m_maxPixelHoles.value() ,
61 m_maxSctHoles.value() ,
62 m_maxShared.value() ,
63 m_minClusters.value() ,
64 m_minPixelHits.value() ,
65 m_minSiNotShared.value() ,
66 m_maxHolesGapPattern.value() ,
67 m_maxHolesPattern.value() ,
69 m_minInPixelHits.value(),
70 m_minStripHits.value()};
71
72 // checking if the set of cuts makes sense
73 size_t noOfEtaBins = m_etaBins.size();
74
75 for (setOfCuts& cuts : allCuts) {
76 auto sCode = std::visit([noOfEtaBins] (auto & testingCuts) -> StatusCode {
77
78 if (testingCuts.get().size() == noOfEtaBins)
79 return StatusCode::SUCCESS;
80
81 if (testingCuts.get().size() > noOfEtaBins)
82 return StatusCode::FAILURE;
83
84 if (testingCuts.get().size() < noOfEtaBins)
85 testingCuts.get().resize(noOfEtaBins, testingCuts.get().back());
86
87 return StatusCode::SUCCESS;
88 } , cuts);
89
90 if (sCode.isFailure()) {
91 ATH_MSG_ERROR( "No. of cut values bigger than eta bins");
92 return sCode;
93 }
94 }
95
96 // printing all the cuts
97 ATH_MSG_DEBUG ("--- Dynamic cuts ---");
98 ATH_MSG_DEBUG ("Eta bins (size=" << (m_etaBins.size()) << "): " << m_etaBins);
99 ATH_MSG_DEBUG ("etaWidthBrem: " << m_etaWidthBrem);
100 ATH_MSG_DEBUG ("maxdImpactSSSSeeds: " << m_maxdImpactSSSSeeds);
101 ATH_MSG_DEBUG ("maxDoubleHoles: " << m_maxDoubleHoles);
102 ATH_MSG_DEBUG ("maxHoles: " << m_maxHoles);
103 ATH_MSG_DEBUG ("maxPixelHoles: " << m_maxPixelHoles);
104 ATH_MSG_DEBUG ("maxPrimaryImpact: " << m_maxPrimaryImpact);
105 ATH_MSG_DEBUG ("maxSctHoles: " << m_maxSctHoles);
106 ATH_MSG_DEBUG ("maxShared: " << m_maxShared);
107 ATH_MSG_DEBUG ("maxZImpact: " << m_maxZImpact);
108 ATH_MSG_DEBUG ("minClusters: " << m_minClusters);
109 ATH_MSG_DEBUG ("minInnermostPixelHits: " << m_minInPixelHits);
110 ATH_MSG_DEBUG ("minPixelHits: " << m_minPixelHits);
111 ATH_MSG_DEBUG ("minStripHits: " << m_minStripHits);
112 ATH_MSG_DEBUG ("minPT: " << m_minPT);
113 ATH_MSG_DEBUG ("minPTBrem: " << m_minPTBrem);
114 ATH_MSG_DEBUG ("minSiNotShared: " << m_minSiNotShared);
115 ATH_MSG_DEBUG ("nHolesGapMax: " << m_maxHolesGapPattern);
116 ATH_MSG_DEBUG ("nHolesMax: " << m_maxHolesPattern);
117 ATH_MSG_DEBUG ("nWeightedClustersMin: " << m_nWeightedClustersMin);
118 ATH_MSG_DEBUG ("phiWidthBrem: " << m_phiWidthBrem);
119 ATH_MSG_DEBUG ("Xi2max: " << m_Xi2max);
120 ATH_MSG_DEBUG ("Xi2maxNoAdd: " << m_Xi2maxNoAdd);
121
122 // Initialize maps for navigation
123 m_mapDoubleCuts[InDet::CutName::etaBins] = m_etaBins;
124 m_mapDoubleCuts[InDet::CutName::minPT] = m_minPT;
125 m_mapDoubleCuts[InDet::CutName::maxPrimaryImpact] = m_maxPrimaryImpact;
126 m_mapDoubleCuts[InDet::CutName::maxZImpact] = m_maxZImpact;
127 m_mapDoubleCuts[InDet::CutName::Xi2max] = m_Xi2max;
128 m_mapDoubleCuts[InDet::CutName::Xi2maxNoAdd] = m_Xi2maxNoAdd;
129 m_mapDoubleCuts[InDet::CutName::maxdImpactSSSSeeds] = m_maxdImpactSSSSeeds;
130 m_mapDoubleCuts[InDet::CutName::minPTBrem] = m_minPTBrem;
131 m_mapDoubleCuts[InDet::CutName::etaWidthBrem] = m_etaWidthBrem;
132 m_mapDoubleCuts[InDet::CutName::phiWidthBrem] = m_phiWidthBrem;
133
134 m_mapIntCuts[InDet::CutName::minClusters] = m_minClusters;
135 m_mapIntCuts[InDet::CutName::minSiNotShared] = m_minSiNotShared;
136 m_mapIntCuts[InDet::CutName::maxShared] = m_maxShared;
137 m_mapIntCuts[InDet::CutName::minPixelHits] = m_minPixelHits;
138 m_mapIntCuts[InDet::CutName::maxHoles] = m_maxHoles;
139 m_mapIntCuts[InDet::CutName::maxPixelHoles] = m_maxPixelHoles;
140 m_mapIntCuts[InDet::CutName::maxSctHoles] = m_maxSctHoles;
141 m_mapIntCuts[InDet::CutName::maxDoubleHoles] = m_maxDoubleHoles;
142 m_mapIntCuts[InDet::CutName::maxHolesPattern] = m_maxHolesPattern;
143 m_mapIntCuts[InDet::CutName::maxHolesGapPattern] = m_maxHolesGapPattern;
144 m_mapIntCuts[InDet::CutName::nWeightedClustersMin] = m_nWeightedClustersMin;
145 m_mapIntCuts[InDet::CutName::minInPixelHits] = m_minInPixelHits;
146 m_mapIntCuts[InDet::CutName::minStripHits] = m_minStripHits;
147
148 return StatusCode::SUCCESS;
149 }
150
152 // Finalize
155 return StatusCode::SUCCESS;
156 }
157
158 int
160 double absEta = std::abs(eta);
161 if (absEta > m_etaBins.value().back() || absEta < m_etaBins.value().front()) {
162 ATH_MSG_INFO("Requesting cut value outside of configured eta range: clamping eta="
163 << absEta << " to eta="
164 << std::clamp(absEta, m_etaBins.value().front(), m_etaBins.value().back()));
165 }
166 absEta = std::clamp(absEta, m_etaBins.value().front(), m_etaBins.value().back());
167 const auto pVal = std::lower_bound(m_etaBins.value().begin(), m_etaBins.value().end(), absEta);
168 const int bin = std::distance(m_etaBins.value().begin(), pVal) - 1;
169 ATH_MSG_DEBUG("Checking (abs(eta)/bin) = (" << absEta << "," << bin << ")");
170 return bin;
171 }
172
173
174 void InDetEtaDependentCutsSvc::getValue(const InDet::CutName cutName, std::vector < double >& cuts) {
175 // getting the number of eta bins
176 size_t noOfEtaBins = m_etaBins.size();
177
178 // resize the cuts vector before setting it
179 cuts.resize(noOfEtaBins);
180
181 std::unordered_map< InDet::CutName, std::vector<double> >::iterator it = m_mapDoubleCuts.find(cutName);
182
183 if(it!=m_mapDoubleCuts.end()) cuts = it->second;
184 else ATH_MSG_ERROR("CutName not recognized. Cuts will remain unchanged.");
185
186 }
187
188 void InDetEtaDependentCutsSvc::getValue(const InDet::CutName cutName, std::vector < int >& cuts) {
189
190 // getting the number of eta bins
191 size_t noOfEtaBins = m_etaBins.size();
192
193 // resize the cuts vector before setting it
194 cuts.resize(noOfEtaBins);
195
196 std::unordered_map< InDet::CutName, std::vector<int> >::iterator it = m_mapIntCuts.find(cutName);
197
198 if(it!=m_mapIntCuts.end()) cuts = it->second;
199 else ATH_MSG_ERROR("CutName not recognized. Cuts will remain unchanged.");
200
201 }
202
203
205 return m_etaBins.value().back();
206 }
207
208 double InDetEtaDependentCutsSvc::getMinPtAtEta(const double eta) const {
210 }
211
215
219
222 }
223
227
231
235
239
243
247
251
255
259
263
264} // end namespace
Scalar eta() const
pseudorapidity method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
std::unordered_map< InDet::CutName, std::vector< int > > m_mapIntCuts
T getValueAtEta(const std::vector< T > &cuts, const double eta) const
int getMinSiNotSharedAtEta(const double eta) const override final
std::unordered_map< InDet::CutName, std::vector< double > > m_mapDoubleCuts
int getMinSiHitsAtEta(const double eta) const override final
int getMaxSharedAtEta(const double eta) const override final
int getMaxSctHolesAtEta(const double eta) const override final
void getValue(const InDet::CutName cutName, std::vector< double > &cut) override final
double getMaxChi2AtEta(const double eta) const override final
double getMaxEta() const override final
virtual ~InDetEtaDependentCutsSvc() override final
Destructor:
double getMaxZImpactAtEta(const double eta) const override final
int getMinPixelHitsAtEta(const double eta) const override final
int getIndexByEta(const double eta) const
int getMinInnermostPixelHitsAtEta(const double eta) const override final
int getMinStripHitsAtEta(const double eta) const override final
double getMinPtAtEta(const double eta) const override final
int getMaxPixelHolesAtEta(const double eta) const override final
InDetEtaDependentCutsSvc(const std::string &name, ISvcLocator *sl)
Constructor with parameters:
int getMaxSiHolesAtEta(const double eta) const override final
int getMaxDoubleHolesAtEta(const double eta) const override final
double getMaxPrimaryImpactAtEta(const double eta) const override final
Primary Vertex Finder.