29 if (
nullptr == hcalGeometry->
parMgr())
33 std::cout <<
"FlexiGeometryLoader initialize with ncells " << fTopology.
ncells() <<
" and shapes " 35 <<
isBH_ << std::endl;
55 std::vector<HcalFlexiHardcodeGeometryLoader::HBHOCellParameters>
result;
56 std::vector<std::pair<double, double> > gconsHB = hcons.
getConstHBHE(0);
60 std::cout <<
"FlexiGeometryLoader called for " << etabins.size() <<
" Eta Bins" << std::endl;
61 for (
unsigned int k = 0;
k < gconsHB.size(); ++
k) {
62 std::cout <<
"gconsHB[" <<
k <<
"] = " << gconsHB[
k].first <<
" +- " << gconsHB[
k].second << std::endl;
65 for (
auto& etabin : etabins) {
66 int iring = (etabin.zside >= 0) ? etabin.ieta : -etabin.ieta;
67 int depth = etabin.depthStart;
69 (etabin.phis.size() > 1) ? (etabin.phis[1].second - etabin.phis[0].second) : ((2.0 *
M_PI) /
MAX_HCAL_PHI);
70 for (
unsigned int k = 0;
k < etabin.layer.size(); ++
k) {
71 int layf = etabin.layer[
k].first - 1;
72 int layl = etabin.layer[
k].second - 1;
73 double rmin = gconsHB[layf].first - gconsHB[layf].second;
74 double rmax = gconsHB[layl].first + gconsHB[layl].second;
75 for (
unsigned int j = 0;
j < etabin.phis.size(); ++
j) {
77 std::cout <<
"HBRing " << iring <<
" eta " << etabin.etaMin <<
":" << etabin.etaMax <<
" depth " <<
depth 78 <<
" R " << rmin <<
":" << rmax <<
" Phi " << etabin.phis[
j].first <<
":" << etabin.phis[
j].second
79 <<
":" << dphi <<
" layer[" <<
k <<
"]: " << etabin.layer[
k].first - 1 <<
":" 80 << etabin.layer[
k].second << std::endl;
83 iring,
depth, etabin.phis[
j].first, etabin.phis[
j].second, dphi, rmin, rmax, etabin.etaMin, etabin.etaMax));
93 const double HORMIN0 = 390.0;
94 const double HORMIN1 = 412.6;
95 const double HORMAX = 413.6;
96 const int nCells = 15;
98 const double etamin[nCells] = {
99 0.000, 0.087, 0.174, 0.261, 0.3395, 0.435, 0.522, 0.609, 0.696, 0.783, 0.873, 0.957, 1.044, 1.131, 1.218};
100 const double etamax[nCells] = {
101 0.087, 0.174, 0.261, 0.3075, 0.435, 0.522, 0.609, 0.696, 0.783, 0.8494, 0.957, 1.044, 1.131, 1.218, 1.305};
102 std::vector<HcalFlexiHardcodeGeometryLoader::HBHOCellParameters>
result;
103 result.reserve(nCells * nPhi);
104 double dphi = ((2.0 *
M_PI) / nPhi);
105 for (
int i = 0;
i < nCells; ++
i) {
106 double rmin = ((
i < 4) ? HORMIN0 : HORMIN1);
107 for (
int iside = -1; iside <= 1; iside += 2) {
108 for (
int j = 0;
j <
nPhi; ++
j) {
109 double phi = (
j + 0.5) * dphi;
112 iside * (
i + 1), 4,
j + 1, phi, dphi, rmin, HORMAX, etamin[
i], etamax[i]));
123 HcalGeometry* fGeometry,
const std::vector<HcalFlexiHardcodeGeometryLoader::HBHOCellParameters>& fCells,
bool fHB) {
125 for (
const auto& param : fCells) {
127 float phiCenter = param.phi;
128 float etaCenter = 0.5 * (param.etaMin + param.etaMax);
129 float x = param.rMin *
cos(phiCenter);
130 float y = param.rMin *
sin(phiCenter);
131 float z = (param.ieta < 0) ? -(param.rMin * sinh(etaCenter)) : (param.rMin * sinh(etaCenter));
134 std::vector<CCGFloat> cellParams;
135 cellParams.reserve(5);
136 cellParams.emplace_back(0.5 * (param.etaMax - param.etaMin));
137 cellParams.emplace_back(0.5 * param.dphi);
138 cellParams.emplace_back(0.5 * (param.rMax - param.rMin) * cosh(etaCenter));
139 cellParams.emplace_back(fabs(refPoint.
eta()));
140 cellParams.emplace_back(fabs(refPoint.
z()));
142 std::cout <<
"HcalFlexiHardcodeGeometryLoader::fillHBHO-> " << hid <<
" " << hid.
rawId() <<
" " << std::hex
143 << hid.
rawId() <<
std::dec <<
" " << hid <<
" " << refPoint <<
'/' << cellParams[0] <<
'/' 144 << cellParams[1] <<
'/' << cellParams[2] << std::endl;
157 std::vector<HcalFlexiHardcodeGeometryLoader::HECellParameters>
result;
158 std::vector<std::pair<double, double> > gconsHE = hcons.
getConstHBHE(1);
160 std::cout <<
"HcalFlexiHardcodeGeometryLoader:HE with " << gconsHE.size() <<
" cells" << std::endl;
162 if (!gconsHE.empty()) {
166 std::cout <<
"FlexiGeometryLoader called for HE with " << etabins.size() <<
" Eta Bins and " << gconsHE.size()
167 <<
" depths" << std::endl;
168 for (
unsigned int i = 0;
i < gconsHE.size(); ++
i)
172 for (
auto& etabin : etabins) {
173 int iring = (etabin.zside >= 0) ? etabin.ieta : -etabin.ieta;
174 int depth = etabin.depthStart;
176 (etabin.phis.size() > 1) ? (etabin.phis[1].second - etabin.phis[0].second) : ((2.0 *
M_PI) /
MAX_HCAL_PHI);
178 std::cout <<
"FlexiGeometryLoader::Ring " << iring <<
" nphi " << etabin.phis.size() <<
" dstart " <<
depth 179 <<
" dphi " << dphi <<
" layers " << etabin.layer.size() << std::endl;
180 for (
unsigned int j = 0;
j < etabin.phis.size(); ++
j)
181 std::cout <<
" [" <<
j <<
"] " << etabin.phis[
j].first <<
":" << etabin.phis[
j].second;
184 for (
unsigned int k = 0;
k < etabin.layer.size(); ++
k) {
185 int layf = etabin.layer[
k].first - 1;
186 int layl = etabin.layer[
k].second - 1;
187 double zmin = gconsHE[layf].first - gconsHE[layf].second;
188 double zmax = gconsHE[layl].first + gconsHE[layl].second;
190 for (
int k2 = layf; k2 <= layl; ++k2) {
191 if (gconsHE[k2].
first > 10) {
192 zmin = gconsHE[k2].first - gconsHE[k2].second;
199 for (
unsigned int j = 0;
j < etabin.phis.size(); ++
j) {
201 std::cout <<
"HERing " << iring <<
" eta " << etabin.etaMin <<
":" << etabin.etaMax <<
" depth " <<
depth 202 <<
" Z " << zmin <<
":" << zmax <<
" Phi :" << etabin.phis[
j].first <<
":" << etabin.phis[
j].second
203 <<
":" << dphi <<
" layer[" <<
k <<
"]: " << etabin.layer[
k].first - 1 <<
":" 204 << etabin.layer[
k].second - 1 << std::endl;
207 iring,
depth, etabin.phis[
j].first, etabin.phis[
j].second, dphi, zmin, zmax, etabin.etaMin, etabin.etaMax));
218 const double HEZMIN_H2 = 400.715;
219 const double HEZMID_H2 = 436.285;
220 const double HEZMAX_H2 = 541.885;
221 const int nEtas = 10;
222 const int nDepth[nEtas] = {1, 2, 2, 2, 2, 2, 2, 2, 3, 3};
223 const int dStart[nEtas] = {3, 1, 1, 1, 1, 1, 1, 1, 1, 1};
224 const int nPhis[nEtas] = {8, 8, 8, 8, 8, 8, 4, 4, 4, 4};
225 const double etas[nEtas + 1] = {1.305, 1.373, 1.444, 1.521, 1.603, 1.693, 1.790, 1.880, 1.980, 2.090, 2.210};
226 const double zval[4 * nEtas] = {
227 409.885, 462.685, 0., 0., HEZMIN_H2, 427.485, 506.685, 0.0, HEZMIN_H2, HEZMID_H2,
228 524.285, 0., HEZMIN_H2, HEZMID_H2, HEZMAX_H2, 0., HEZMIN_H2, HEZMID_H2, HEZMAX_H2, 0.,
229 HEZMIN_H2, HEZMID_H2, HEZMAX_H2, 0., HEZMIN_H2, HEZMID_H2, HEZMAX_H2, 0., HEZMIN_H2, HEZMID_H2,
230 HEZMAX_H2, 0., HEZMIN_H2, 418.685, HEZMID_H2, HEZMAX_H2, HEZMIN_H2, 418.685, HEZMID_H2, HEZMAX_H2};
231 std::vector<HcalFlexiHardcodeGeometryLoader::HECellParameters>
result;
233 for (
int i = 0;
i < nEtas; ++
i) {
235 for (
int k = 0;
k < nDepth[
i]; ++
k) {
237 for (
int j = 0;
j < nPhis[
i]; ++
j) {
238 int iphi = (nPhis[
i] == 8) ? (
j + 1) : (2 *
j + 1);
240 double phi0 = (
j + 0.5) * dphi;
243 ieta, depth, iphi, phi0, dphi, zval[4 *
i + k + 1], zval[4 *
i + k + 2], etas[
i], etas[i + 1]));
253 const float HFZMIN1 = 1115.;
254 const float HFZMIN2 = 1137.;
255 const float HFZMAX = 1280.1;
257 unsigned int nCells = cells.size();
258 std::vector<HcalFlexiHardcodeGeometryLoader::HFCellParameters>
result;
259 result.reserve(nCells);
260 for (
unsigned int i = 0;
i < nCells; ++
i) {
266 5 * cells[
i].stepPhi,
271 result.emplace_back(cell1);
277 5 * cells[
i].stepPhi,
282 result.emplace_back(cell2);
288 HcalGeometry* fGeometry,
const std::vector<HcalFlexiHardcodeGeometryLoader::HECellParameters>& fCells) {
290 for (
const auto& param : fCells) {
292 float phiCenter = param.phi;
293 float etaCenter = 0.5 * (param.etaMin + param.etaMax);
294 int iside = (param.ieta >= 0) ? 1 : -1;
295 float z = (
isBH_) ? (iside * 0.5 * (param.zMin + param.zMax)) : (iside * param.zMin);
297 float x = perp *
cos(phiCenter);
298 float y = perp *
sin(phiCenter);
301 std::vector<CCGFloat> cellParams;
302 cellParams.reserve(5);
303 cellParams.emplace_back(0.5 * (param.etaMax - param.etaMin));
304 cellParams.emplace_back(0.5 * param.dphi);
305 cellParams.emplace_back(-0.5 * (param.zMax - param.zMin) / tanh(etaCenter));
306 cellParams.emplace_back(fabs(refPoint.
eta()));
307 cellParams.emplace_back(fabs(refPoint.
z()));
309 std::cout <<
"HcalFlexiHardcodeGeometryLoader::fillHE-> " << hid <<
" " << hid.
rawId() <<
" " << std::hex
310 << hid.
rawId() <<
std::dec <<
" " << hid << refPoint <<
'/' << cellParams[0] <<
'/' << cellParams[1]
311 <<
'/' << cellParams[2] << std::endl;
322 HcalGeometry* fGeometry,
const std::vector<HcalFlexiHardcodeGeometryLoader::HFCellParameters>& fCells) {
324 for (
const auto& param : fCells) {
326 int iPhi = param.phiFirst +
kPhi * param.phiStep;
332 float iEta = inner.
eta();
333 float oEta = outer.
eta();
334 float etaCenter = 0.5 * (iEta + oEta);
336 float perp = param.zMin / sinh(etaCenter);
337 float x = perp *
cos(phiCenter);
338 float y = perp *
sin(phiCenter);
339 float z = (param.eta > 0) ? param.zMin : -param.zMin;
342 std::vector<CCGFloat> cellParams;
343 cellParams.reserve(5);
344 cellParams.emplace_back(0.5 * (iEta - oEta));
345 cellParams.emplace_back(0.5 * param.dphi *
DEGREE2RAD);
346 cellParams.emplace_back(0.5 * (param.zMax - param.zMin));
347 cellParams.emplace_back(fabs(refPoint.eta()));
348 cellParams.emplace_back(fabs(refPoint.z()));
350 std::cout <<
"HcalFlexiHardcodeGeometryLoader::fillHF-> " << hid <<
" " << hid.
rawId() <<
" " << std::hex
351 << hid.
rawId() <<
std::dec <<
" " << hid <<
" " << refPoint <<
'/' << cellParams[0] <<
'/' 352 << cellParams[1] <<
'/' << cellParams[2] << std::endl;
unsigned int getHFSize() const
std::vector< HFCellParameters > makeHFCells(const HcalDDDRecConstants &hcons)
Sin< T >::type sin(const T &t)
unsigned int numberOfShapes() const override
constexpr uint32_t rawId() const
get the raw id
std::vector< HECellParameters > makeHECells_H2()
void allocatePar(ParVec::size_type n, unsigned int m)
std::vector< HBHOCellParameters > makeHBCells(const HcalDDDRecConstants &hcons)
HcalTopologyMode::Mode mode() const
U second(std::pair< T, U > const &p)
void newCellFast(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
std::vector< HcalEtaBin > getEtaBins(const int &itype) const
std::vector< HBHOCellParameters > makeHOCells()
Cos< T >::type cos(const T &t)
std::vector< HFCellParameters > getHFCellParameters() const
Abs< T >::type abs(const T &t)
CaloCellGeometry::CCGFloat CCGFloat
void fillHE(HcalGeometry *fGeometry, const std::vector< HECellParameters > &fCells)
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
std::vector< HECellParameters > makeHECells(const HcalDDDRecConstants &hcons)
CaloCellGeometry::CornersMgr * cornersMgr()
void increaseReserve(unsigned int extra)
T perp() const
Magnitude of transverse component.
void fillHBHO(HcalGeometry *fGeometry, const std::vector< HBHOCellParameters > &fCells, bool fHB)
CaloSubdetectorGeometry * load(const HcalTopology &fTopology, const HcalDDDRecConstants &hcons)
unsigned int ncells() const override
return a count of valid cells (for dense indexing use)
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
HcalFlexiHardcodeGeometryLoader()
void fillHF(HcalGeometry *fGeometry, const std::vector< HFCellParameters > &fCells)
std::vector< std::pair< double, double > > getConstHBHE(const int &type) const