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]);
47 for (
unsigned int l=0;
l<lymx0; ++
l) {
49 if (lmin == 0) lmin =
l + 1;
52 if (dstart < 0) dstart = dep;
54 etabin0.
layer.push_back(std::pair<int,int>(lmin,lmax));
56 etabin.
layer.push_back(std::pair<int,int>(lmin,lmax));
70 etabin0.
layer.push_back(std::pair<int,int>(lmin,lmax));
71 bins.push_back(etabin0);
74 etabin.
layer.push_back(std::pair<int,int>(lmin,lmax));
75 if (dstart < 0) dstart = dep;
80 bins.push_back(etabin);
83 std::cout <<
"Prepares " << bins.size() <<
" eta bins for type " << type
85 for (
unsigned int i=0;
i<bins.size(); ++
i) {
86 std::cout <<
"Bin[" <<
i <<
"]: Eta = (" << bins[
i].ieta <<
":"
87 << bins[
i].etaMin <<
":" << bins[
i].etaMax <<
") Phi = ("
88 << bins[
i].nPhi <<
":" << bins[
i].phi0 <<
":" << bins[
i].dphi
89 <<
") and " << bins[
i].layer.size() <<
" depths (start) "
90 << bins[
i].depthStart <<
" :";
91 for (
unsigned int k=0;
k<bins[
i].layer.size(); ++
k)
100 std::pair<double,double>
102 int ietaAbs = (ieta > 0) ? ieta : -ieta;
103 const double fiveDegInRad = 2*
M_PI/72;
105 if ((subdet == static_cast<int>(
HcalBarrel)) ||
107 (subdet == static_cast<int>(
HcalOuter))) {
108 int unit = (int)(
phibin[ietaAbs-1]/fiveDegInRad+0.5);
109 int kphi = (unit == 2) ? ((iphi-1)/2 + 1) : iphi;
112 phi = foff + (kphi-0.5)*
phibin[ietaAbs-1];
116 int kphi = (unit == 4) ? ((iphi-3)/4 + 1) : ((iphi-1)/2 + 1);
124 std::cout <<
"getEtaPhi: subdet|ieta|iphi " << subdet <<
"|" << ieta <<
"|"
125 << iphi <<
" eta|phi " <<
eta <<
"|" << phi << std::endl;
127 return std::pair<double,double>(
eta,
phi);
135 if ((subdet == static_cast<int>(
HcalOuter)) ||
136 ((subdet == static_cast<int>(
HcalBarrel)) && (lay > 17))) {
139 }
else if (subdet == static_cast<int>(
HcalBarrel) ||
147 }
else if (unit == 4) {
163 kphi = (kphi-1)%4 + 1;
164 if (kphi == 2 || kphi == 3) depth =
layerGroup(
eta-1, lay-2 );
170 std::cout <<
"getHCID: input " << subdet <<
":" << ieta <<
":" << iphi
171 <<
":" << idepth <<
":" << lay <<
" output " <<
eta <<
":" <<
phi
172 <<
":" << depth << std::endl;
177 std::vector<HcalDDDRecConstants::HFCellParameters>
180 std::vector<HcalDDDRecConstants::HFCellParameters> cells;
183 for (
unsigned int k=0;
k<
nEta; ++
k) {
186 int iphi = (dphi == 4) ? 3 : 1;
191 cells.push_back(cell1);
193 cells.push_back(cell2);
206 cells.push_back(cell1);
209 for (
unsigned int k=0;
k<
nEta; ++
k) {
212 int iphi = (dphi == 4) ? 3 : 1;
217 cells.push_back(cell1);
219 cells.push_back(cell2);
224 std::cout <<
"HcalDDDRecConstants returns " << cells.size()
225 <<
" HF cell parameters" << std::endl;
226 for (
unsigned int k=0;
k<cells.size(); ++
k)
228 <<
", " << cells[
k].firstPhi <<
", " << cells[
k].stepPhi <<
", "
229 << cells[
k].
nPhi <<
", " << cells[
k].rMin <<
", "
230 << cells[
k].rMax <<
")" << std::endl;
238 unsigned int type = (itype == 0) ? 0 : 1;
239 unsigned int lymax = (type == 0) ? 17 : 19;
251 int ietaAbs = (ieta > 0) ? ieta : -ieta;
256 if (ietaAbs < hpar->
etaMax[1]) {
271 std::cout <<
"getRZ: subdet|ieta|depth " << subdet <<
"|" << ieta <<
"|"
272 << depth <<
" lay|rz " << lay <<
"|" << rz << std::endl;
277 std::vector<HcalDDDRecConstants::HcalActiveLength>
280 std::vector<HcalDDDRecConstants::HcalActiveLength> actives;
281 std::vector<HcalDDDRecConstants::HcalEtaBin> bins =
getEtaBins(type);
283 unsigned int kount(0);
285 for (
unsigned int k=0;
k<bins.size(); ++
k) {
286 int ieta = bins[
k].ieta;
287 double eta = 0.5*(bins[
k].etaMin+bins[
k].etaMax);
289 double scale = 1.0/((type == 0) ?
sin(theta) :
cos(theta));
290 int depth = bins[
k].depthStart;
291 for (
unsigned int i = 0;
i < bins[
k].layer.size(); ++
i) {
293 for (
int j = bins[
k].layer[
i].
first;
j <= bins[
k].layer[
i].second; ++
j) {
294 if (type == 0 ||
j > 1)
299 actives.push_back(active);
303 std::cout <<
"getThickActive: [" << kount <<
"] eta:" << active.
ieta
304 <<
":" << active.
eta <<
" depth " << active.
depth <<
" thick "
305 << active.
thick << std::endl;
312 std::vector<HcalCellType>
316 std::vector<HcalCellType> cells;
318 std::vector<HcalDDDRecConstants::HcalEtaBin> etabins =
getEtaBins(isub);
319 for (
unsigned int bin=0;
bin<etabins.size(); ++
bin) {
320 std::vector<HcalCellType>
temp;
321 std::vector<int>
count;
322 std::vector<double> dmin, dmax;
323 for (
unsigned int il=0; il<etabins[
bin].layer.size(); ++il) {
325 temp.push_back(cell);
330 int ieta = etabins[
bin].ieta;
334 for (
unsigned int ic=0; ic<cells.size(); ++ic) {
335 for (
unsigned int il=0; il<etabins[
bin].layer.size(); ++il) {
336 if (cells[ic].depthSegment() >= etabins[
bin].layer[il].first &&
337 cells[ic].depthSegment() <= etabins[
bin].layer[il].second) {
338 if (count[il] == 0) {
339 temp[il] = cells[ic];
340 dmin[il] = cells[ic].depthMin();
341 dmax[il] = cells[ic].depthMax();
344 if (cells[ic].depthMin() < dmin[il]) dmin[il] = cells[ic].depthMin();
345 if (cells[ic].depthMax() > dmax[il]) dmax[il] = cells[ic].depthMax();
352 for (
unsigned int il=0; il<etabins[
bin].layer.size(); ++il) {
353 int depth = etabins[
bin].depthStart + (int)(il);
355 temp[il].setPhi(etabins[
bin].
nPhi,unit,etabins[
bin].dphi/CLHEP::deg,
357 temp[il].setDepth(depth,dmin[il],dmax[il]);
358 cells.push_back(temp[il]);
362 std::cout <<
"HcalDDDRecConstants: found " << cells.size() <<
" cells for sub-detector type " << isub << std::endl;
363 for (
unsigned int ic=0; ic<cells.size(); ++ic)
364 std::cout <<
"Cell[" << ic <<
"] " << cells[ic] << std::endl;
375 unsigned int num = 0;
377 for (
unsigned int i=0;
i<cellTypes.size();
i++) {
378 num += (
unsigned int)(cellTypes[
i].
nPhiBins());
380 num += (
unsigned int)(cellTypes[
i].nPhiBins());
381 num -= (
unsigned int)(cellTypes[
i].nPhiMissingBins());
384 edm::LogInfo (
"HCalGeom") <<
"HcalDDDRecConstants:numberOfCells "
385 << cellTypes.size() <<
" " << num
386 <<
" for subdetector " << subdet;
398 std::vector<HcalDDDRecConstants::HcalEtaBin> etabins =
getEtaBins(isub);
399 unsigned int ncell(0);
400 for (
unsigned int i=0;
i<etabins.size(); ++
i) {
401 ncell += (((
unsigned int)(etabins[
i].
nPhi))*(etabins[
i].layer.size()));
422 edm::LogError(
"HCalGeom") <<
"HcalDDDRecConstants: sizes of the vectors "
423 <<
" etaGroup (" << nEta <<
") and phiGroup ("
425 throw cms::Exception(
"DDException") <<
"HcalDDDRecConstants: inconsistent array sizes" << nEta <<
":" <<
hpar->
phigroup.size();
432 int ieta(0), ietaHB(0), ietaHE(0);
438 edm::LogError(
"HCalGeom") <<
"Going beyond the array boundary "
440 <<
" of etaTable from SimConstant";
441 throw cms::Exception(
"DDException") <<
"Going beyond the array boundary "
444 <<
" of etaTable from SimConstant";
447 etaSimValu.push_back(std::pair<int,int>(ef,ieta));
450 if (ieta <= hpar->
etaMax[0]) ietaHB =
i+1;
451 if (ieta <= hpar->
etaMin[1]) ietaHE =
i+1;
470 std::cout <<
"Modified eta/deltaphi table for " << nEta <<
" bins" << std::endl;
474 <<
" PhiBin[" <<
i <<
"] = " <<
phibin[
i]/CLHEP::deg <<std::endl;
496 int laymax0 = (imx > 16) ?
layerGroup(
i,16) : laymax;
499 std::cout <<
"HB " <<
i <<
" " << imx <<
" " << laymax <<
" " << laymax0 << std::endl;
505 std::cout <<
"HE " <<
i <<
" " << imx <<
" " << laymax << std::endl;
511 for (
int i=0;
i<4; ++
i)
519 for (
unsigned int i=0;
i<
hpar->
rHB.size(); ++
i) {
525 <<
" halves and " <<
gconsHB.size() <<
" layers" << std::endl;
532 for (
unsigned int i=0;
i<
hpar->
zHE.size(); ++
i) {
538 <<
" halves and " <<
gconsHE.size() <<
" layers" << std::endl;
548 if( it.layer == eta + 1 ) {
549 return it.layerGroup.size();
551 if( it.layer > eta + 1 )
break;
552 k = it.layerGroup.size();
558 unsigned int i)
const {
561 if( it.layer == eta + 1 ) {
562 return it.layerGroup.at( i );
564 if( it.layer > eta + 1 )
break;
565 k = it.layerGroup.at( i );
573 if( it->layer == i + 1 )
574 return it->layerGroup;
575 if( it->layer > i + 1 )
576 return last->layerGroup;
579 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
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< 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