14 using namespace geant_units::operators;
20 const std::vector<std::string>& fvec =
val.strings();
22 throw cms::Exception(
"HcalParametersFromDD") <<
"Failed to get " << s <<
" tag.";
37 throw cms::Exception(
"HcalParametersFromDD") <<
"Failed to get " << s <<
" tag.";
41 int getTopologyMode(
const std::string& s,
bool type) {
58 edm::LogVerbatim(
"HCalGeom") <<
"HcalParametersFromDD::build(const DDCompactView*, HcalParameters&) is called";
66 const int nEtaMax = 100;
69 std::unique_ptr<HcalGeomParameters>
geom = std::make_unique<HcalGeomParameters>();
70 geom->loadGeometry(fv1, php);
71 php.
modHB = geom->getModHalfHBHE(0);
72 php.
modHE = geom->getModHalfHBHE(1);
73 php.
dzVcal = geom->getConstDzHF();
74 geom->getConstRHO(php.
rHO);
82 for (
unsigned int i = 1;
i <= nEtaMax; ++
i) {
83 std::stringstream sstm;
84 sstm <<
"layerGroupSimEta" <<
i;
86 auto const&
v = cpv->
vector(tempName);
109 throw cms::Exception(
"HcalParametersFromDD") <<
"Not found " << attribute.c_str() <<
" but needed.";
112 attribute =
"OnlyForHcalRecNumbering";
118 int topoMode = getTopologyMode(
"TopologyMode", sv,
true);
119 int trigMode = getTopologyMode(
"TriggerMode", sv,
false);
120 php.
topologyMode = ((trigMode & 0xFF) << 8) | (topoMode & 0xFF);
123 for (
unsigned int i = 1;
i <= nEtaMax; ++
i) {
124 std::stringstream sstm;
125 sstm <<
"layerGroupRecEta" <<
i;
127 auto const&
v = cpv->
vector(tempName);
136 throw cms::Exception(
"HcalParametersFromDD") <<
"Not found " << attribute.c_str() <<
" but needed.";
144 edm::LogVerbatim(
"HCalGeom") <<
"HcalParametersFromDD::build(const cms::DDCompactView*, HcalParameters&) is called";
146 const int nEtaMax = 100;
148 std::unique_ptr<HcalGeomParameters>
geom = std::make_unique<HcalGeomParameters>();
149 geom->loadGeometry(cpv, php);
150 php.
modHB = geom->getModHalfHBHE(0);
151 php.
modHE = geom->getModHalfHBHE(1);
152 php.
dzVcal = geom->getConstDzHF();
153 geom->getConstRHO(php.
rHO);
155 php.
phioff = cpv.
get<std::vector<double>>(
"phioff");
156 php.
etaTable = cpv.
get<std::vector<double>>(
"etaTable");
157 php.
rTable = cpv.
get<std::vector<double>>(
"rTable");
158 php.
phibin = cpv.
get<std::vector<double>>(
"phibin");
159 php.
phitable = cpv.
get<std::vector<double>>(
"phitable");
162 php.
etaRange = cpv.
get<std::vector<double>>(
"etaRange");
163 php.
gparHF = cpv.
get<std::vector<double>>(
"gparHF");
165 php.
Layer0Wt = cpv.
get<std::vector<double>>(
"Layer0Wt");
166 php.
HBGains = cpv.
get<std::vector<double>>(
"HBGains");
168 php.
HEGains = cpv.
get<std::vector<double>>(
"HEGains");
170 php.
HFGains = cpv.
get<std::vector<double>>(
"HFGains");
176 for (
unsigned int i = 1;
i <= nEtaMax; ++
i) {
189 std::vector<std::string> tempS = fv.
get<std::vector<std::string>>(
"hcal",
"TopologyMode");
190 std::string sv = (!tempS.empty()) ? tempS[0] :
"HcalTopologyMode::SLHC";
191 int topoMode = getTopologyMode(sv,
true);
192 tempS = fv.
get<std::vector<std::string>>(
"hcal",
"TriggerMode");
193 sv = (!tempS.empty()) ? tempS[0] :
"HcalTopologyMode::TriggerMode_2021";
194 int trigMode = getTopologyMode(sv,
false);
195 php.
topologyMode = ((trigMode & 0xFF) << 8) | (topoMode & 0xFF);
200 for (
unsigned int i = 1;
i <= nEtaMax; ++
i) {
218 for (
unsigned int i = 0;
i < php.
rTable.size(); ++
i) {
219 unsigned int k = php.
rTable.size() -
i - 1;
225 std::stringstream ss0;
226 ss0 <<
"HcalParametersFromDD: MaxDepth[" << php.
maxDepth.size() <<
"]: ";
230 std::stringstream ss1;
231 ss1 <<
"HcalParametersFromDD: ModHB [" << php.
modHB.size() <<
"]: ";
232 for (
const auto& it : php.
modHB)
235 std::stringstream ss2;
236 ss2 <<
"HcalParametersFromDD: ModHE [" << php.
modHE.size() <<
"]: ";
237 for (
const auto& it : php.
modHE)
240 std::stringstream ss3;
241 ss3 <<
"HcalParametersFromDD: " << php.
phioff.size() <<
" phioff values:";
242 std::vector<double>::const_iterator it;
243 for (it = php.
phioff.begin(), i = 0; it != php.
phioff.end(); ++it)
246 std::stringstream ss4;
247 ss4 <<
"HcalParametersFromDD: " << php.
etaTable.size() <<
" entries for etaTable:";
249 ss4 <<
" [" << ++i <<
"] = " << (*it);
251 std::stringstream ss5;
252 ss5 <<
"HcalParametersFromDD: " << php.
rTable.size() <<
" entries for rTable:";
253 for (it = php.
rTable.begin(), i = 0; it != php.
rTable.end(); ++it)
256 std::stringstream ss6;
257 ss6 <<
"HcalParametersFromDD: " << php.
phibin.size() <<
" phibin values:";
258 for (it = php.
phibin.begin(), i = 0; it != php.
phibin.end(); ++it)
261 std::stringstream ss7;
262 ss7 <<
"HcalParametersFromDD: " << php.
phitable.size() <<
" phitable values:";
268 std::vector<int>::const_iterator kt;
270 std::stringstream ss8;
273 ss8 <<
" " << ++i <<
":" << (*kt);
276 std::stringstream ss8;
277 ss8 <<
"HcalParametersFromDD: " << php.
etaMin.size() <<
" etaMin values:";
278 for (kt = php.
etaMin.begin(), i = 0; kt != php.
etaMin.end(); ++kt)
279 ss8 <<
" [" << ++i <<
"] = " << (*kt);
281 std::stringstream ss9;
282 ss9 <<
"HcalParametersFromDD: " << php.
etaMax.size() <<
" etaMax values:";
283 for (kt = php.
etaMax.begin(), i = 0; kt != php.
etaMax.end(); ++kt)
284 ss9 <<
" [" << ++i <<
"] = " << (*kt);
286 std::stringstream ss10;
287 ss10 <<
"HcalParametersFromDD: " << php.
etaRange.size() <<
" etaRange values:";
289 ss10 <<
" [" << ++i <<
"] = " << (*it);
291 std::stringstream ss11;
292 ss11 <<
"HcalParametersFromDD: " << php.
gparHF.size() <<
" gparHF values:";
293 for (it = php.
gparHF.begin(), i = 0; it != php.
gparHF.end(); ++it)
296 std::stringstream ss12;
297 ss12 <<
"HcalParametersFromDD: " << php.
noff.size() <<
" noff values:";
298 for (kt = php.
noff.begin(), i = 0; kt != php.
noff.end(); ++kt)
299 ss12 <<
" [" << ++i <<
"] = " << (*kt);
301 std::stringstream ss13;
302 ss13 <<
"HcalParametersFromDD: " << php.
Layer0Wt.size() <<
" Layer0Wt values:";
304 ss13 <<
" [" << ++i <<
"] = " << (*it);
306 std::stringstream ss14;
307 ss14 <<
"HcalParametersFromDD: " << php.
HBGains.size() <<
" Shift/Gains values for HB:";
308 for (
unsigned k = 0;
k < php.
HBGains.size(); ++
k)
311 std::stringstream ss15;
312 ss15 <<
"HcalParametersFromDD: " << php.
HEGains.size() <<
" Shift/Gains values for HE:";
313 for (
unsigned k = 0;
k < php.
HEGains.size(); ++
k)
316 std::stringstream ss16;
317 ss16 <<
"HcalParametersFromDD: " << php.
HFGains.size() <<
" Shift/Gains values for HF:";
318 for (
unsigned k = 0;
k < php.
HFGains.size(); ++
k)
321 std::stringstream ss17;
322 ss17 <<
"HcalParametersFromDD: " << php.
etagroup.size() <<
" etagroup values:";
324 ss17 <<
" [" << ++i <<
"] = " << (*kt);
326 std::stringstream ss18;
327 ss18 <<
"HcalParametersFromDD: " << php.
phigroup.size() <<
" phigroup values:";
329 ss18 <<
" [" << ++i <<
"] = " << (*kt);
333 std::stringstream ss19;
336 ss19 <<
" " << ++i <<
":" << (*kt);
347 std::for_each(v.begin(), v.end(), [
s](
double&
n) {
n *=
s; });
Log< level::Info, true > LogVerbatim
std::vector< double > etaTable
std::vector< int > etagroup
static std::vector< std::string > checklist log
bool build(const DDCompactView *, HcalParameters &)
std::vector< double > etaRange
T const & get(const std::string &) const
constexpr NumType convertRadToDeg(NumType radians)
std::vector< double > HBGains
std::vector< int > HEShift
Compact representation of the geometrical detector hierarchy.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
std::vector< double > etaTableHF
std::vector< int > etaMax
static constexpr double k_ScaleFromDDDToG4
void rescale(std::vector< double > &, const double s)
std::vector< LayerItem > layerGroupEtaSim
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::vector< double > rHO
std::vector< int > layerGroup
Tan< T >::type tan(const T &t)
std::vector< double > const & vector(std::string_view iKey) const
returns an empty container if not found
std::vector< int > HFShift
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
std::vector< double > HEGains
T get(const std::string &)
extract attribute value
std::vector< double > phioff
std::vector< double > gparHF
DDsvalues_type mergedSpecifics() const
std::vector< double > Layer0Wt
std::vector< double > rTable
std::vector< double > phitable
std::vector< double > phibin
std::vector< LayerItem > layerGroupEtaRec
bool firstChild()
set the current node to the first child ...
std::vector< T > getVector(const std::string &) const
std::vector< double > HFGains
constexpr NumType convertMmToCm(NumType millimeters)
std::vector< int > HBShift
std::vector< int > maxDepth
std::vector< int > phigroup
static constexpr double k_ScaleFromDD4hepToG4
std::vector< int > etaMin
T parseString(const std::string &value)