7 #include "CLHEP/Units/GlobalPhysicalConstants.h" 8 #include "CLHEP/Units/GlobalSystemOfUnits.h" 29 for (
int simreco = 0; simreco < 2; ++simreco) {
32 for (
unsigned int layer=1; layer <=
tot_layers_[simreco]; ++layer) {
44 edm::LogInfo(
"HGCalGeom") <<
"HGCalDDDConstants initialized for " << name
45 <<
" with " <<
layers(
false) <<
":" 47 <<
":" << 2*
modHalf_ <<
" wafers and " 48 <<
"maximum of " <<
maxCells(
false) <<
":" 52 std::cout <<
"HGCalDDDConstants initialized for " << name <<
" with " 55 <<
":" <<
maxCells(
true) <<
" cells" << std::endl;
60 int wminT(9999999), wmaxT(0), kount1(0), kount2(0);
63 int wmin(9999999), wmax(0), kount(0);
64 for (
int wafer=0; wafer<
sectors(); ++wafer) {
66 if (wafer < wmin) wmin = wafer;
67 if (wafer > wmax) wmax = wafer;
71 if (wminT > wmin) wminT = wmin;
72 if (wmaxT < wmax) wmaxT = wmax;
73 if (kount1 < kount) kount1= kount;
76 int lay1 =
getIndex(lay0,
true).first;
77 std::cout <<
"Index " <<
i <<
" Layer " << lay0 <<
":" << lay1
78 <<
" Wafer " << wmin <<
":" << wmax <<
":" << kount << std::endl;
83 waferMax_ = std::array<int,4>{ {wminT,wmaxT,kount1,kount2} };
85 std::cout <<
"Overall wafer statistics: " << wminT <<
":" << wmaxT <<
":" 86 << kount1 <<
":" << kount2 << std::endl;
93 int subSec,
bool reco)
const {
95 std::pair<int,int> cellAssignment(-1,-1);
97 if (i < 0)
return cellAssignment;
104 return cellAssignment;
120 return std::pair<int,int>(wafer,cell);
124 int indx = (type == 1) ? 0 : 1;
148 std::vector<HGCalParameters::hgtrap> mytrs;
156 std::vector<HGCalParameters::hgtrform> mytrs;
164 bool ok(
false), okMod(
false);
171 const int32_t lay_idx = reco ? (lay-1)*3 + 1 : lay;
173 auto moditr = the_modules.find(copyNumber);
174 ok = okMod = (moditr != the_modules.end());
176 if (!
ok)
std::cout <<
"HGCalDDDConstants: Layer " << lay <<
":" 177 << lay_idx <<
" Copy " << copyNumber <<
":" << mod
178 <<
" Flag " <<
ok << std::endl;
181 if (moditr->second >= 0) {
184 ok = (cell >=0 && cell <= cellmax);
193 if (!
ok)
std::cout <<
"HGCalDDDConstants: Layer " << lay <<
":" 194 << (lay > 0 && (lay <= (
int)(
layers(reco)))) <<
" Module " 195 << mod <<
":" << okMod <<
" Cell " << cell <<
":" 196 << cellmax <<
":" << (cell >=0 && cell <= cellmax)
197 <<
":" <<
maxCells(reco) << std::endl;
214 double rr =
sqrt(x*x+y*y);
216 (rr <= hgpar_->rMaxLayHex_[lay-1]));
219 std::cout <<
"Input " << lay <<
":" << wafer <<
":" << cell <<
" Position " 220 << x <<
":" << y <<
":" << rr <<
" Compare Limits " 222 <<
" Flag " << ok << std::endl;
238 float x(999999.),
y(999999.);
241 if (i < 0)
return std::pair<float,float>(
x,
y);
258 return std::pair<float,float>(
x,
y);
275 return std::pair<float,float>(
x,
y);
281 for (
unsigned int i = 0;
i<
layers(reco); ++
i) {
295 unsigned int cells(0);
300 if (cell > cells) cells = cell;
314 if (i < 0)
return kymax;
320 if (ky > kymax) kymax = ky;
335 if (index.first < 0)
return nmod;
346 std::vector<int> ncell;
354 ncell.emplace_back((
int)(cell));
379 if ((copy/10000)%10 != 0) col = -col;
380 row = (copy/100)%100;
381 if ((copy/100000)%10 != 0) row = -row;
383 return std::pair<int,int>(row,
col);
392 return std::pair<int,int>(-1,-1);
394 int kx(-1),
depth(-1);
401 }
else if (type == 2) {
407 return std::pair<int,int>(kx,
depth);
416 for (
int k=0;
k<ncopies; ++
k) {
427 std::cout <<
"Cannot find " << copy <<
" in a list of " << ncopies <<
"\n";
436 int& wafer,
int& icell,
437 int& celltyp)
const {
442 for (
int k=0;
k<size_; ++
k) {
464 std::cout <<
"Position " << x <<
":" << y <<
" Wafer " << wafer <<
":" 465 << size_ <<
" XX " <<
xx <<
":" << yy <<
" Cell " << icell
466 <<
" Type " << celltyp << std::endl;
472 std::pair<int,float> indx =
getIndex(lay, reco);
473 if (indx.first < 0)
return false;
489 std::pair<double,double>
xy(
xx,yy);
503 for (
unsigned int i = 0;
i<
layers(
true); ++
i) {
515 unsigned ity = (type > 0 && type <= 2) ? type : 0;
516 wafer = (itr->second)[ity];
522 if( waferType < 1 || cell < 0)
return false;
528 const std::vector<double>&
posX,
529 const std::vector<double>&
posY)
const {
531 const double tol(0.00001);
533 for (
unsigned int k=0;
k<posX.size(); ++
k) {
536 if (dx <= (cellR+tol) && dy <= (cellY+tol)) {
537 double xmax = (dy<=0.5*cellY) ? cellR : (cellR-(dy-0.5*cellY)/
tan30deg_);
538 if (dx <= (xmax+tol)) {
549 if (lay<1 || lay>(
int)(
hgpar_->
layerIndex_.size()))
return std::pair<int,float>(-1,0);
550 if (reco && lay>(
int)(
hgpar_->
depthIndex_.size()))
return std::pair<int,float>(-1,0);
558 return std::pair<int,float>(indx,cell);
567 xc[0] = waferX+
rmax_; yc[0] = waferY-0.5*
rr;
568 xc[1] = waferX+
rmax_; yc[1] = waferY+0.5*
rr;
569 xc[2] = waferX; yc[2] = waferY+
rr;
570 xc[3] = waferX-
rmax_; yc[3] = waferY+0.5*
rr;
571 xc[4] = waferX+
rmax_; yc[4] = waferY-0.5*
rr;
572 xc[5] = waferX; yc[5] = waferY-
rr;
573 bool cornerOne(
false), cornerAll(
true);
574 for (
int k=0;
k<6; ++
k) {
577 (rpos <= hgpar_->rMaxLayHex_[lay])) cornerOne =
true;
578 else cornerAll =
false;
bool isHalfCell(int waferType, int cell) const
std::vector< double > waferPosY_
std::vector< int > layer_
std::vector< int > depthLayerF_
std::vector< int > depth_
std::vector< double > moduleCellR_
bool isValid(int lay, int mod, int cell, bool reco) const
layer_map copiesInLayers_
std::vector< HGCalParameters::hgtrap > getModules() const
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
std::array< uint32_t, 2 > tot_layers_
std::map< int, HGCWaferParam > waferLayer_
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
std::vector< int > moduleLayR_
double cellSizeHex(int type) const
HGCalParameters::hgtrform getTrForm(unsigned int k) const
Simrecovecs max_modules_layer_
unsigned int layersInit(bool reco) const
std::array< int, 4 > waferMax_
int maxRows(int lay, bool reco) const
std::vector< int > numberCells(int lay, bool reco) const
std::vector< double > cellFineY_
int modulesInit(int lay, bool reco) const
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
std::vector< uint32_t > trformIndex_
std::vector< int > layerGroupM_
HGCalGeometryMode::GeometryMode mode_
HGCalGeometryMode::GeometryMode mode_
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
std::vector< double > cellCoarseX_
int modules(int lay, bool reco) const
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
unsigned int getTrFormN() const
unsigned int layers(bool reco) const
int numberCellsHexagon(int wafer) const
std::vector< double > cellSize_
std::vector< HGCalParameters::hgtrform > getTrForms() const
std::pair< int, int > assignCellHexagon(float x, float y) const
std::pair< double, double > waferPosition(int wafer, bool reco=true) const
std::vector< int > layerIndex_
hgtrform getTrForm(unsigned int k) const
std::pair< int, float > getIndex(int lay, bool reco) const
HGCalDDDConstants(const HGCalParameters *hp, const std::string &name)
Cos< T >::type cos(const T &t)
hgtrap getModule(unsigned int k, bool reco) const
Abs< T >::type abs(const T &t)
bool isValidCell(int layindex, int wafer, int cell) const
std::vector< double > rMinLayHex_
std::pair< int, int > rowColumnWafer(const int wafer) const
std::vector< double > zLayerHex_
double waferZ(int layer, bool reco) const
#define TYPELOOKUP_DATA_REG(_dataclass_)
std::vector< double > rMaxLayHex_
int waferFromCopy(int copy) const
std::vector< int > layerGroup_
std::vector< double > moduleCellS_
std::vector< double > cellFineX_
std::vector< int > layerGroupO_
std::vector< int > waferCopy_
std::vector< int > depthIndex_
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
const HGCalParameters * hgpar_
int maxCells(bool reco) const
std::vector< double > waferPosX_
T mod(const T &a, const T &b)
std::vector< int > waferTypeL_
std::array< int, 3 > HGCWaferParam
bool waferInLayer(int wafer, int lay, bool reco) const