12 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDSimConstants::HcalDDDSimConstants (const HcalParameters* hp) constructor";
18 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDSimConstants: " << cellTypes.size() <<
" cells of type HCal (All)";
29 const int& idet,
const int&
zside,
const int&
depth,
const int& etaR,
const int&
iphi)
const {
39 double eta = 0, deta = 0,
phi = 0, dphi = 0, rz = 0, drz = 0;
40 bool ok =
false, flagrz =
true;
43 etaR >= etaMn && etaR <= etaMx && depth > 0)
60 }
else if (idet == static_cast<int>(
HcalEndcap)) {
69 phi = -fioff + (
iphi - 0.5) * fibin;
73 if (ir > 0 && ir <
nR) {
79 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDSimConstants: wrong eta " << etaR <<
" (" << ir <<
"/" <<
nR 80 <<
") Detector " << idet;
83 }
else if (etaR <=
nEta) {
85 if (idet == static_cast<int>(
HcalOuter)) {
88 laymax = (
static_cast<int>(
hpar->
zHE.size()));
90 double d1 = 0, d2 = 0;
100 drz = 0.5 * (d2 -
d1);
103 edm::LogWarning(
"HCalGeom") <<
"HcalDDDSimConstants: wrong depth " <<
depth <<
" or etaR " << etaR
104 <<
" for detector " << idet;
114 <<
"phi " << idet <<
"/" <<
zside <<
"/" <<
depth <<
"/" << etaR <<
"/" <<
iphi 115 <<
" Cell Flag " <<
tmp.ok <<
" " <<
tmp.eta <<
" " <<
tmp.deta <<
" phi " <<
tmp.phi
116 <<
" " <<
tmp.dphi <<
" r(z) " <<
tmp.rz <<
" " <<
tmp.drz <<
" " <<
tmp.flagrz;
122 const int& det,
const int&
eta,
const int&
phi,
const int&
zside,
const int& lay)
const {
128 const std::vector<HcalParameters::LayerItem>& layerGroup)
const {
140 std::vector<std::pair<double, double> > gcons;
142 for (
unsigned int i = 0;
i <
hpar->
rHB.size(); ++
i) {
146 for (
unsigned int i = 0;
i <
hpar->
zHE.size(); ++
i) {
165 std::vector<int> phis;
168 int zside = (phis[0] > 0) ? 1 : -1;
169 int iphi = (phis[0] > 0) ? phis[0] : -phis[0];
171 if (det == 1 && depthsp >
depth)
173 if (det == 2 && depthsp <
depth)
188 if (
i == 0 && planOne) {
189 std::vector<int> phis;
192 int zside = (phis[0] > 0) ? 1 : -1;
193 int iphi = (phis[0] > 0) ? phis[0] : -phis[0];
203 int hsubdet(0),
ieta(0);
205 double heta = fabs(
eta);
211 (ieta <= hpar->
etaMax[1])) {
219 double theta = 2. * atan(
exp(-heta));
221 etaR = (
eta >= 0. ? hR : -hR);
223 return std::pair<int, double>(hsubdet, etaR);
230 for (
int i =
nR - 1;
i > 0;
i--)
231 if (hetaR < hpar->rTable[
i])
235 for (
int i = 0;
i <
nEta - 1;
i++)
245 }
else if (det == static_cast<int>(
HcalEndcap)) {
246 if (ieta <= hpar->
etaMin[1])
254 const int& det,
int etaR,
const int&
phi,
const int&
zside,
int depth,
const int& lay)
const {
256 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDEsimConstants:getEtaDepth: I/P " << det <<
":" << etaR <<
":" <<
phi <<
":" 260 if ((det == static_cast<int>(
HcalEndcap)) && (etaR == 17) && (lay == 1))
263 }
else if (det == static_cast<int>(
HcalOuter)) {
268 if (((det == 2) && (etaR == 18)) || ((det == 1) && (etaR == 15)))
269 if (etaR ==
hpar->
noff[0] && lay > 1) {
271 kphi = (kphi - 1) % 4 + 1;
272 if (kphi == 2 || kphi == 3)
275 }
else if (det == static_cast<int>(
HcalBarrel)) {
294 return std::pair<int, int>(etaR,
depth);
299 double eta = fabs(etaR);
304 if (eta <= hpar->etaTable[10])
307 if (eta <= hpar->etaTable[4])
370 const int& det,
const int&
eta,
const int&
phi,
const int&
zside,
const int&
depth)
const {
373 if (det == 1 || det == 2) {
389 const int& det,
const int&
eta,
const int&
phi,
const int&
zside,
const int&
depth)
const {
392 if (det == 1 || det == 2) {
408 const int& det,
const int&
eta,
const int&
phi,
const int&
zside,
const bool& partialDetOnly)
const {
410 if (partialDetOnly) {
414 }
else if (det == 1 || det == 2) {
423 }
else if (det == 3) {
425 }
else if (det == 4) {
434 const int& det,
const int&
eta,
const int&
phi,
const int&
zside,
const bool& partialDetOnly)
const {
436 if (partialDetOnly) {
440 }
else if (det == 3) {
442 }
else if (det == 4) {
449 unsigned int type = (det == 1) ? 0 : 1;
468 double fioff(0), fibin(0);
483 return std::pair<double, double>(fioff, fibin);
487 std::vector<std::pair<int, double> > phis;
489 std::pair<double, double> ficons =
getPhiCons(subdet, ietaAbs);
490 int nphi =
int((2._pi + 0.1 * ficons.second) / ficons.second);
492 for (
int ifi = 0; ifi <
nphi; ++ifi) {
493 double phi = -ficons.first + (ifi + 0.5) * ficons.second;
495 phis.emplace_back(std::pair<int, double>(
iphi,
phi));
498 edm::LogVerbatim(
"HCalGeom") <<
"getPhis: subdet|ieta|iphi " << subdet <<
"|" <<
ieta <<
" with " << phis.size()
500 for (
unsigned int k = 0;
k < phis.size(); ++
k)
510 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDSimConstants: " << cellTypes.size() <<
" cells of type HCal Barrel";
511 for (
unsigned int i = 0;
i < cellTypes.size();
i++)
517 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDSimConstants: " << hoCells.size() <<
" cells of type HCal Outer";
518 for (
unsigned int i = 0;
i < hoCells.size();
i++)
521 cellTypes.insert(cellTypes.end(), hoCells.begin(), hoCells.end());
525 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDSimConstants: " << heCells.size() <<
" cells of type HCal Endcap";
526 for (
unsigned int i = 0;
i < heCells.size();
i++)
529 cellTypes.insert(cellTypes.end(), heCells.begin(), heCells.end());
533 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDSimConstants: " << hfCells.size() <<
" cells of type HCal Forward";
534 for (
unsigned int i = 0;
i < hfCells.size();
i++)
537 cellTypes.insert(cellTypes.end(), hfCells.begin(), hfCells.end());
545 std::vector<HcalCellType> cellTypes;
551 int dmin, dmax, indx, nz;
580 dmin = dmax = depthl;
583 int phi = (indx == 2) ? 3 : 1;
586 int subdet0 =
static_cast<int>(subdet);
596 for (
int eta = ietamin;
eta <= ietamax;
eta++) {
597 for (
int iz = 0; iz < nz; ++iz) {
598 int zside = -2 * iz + 1;
601 std::vector<std::pair<int, double> > phis =
getPhis(subdet0,
eta);
604 std::vector<int> phiMiss2;
611 for (
int miss = 0; miss <
hpar->
noff[5 + iz]; miss++) {
627 temp2.
setPhi(phis, phiMiss2, fioff, dphi,
unit);
628 cellTypes.emplace_back(temp2);
632 std::vector<int> phiMiss3;
633 for (
auto&
phi : phis) {
642 phiMiss3.emplace_back(
phi.first);
647 temp3.
setPhi(phis, phiMiss2, fioff, dphi,
unit);
648 cellTypes.emplace_back(temp3);
662 if ((
eta ==
k.ieta()) && (
iphi ==
k.iphi())) {
674 unsigned int num = 0;
676 for (
auto& cellType : cellTypes) {
677 num +=
static_cast<unsigned int>(cellType.nPhiBins());
680 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDSimConstants:numberOfCells " << cellTypes.size() <<
" " <<
num 681 <<
" for subdetector " << subdet;
689 iphi_skip = (
phi - 1) * 2 + 1;
691 iphi_skip = (
phi - 1) * 4 - 1;
698 std::vector<int> phis;
700 int kphi = (detsp > 0) ? phis[0] : 1;
701 int zside = (kphi > 0) ? 1 : -1;
702 int iphi = (kphi > 0) ? kphi : -kphi;
736 const double fiveDegInRad = 2 *
M_PI / 72;
737 int units =
int(dphi / fiveDegInRad + 0.5);
750 for (
int i = 0;
i <
nEta - 1; ++
i) {
751 edm::LogVerbatim(
"HCalGeom") <<
"HcalDDDSimConstants:Read LayerGroup" <<
i <<
":";
769 for (
int i = 0;
i <
nEta - 1; ++
i) {
771 int laymax = (imx > 0) ?
layerGroup(
i, imx - 1) : 0;
772 if (i < hpar->
etaMax[0]) {
773 int laymax0 = (imx > 16) ?
layerGroup(
i, 16) : laymax;
785 for (
int i = 0;
i < 4; ++
i)
791 for (
int i = 0;
i < maxdepth; ++
i) {
792 for (
int k = 0;
k <
nEta - 1; ++
k) {
795 for (
int l = layermx - 1;
l >= 0; --
l) {
806 for (
int k = 0;
k <
nEta - 1; ++
k)
817 <<
nmodHE <<
" endcap half-sectors";
822 for (
int k = 0;
k < 4; ++
k)
835 for (
int i = 0;
i < 4; ++
i)
837 for (
unsigned int i = 0;
i <
hpar->
zHO.size(); ++
i)
842 int noffl(noffsize + 5);
843 if (static_cast<int>(
hpar->
noff.size()) > (noffsize + 3)) {
848 if (static_cast<int>(
hpar->
noff.size()) > (noffsize + 4)) {
849 noffl += (2 *
hpar->
noff[noffsize + 4]);
850 if (static_cast<int>(
hpar->
noff.size()) > noffl)
866 if (static_cast<int>(
hpar->
noff.size()) > (noffsize + 4)) {
867 int npair =
hpar->
noff[noffsize + 4];
868 int kk = noffsize + 4;
869 for (
int k = 0;
k < npair; ++
k) {
898 int noffk(noffsize + 5);
899 if (static_cast<int>(
hpar->
noff.size()) > (noffsize + 5)) {
900 noffk += (2 *
hpar->
noff[noffsize + 4]);
901 if (static_cast<int>(
hpar->
noff.size()) >= noffk + 7) {
907 double wt = 0.1 * (
hpar->
noff[noffk + 6]);
908 if (static_cast<int>(
hpar->
noff.size()) >= (noffk + 7 +
nphi + 3 * ndeps)) {
910 std::vector<int> ifi, iet, ily, idp;
912 ifi.emplace_back(
hpar->
noff[noffk + 7 +
i]);
913 for (
int i = 0;
i < ndeps; ++
i) {
925 for (
int i = 0;
i < ndeps; ++
i)
931 int zside = (ifi[0] > 0) ? 1 : -1;
932 int iphi = (ifi[0] > 0) ? ifi[0] : -ifi[0];
936 int noffm = (noffk + 7 +
nphi + 3 * ndeps);
937 if (static_cast<int>(
hpar->
noff.size()) > noffm) {
939 if (ndnext > 4 && static_cast<int>(
hpar->
noff.size()) >= noffm + ndnext) {
940 for (
int i = 0;
i < 2; ++
i)
942 for (
int i = 0;
i < 3; ++
i)
945 if (ndnext > 11 && static_cast<int>(
hpar->
noff.size()) >= noffm + ndnext) {
946 for (
int i = 0;
i < 3; ++
i)
948 for (
int i = 0;
i < 4; ++
i)
983 if (ir > 0 && ir <
nR) {
990 if (etaR > 0 && etaR <
nEta) {
993 }
else if (det == static_cast<int>(
HcalOuter)) {
996 }
else if (etaR ==
hpar->
noff[2] + 1) {
1000 }
else if (etaR ==
hpar->
noff[3] + 1) {
1020 if (ir > 0 && ir <
nR) {
1027 if (etaR > 0 && etaR <
nEta) {
1030 }
else if (det == static_cast<int>(
HcalOuter)) {
1033 }
else if (etaR ==
hpar->
noff[2] + 1) {
1035 }
else if (etaR ==
hpar->
noff[3]) {
1037 }
else if (etaR ==
hpar->
noff[3] + 1) {
1108 double thetaL = 2. * atan(
exp(-etaL));
1110 double thetaH = 2. * atan(
exp(-etaH));
1116 for (
int lay = layL - 1; lay < layH; ++lay) {
1117 std::vector<double>
area(2, 0);
1120 for (
unsigned int k = 0;
k <
hpar->
layHB.size(); ++
k) {
1134 edm::LogVerbatim(
"HCalGeom") << std::setw(2) << lay <<
" Area " << std::setw(8) <<
area[0] <<
" " << std::setw(8)
1142 double thetaL = 2. * atan(
exp(-etaL));
1144 double thetaH = 2. * atan(
exp(-etaH));
1153 <<
":" << layH - 1 <<
" phi " <<
nphi;
1154 for (
int lay = layL - 1; lay < layH; ++lay) {
1155 std::vector<double>
area(4, 0);
1158 for (
unsigned int k = 0;
k <
hpar->
layHE.size(); ++
k) {
1162 if ((lay != 0 ||
eta == 18) &&
1168 double dx1 = rmin *
std::tan(phib);
1169 double dx2 = rmax *
std::tan(phib);
1170 double ar1 = 0, ar2 = 0;
1172 ar1 = 0.5 * (rmax - rmin) * (dx1 + dx2 - 4. *
hpar->
dx1HE[
k]);
1175 ar1 = 0.5 * (rmax - rmin) * (dx1 + dx2 - 2. *
hpar->
dx1HE[
k]);
1176 ar2 = 0.5 * (rmax - rmin) * ((rmax + rmin) *
tan(10._deg) - 4 *
hpar->
dx1HE[
k]) - ar1;
1177 mean += (ar1 + ar2);
1191 edm::LogVerbatim(
"HCalGeom") << std::setw(2) << lay0 <<
" Area " << std::setw(8) <<
area[0] <<
" " 1192 << std::setw(8) <<
area[1] <<
" Mean " <<
mean;
1195 edm::LogVerbatim(
"HCalGeom") << std::setw(2) << lay0 <<
" Area " << std::setw(8) <<
area[0] <<
" " 1196 << std::setw(8) <<
area[1] <<
":" << std::setw(8) <<
area[2] <<
" " << std::setw(8)
1206 if (it.layer == static_cast<unsigned int>(
eta + 1)) {
1207 return it.layerGroup.size();
1209 if (it.layer > static_cast<unsigned int>(
eta + 1))
1211 k = it.layerGroup.size();
1219 if (it.layer == static_cast<unsigned int>(
eta + 1)) {
1220 return it.layerGroup.at(
i);
1222 if (it.layer > static_cast<unsigned int>(
eta + 1))
1224 k = it.layerGroup.at(
i);
1231 unsigned int depth = (depth0 > 0) ? static_cast<unsigned int>(depth0) :
layerGroup(
eta - 1, lay);
double getLayer0Wt(const int subdet, const int iphi, const int zside) const
HcalCellType::HcalCell cell(const int &det, const int &zside, const int &depth, const int &etaR, const int &iphi) const
Log< level::Info, true > LogVerbatim
int getEta(const int &det, const int &lay, const double &hetaR) const
std::vector< double > zHO
std::vector< double > etaTable
int getFrontLayer(const int &det, const int &eta) const
int getDepth(const int subdet, const int ieta, const int iphi, const int zside, const int layer) const
double getEtaHO(const double &etaR, const double &x, const double &y, const double &z) const
unsigned int findLayer(const int &layer, const std::vector< HcalParameters::LayerItem > &layerGroup) const
void initialize(const int subdet, const int ietaMax, const int dep16C, const int dep29C, const double wtl0C, std::vector< int > const &iphi, std::vector< int > const &ieta, std::vector< int > const &layer, std::vector< int > const &depth)
std::vector< int > maxDepth
std::vector< double > rHB
bool isValid(const int det, const int phi, const int zside) const
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
int getDepthEta29M(const int &i, const bool &planOne) const
constexpr NumType convertRadToDeg(NumType radians)
std::vector< double > rhoxHB
int maxHFDepth(const int &ieta, const int &iphi) const
Sin< T >::type sin(const T &t)
static const int maxLayer_
std::vector< double > HBGains
int getLayerFront(const int subdet, const int ieta, const int iphi, const int zside, const int depth) const
std::pair< int, int > depthMaxDf_
int getDepthEta29(const int &phi, const int &zside, const int &i) const
std::vector< int > HEShift
double deltaEta(const int &det, const int &eta, const int &depth) const
double getLayer0Wt(const int &det, const int &phi, const int &zside) const
std::pair< double, double > getPhiCons(const int &det, const int &ieta) const
HcalDDDSimConstants(const HcalParameters *hp)
double getGain(const HcalSubdetector &subdet, const int &depth) const
std::pair< int, double > getDetEta(const double &eta, const int &depth) const
int getDepthEta16M(const int &det) const
unsigned int numberOfCells(const HcalSubdetector &) const
std::vector< int > etaMax
std::vector< int > depths[nDepthMax]
int phiNumber(const int &phi, const int &unit) const
std::vector< double > rhoxHE
U second(std::pair< T, U > const &p)
std::vector< double > zxHE
std::vector< double > zHE
std::vector< LayerItem > layerGroupEtaSim
unsigned int layerGroupSize(int eta) const
std::vector< double > dyHE
void setPhi(const std::vector< std::pair< int, double >> &phis, const std::vector< int > &iphiMiss, double foff, double dphi, int unit)
std::pair< int, int > getEtaDepth(const int &det, int etaR, const int &phi, const int &zside, int depth, const int &lay) const
int getMaxDepthLastHE(const int subdet, const int iphi, const int zside) const
std::vector< double > dx1HE
std::vector< double > rHO
std::pair< int, int > getDepths(const int eta) const
std::vector< double > dzHE
std::vector< std::pair< double, double > > getConstHBHE(const int &type) const
std::pair< int, int > depthMaxSp_
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
std::vector< HcalCellType > HcalCellTypes() const
std::vector< std::pair< int, double > > getPhis(const int &subdet, const int &ieta) const
std::vector< HcalDetId > idHF2QIE
std::vector< int > HFShift
int findDepth(const int &det, const int &eta, const int &phi, const int &zside, const int &lay) const
Basic3DVector unit() const
int unitPhi(const int &det, const int &etaR) const
int getLayerBack(const int subdet, const int ieta, const int iphi, const int zside, const int depth) const
int getLayerBack(const int &det, const int &eta, const int &phi, const int &zside, const int &depth) const
std::vector< double > HEGains
int getLayerFront(const int &det, const int &eta, const int &phi, const int &zside, const int &depth) const
std::vector< double > dyHB
std::vector< double > phioff
std::vector< double > gparHF
void printTileHE(const int &eta, const int &phi, const int &zside, const int &depth) const
int getMinDepth(const int &det, const int &eta, const int &phi, const int &zside, const bool &partialOnly) const
std::vector< double > Layer0Wt
std::vector< double > dxHB
void printTileHB(const int &eta, const int &phi, const int &zside, const int &depth) const
std::vector< double > rTable
std::vector< double > phitable
std::pair< int, int > getModHalfHBHE(const int &type) const
TString units(TString variable, Char_t axis)
int getDepthMax(const int subdet, const int iphi, const int zside) const
std::vector< double > phibin
std::vector< double > drHB
std::vector< double > HFGains
static unsigned int const shift
unsigned int layerGroup(int eta, int i) const
std::vector< int > HBShift
int getDepth16(const int subdet, const int iphi, const int zside) const
Log< level::Warning, false > LogWarning
const HcalParameters * hpar
std::vector< int > maxDepth
static constexpr float d1
int getMaxDepth(const int &type) const
int getLastLayer(const int &det, const int &eta) const
int getLayerMax(const int &eta, const int &depth) const
Geom::Theta< T > theta() const
static const int maxLayerHB_
int validDet(std::vector< int > &phis) const
int getDepthEta16(const int &det, const int &phi, const int &zside) const
std::vector< int > etaMin
int getShift(const HcalSubdetector &subdet, const int &depth) const