6 #include "CLHEP/Units/GlobalPhysicalConstants.h"
7 #include "CLHEP/Units/GlobalSystemOfUnits.h"
18 std::cout <<
"HcalDDDRecConstants::HcalDDDRecConstants (const HcalParameters* hp) constructor" << std::endl;
25 std::cout <<
"HcalDDDRecConstants::destructed!!!" << std::endl;
29 std::vector<HcalDDDRecConstants::HcalEtaBin>
32 std::vector<HcalDDDRecConstants::HcalEtaBin> bins;
33 unsigned int type = (itype == 0) ? 0 : 1;
34 unsigned int lymax = (type == 0) ? 17 : 19;
36 int nfi = (int)((20.001*
nModule[itype]*CLHEP::deg)/
phibin[ieta-1]);
49 <<
":" << lymax <<
" Depth " << dep;
50 for (
unsigned int l=0;
l<lymax; ++
l)
54 for (
unsigned int l=0;
l<lymx0; ++
l) {
56 if (lmin == 0) lmin =
l + 1;
59 if (dstart < 0) dstart = dep;
60 int lmax0 = (lmax >= lmin) ? lmax : lmin;
62 etabin0.
layer.push_back(std::pair<int,int>(lmin,lmax0));
64 etabin.
layer.push_back(std::pair<int,int>(lmin,lmax0));
75 if (
l+1 == lymx0) lmax = lymx0;
79 etabin0.
layer.push_back(std::pair<int,int>(lmin,lmax));
80 bins.push_back(etabin0);
83 etabin.
layer.push_back(std::pair<int,int>(lmin,lmax));
84 if (dstart < 0) dstart = dep;
89 bins.push_back(etabin);
92 std::cout <<
"Prepares " << bins.size() <<
" eta bins for type " << type
94 for (
unsigned int i=0;
i<bins.size(); ++
i) {
95 std::cout <<
"Bin[" <<
i <<
"]: Eta = (" << bins[
i].ieta <<
":"
96 << bins[
i].etaMin <<
":" << bins[
i].etaMax <<
") Phi = ("
97 << bins[
i].nPhi <<
":" << bins[
i].phi0 <<
":" << bins[
i].dphi
98 <<
") and " << bins[
i].layer.size() <<
" depths (start) "
99 << bins[
i].depthStart <<
" :";
100 for (
unsigned int k=0;
k<bins[
i].layer.size(); ++
k)
109 std::pair<double,double>
111 int ietaAbs = (ieta > 0) ? ieta : -ieta;
113 if ((subdet == static_cast<int>(
HcalBarrel)) ||
115 (subdet == static_cast<int>(
HcalOuter))) {
117 int kphi = (unit == 2) ? ((iphi-1)/2 + 1) : iphi;
120 phi = foff + (kphi-0.5)*
phibin[ietaAbs-1];
124 int kphi = (unit == 4) ? ((iphi-3)/4 + 1) : ((iphi-1)/2 + 1);
132 std::cout <<
"getEtaPhi: subdet|ieta|iphi " << subdet <<
"|" << ieta <<
"|"
133 << iphi <<
" eta|phi " <<
eta <<
"|" << phi << std::endl;
135 return std::pair<double,double>(
eta,
phi);
143 if ((subdet == static_cast<int>(
HcalOuter)) ||
144 ((subdet == static_cast<int>(
HcalBarrel)) && (lay > 17))) {
147 }
else if (subdet == static_cast<int>(
HcalBarrel) ||
155 }
else if (unit == 4) {
171 kphi = (kphi-1)%4 + 1;
172 if (kphi == 2 || kphi == 3) depth =
layerGroup(
eta-1, lay-2);
178 std::cout <<
"getHCID: input " << subdet <<
":" << ieta <<
":" << iphi
179 <<
":" << idepth <<
":" << lay <<
" output " <<
eta <<
":" <<
phi
180 <<
":" << depth << std::endl;
185 std::vector<HcalDDDRecConstants::HFCellParameters>
188 std::vector<HcalDDDRecConstants::HFCellParameters> cells;
191 for (
unsigned int k=0;
k<
nEta; ++
k) {
194 int iphi = (dphi == 4) ? 3 : 1;
199 cells.push_back(cell1);
201 cells.push_back(cell2);
214 cells.push_back(cell1);
217 for (
unsigned int k=0;
k<
nEta; ++
k) {
220 int iphi = (dphi == 4) ? 3 : 1;
225 cells.push_back(cell1);
227 cells.push_back(cell2);
232 std::cout <<
"HcalDDDRecConstants returns " << cells.size()
233 <<
" HF cell parameters" << std::endl;
234 for (
unsigned int k=0;
k<cells.size(); ++
k)
236 <<
", " << cells[
k].firstPhi <<
", " << cells[
k].stepPhi <<
", "
237 << cells[
k].
nPhi <<
", " << cells[
k].rMin <<
", "
238 << cells[
k].rMax <<
")" << std::endl;
246 unsigned int type = (itype == 0) ? 0 : 1;
247 unsigned int lymax = (type == 0) ? 17 : 19;
261 }
else if (itype == 3) {
264 unsigned int type = (itype == 0) ? 0 : 1;
275 int ietaAbs = (ieta > 0) ? ieta : -ieta;
280 if (ietaAbs < hpar->
etaMax[1]) {
295 std::cout <<
"getRZ: subdet|ieta|depth " << subdet <<
"|" << ieta <<
"|"
296 << depth <<
" lay|rz " << lay <<
"|" << rz << std::endl;
301 std::vector<HcalDDDRecConstants::HcalActiveLength>
304 std::vector<HcalDDDRecConstants::HcalActiveLength> actives;
305 std::vector<HcalDDDRecConstants::HcalEtaBin> bins =
getEtaBins(type);
307 unsigned int kount(0);
309 for (
unsigned int k=0;
k<bins.size(); ++
k) {
310 int ieta = bins[
k].ieta;
311 double eta = 0.5*(bins[
k].etaMin+bins[
k].etaMax);
313 double scale = 1.0/((type == 0) ?
sin(theta) :
cos(theta));
314 int depth = bins[
k].depthStart;
315 for (
unsigned int i = 0;
i < bins[
k].layer.size(); ++
i) {
317 for (
int j = bins[
k].layer[
i].
first;
j <= bins[
k].layer[
i].second; ++
j) {
318 if (type == 0 ||
j > 1) {
320 if (t > 0) thick +=
t;
325 actives.push_back(active);
329 std::cout <<
"getThickActive: [" << kount <<
"] eta:" << active.
ieta
330 <<
":" << active.
eta <<
" depth " << active.
depth <<
" thick "
331 << active.
thick << std::endl;
338 std::vector<HcalCellType>
342 std::vector<HcalCellType> cells;
344 std::vector<HcalDDDRecConstants::HcalEtaBin> etabins =
getEtaBins(isub);
345 for (
unsigned int bin=0;
bin<etabins.size(); ++
bin) {
346 std::vector<HcalCellType>
temp;
347 std::vector<int>
count;
348 std::vector<double> dmin, dmax;
349 for (
unsigned int il=0; il<etabins[
bin].layer.size(); ++il) {
351 temp.push_back(cell);
356 int ieta = etabins[
bin].ieta;
360 for (
unsigned int ic=0; ic<cells.size(); ++ic) {
361 for (
unsigned int il=0; il<etabins[
bin].layer.size(); ++il) {
362 if (cells[ic].depthSegment() >= etabins[
bin].layer[il].first &&
363 cells[ic].depthSegment() <= etabins[
bin].layer[il].second) {
364 if (count[il] == 0) {
365 temp[il] = cells[ic];
366 dmin[il] = cells[ic].depthMin();
367 dmax[il] = cells[ic].depthMax();
370 if (cells[ic].depthMin() < dmin[il]) dmin[il] = cells[ic].depthMin();
371 if (cells[ic].depthMax() > dmax[il]) dmax[il] = cells[ic].depthMax();
378 for (
unsigned int il=0; il<etabins[
bin].layer.size(); ++il) {
379 int depth = etabins[
bin].depthStart + (int)(il);
381 temp[il].setPhi(etabins[
bin].
nPhi,unit,etabins[
bin].dphi/CLHEP::deg,
383 temp[il].setDepth(depth,dmin[il],dmax[il]);
384 cells.push_back(temp[il]);
388 std::cout <<
"HcalDDDRecConstants: found " << cells.size() <<
" cells for sub-detector type " << isub << std::endl;
389 for (
unsigned int ic=0; ic<cells.size(); ++ic)
390 std::cout <<
"Cell[" << ic <<
"] " << cells[ic] << std::endl;
401 unsigned int num = 0;
403 for (
unsigned int i=0;
i<cellTypes.size();
i++) {
404 num += (
unsigned int)(cellTypes[
i].
nPhiBins());
406 num += (
unsigned int)(cellTypes[
i].nPhiBins());
407 num -= (
unsigned int)(cellTypes[
i].nPhiMissingBins());
410 edm::LogInfo (
"HCalGeom") <<
"HcalDDDRecConstants:numberOfCells "
411 << cellTypes.size() <<
" " << num
412 <<
" for subdetector " << subdet;
424 std::vector<HcalDDDRecConstants::HcalEtaBin> etabins =
getEtaBins(isub);
425 unsigned int ncell(0);
426 for (
unsigned int i=0;
i<etabins.size(); ++
i) {
427 ncell += (((
unsigned int)(etabins[
i].
nPhi))*(etabins[
i].layer.size()));
448 edm::LogError(
"HCalGeom") <<
"HcalDDDRecConstants: sizes of the vectors "
449 <<
" etaGroup (" << nEta <<
") and phiGroup ("
451 throw cms::Exception(
"DDException") <<
"HcalDDDRecConstants: inconsistent array sizes" << nEta <<
":" <<
hpar->
phigroup.size();
458 int ieta(0), ietaHB(0), ietaHE(0), ietaHEM(0);
464 edm::LogError(
"HCalGeom") <<
"Going beyond the array boundary "
466 <<
" of etaTable from SimConstant";
467 throw cms::Exception(
"DDException") <<
"Going beyond the array boundary "
470 <<
" of etaTable from SimConstant";
473 etaSimValu.push_back(std::pair<int,int>(ef,ieta));
476 if (ieta <= hpar->
etaMax[0]) ietaHB =
i+1;
477 if (ieta <= hpar->
etaMin[1]) ietaHE =
i+1;
478 if (ieta <= hpar->etaMax[1]) ietaHEM=
i+1;
486 for (
unsigned int k=0;
k<4; ++
k)
nPhiBins.push_back(0);
492 int nphi = (int)((CLHEP::twopi + 0.001)/dphi);
510 std::cout <<
"Modified eta/deltaphi table for " << nEta <<
" bins" << std::endl;
514 <<
" PhiBin[" <<
i <<
"] = " <<
phibin[
i]/CLHEP::deg <<std::endl;
540 int laymax0 = (imx > 16) ?
layerGroup(
i,16) : laymax;
543 std::cout <<
"HB " <<
i <<
" " << imx <<
" " << laymax <<
" " << laymax0 << std::endl;
549 std::cout <<
"HE " <<
i <<
" " << imx <<
" " << laymax << std::endl;
555 for (
int i=0;
i<4; ++
i)
563 for (
unsigned int i=0;
i<
hpar->
rHB.size(); ++
i) {
569 <<
" halves and " <<
gconsHB.size() <<
" layers" << std::endl;
576 for (
unsigned int i=0;
i<
hpar->
zHE.size(); ++
i) {
582 <<
" halves and " <<
gconsHE.size() <<
" layers" << std::endl;
592 if( it.layer == eta + 1 ) {
593 return it.layerGroup.size();
595 if( it.layer > eta + 1 )
break;
596 k = it.layerGroup.size();
602 unsigned int i)
const {
605 if( it.layer == eta + 1 ) {
606 return it.layerGroup.at( i );
608 if( it.layer > eta + 1 )
break;
609 k = it.layerGroup.at( i );
617 if( it->layer == i + 1 )
618 return it->layerGroup;
619 if( it->layer > i + 1 )
620 return last->layerGroup;
623 return last->layerGroup;
std::vector< double > etaTable
std::vector< int > iEtaMin
std::vector< int > etagroup
int unitPhi(int det, int etaR) const
double getRZ(int subdet, int ieta, int depth) const
std::vector< double > rHB
std::vector< std::pair< int, int > > etaSimValu
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
std::vector< int > maxDepth
int getMinDepth(const int itype, const int ieta) const
std::vector< double > etaTableHF
unsigned int numberOfCells(HcalSubdetector) const
std::vector< int > etaMax
int getDepthEta16(int i) const
std::vector< int > phiUnitS
U second(std::pair< T, U > const &p)
const HcalParameters * hpar
int getMaxDepth(const int type) const
std::vector< std::pair< double, double > > gconsHE
std::vector< double > zHE
std::vector< double > phibin
const std::vector< double > & getRTableHF() const
unsigned int numberOfCells(HcalSubdetector) const
unsigned int layerGroup(unsigned int eta, unsigned int i) const
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
std::vector< double > dzHE
Cos< T >::type cos(const T &t)
const std::vector< double > & getPhiTableHF() const
std::vector< HFCellParameters > getHFCellParameters() const
std::vector< int > iEtaMax
Abs< T >::type abs(const T &t)
std::vector< HcalCellType > HcalCellTypes() const
std::vector< int > ietaMap
std::vector< int > nPhiBins
std::vector< std::pair< int, int > > layer
unsigned int layerGroupSize(unsigned int eta) const
std::vector< HcalCellType > HcalCellTypes(HcalSubdetector) const
std::vector< HcalActiveLength > getThickActive(const int type) const
std::vector< double > phioff
int getDepthEta29(int i) const
std::vector< double > etaTable
HcalDDDRecConstants(const HcalParameters *hp, const HcalDDDSimConstants &hc)
const std::vector< int > & getDepth(const unsigned int i) const
std::vector< double > phitable
std::vector< double > phibin
std::vector< LayerItem > layerGroupEtaRec
int phiNumber(int phi, int unit) const
std::vector< double > drHB
const HcalDDDSimConstants & hcons
const std::vector< HcalDetId > & getIdHF2QIE() const
std::vector< std::pair< double, double > > gconsHB
std::vector< int > maxDepth
std::vector< int > phigroup
for(const auto &isodef:isoDefs)
std::pair< double, double > getEtaPhi(int subdet, int ieta, int iphi) const
std::vector< int > etaMin
unsigned int nCells() const
std::vector< HcalEtaBin > getEtaBins(const int itype) const