6 #include "CLHEP/Units/GlobalPhysicalConstants.h"
7 #include "CLHEP/Units/GlobalSystemOfUnits.h"
17 if( it.layer == eta + 1 )
19 return it.layerGroup.size();
21 if( it.layer > eta + 1 )
23 k = it.layerGroup.size();
34 if( it.layer == eta + 1 )
36 return it.layerGroup.at( i );
38 if( it.layer > eta + 1 )
41 k = it.layerGroup.at( i );
49 edm::LogInfo(
"HCalGeom") <<
"HcalDDDSimConstants::HcalDDDSimConstants (const HcalParameter* hp) constructor";
55 edm::LogInfo (
"HCalGeom") <<
"HcalDDDSimConstants: " << cellTypes.size()
56 <<
" cells of type HCal (All)";
63 edm::LogInfo (
"HCalGeom") <<
"HcalDDDSimConstants::destructed!!!";
78 double eta = 0, deta = 0,
phi = 0, dphi = 0, rz = 0, drz = 0;
79 bool ok =
false, flagrz =
true;
82 && etaR >=etaMn && etaR <= etaMx && depth > 0) ok =
true;
83 if (idet == static_cast<int>(
HcalEndcap) && depth>(
int)(
hpar->
zHE.size()))ok=
false;
84 else if (idet == static_cast<int>(
HcalBarrel) && depth > 17) ok=
false;
85 else if (idet == static_cast<int>(
HcalOuter) && depth != 4) ok=
false;
88 eta =
getEta(idet, etaR, zside, depth);
95 }
else if (idet == static_cast<int>(
HcalEndcap)) {
103 phi = fioff + (iphi - 0.5)*fibin;
107 if (ir > 0 && ir <
nR) {
113 edm::LogInfo(
"HCalGeom") <<
"HcalDDDSimConstants: wrong eta " << etaR
114 <<
" (" << ir <<
"/" <<
nR <<
") Detector "
118 }
else if (etaR <=
nEta) {
119 int laymin(depth), laymax(depth);
120 if (idet == static_cast<int>(
HcalOuter)) {
122 laymax = ((int)(
hpar->
zHE.size()));
138 edm::LogInfo(
"HCalGeom") <<
"HcalDDDSimConstants: wrong depth " << depth
139 <<
" or etaR " << etaR <<
" for detector "
146 edm::LogInfo(
"HCalGeom") <<
"HcalDDDSimConstants: wrong depth " << depth
153 edm::LogInfo(
"HCalGeom") <<
"HcalDDDSimConstants: det/side/depth/etaR/phi "
154 << idet <<
"/" << zside <<
"/" << depth <<
"/"
155 << etaR <<
"/" << iphi <<
" Cell Flag " << tmp.
ok
156 <<
" " << tmp.
eta <<
" " << tmp.
deta <<
" phi "
157 << tmp.
phi <<
" " << tmp.
dphi <<
" r(z) " << tmp.
rz
165 std::vector<std::pair<double,double> > gcons;
167 for (
unsigned int i=0;
i<
hpar->
rHB.size(); ++
i) {
171 for (
unsigned int i=0;
i<
hpar->
zHE.size(); ++
i) {
181 int hsubdet(0), ieta(0);
183 double heta = fabs(eta);
197 etaR = (eta >= 0. ? hR : -hR);
199 return std::pair<int,double>(hsubdet,etaR);
207 for (
int i =
nR-1;
i > 0;
i--)
208 if (hetaR < hpar->rTable[
i]) ieta =
hpar->
etaMin[2] +
nR - i - 1;
211 for (
int i = 0;
i <
nEta-1;
i++)
226 int depth,
int lay) {
230 }
else if (det == static_cast<int>(
HcalOuter)) {
235 if (etaR ==
hpar->
noff[0] && lay > 1) {
237 kphi = (kphi-1)%4 + 1;
238 if (kphi == 2 || kphi == 3) depth =
layerGroup( etaR-1, lay-2 );
240 }
else if (det == static_cast<int>(
HcalBarrel)) {
241 if (depth==3) depth = 2;
243 if (etaR ==
hpar->
noff[1] && depth > 2) {
247 if (depth > 2) depth = 2;
249 if (depth < 3) depth = 3;
253 return std::pair<int,int>(etaR,
depth);
260 double eta = fabs(etaR);
265 if (eta <= hpar->etaTable[10]) eta =
hpar->
etaTable[10]+0.001;
266 }
else if (zz >
hpar->
zHO[1]) {
267 if (eta <= hpar->etaTable[4]) eta =
hpar->
etaTable[4]+0.001;
270 eta = (z >= 0. ? eta : -
eta);
272 edm::LogInfo (
"HCalGeom") <<
"R " << r <<
" Z " << z <<
" eta " << etaR
274 if (eta != etaR)
edm::LogInfo (
"HCalGeom") <<
"**** Check *****";
284 unsigned int id = layerGroup.size();
285 for (
unsigned int i = 0;
i < layerGroup.size();
i++) {
286 if (layer == (
int)(layerGroup[
i].layer)) {
305 double fioff(0), fibin(0);
320 return std::pair<double,double>(fioff,fibin);
327 edm::LogInfo (
"HCalGeom") <<
"HcalDDDSimConstants: " << cellTypes.size()
328 <<
" cells of type HCal Barrel";
329 for (
unsigned int i=0;
i<cellTypes.size();
i++)
335 edm::LogInfo (
"HCalGeom") <<
"HcalDDDSimConstants: " << hoCells.size()
336 <<
" cells of type HCal Outer";
337 for (
unsigned int i=0;
i<hoCells.size();
i++)
340 cellTypes.insert(cellTypes.end(), hoCells.begin(), hoCells.end());
344 edm::LogInfo (
"HCalGeom") <<
"HcalDDDSimConstants: " << heCells.size()
345 <<
" cells of type HCal Endcap";
346 for (
unsigned int i=0;
i<heCells.size();
i++)
349 cellTypes.insert(cellTypes.end(), heCells.begin(), heCells.end());
353 edm::LogInfo (
"HCalGeom") <<
"HcalDDDSimConstants: " << hfCells.size()
354 <<
" cells of type HCal Forward";
355 for (
unsigned int i=0;
i<hfCells.size();
i++)
358 cellTypes.insert(cellTypes.end(), hfCells.begin(), hfCells.end());
364 int ieta,
int depthl)
const {
366 std::vector<HcalCellType> cellTypes;
368 if (
dzVcal < 0)
return cellTypes;
371 int dmin, dmax, indx, nz, nmod;
375 dmin = 1; dmax = 19; indx = 1; nz =
nzHE; nmod =
nmodHE;
378 dmin = 1; dmax = 2; indx = 2; nz = 2; nmod = 18;
381 dmin = 4; dmax = 4; indx = 0; nz =
nzHB; nmod =
nmodHB;
384 dmin = 1; dmax = 17; indx = 0; nz =
nzHB; nmod =
nmodHB;
387 if (depthl > 0) dmin = dmax = depthl;
388 int ietamin = (ieta>0) ? ieta :
hpar->
etaMin[indx];
389 int ietamax = (ieta>0) ? ieta :
hpar->
etaMax[indx];
394 int subdet0 =
static_cast<int>(subdet);
402 for (
int eta=ietamin;
eta<= ietamax;
eta++) {
407 shift, gain, nz, nmod, hsize, units);
410 std::vector<int> missPlus, missMinus;
412 for (
int miss=0; miss<
hpar->
noff[5]; miss++) {
416 for (
int miss=0; miss<
hpar->
noff[6]; miss++) {
417 missMinus.push_back(
hpar->
noff[kk]);
423 cellTypes.push_back(temp2);
432 unsigned int num = 0;
434 for (
unsigned int i=0;
i<cellTypes.size();
i++) {
435 num += (
unsigned int)(cellTypes[
i].
nPhiBins());
436 if (cellTypes[
i].nHalves() > 1)
437 num += (
unsigned int)(cellTypes[
i].nPhiBins());
438 num -= (
unsigned int)(cellTypes[
i].nPhiMissingBins());
441 edm::LogInfo (
"HCalGeom") <<
"HcalDDDSimConstants:numberOfCells "
442 << cellTypes.size() <<
" " << num
443 <<
" for subdetector " << subdet;
451 if (units==2) iphi_skip = (phi-1)*2+1;
452 else if (units==4) iphi_skip = (phi-1)*4-1;
453 if (iphi_skip < 0) iphi_skip += 72;
490 const double fiveDegInRad = 2*
M_PI/72;
491 int units = int(dphi/fiveDegInRad+0.5);
503 std::cout <<
"HcalDDDSimConstants:Read LayerGroup" <<
i <<
":";
516 <<
" and dzVcal " <<
dzVcal << std::endl;
522 for (
int i=0;
i<nEta-1; ++
i) {
524 int laymax = (imx > 0) ?
layerGroup(
i, imx-1 ) : 0;
525 if (i < hpar->
etaMax[0]) {
526 int laymax0 = (imx > 16) ?
layerGroup(
i, 16 ) : laymax;
527 if (
i+1 ==
hpar->
etaMax[0] && laymax0 > 2) laymax0 = 2;
530 if (
i >=
hpar->
etaMin[1]-1 && i < hpar->etaMax[1]) {
535 for (
int i=0;
i<4; ++
i)
541 for (
int i=0;
i<maxdepth; ++
i) {
542 for (
int k=0;
k<nEta-1; ++
k) {
545 for (
int l=layermx-1;
l >= 0; --
l) {
567 <<
" endcap half-sectors" << std::endl;
582 <<
" " <<
etaHO[2] <<
" " <<
etaHO[3] << std::endl;
585 for (
unsigned int i=0;
i<
hpar->
zHO.size(); ++
i)
596 if (ir > 0 && ir <
nR) {
598 if (depth%2 != 1) z +=
dlShort;
602 if (etaR > 0 && etaR <
nEta) {
603 if (etaR ==
hpar->
noff[1]-1 && depth > 2) {
605 }
else if (det == static_cast<int>(
HcalOuter)) {
608 }
else if (etaR ==
hpar->
noff[2]+1) {
612 }
else if (etaR ==
hpar->
noff[3]+1) {
623 edm::LogInfo(
"HCalGeom") <<
"HcalDDDSimConstants::deltaEta " << etaR <<
" "
624 << depth <<
" ==> " <<
tmp;
635 if (ir > 0 && ir <
nR) {
637 if (depth%2 != 1) z +=
dlShort;
641 if (etaR > 0 && etaR <
nEta) {
642 if (etaR ==
hpar->
noff[1]-1 && depth > 2) {
644 }
else if (det == static_cast<int>(
HcalOuter)) {
647 }
else if (etaR ==
hpar->
noff[2]+1) {
651 }
else if (etaR ==
hpar->
noff[3]+1) {
661 if (zside == 0) tmp = -
tmp;
663 edm::LogInfo(
"HCalGeom") <<
"HcalDDDSimConstants::getEta " << etaR <<
" "
664 << zside <<
" " << depth <<
" ==> " <<
tmp;
672 if (z != 0) tmp = -
log(
tan(0.5*atan(r/z)));
674 edm::LogInfo(
"HCalGeom") <<
"HcalDDDSimConstants::getEta " << r <<
" " << z
721 std::cout <<
"HcalDDDSimConstants::printTileHB for eta " << eta <<
" and depth " << depth <<
"\n";
724 double thetaL = 2.*atan(
exp(-etaL));
726 double thetaH = 2.*atan(
exp(-etaH));
734 std::cout <<
"\ntileHB:: eta|depth " << eta <<
"|" << depth <<
" theta " << thetaH/CLHEP::deg <<
":" << thetaL/CLHEP::deg <<
" Layer " << layL <<
":" << layH-1 <<
"\n";
735 for (
int lay=layL; lay<layH; ++lay) {
736 std::vector<double> area(2,0);
749 if (area[0] > 0)
std::cout << std::setw(2) << lay <<
" Area " << std::setw(8) << area[0] <<
" " << std::setw(8) << area[1] <<
"\n";
756 double thetaL = 2.*atan(
exp(-etaL));
758 double thetaH = 2.*atan(
exp(-etaH));
762 }
else if (depth == 1) {
764 }
else if (depth == 2) {
773 if (phib > 6*CLHEP::deg) nphi = 1;
774 std::cout <<
"\ntileHE:: Eta/depth " << eta <<
"|" << depth <<
" theta " << thetaH/CLHEP::deg <<
":" << thetaL/CLHEP::deg <<
" Layer " << layL <<
":" << layH-1 <<
" phi " << nphi <<
"\n";
775 for (
int lay=layL; lay<layH; ++lay) {
776 std::vector<double> area(4,0);
782 if ((lay != 0 || eta == 18) &&
793 ar1 = 0.5*(rmax-rmin)*(dx1+dx2-4.*
hpar->
dx1HE[
k]);
795 ar1 = 0.5*(rmax-rmin)*(dx1+dx2-2.*
hpar->
dx1HE[
k]);
796 ar2 = 0.5*(rmax-rmin)*((rmax+rmin)*
tan(10.*CLHEP::deg)-4*
hpar->
dx1HE[
k])-ar1;
804 if (area[0] > 0 && area[1] > 0) {
806 if (eta == 18) lay0++;
808 std::cout << std::setw(2) << lay0 <<
" Area " << std::setw(8) << area[0] <<
" " << std::setw(8) << area[1] <<
"\n";
810 std::cout << std::setw(2) << lay0 <<
" Area " << std::setw(8) << area[0] <<
" " << std::setw(8) << area[1] <<
":" << std::setw(8) << area[2] <<
" " << std::setw(8) << area[3] <<
"\n";
std::pair< int, int > getEtaDepth(int det, int etaR, int phi, int depth, int lay)
std::vector< double > zHO
std::vector< double > etaTable
void setMissingPhi(std::vector< int > &, std::vector< int > &)
int unitPhi(int det, int etaR) const
void printTileHB(int eta, int depth) const
std::vector< int > maxDepth
std::vector< double > rHB
int getEta(int det, int lay, double hetaR)
std::vector< double > rhoxHB
Sin< T >::type sin(const T &t)
std::vector< double > HBGains
Geom::Theta< T > theta() const
std::vector< int > HEShift
std::vector< std::pair< double, double > > getConstHBHE(const int type) const
HcalDDDSimConstants(const HcalParameters *hp)
unsigned int numberOfCells(HcalSubdetector) const
std::vector< int > etaMax
std::vector< int > depths[nDepthMax]
std::vector< double > rhoxHE
std::vector< double > zxHE
T x() const
Cartesian x coordinate.
std::vector< double > zHE
double getEtaHO(double &etaR, double &x, double &y, double &z) const
std::vector< LayerItem > layerGroupEtaSim
void printTileHE(int eta, int depth) const
std::vector< double > dyHE
std::vector< double > dx1HE
std::vector< double > rHO
std::vector< double > dzHE
Cos< T >::type cos(const T &t)
int getShift(HcalSubdetector subdet, int depth) const
double getGain(HcalSubdetector subdet, int depth) const
Tan< T >::type tan(const T &t)
std::vector< HcalCellType > HcalCellTypes() const
std::pair< int, int > getModHalfHBHE(const int type) const
std::vector< int > HFShift
unsigned int findLayer(int layer, const std::vector< HcalParameters::LayerItem > &layerGroup) const
std::vector< double > HEGains
std::pair< int, double > getDetEta(double eta, int depth)
std::vector< double > dyHB
std::vector< double > phioff
std::pair< double, double > getPhiCons(int det, int ieta)
std::vector< double > gparHF
double deltaEta(int det, int eta, int depth) const
Geom::Phi< T > phi() const
std::vector< double > dxHB
std::vector< std::vector< double > > tmp
std::vector< double > rTable
std::vector< double > phitable
TString units(TString variable, Char_t axis)
std::vector< double > phibin
HcalCellType::HcalCell cell(int det, int zside, int depth, int etaR, int iphi) const
int phiNumber(int phi, int unit) const
std::vector< double > drHB
std::vector< double > HFGains
static unsigned int const shift
std::vector< int > HBShift
const HcalParameters * hpar
std::vector< int > maxDepth
unsigned int layerGroup(unsigned int eta, unsigned int i) const
std::vector< int > etaMin
unsigned int layerGroupSize(unsigned int eta) const