6 #include "CLHEP/Units/GlobalPhysicalConstants.h"
7 #include "CLHEP/Units/GlobalSystemOfUnits.h"
17 std::cout <<
"HcalDDDRecConstants::HcalDDDRecConstants (const HcalParameters* hp) constructor" << std::endl;
24 std::cout <<
"HcalDDDRecConstants::destructed!!!" << std::endl;
28 std::vector<HcalDDDRecConstants::HcalEtaBin>
31 std::vector<HcalDDDRecConstants::HcalEtaBin> bins;
32 unsigned int type = (itype == 0) ? 0 : 1;
33 unsigned int lymax = (type == 0) ? 17 : 19;
35 int nfi = (int)((20.001*
nModule[itype]*CLHEP::deg)/
phibin[ieta-1]);
41 if (type == 1 && ieta ==
iEtaMin[type]) dep = 3;
43 for (
unsigned int l=0;
l<lymx0; ++
l) {
45 if (lmin == 0) lmin =
l + 1;
48 if (dstart < 0) dstart = dep;
49 etabin.
layer.push_back(std::pair<int,int>(lmin,lmax));
54 if (type == 0 && ieta ==
iEtaMax[type] && dep > 2)
break;
61 etabin0.
layer.push_back(std::pair<int,int>(lmin,lmax));
62 bins.push_back(etabin0);
64 etabin.
layer.push_back(std::pair<int,int>(lmin,lmax));
65 if (dstart < 0) dstart = dep;
70 bins.push_back(etabin);
73 std::cout <<
"Prepares " << bins.size() <<
" eta bins for type " << type
75 for (
unsigned int i=0;
i<bins.size(); ++
i) {
76 std::cout <<
"Bin[" <<
i <<
"]: Eta = (" << bins[
i].ieta <<
":"
77 << bins[
i].etaMin <<
":" << bins[
i].etaMax <<
") Phi = ("
78 << bins[
i].nPhi <<
":" << bins[
i].phi0 <<
":" << bins[
i].dphi
79 <<
") and " << bins[
i].layer.size() <<
" depths (start) "
80 << bins[
i].depthStart <<
" :";
81 for (
unsigned int k=0;
k<bins[
i].layer.size(); ++
k)
90 std::pair<double,double>
92 int ietaAbs = (ieta > 0) ? ieta : -ieta;
93 const double fiveDegInRad = 2*
M_PI/72;
95 if ((subdet == static_cast<int>(
HcalBarrel)) ||
97 (subdet == static_cast<int>(
HcalOuter))) {
98 int unit = (int)(
phibin[ietaAbs-1]/fiveDegInRad+0.5);
99 int kphi = (unit == 2) ? ((iphi-1)/2 + 1) : iphi;
102 phi = foff + (kphi-0.5)*
phibin[ietaAbs-1];
106 int kphi = (unit == 4) ? ((iphi-3)/4 + 1) : ((iphi-1)/2 + 1);
114 std::cout <<
"getEtaPhi: subdet|ieta|iphi " << subdet <<
"|" << ieta <<
"|"
115 << iphi <<
" eta|phi " <<
eta <<
"|" << phi << std::endl;
117 return std::pair<double,double>(
eta,
phi);
125 if ((subdet == static_cast<int>(
HcalOuter)) ||
126 ((subdet == static_cast<int>(
HcalBarrel)) && (lay > 17))) {
129 }
else if (subdet == static_cast<int>(
HcalBarrel) ||
137 }
else if (unit == 4) {
147 if (depth > 2) depth = 2;
149 if (depth < 3) depth = 3;
153 kphi = (kphi-1)%4 + 1;
154 if (kphi == 2 || kphi == 3) depth =
layerGroup(
eta-1, lay-2 );
160 std::cout <<
"getHCID: input " << subdet <<
":" << ieta <<
":" << iphi
161 <<
":" << idepth <<
":" << lay <<
" output " <<
eta <<
":" <<
phi
162 <<
":" << depth << std::endl;
170 int ietaAbs = (ieta > 0) ? ieta : -ieta;
175 if (ietaAbs < hpar->
etaMax[1]) {
190 std::cout <<
"getRZ: subdet|ieta|depth " << subdet <<
"|" << ieta <<
"|"
191 << depth <<
" lay|rz " << lay <<
"|" << rz << std::endl;
196 std::vector<HcalDDDRecConstants::HcalActiveLength>
199 std::vector<HcalDDDRecConstants::HcalActiveLength> actives;
200 std::vector<HcalDDDRecConstants::HcalEtaBin> bins =
getEtaBins(type);
202 unsigned int kount(0);
204 for (
unsigned int k=0;
k<bins.size(); ++
k) {
205 int ieta = bins[
k].ieta;
206 double eta = 0.5*(bins[
k].etaMin+bins[
k].etaMax);
208 double scale = 1.0/((type == 0) ?
sin(theta) :
cos(theta));
209 int depth = bins[
k].depthStart;
210 for (
unsigned int i = 0;
i < bins[
k].layer.size(); ++
i) {
212 for (
int j = bins[
k].layer[
i].
first;
j <= bins[
k].layer[
i].second; ++
j) {
213 if (type == 0 ||
j > 1)
218 actives.push_back(active);
222 std::cout <<
"getThickActive: [" << kount <<
"] eta:" << active.
ieta
223 <<
":" << active.
eta <<
" depth " << active.
depth <<
" thick "
224 << active.
thick << std::endl;
231 std::vector<HcalCellType>
235 std::vector<HcalCellType> cells;
237 std::vector<HcalDDDRecConstants::HcalEtaBin> etabins =
getEtaBins(isub);
238 for (
unsigned int bin=0;
bin<etabins.size(); ++
bin) {
239 std::vector<HcalCellType>
temp;
240 std::vector<int>
count;
241 std::vector<double> dmin, dmax;
242 for (
unsigned int il=0; il<etabins[
bin].layer.size(); ++il) {
244 temp.push_back(cell);
249 int ieta = etabins[
bin].ieta;
253 for (
unsigned int ic=0; ic<cells.size(); ++ic) {
254 for (
unsigned int il=0; il<etabins[
bin].layer.size(); ++il) {
255 if (cells[ic].depthSegment() >= etabins[
bin].layer[il].first &&
256 cells[ic].depthSegment() <= etabins[
bin].layer[il].second) {
257 if (count[il] == 0) {
258 temp[il] = cells[ic];
259 dmin[il] = cells[ic].depthMin();
260 dmax[il] = cells[ic].depthMax();
263 if (cells[ic].depthMin() < dmin[il]) dmin[il] = cells[ic].depthMin();
264 if (cells[ic].depthMax() > dmax[il]) dmax[il] = cells[ic].depthMax();
271 for (
unsigned int il=0; il<etabins[
bin].layer.size(); ++il) {
272 int depth = etabins[
bin].depthStart + (int)(il);
274 temp[il].setPhi(etabins[
bin].
nPhi,unit,etabins[
bin].dphi/CLHEP::deg,
276 temp[il].setDepth(depth,dmin[il],dmax[il]);
277 cells.push_back(temp[il]);
281 std::cout <<
"HcalDDDRecConstants: found " << cells.size() <<
" cells for sub-detector type " << isub << std::endl;
282 for (
unsigned int ic=0; ic<cells.size(); ++ic)
283 std::cout <<
"Cell[" << ic <<
"] " << cells[ic] << std::endl;
294 unsigned int num = 0;
296 for (
unsigned int i=0;
i<cellTypes.size();
i++) {
297 num += (
unsigned int)(cellTypes[
i].
nPhiBins());
299 num += (
unsigned int)(cellTypes[
i].nPhiBins());
300 num -= (
unsigned int)(cellTypes[
i].nPhiMissingBins());
303 edm::LogInfo (
"HCalGeom") <<
"HcalDDDRecConstants:numberOfCells "
304 << cellTypes.size() <<
" " << num
305 <<
" for subdetector " << subdet;
317 std::vector<HcalDDDRecConstants::HcalEtaBin> etabins =
getEtaBins(isub);
318 unsigned int ncell(0);
319 for (
unsigned int i=0;
i<etabins.size(); ++
i) {
320 ncell += (((
unsigned int)(etabins[
i].
nPhi))*(etabins[
i].layer.size()));
341 edm::LogError(
"HCalGeom") <<
"HcalDDDRecConstants: sizes of the vectors "
342 <<
" etaGroup (" << nEta <<
") and phiGroup ("
344 throw cms::Exception(
"DDException") <<
"HcalDDDRecConstants: inconsistent array sizes" << nEta <<
":" <<
hpar->
phigroup.size();
351 int ieta(0), ietaHB(0), ietaHE(0);
357 edm::LogError(
"HCalGeom") <<
"Going beyond the array boundary "
359 <<
" of etaTable from SimConstant";
360 throw cms::Exception(
"DDException") <<
"Going beyond the array boundary "
363 <<
" of etaTable from SimConstant";
366 etaSimValu.push_back(std::pair<int,int>(ef,ieta));
369 if (ieta <= hpar->
etaMax[0]) ietaHB =
i+1;
370 if (ieta <= hpar->
etaMin[1]) ietaHE =
i+1;
389 std::cout <<
"Modified eta/deltaphi table for " << nEta <<
" bins" << std::endl;
393 <<
" PhiBin[" <<
i <<
"] = " <<
phibin[
i]/CLHEP::deg <<std::endl;
415 int laymax0 = (imx > 16) ?
layerGroup(
i,16) : laymax;
416 if (
i+1 ==
iEtaMax[0] && laymax0 > 2) laymax0 = 2;
418 std::cout <<
"HB " <<
i <<
" " << imx <<
" " << laymax <<
" " << laymax0 << std::endl;
424 std::cout <<
"HE " <<
i <<
" " << imx <<
" " << laymax << std::endl;
430 for (
int i=0;
i<4; ++
i)
438 for (
unsigned int i=0;
i<
hpar->
rHB.size(); ++
i) {
444 <<
" halves and " <<
gconsHB.size() <<
" layers" << std::endl;
451 for (
unsigned int i=0;
i<
hpar->
zHE.size(); ++
i) {
457 <<
" halves and " <<
gconsHE.size() <<
" layers" << std::endl;
470 if( it.layer == eta + 1 )
472 return it.layerGroup.size();
474 if( it.layer > eta + 1 )
476 k = it.layerGroup.size();
487 if( it.layer == eta + 1 )
489 return it.layerGroup.at( i );
491 if( it.layer > eta + 1 )
494 k = it.layerGroup.at( i );
499 const std::vector<int> &
504 if( it->layer == i + 1 )
505 return it->layerGroup;
506 if( it->layer > i + 1 )
507 return last->layerGroup;
510 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
std::vector< int > phiUnitS
U second(std::pair< T, U > const &p)
const HcalParameters * hpar
std::vector< std::pair< double, double > > gconsHE
std::vector< double > zHE
std::vector< double > phibin
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)
std::vector< int > iEtaMax
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
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
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