test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
HGCalDDDConstants Class Reference

#include <HGCalDDDConstants.h>

Public Types

typedef std::array
< std::vector< int32_t >, 2 > 
simrecovecs
 

Public Member Functions

std::pair< int, int > assignCell (float x, float y, int lay, int subSec, bool reco) const
 
std::pair< int, int > assignCellHexagon (float x, float y) const
 
std::pair< int, int > assignCellSquare (float x, float y, float h, float bl, float tl, float alpha, float cellSize) const
 
double cellSizeHex (int type) const
 
std::pair< int, int > findCell (int cell, int lay, int subSec, bool reco) const
 
std::pair< int, int > findCellSquare (int cell, float h, float bl, float tl, float alpha, float cellSize) const
 
HGCalGeometryMode geomMode () const
 
std::pair< int, float > getIndex (int lay, bool reco) const
 
HGCalParameters::hgtrap getModule (unsigned int k, bool hexType, bool reco) const
 
std::vector
< HGCalParameters::hgtrap
getModules () const
 
HGCalParameters::hgtrform getTrForm (unsigned int k) const
 
unsigned int getTrFormN () const
 
std::vector
< HGCalParameters::hgtrform
getTrForms () const
 
 HGCalDDDConstants (const HGCalParameters *hp, const std::string name)
 
bool isHalfCell (int waferType, int cell) const
 
bool isValid (int lay, int mod, int cell, bool reco) const
 
bool isValidCell (int layindex, int wafer, int cell) const
 
unsigned int layers (bool reco) const
 
unsigned int layersInit (bool reco) const
 
int levelTop () const
 
std::pair< float, float > locateCell (int cell, int lay, int type, bool reco) const
 
std::pair< float, float > locateCellHex (int cell, int wafer, bool reco) const
 
int maxCells (bool reco) const
 
int maxCells (int lay, bool reco) const
 
int maxCellsSquare (float h, float bl, float tl, float alpha, float cellSize) const
 
int maxModules () const
 
int maxRows (int lay, bool reco) const
 
double minSlope () const
 
int modules (int lay, bool reco) const
 
int modulesInit (int lay, bool reco) const
 
std::pair< int, int > newCell (int cell, int layer, int sector, int subsector, int incrx, int incry, bool half) const
 
std::pair< int, int > newCell (int cell, int layer, int subsector, int incrz, bool half) const
 
int newCell (int kx, int ky, int lay, int subSec) const
 
std::vector< int > numberCells (int lay, bool reco) const
 
int numberCellsHexagon (int wafer) const
 
std::vector< int > numberCellsSquare (float h, float bl, float tl, float alpha, float cellSize) const
 
std::pair< int, int > rowColumnWafer (const int wafer) const
 
int sectors () const
 
std::pair< int, int > simToReco (int cell, int layer, int mod, bool half) const
 
unsigned int volumes () const
 
int waferFromCopy (int copy) const
 
void waferFromPosition (const double x, const double y, int &wafer, int &icell, int &celltyp) const
 
bool waferInLayer (int wafer, int lay, bool reco) const
 
std::pair< double, double > waferPosition (int wafer) const
 
int wafers () const
 
int waferToCopy (int wafer) const
 
int waferTypeL (int wafer) const
 
int waferTypeT (int wafer) const
 
double waferZ (int layer, bool reco) const
 
 ~HGCalDDDConstants ()
 

Private Member Functions

int cellHex (double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
 
void getParameterSquare (int lay, int subSec, bool reco, float &h, float &bl, float &tl, float &alpha) const
 
bool waferInLayer (int wafer, int lay) const
 

Private Attributes

double hexside_
 
const HGCalParametershgpar_
 
simrecovecs max_modules_layer_
 
HGCalGeometryMode mode_
 
int32_t modHalf_
 
double rmax_
 
std::array< uint32_t, 2 > tot_layers_
 
int32_t tot_wafers_
 

Static Private Attributes

static double tan30deg_ = 0.5773502693
 

Detailed Description

this class reads the constant section of the numbering xml-files of the high granulairy calorimeter

Date:
2014/03/20 00:06:50
Author
Sunanda Banerjee, SINP sunan.nosp@m.da.b.nosp@m.anerj.nosp@m.ee@c.nosp@m.ern.c.nosp@m.h

Definition at line 23 of file HGCalDDDConstants.h.

Member Typedef Documentation

typedef std::array<std::vector<int32_t>, 2> HGCalDDDConstants::simrecovecs

Definition at line 27 of file HGCalDDDConstants.h.

Constructor & Destructor Documentation

HGCalDDDConstants::HGCalDDDConstants ( const HGCalParameters hp,
const std::string  name 
)

Definition at line 15 of file HGCalDDDConstants.cc.

References HGCalParameters::cellSize_, funct::cos(), gather_cfg::cout, hexside_, hgpar_, k_ScaleFromDDD, layers(), layersInit(), max_modules_layer_, maxCells(), mode_, HGCalParameters::mode_, modHalf_, modulesInit(), rmax_, sectors(), Square, tan30deg_, tot_layers_, tot_wafers_, HGCalParameters::waferR_, and wafers().

16  : hgpar_(hp) {
19  rmax_ = 0;
20  modHalf_ = sectors()*layers(true);
21  for (int simreco = 0; simreco < 2; ++simreco ) {
22  tot_layers_[simreco] = layersInit((bool)simreco);
23  }
24 
25  edm::LogInfo("HGCalGeom") << "HGCalDDDConstants initialized for " << name
26  << " with " << layers(false) << ":"
27  << layers(true) << " layers, " << sectors()
28  << " sectors " << 2*modHalf_ << " modules and "
29  << "maximum of " << maxCells(false) << ":"
30  << maxCells(true) << " cells";
31 #ifdef EDM_ML_DEBUG
32  std::cout << "HGCalDDDConstants initialized for " << name << " with "
33  << layers(false) << ":" << layers(true) << " layers, "
34  << sectors() << " sectors and maximum of " << maxCells(false)
35  << ":" << maxCells(true) << " cells" << std::endl;
36 #endif
37  } else {
38  rmax_ = k_ScaleFromDDD * (hgpar_->waferR_) * std::cos(30.0*CLHEP::deg);
39  hexside_ = 2.0 * rmax_ * tan30deg_;
40 #ifdef EDM_ML_DEBUG
41  std::cout << "rmax_ " << rmax_ << ":" << hexside_ << " CellSize "
42  << 0.5*k_ScaleFromDDD*hgpar_->cellSize_[0] << ":"
43  << 0.5*k_ScaleFromDDD*hgpar_->cellSize_[1] << std::endl;
44 #endif
45  // init maps and constants
46  modHalf_ = 0;
47  for (int simreco = 0; simreco < 2; ++simreco) {
48  tot_layers_[simreco] = layersInit((bool)simreco);
49  max_modules_layer_[simreco].resize(tot_layers_[simreco]+1);
50  for (unsigned int layer=1; layer <= tot_layers_[simreco]; ++layer) {
51  max_modules_layer_[simreco][layer] = modulesInit(layer,(bool)simreco);
52  if (simreco == 1) {
53  modHalf_ += max_modules_layer_[simreco][layer];
54 #ifdef EDM_ML_DEBUG
55  std::cout << "Layer " << layer << " with " << max_modules_layer_[simreco][layer] << ":" << modHalf_ << " modules\n";
56 #endif
57  }
58  }
59  }
60  tot_wafers_ = wafers();
61 
62  edm::LogInfo("HGCalGeom") << "HGCalDDDConstants initialized for " << name
63  << " with " << layers(false) << ":"
64  << layers(true) << " layers, " << wafers()
65  << " wafers, " << 2*modHalf_ << " wafers and "
66  << "maximum of " << maxCells(false) << ":"
67  << maxCells(true) << " cells";
68 
69 #ifdef EDM_ML_DEBUG
70  std::cout << "HGCalDDDConstants initialized for " << name << " with "
71  << layers(false) << ":" << layers(true) << " layers, "
72  << wafers() << " wafers and " << "maximum of " << maxCells(false)
73  << ":" << maxCells(true) << " cells" << std::endl;
74 #endif
75 
76  }
77 
78 }
std::array< uint32_t, 2 > tot_layers_
unsigned int layersInit(bool reco) const
int modulesInit(int lay, bool reco) const
unsigned int layers(bool reco) const
std::vector< double > cellSize_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int sectors() const
HGCalGeometryMode
HGCalGeometryMode mode_
simrecovecs max_modules_layer_
double k_ScaleFromDDD
tuple cout
Definition: gather_cfg.py:145
const HGCalParameters * hgpar_
int maxCells(bool reco) const
static double tan30deg_
HGCalDDDConstants::~HGCalDDDConstants ( )

Definition at line 80 of file HGCalDDDConstants.cc.

80 {}

Member Function Documentation

std::pair< int, int > HGCalDDDConstants::assignCell ( float  x,
float  y,
int  lay,
int  subSec,
bool  reco 
) const

Definition at line 82 of file HGCalDDDConstants.cc.

References alpha, assignCellHexagon(), assignCellSquare(), getIndex(), getParameterSquare(), h, i, cmsHarvester::index, k_ScaleFromDDD, mode_, dt_dqm_sourceclient_common_cff::reco, and Square.

Referenced by HGCNumberingScheme::assignCell(), HGCalGeometry::getClosestCell(), HGCNumberingScheme::getUnitID(), and newCell().

83  {
84  std::pair<int,float> index = getIndex(lay, reco);
85  std::pair<int,int> cellAssignment(-1,-1);
86  int i = index.first;
87  if (i < 0) return cellAssignment;
89  float alpha, h, bl, tl;
90  getParameterSquare(i,subSec,reco,h,bl,tl,alpha);
91  cellAssignment = assignCellSquare(x, y, h, bl, tl, alpha, index.second);
92  } else {
93  float xx = (reco) ? x : k_ScaleFromDDD*x;
94  float yy = (reco) ? y : k_ScaleFromDDD*y;
95  cellAssignment = assignCellHexagon(xx,yy);
96  }
97  return cellAssignment;
98 }
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::pair< int, int > assignCellSquare(float x, float y, float h, float bl, float tl, float alpha, float cellSize) const
std::pair< int, int > assignCellHexagon(float x, float y) const
std::pair< int, float > getIndex(int lay, bool reco) const
void getParameterSquare(int lay, int subSec, bool reco, float &h, float &bl, float &tl, float &alpha) const
HGCalGeometryMode mode_
double k_ScaleFromDDD
std::pair< int, int > HGCalDDDConstants::assignCellHexagon ( float  x,
float  y 
) const

Definition at line 143 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellHex(), HGCalParameters::cellSize_, hgpar_, k_ScaleFromDDD, rmax_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, and HGCalParameters::waferTypeT_.

Referenced by assignCell().

144  {
145  double xx(x), yy(y);
146  //First the wafer
147  int wafer = cellHex(xx, yy, rmax_, hgpar_->waferPosX_, hgpar_->waferPosY_);
148  // Now the cell
149  xx -= hgpar_->waferPosX_[wafer];
150  yy -= hgpar_->waferPosY_[wafer];
151  int cell(0);
152  if (hgpar_->waferTypeT_[wafer] == 1)
154  else
156  return std::pair<int,int>(wafer,cell);
157 }
std::vector< double > waferPosY_
std::vector< double > cellFineY_
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
std::vector< double > cellCoarseX_
std::vector< double > cellSize_
std::vector< double > cellFineX_
double k_ScaleFromDDD
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::pair< int, int > HGCalDDDConstants::assignCellSquare ( float  x,
float  y,
float  h,
float  bl,
float  tl,
float  alpha,
float  cellSize 
) const

Definition at line 100 of file HGCalDDDConstants.cc.

References a, b, h, and k_horizontalShift.

Referenced by assignCell().

103  {
104 
105  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
106  float b = 2*h*bl/(tl-bl);
107 
108  float x0(x);
109  int phiSector = (x0 > 0) ? 1 : 0;
110  if (alpha < 0) {x0 -= 0.5*(tl+bl); phiSector = 0;}
111  else if (alpha > 0) {x0 += 0.5*(tl+bl); phiSector = 1;}
112 
113  //determine the i-y
114  int ky = floor((y+h)/cellSize);
115  if (ky*cellSize> y+h) ky--;
116  if (ky<0) return std::pair<int,int>(-1,-1);
117  if ((ky+1)*cellSize < (y+h) ) ky++;
118  int max_ky_allowed=floor(2*h/cellSize);
119  if (ky>max_ky_allowed-1) return std::pair<int,int>(-1,-1);
120 
121  //determine the i-x
122  //notice we substitute y by the top of the candidate cell to reduce the dead zones
123  int kx = floor(fabs(x0)/cellSize);
124  if (kx*cellSize > fabs(x0) ) kx--;
125  if (kx<0) return std::pair<int,int>(-1,-1);
126  if ((kx+1)*cellSize < fabs(x0)) kx++;
127  int max_kx_allowed=floor( ((ky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize) );
128  if (kx>max_kx_allowed-1) return std::pair<int,int>(-1,-1);
129 
130  //count cells summing in rows until required height
131  //notice the bottom of the cell must be used
132  int icell(0);
133  for (int iky=0; iky<ky; ++iky) {
134  int cellsInRow( floor( ((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize) ) );
135  icell += cellsInRow;
136  }
137  icell += kx;
138 
139  //return result
140  return std::pair<int,int>(phiSector,icell);
141 }
double k_horizontalShift
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
int HGCalDDDConstants::cellHex ( double  xx,
double  yy,
const double &  cellR,
const std::vector< double > &  posX,
const std::vector< double > &  posY 
) const
private

Definition at line 696 of file HGCalDDDConstants.cc.

References funct::abs(), relval_2017::k, pileupDistInMC::num, tan30deg_, and hlt_dqm_clientPB-live_cfg::xmax.

Referenced by assignCellHexagon(), and waferFromPosition().

699  {
700  int num(0);
701  const double tol(0.00001);
702  double cellY = 2.0*cellR*tan30deg_;
703  for (unsigned int k=0; k<posX.size(); ++k) {
704  double dx = std::abs(xx - posX[k]);
705  double dy = std::abs(yy - posY[k]);
706  if (dx <= (cellR+tol) && dy <= (cellY+tol)) {
707  double xmax = (dy<=0.5*cellY) ? cellR : (cellR-(dy-0.5*cellY)/tan30deg_);
708  if (dx <= (xmax+tol)) {
709  num = k;
710  break;
711  }
712  }
713  }
714  return num;
715 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static double tan30deg_
double HGCalDDDConstants::cellSizeHex ( int  type) const

Definition at line 159 of file HGCalDDDConstants.cc.

References HGCalParameters::cellSize_, hgpar_, and k_ScaleFromDDD.

Referenced by HGCalGeometryLoader::build(), and hgcal::RecHitTools::getRadiusToSide().

159  {
160  int indx = (type == 1) ? 0 : 1;
161  double cell = (0.5*k_ScaleFromDDD*hgpar_->cellSize_[indx]);
162  return cell;
163 }
type
Definition: HCALResponse.h:21
std::vector< double > cellSize_
double k_ScaleFromDDD
const HGCalParameters * hgpar_
std::pair< int, int > HGCalDDDConstants::findCell ( int  cell,
int  lay,
int  subSec,
bool  reco 
) const

Definition at line 173 of file HGCalDDDConstants.cc.

References alpha, findCellSquare(), getIndex(), getParameterSquare(), h, i, cmsHarvester::index, mode_, and Square.

Referenced by locateCell(), and newCell().

174  {
175 
176  std::pair<int,float> index = getIndex(lay, reco);
177  int i = index.first;
178  if (i < 0) return std::pair<int,int>(-1,-1);
180  return std::pair<int,int>(-1,-1);
181  } else {
182  float alpha, h, bl, tl;
183  getParameterSquare(i,subSec,reco,h,bl,tl,alpha);
184  return findCellSquare(cell, h, bl, tl, alpha, index.second);
185  }
186 }
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::pair< int, int > findCellSquare(int cell, float h, float bl, float tl, float alpha, float cellSize) const
std::pair< int, float > getIndex(int lay, bool reco) const
void getParameterSquare(int lay, int subSec, bool reco, float &h, float &bl, float &tl, float &alpha) const
HGCalGeometryMode mode_
std::pair< int, int > HGCalDDDConstants::findCellSquare ( int  cell,
float  h,
float  bl,
float  tl,
float  alpha,
float  cellSize 
) const

Definition at line 188 of file HGCalDDDConstants.cc.

References a, b, and k_horizontalShift.

Referenced by findCell(), and simToReco().

191  {
192 
193  //check if cell number is meaningful
194  if(cell<0) return std::pair<int,int>(-1,-1);
195 
196  //parameterization of the boundary of the trapezoid
197  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
198  float b = 2*h*bl/(tl-bl);
199  int kx(cell), ky(0);
200  int kymax( floor((2*h)/cellSize) );
201  int testCell(0);
202  for (int iky=0; iky<kymax; ++iky) {
203 
204  //check if adding all the cells in this row is above the required cell
205  //notice the top of the cell is used to maximize space
206  int cellsInRow(floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize)));
207  if (testCell+cellsInRow > cell) break;
208  testCell += cellsInRow;
209  ky++;
210  kx -= cellsInRow;
211  }
212 
213  return std::pair<int,int>(kx,ky);
214 }
double k_horizontalShift
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
HGCalGeometryMode HGCalDDDConstants::geomMode ( ) const
inline
std::pair< int, float > HGCalDDDConstants::getIndex ( int  lay,
bool  reco 
) const

Definition at line 717 of file HGCalDDDConstants.cc.

References HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, hgpar_, HGCalParameters::layerIndex_, mode_, HGCalParameters::moduleCellR_, HGCalParameters::moduleCellS_, and Square.

Referenced by assignCell(), findCell(), locateCell(), maxCells(), maxRows(), modules(), modulesInit(), newCell(), numberCells(), simToReco(), waferInLayer(), and waferZ().

717  {
718 
719  if (lay<1 || lay>(int)(hgpar_->layerIndex_.size())) return std::pair<int,float>(-1,0);
720  if (reco && lay>(int)(hgpar_->depthIndex_.size())) return std::pair<int,float>(-1,0);
721  int indx(0);
722  float cell(0);
724  indx = (reco ? hgpar_->depthIndex_[lay-1] : hgpar_->layerIndex_[lay-1]);
725  cell = (reco ? hgpar_->moduleCellR_[indx] : hgpar_->moduleCellS_[indx]);
726  } else {
727  indx = (reco ? hgpar_->depthLayerF_[lay-1] : hgpar_->layerIndex_[lay-1]);
728  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
729  }
730  return std::pair<int,float>(indx,cell);
731 }
std::vector< int > depthLayerF_
std::vector< double > moduleCellR_
std::vector< int > layerIndex_
std::vector< double > moduleCellS_
HGCalGeometryMode mode_
std::vector< int > depthIndex_
const HGCalParameters * hgpar_
HGCalParameters::hgtrap HGCalDDDConstants::getModule ( unsigned int  k,
bool  hexType,
bool  reco 
) const

Definition at line 216 of file HGCalDDDConstants.cc.

References HGCalParameters::getModule(), hgpar_, reco::if(), and HGCalParameters::waferTypeL_.

Referenced by HGCalGeometryLoader::build(), and HGCalGeometry::getSummary().

218  {
219 
221  if (hexType) {
222  unsigned int type = (indx < hgpar_->waferTypeL_.size()) ?
223  hgpar_->waferTypeL_[indx] : 3;
224  if (type > 0) --type;
225  mytr = hgpar_->getModule(type, true);
226  } else {
227  if (reco) mytr = hgpar_->getModule(indx,true);
228  else mytr = hgpar_->getModule(indx,false);
229  }
230  return mytr;
231 }
type
Definition: HCALResponse.h:21
hgtrap getModule(unsigned int k, bool reco) const
if(dp >Float(M_PI)) dp-
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
std::vector< HGCalParameters::hgtrap > HGCalDDDConstants::getModules ( ) const

Definition at line 233 of file HGCalDDDConstants.cc.

References HGCalParameters::getModule(), hgpar_, relval_2017::k, and HGCalParameters::moduleLayR_.

233  {
234 
235  std::vector<HGCalParameters::hgtrap> mytrs;
236  for (unsigned int k=0; k<hgpar_->moduleLayR_.size(); ++k)
237  mytrs.push_back(hgpar_->getModule(k,true));
238  return mytrs;
239 }
std::vector< int > moduleLayR_
hgtrap getModule(unsigned int k, bool reco) const
const HGCalParameters * hgpar_
void HGCalDDDConstants::getParameterSquare ( int  lay,
int  subSec,
bool  reco,
float &  h,
float &  bl,
float &  tl,
float &  alpha 
) const
private

Definition at line 733 of file HGCalDDDConstants.cc.

References alpha, hgpar_, HGCalParameters::moduleAlphaR_, HGCalParameters::moduleAlphaS_, HGCalParameters::moduleBlR_, HGCalParameters::moduleBlS_, HGCalParameters::moduleHR_, HGCalParameters::moduleHS_, HGCalParameters::moduleTlR_, and HGCalParameters::moduleTlS_.

Referenced by assignCell(), findCell(), locateCell(), maxCells(), and numberCells().

735  {
736  if (reco) {
737  h = hgpar_->moduleHR_[lay];
738  bl = hgpar_->moduleBlR_[lay];
739  tl = hgpar_->moduleTlR_[lay];
740  alpha= hgpar_->moduleAlphaR_[lay];
741  if ((subSec>0 && alpha<0) || (subSec<=0 && alpha>0)) alpha = -alpha;
742  } else {
743  h = hgpar_->moduleHS_[lay];
744  bl = hgpar_->moduleBlS_[lay];
745  tl = hgpar_->moduleTlS_[lay];
746  alpha= hgpar_->moduleAlphaS_[lay];
747  }
748 }
float alpha
Definition: AMPTWrapper.h:95
std::vector< double > moduleHR_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< double > moduleHS_
std::vector< double > moduleAlphaR_
std::vector< double > moduleBlR_
std::vector< double > moduleTlS_
std::vector< double > moduleAlphaS_
std::vector< double > moduleBlS_
const HGCalParameters * hgpar_
std::vector< double > moduleTlR_
HGCalParameters::hgtrform HGCalDDDConstants::getTrForm ( unsigned int  k) const
inline

Definition at line 92 of file HGCalDDDConstants.h.

References HGCalParameters::getTrForm(), and hgpar_.

Referenced by HGCalGeometryLoader::build(), and HGCalGeometry::getSummary().

92 {return hgpar_->getTrForm(k);}
hgtrform getTrForm(unsigned int k) const
const HGCalParameters * hgpar_
unsigned int HGCalDDDConstants::getTrFormN ( ) const
inline

Definition at line 91 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::trformIndex_.

Referenced by HGCalGeometryLoader::build(), and HGCalGeometry::getSummary().

91 {return hgpar_->trformIndex_.size();}
std::vector< uint32_t > trformIndex_
const HGCalParameters * hgpar_
std::vector< HGCalParameters::hgtrform > HGCalDDDConstants::getTrForms ( ) const

Definition at line 241 of file HGCalDDDConstants.cc.

References HGCalParameters::getTrForm(), hgpar_, relval_2017::k, and HGCalParameters::trformIndex_.

Referenced by HGCalTrackCollectionProducer::beginLuminosityBlock().

241  {
242 
243  std::vector<HGCalParameters::hgtrform> mytrs;
244  for (unsigned int k=0; k<hgpar_->trformIndex_.size(); ++k)
245  mytrs.push_back(hgpar_->getTrForm(k));
246  return mytrs;
247 }
std::vector< uint32_t > trformIndex_
hgtrform getTrForm(unsigned int k) const
const HGCalParameters * hgpar_
bool HGCalDDDConstants::isHalfCell ( int  waferType,
int  cell 
) const

Definition at line 691 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseHalf_, HGCalParameters::cellFineHalf_, and hgpar_.

Referenced by hgcal::RecHitTools::isHalfCell().

691  {
692  if( waferType < 1 || cell < 0) return false;
693  return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell];
694 }
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
const HGCalParameters * hgpar_
bool HGCalDDDConstants::isValid ( int  lay,
int  mod,
int  cell,
bool  reco 
) const

Definition at line 249 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, HGCalParameters::copiesInLayers_, gather_cfg::cout, hgpar_, isValidCell(), layers(), maxCells(), mod(), mode_, modmax, convertSQLiteXML::ok, sectors(), Square, HGCalParameters::waferCopy_, and HGCalParameters::waferTypeT_.

Referenced by ntuple._Object::_checkIsValid(), HGCNumberingScheme::getUnitID(), core.AutoHandle.AutoHandle::ReallyLoad(), and HGCalTopology::valid().

249  {
250 
251  bool ok(false);
252  int cellmax(0), modmax(0);
254  cellmax = maxCells(lay,reco);
255  modmax = sectors();
256  ok = ((lay > 0 && lay <= (int)(layers(reco))) &&
257  (mod > 0 && mod <= modmax) &&
258  (cell >=0 && cell <= cellmax));
259  } else {
260  int32_t copyNumber = hgpar_->waferCopy_[mod];
261  ok = ((lay > 0 && lay <= (int)(layers(reco))));
262  if( ok ) {
263  const int32_t lay_idx = reco ? (lay-1)*3 + 1 : lay;
264  const auto& the_modules = hgpar_->copiesInLayers_[lay_idx];
265  auto moditr = the_modules.find(copyNumber);
266  ok = (moditr != the_modules.end());
267  if (ok) {
268  if (moditr->second >= 0) {
269  cellmax = (hgpar_->waferTypeT_[mod]==1) ?
270  (int)(hgpar_->cellFineX_.size()) : (int)(hgpar_->cellCoarseX_.size());
271  ok = (cell >=0 && cell <= cellmax);
272  } else {
273  ok = isValidCell(lay_idx, mod, cell);
274  }
275  }
276  }
277  }
278 
279 #ifdef EDM_ML_DEBUG
280  if (!ok) std::cout << "HGCalDDDConstants: Layer " << lay << ":"
281  << (lay > 0 && (lay <= (int)(layers(reco)))) << " Module "
282  << mod << ":" << (mod > 0 && mod <= modmax) << " Cell "
283  << cell << ":" << (cell >=0 && cell <= cellmax)
284  << ":" << maxCells(reco) << std::endl;
285 #endif
286  return ok;
287 }
layer_map copiesInLayers_
static const int modmax
Definition: herwig.h:133
std::vector< double > cellCoarseX_
unsigned int layers(bool reco) const
bool isValidCell(int layindex, int wafer, int cell) const
int sectors() const
HGCalGeometryMode mode_
std::vector< double > cellFineX_
std::vector< int > waferCopy_
tuple cout
Definition: gather_cfg.py:145
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
int maxCells(bool reco) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
bool HGCalDDDConstants::isValidCell ( int  layindex,
int  wafer,
int  cell 
) const

Definition at line 289 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, gather_cfg::cout, hgpar_, convertSQLiteXML::ok, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, findQualityFiles::rr, mathSSE::sqrt(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, x, and y.

Referenced by isValid().

289  {
290 
291  // Calculate the position of the cell
292  double x = hgpar_->waferPosX_[wafer];
293  double y = hgpar_->waferPosY_[wafer];
294  if (hgpar_->waferTypeT_[wafer] == 1) {
295  x += hgpar_->cellFineX_[cell];
296  y += hgpar_->cellFineY_[cell];
297  } else {
298  x += hgpar_->cellCoarseX_[cell];
299  y += hgpar_->cellCoarseY_[cell];
300  }
301  double rr = sqrt(x*x+y*y);
302  bool ok = ((rr >= hgpar_->rMinLayHex_[lay-1]) &
303  (rr <= hgpar_->rMaxLayHex_[lay-1]));
304 #ifdef EDM_ML_DEBUG
305  std::cout << "Input " << lay << ":" << wafer << ":" << cell << " Position "
306  << x << ":" << y << ":" << rr << " Compare Limits "
307  << hgpar_->rMinLayHex_[lay-1] << ":" << hgpar_->rMaxLayHex_[lay-1]
308  << " Flag " << ok << std::endl;
309 #endif
310  return ok;
311 }
std::vector< double > waferPosY_
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< double > rMinLayHex_
std::vector< double > rMaxLayHex_
std::vector< double > cellFineX_
tuple cout
Definition: gather_cfg.py:145
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
unsigned int HGCalDDDConstants::layers ( bool  reco) const
unsigned int HGCalDDDConstants::layersInit ( bool  reco) const

Definition at line 169 of file HGCalDDDConstants.cc.

References HGCalParameters::depthIndex_, hgpar_, and HGCalParameters::layerIndex_.

Referenced by HGCalDDDConstants().

169  {
170  return (reco ? hgpar_->depthIndex_.size() : hgpar_->layerIndex_.size());
171 }
std::vector< int > layerIndex_
std::vector< int > depthIndex_
const HGCalParameters * hgpar_
int HGCalDDDConstants::levelTop ( ) const
inline

Definition at line 50 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::levelT_.

50 {return hgpar_->levelT_;}
const HGCalParameters * hgpar_
std::pair< float, float > HGCalDDDConstants::locateCell ( int  cell,
int  lay,
int  type,
bool  reco 
) const

Definition at line 313 of file HGCalDDDConstants.cc.

References alpha, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, findCell(), getIndex(), getParameterSquare(), h, hgpar_, i, cmsHarvester::index, k_ScaleFromDDD, mode_, Square, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, x, and y.

Referenced by HGCalSimHitValidation::analyzeHits(), HGCalTBAnalyzer::analyzeSimHits(), HGCalGeometry::getCorners(), HGCNumberingScheme::getLocalCoords(), HGCalGeometry::getPosition(), and newCell().

314  {
315  // type refers to subsector # for square cell and wafer # for hexagon cell
316  float x(999999.), y(999999.);
317  std::pair<int,float> index = getIndex(lay, reco);
318  int i = index.first;
319  if (i < 0) return std::pair<float,float>(x,y);
321  std::pair<int,int> kxy = findCell(cell, lay, type, reco);
322  float alpha, h, bl, tl;
323  getParameterSquare(i,type,reco,h,bl,tl,alpha);
324  float cellSize = index.second;
325  x = (kxy.first+0.5)*cellSize;
326  if (alpha < 0) x -= 0.5*(tl+bl);
327  else if (alpha > 0) x -= 0.5*(tl+bl);
328  if (type != 1) x = -x;
329  y = ((kxy.second+0.5)*cellSize-h);
330  } else {
331  x = hgpar_->waferPosX_[type];
332  y = hgpar_->waferPosY_[type];
333  if (hgpar_->waferTypeT_[type] == 1) {
334  x += hgpar_->cellFineX_[cell];
335  y += hgpar_->cellFineY_[cell];
336  } else {
337  x += hgpar_->cellCoarseX_[cell];
338  y += hgpar_->cellCoarseY_[cell];
339  }
340  if (!reco) {
341  x /= k_ScaleFromDDD;
342  y /= k_ScaleFromDDD;
343  }
344  }
345  return std::pair<float,float>(x,y);
346 }
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
std::pair< int, int > findCell(int cell, int lay, int subSec, bool reco) const
std::pair< int, float > getIndex(int lay, bool reco) const
void getParameterSquare(int lay, int subSec, bool reco, float &h, float &bl, float &tl, float &alpha) const
HGCalGeometryMode mode_
std::vector< double > cellFineX_
double k_ScaleFromDDD
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::pair< float, float > HGCalDDDConstants::locateCellHex ( int  cell,
int  wafer,
bool  reco 
) const

Definition at line 348 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, hgpar_, k_ScaleFromDDD, HGCalParameters::waferTypeT_, x, and y.

Referenced by HGCalGeometry::getCorners(), and HGCalGeometry::getPosition().

349  {
350  float x(0), y(0);
351  if (hgpar_->waferTypeT_[wafer] == 1) {
352  x = hgpar_->cellFineX_[cell];
353  y = hgpar_->cellFineY_[cell];
354  } else {
355  x = hgpar_->cellCoarseX_[cell];
356  y = hgpar_->cellCoarseY_[cell];
357  }
358  if (!reco) {
359  x /= k_ScaleFromDDD;
360  y /= k_ScaleFromDDD;
361  }
362  return std::pair<float,float>(x,y);
363 }
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
std::vector< double > cellFineX_
double k_ScaleFromDDD
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
int HGCalDDDConstants::maxCells ( bool  reco) const

Definition at line 365 of file HGCalDDDConstants.cc.

References HGCalParameters::depth_, hgpar_, i, HGCalParameters::layer_, and layers().

Referenced by HGCalDDDConstants(), HGCalTopology::HGCalTopology(), isValid(), HGCalGeometry::newCell(), and newCell().

365  {
366 
367  int cells(0);
368  for (unsigned int i = 0; i<layers(reco); ++i) {
369  int lay = reco ? hgpar_->depth_[i] : hgpar_->layer_[i];
370  if (cells < maxCells(lay, reco)) cells = maxCells(lay, reco);
371  }
372  return cells;
373 }
std::vector< int > layer_
int i
Definition: DBlmapReader.cc:9
std::vector< int > depth_
unsigned int layers(bool reco) const
const HGCalParameters * hgpar_
int maxCells(bool reco) const
int HGCalDDDConstants::maxCells ( int  lay,
bool  reco 
) const

Definition at line 375 of file HGCalDDDConstants.cc.

References alpha, HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, getIndex(), getParameterSquare(), h, hgpar_, i, cmsHarvester::index, relval_2017::k, maxCellsSquare(), mode_, Square, waferInLayer(), and HGCalParameters::waferTypeT_.

375  {
376 
377  std::pair<int,float> index = getIndex(lay, reco);
378  int i = index.first;
379  if (i < 0) return 0;
381  float h, bl, tl, alpha;
382  getParameterSquare(i,0,reco,h,bl,tl,alpha);
383  return maxCellsSquare(h, bl, tl, alpha, index.second);
384  } else {
385  unsigned int cells(0);
386  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
387  if (waferInLayer(k,index.first)) {
388  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
389  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
390  if (cell > cells) cells = cell;
391  }
392  }
393  return (int)(cells);
394  }
395 }
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
int maxCellsSquare(float h, float bl, float tl, float alpha, float cellSize) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< double > cellCoarseX_
std::pair< int, float > getIndex(int lay, bool reco) const
void getParameterSquare(int lay, int subSec, bool reco, float &h, float &bl, float &tl, float &alpha) const
HGCalGeometryMode mode_
std::vector< double > cellFineX_
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
bool waferInLayer(int wafer, int lay, bool reco) const
int HGCalDDDConstants::maxCellsSquare ( float  h,
float  bl,
float  tl,
float  alpha,
float  cellSize 
) const

Definition at line 397 of file HGCalDDDConstants.cc.

References a, b, and k_horizontalShift.

Referenced by maxCells().

398  {
399 
400  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
401  float b = 2*h*bl/(tl-bl);
402 
403  int ncells(0);
404  //always use the top of the cell to maximize space
405  int kymax = floor((2*h)/cellSize);
406  for (int iky=0; iky<kymax; ++iky) {
407  int cellsInRow=floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize));
408  ncells += cellsInRow;
409  }
410 
411  return ncells;
412 }
double k_horizontalShift
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
int HGCalDDDConstants::maxModules ( ) const
inline

Definition at line 55 of file HGCalDDDConstants.h.

References modHalf_.

55 {return modHalf_;}
int HGCalDDDConstants::maxRows ( int  lay,
bool  reco 
) const

Definition at line 414 of file HGCalDDDConstants.cc.

References getIndex(), h, hgpar_, i, cmsHarvester::index, relval_2017::k, mode_, HGCalParameters::moduleHR_, HGCalParameters::moduleHS_, dt_dqm_sourceclient_common_cff::reco, Square, HGCalParameters::waferCopy_, and waferInLayer().

Referenced by newCell().

414  {
415 
416  int kymax(0);
417  std::pair<int,float> index = getIndex(lay, reco);
418  int i = index.first;
419  if (i < 0) return kymax;
421  float h = (reco) ? hgpar_->moduleHR_[i] : hgpar_->moduleHS_[i];
422  kymax = floor((2*h)/index.second);
423  } else {
424  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
425  if (waferInLayer(k,i)) {
426  int ky = ((hgpar_->waferCopy_[k])/100)%100;
427  if (ky > kymax) kymax = ky;
428  }
429  }
430  }
431  return kymax;
432 }
int i
Definition: DBlmapReader.cc:9
std::vector< double > moduleHR_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< double > moduleHS_
std::pair< int, float > getIndex(int lay, bool reco) const
HGCalGeometryMode mode_
std::vector< int > waferCopy_
const HGCalParameters * hgpar_
bool waferInLayer(int wafer, int lay, bool reco) const
double HGCalDDDConstants::minSlope ( ) const
inline

Definition at line 57 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::slopeMin_.

57 {return hgpar_->slopeMin_;}
const HGCalParameters * hgpar_
int HGCalDDDConstants::modules ( int  lay,
bool  reco 
) const

Definition at line 434 of file HGCalDDDConstants.cc.

References plotBeamSpotDB::first, getIndex(), and max_modules_layer_.

Referenced by wafers().

434  {
435  if( getIndex(lay,reco).first < 0 ) return 0;
436  return max_modules_layer_[(int)reco][lay];
437 }
std::pair< int, float > getIndex(int lay, bool reco) const
simrecovecs max_modules_layer_
int HGCalDDDConstants::modulesInit ( int  lay,
bool  reco 
) const

Definition at line 439 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, cmsHarvester::index, relval_2017::k, waferInLayer(), and HGCalParameters::waferPosX_.

Referenced by HGCalDDDConstants().

439  {
440  int nmod(0);
441  std::pair<int,float> index = getIndex(lay, reco);
442  if (index.first < 0) return nmod;
443  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
444  if (waferInLayer(k,index.first)) ++nmod;
445  }
446  return nmod;
447 }
std::pair< int, float > getIndex(int lay, bool reco) const
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
bool waferInLayer(int wafer, int lay, bool reco) const
std::pair< int, int > HGCalDDDConstants::newCell ( int  cell,
int  layer,
int  sector,
int  subsector,
int  incrx,
int  incry,
bool  half 
) const

Definition at line 449 of file HGCalDDDConstants.cc.

References findCell(), hgpar_, maxCells(), maxRows(), and HGCalParameters::nSectors_.

Referenced by HGCalTopology::changeXY(), and HGCalTopology::changeZ().

451  {
452 
453  int subSec = half ? subsector : 0;
454  std::pair<int,int> kxy = findCell(cell, layer, subSec, true);
455  int kx = kxy.first + incrx;
456  int ky = kxy.second + incry;
457  if (ky < 0 || ky > maxRows(layer, true)) {
458  cell = maxCells(true);
459  return std::pair<int,int>(cell,sector*subsector);
460  } else if (kx < 0) {
461  kx =-kx;
462  subsector =-subsector;
463  } else if (kx > maxCells(layer, true)) {
464  kx -= maxCells(layer, true);
465  sector += subsector;
466  subsector =-subsector;
467  if (sector < 1) sector = hgpar_->nSectors_;
468  else if (sector > hgpar_->nSectors_) sector = 1;
469  }
470  cell = newCell(kx, ky, layer, subSec);
471  return std::pair<int,int>(cell,sector*subsector);
472 }
int maxRows(int lay, bool reco) const
std::pair< int, int > findCell(int cell, int lay, int subSec, bool reco) const
std::pair< int, int > newCell(int cell, int layer, int sector, int subsector, int incrx, int incry, bool half) const
const HGCalParameters * hgpar_
int maxCells(bool reco) const
std::pair< int, int > HGCalDDDConstants::newCell ( int  cell,
int  layer,
int  subsector,
int  incrz,
bool  half 
) const

Definition at line 474 of file HGCalDDDConstants.cc.

References assignCell(), layers(), locateCell(), and create_public_lumi_plots::xy.

475  {
476 
477  int layer = lay + incrz;
478  if (layer <= 0 || layer > (int)(layers(true))) return std::pair<int,int>(cell,0);
479  int subSec = half ? subsector : 0;
480  std::pair<float,float> xy = locateCell(cell, lay, subSec, true);
481  std::pair<int,int> kcell = assignCell(xy.first, xy.second, layer, subSec,
482  true);
483  return std::pair<int,int>(kcell.second,layer);
484 }
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
unsigned int layers(bool reco) const
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
int HGCalDDDConstants::newCell ( int  kx,
int  ky,
int  lay,
int  subSec 
) const

Definition at line 486 of file HGCalDDDConstants.cc.

References a, alpha, b, getIndex(), hgpar_, i, cmsHarvester::index, k_horizontalShift, maxCells(), HGCalParameters::moduleAlphaS_, HGCalParameters::moduleBlR_, HGCalParameters::moduleHR_, and HGCalParameters::moduleTlR_.

486  {
487 
488  std::pair<int,float> index = getIndex(lay, true);
489  int i = index.first;
490  if (i < 0) return maxCells(true);
491  float alpha = (subSec == 0) ? hgpar_->moduleAlphaS_[i] : subSec;
492  float cellSize = index.second;
493  float a = (alpha==0) ?
496  float b = 2*hgpar_->moduleHR_[i]*hgpar_->moduleBlR_[i]/
498  int icell(kx);
499  for (int iky=0; iky<ky; ++iky)
500  icell += floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize));
501  return icell;
502 }
int i
Definition: DBlmapReader.cc:9
double k_horizontalShift
float alpha
Definition: AMPTWrapper.h:95
std::vector< double > moduleHR_
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > moduleBlR_
double b
Definition: hdecay.h:120
std::vector< double > moduleAlphaS_
double a
Definition: hdecay.h:121
const HGCalParameters * hgpar_
int maxCells(bool reco) const
std::vector< double > moduleTlR_
std::vector< int > HGCalDDDConstants::numberCells ( int  lay,
bool  reco 
) const

Definition at line 504 of file HGCalDDDConstants.cc.

References alpha, HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, getIndex(), getParameterSquare(), h, hgpar_, i, cmsHarvester::index, relval_2017::k, mode_, numberCellsSquare(), Square, waferInLayer(), and HGCalParameters::waferTypeT_.

504  {
505 
506  std::pair<int,float> index = getIndex(lay, reco);
507  int i = index.first;
508  std::vector<int> ncell;
509  if (i >= 0) {
511  float h, bl, tl, alpha;
512  getParameterSquare(i,0,reco,h,bl,tl,alpha);
513  return numberCellsSquare(h, bl, tl, alpha, index.second);
514  } else {
515  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
516  if (waferInLayer(k,i)) {
517  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
518  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
519  ncell.push_back((int)(cell));
520  }
521  }
522  }
523  }
524  return ncell;
525 }
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
std::vector< int > numberCellsSquare(float h, float bl, float tl, float alpha, float cellSize) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< double > cellCoarseX_
std::pair< int, float > getIndex(int lay, bool reco) const
void getParameterSquare(int lay, int subSec, bool reco, float &h, float &bl, float &tl, float &alpha) const
HGCalGeometryMode mode_
std::vector< double > cellFineX_
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
bool waferInLayer(int wafer, int lay, bool reco) const
int HGCalDDDConstants::numberCellsHexagon ( int  wafer) const

Definition at line 540 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, hgpar_, and HGCalParameters::waferTypeT_.

Referenced by HGCalGeometry::newCell().

540  {
541 
542  int ncell(0);
543  if (wafer >= 0 && wafer < (int)(hgpar_->waferTypeT_.size())) {
544  if (hgpar_->waferTypeT_[wafer]==1)
545  ncell = (int)(hgpar_->cellFineX_.size());
546  else
547  ncell = (int)(hgpar_->cellCoarseX_.size());
548  }
549  return ncell;
550 }
std::vector< double > cellCoarseX_
std::vector< double > cellFineX_
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
std::vector< int > HGCalDDDConstants::numberCellsSquare ( float  h,
float  bl,
float  tl,
float  alpha,
float  cellSize 
) const

Definition at line 527 of file HGCalDDDConstants.cc.

References a, b, and k_horizontalShift.

Referenced by numberCells().

529  {
530 
531  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
532  float b = 2*h*bl/(tl-bl);
533  int kymax = floor((2*h)/cellSize);
534  std::vector<int> ncell;
535  for (int iky=0; iky<kymax; ++iky)
536  ncell.push_back(floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize)));
537  return ncell;
538 }
double k_horizontalShift
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
std::pair< int, int > HGCalDDDConstants::rowColumnWafer ( const int  wafer) const

Definition at line 552 of file HGCalDDDConstants.cc.

References cuy::col, filterCSVwithJSON::copy, hgpar_, and HGCalParameters::waferCopy_.

552  {
553  int row(0), col(0);
554  if (wafer < (int)(hgpar_->waferCopy_.size())) {
555  int copy = hgpar_->waferCopy_[wafer];
556  col = copy%100;
557  if ((copy/10000)%10 != 0) col = -col;
558  row = (copy/100)%100;
559  if ((copy/100000)%10 != 0) row = -row;
560  }
561  return std::pair<int,int>(row,col);
562 }
std::vector< int > waferCopy_
int col
Definition: cuy.py:1008
const HGCalParameters * hgpar_
int HGCalDDDConstants::sectors ( ) const
inline
std::pair< int, int > HGCalDDDConstants::simToReco ( int  cell,
int  layer,
int  mod,
bool  half 
) const

Definition at line 564 of file HGCalDDDConstants.cc.

References a, b, HGCalParameters::cellFactor_, gather_cfg::cout, HLT_25ns10e33_v2_cff::depth, findCellSquare(), getIndex(), h, hgpar_, i, cmsHarvester::index, k_horizontalShift, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, mod(), mode_, HGCalParameters::moduleAlphaS_, HGCalParameters::moduleBlS_, HGCalParameters::moduleHS_, HGCalParameters::moduleTlS_, Square, and HGCalParameters::waferTypeL_.

Referenced by HGCalTBAnalyzer::analyzeSimHits(), and CaloTruthAccumulator::fillSimHits().

565  {
566 
567  std::pair<int,float> index = getIndex(lay, false);
568  int i = index.first;
569  if (i < 0) {
570  return std::pair<int,int>(-1,-1);
571  }
572  int kx(-1), depth(-1);
574  float h = hgpar_->moduleHS_[i];
575  float bl = hgpar_->moduleBlS_[i];
576  float tl = hgpar_->moduleTlS_[i];
577  float cellSize = hgpar_->cellFactor_[i]*index.second;
578 
579  std::pair<int,int> kxy = findCellSquare(cell, h, bl, tl, hgpar_->moduleAlphaS_[i], index.second);
581  if (depth<0) return std::pair<int,int>(-1,-1);
582  kx = kxy.first/hgpar_->cellFactor_[i];
583  int ky = kxy.second/hgpar_->cellFactor_[i];
584 
585  float a = (half) ? (h/(tl-bl)) : (2*h/(tl-bl));
586  float b = 2*h*bl/(tl-bl);
587  for (int iky=0; iky<ky; ++iky)
588  kx += floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize));
589 #ifdef EDM_ML_DEBUG
590  std::cout << "simToReco: input " << cell << ":" << lay << ":" << half
591  << " kxy " << kxy.first << ":" << kxy.second << " output "
592  << kx << ":" << depth << " cell factor="
593  << hgpar_->cellFactor_[i] << std::endl;
594 #endif
595  } else {
596  kx = cell;
597  int type = hgpar_->waferTypeL_[mod];
598  if (type == 1) {
600  } else if (type == 2) {
602  } else {
604  }
605  }
606  return std::pair<int,int>(kx,depth);
607 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
double k_horizontalShift
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< double > moduleHS_
std::pair< int, int > findCellSquare(int cell, float h, float bl, float tl, float alpha, float cellSize) const
std::vector< int > layerGroupM_
std::vector< int > cellFactor_
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > moduleTlS_
std::vector< int > layerGroup_
double b
Definition: hdecay.h:120
HGCalGeometryMode mode_
std::vector< double > moduleAlphaS_
std::vector< int > layerGroupO_
std::vector< double > moduleBlS_
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:145
const HGCalParameters * hgpar_
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > waferTypeL_
unsigned int HGCalDDDConstants::volumes ( ) const
inline

Definition at line 72 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::moduleLayR_.

Referenced by HGCalGeometryLoader::build(), and HGCalGeometry::getSummary().

72 {return hgpar_->moduleLayR_.size();}
std::vector< int > moduleLayR_
const HGCalParameters * hgpar_
int HGCalDDDConstants::waferFromCopy ( int  copy) const

Definition at line 609 of file HGCalDDDConstants.cc.

References hgpar_, relval_2017::k, and HGCalParameters::waferCopy_.

Referenced by HGCNumberingScheme::getUnitID().

609  {
610  const int ncopies = hgpar_->waferCopy_.size();
611  int wafer = ncopies;
612  for (int k=0; k<ncopies; ++k) {
613  if (copy == hgpar_->waferCopy_[k]) {
614  wafer = k;
615  break;
616  }
617  }
618  return wafer;
619 }
std::vector< int > waferCopy_
const HGCalParameters * hgpar_
void HGCalDDDConstants::waferFromPosition ( const double  x,
const double  y,
int &  wafer,
int &  icell,
int &  celltyp 
) const

Definition at line 621 of file HGCalDDDConstants.cc.

References funct::abs(), HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellHex(), HGCalParameters::cellSize_, gather_cfg::cout, hexside_, hgpar_, relval_2017::k, k_ScaleFromDDD, rmax_, edm::size_(), tan30deg_, HGCalParameters::waferCopy_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, and HGCalParameters::waferTypeT_.

Referenced by HGCNumberingScheme::getUnitID().

623  {
624 
625  double xx(k_ScaleFromDDD*x), yy(k_ScaleFromDDD*y);
626  int size_ = (int)(hgpar_->waferCopy_.size());
627  wafer = size_;
628  for (int k=0; k<size_; ++k) {
629  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
630  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
631  if (dx <= rmax_ && dy <= hexside_) {
632  if ((dy <= 0.5*hexside_) || (dx <= (2.*rmax_-dy/tan30deg_))) {
633  wafer = k;
634  celltyp = hgpar_->waferTypeT_[k];
635  xx -= hgpar_->waferPosX_[k];
636  yy -= hgpar_->waferPosY_[k];
637  break;
638  }
639  }
640  }
641  if (wafer < size_) {
642  if (celltyp == 1)
643  icell = cellHex(xx, yy, 0.5*k_ScaleFromDDD*hgpar_->cellSize_[0],
645  else
646  icell = cellHex(xx, yy, 0.5*k_ScaleFromDDD*hgpar_->cellSize_[1],
648  }
649 #ifdef EDM_ML_DEBUG
650  std::cout << "Position " << x << ":" << y << " Wafer " << wafer << ":"
651  << size_ << " XX " << xx << ":" << yy << " Cell " << icell
652  << " Type " << celltyp << std::endl;
653 #endif
654 }
std::vector< double > waferPosY_
std::vector< double > cellFineY_
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
std::vector< double > cellCoarseX_
std::vector< double > cellSize_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > cellFineX_
std::vector< int > waferCopy_
double k_ScaleFromDDD
tuple cout
Definition: gather_cfg.py:145
size_(0)
Definition: OwnArray.h:181
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
static double tan30deg_
bool HGCalDDDConstants::waferInLayer ( int  wafer,
int  lay,
bool  reco 
) const

Definition at line 656 of file HGCalDDDConstants.cc.

References getIndex().

Referenced by HGCalGeometryLoader::build(), HGCalGeometry::getSummary(), maxCells(), maxRows(), modulesInit(), and numberCells().

656  {
657 
658  std::pair<int,float> indx = getIndex(lay, reco);
659  if (indx.first < 0) return false;
660  return waferInLayer(wafer,indx.first);
661 }
std::pair< int, float > getIndex(int lay, bool reco) const
bool waferInLayer(int wafer, int lay, bool reco) const
bool HGCalDDDConstants::waferInLayer ( int  wafer,
int  lay 
) const
private

Definition at line 750 of file HGCalDDDConstants.cc.

References Hexagon, HexagonFull, hgpar_, recoMuon::in, relval_2017::k, HGCalParameters::mode_, rmax_, HGCalParameters::rMinLayHex_, findQualityFiles::rr, mathSSE::sqrt(), tan30deg_, HGCalParameters::waferPosX_, and HGCalParameters::waferPosY_.

750  {
751 
752  const double rr = 2*rmax_*tan30deg_;
753  const double waferX = hgpar_->waferPosX_[wafer];
754  const double waferY = hgpar_->waferPosY_[wafer];
755  double xc[6], yc[6];
756  xc[0] = waferX+rmax_; yc[0] = waferY-0.5*rr;
757  xc[1] = waferX+rmax_; yc[1] = waferY+0.5*rr;
758  xc[2] = waferX; yc[2] = waferY+rr;
759  xc[3] = waferX-rmax_; yc[3] = waferY+0.5*rr;
760  xc[4] = waferX+rmax_; yc[4] = waferY-0.5*rr;
761  xc[5] = waferX; yc[5] = waferY-rr;
762  bool cornerOne(false), cornerAll(true);
763  for (int k=0; k<6; ++k) {
764  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
765  if ((rpos >= hgpar_->rMinLayHex_[lay]) &&
766  (rpos <= hgpar_->rMaxLayHex_[lay])) cornerOne = true;
767  else cornerAll = false;
768  }
769  bool in(false);
770  if (hgpar_->mode_ == static_cast<int> (HGCalGeometryMode::Hexagon))
771  in = cornerAll;
772  else if (hgpar_->mode_ == static_cast<int> (HGCalGeometryMode::HexagonFull))
773  in = cornerOne;
774  return in;
775 }
std::vector< double > waferPosY_
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< double > rMinLayHex_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
static double tan30deg_
std::pair< double, double > HGCalDDDConstants::waferPosition ( int  wafer) const

Definition at line 663 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, and create_public_lumi_plots::xy.

Referenced by HGCalGeometryLoader::build().

663  {
664 
665  std::pair<double,double> xy;
666  if (wafer >= 0 && wafer < (int)(hgpar_->waferPosX_.size())) {
667  xy = std::pair<double,double>(hgpar_->waferPosX_[wafer],hgpar_->waferPosY_[wafer]);
668  } else {
669  xy = std::pair<double,double>(0,0);
670  }
671  return xy;
672 }
std::vector< double > waferPosY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int HGCalDDDConstants::wafers ( ) const

Definition at line 681 of file HGCalDDDConstants.cc.

References HGCalParameters::depth_, hgpar_, i, layers(), and modules().

Referenced by HGCalTopology::allGeomModules(), and HGCalDDDConstants().

681  {
682 
683  int wafer(0);
684  for (unsigned int i = 0; i<layers(true); ++i) {
685  int lay = hgpar_->depth_[i];
686  wafer += modules(lay, true);
687  }
688  return wafer;
689 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > depth_
int modules(int lay, bool reco) const
unsigned int layers(bool reco) const
const HGCalParameters * hgpar_
int HGCalDDDConstants::waferToCopy ( int  wafer) const
inline

Definition at line 80 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferCopy_.

80 {return ((wafer>=0)&&(wafer< (int)(hgpar_->waferCopy_.size()))) ? hgpar_->waferCopy_[wafer] : (int)(hgpar_->waferCopy_.size());}
std::vector< int > waferCopy_
const HGCalParameters * hgpar_
int HGCalDDDConstants::waferTypeL ( int  wafer) const
inline

Definition at line 84 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferTypeL_.

Referenced by hgcal::RecHitTools::getSiThickness(), HGCalUncalibRecHitRecWeightsAlgo< HGCDataFrame >::makeRecHit(), and PFRecHitQTestThresholdInThicknessNormalizedMIPs::test().

84 {return ((wafer>=0)&&(wafer<(int)(hgpar_->waferTypeL_.size()))) ? hgpar_->waferTypeL_[wafer] : 0;}
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
int HGCalDDDConstants::waferTypeT ( int  wafer) const
inline

Definition at line 82 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferTypeT_.

Referenced by HGCalGeometryLoader::build(), HGCalGeometry::getClosestCell(), and hgcal::RecHitTools::isHalfCell().

82 {return ((wafer>=0)&&(wafer<(int)(hgpar_->waferTypeT_.size()))) ? hgpar_->waferTypeT_[wafer] : 0;}
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
double HGCalDDDConstants::waferZ ( int  layer,
bool  reco 
) const

Definition at line 674 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, i, cmsHarvester::index, and HGCalParameters::zLayerHex_.

Referenced by HGCalSimHitValidation::analyzeHits(), HGCalTBAnalyzer::analyzeRecHits(), HGCalTBAnalyzer::analyzeSimHits(), and CaloTruthAccumulator::beginLuminosityBlock().

674  {
675  std::pair<int,float> index = getIndex(lay, reco);
676  int i = index.first;
677  if (i < 0) return 0;
678  else return hgpar_->zLayerHex_[i];
679 }
int i
Definition: DBlmapReader.cc:9
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > zLayerHex_
const HGCalParameters * hgpar_

Member Data Documentation

double HGCalDDDConstants::hexside_
private

Definition at line 107 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and waferFromPosition().

const HGCalParameters* HGCalDDDConstants::hgpar_
private
simrecovecs HGCalDDDConstants::max_modules_layer_
private

Definition at line 111 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and modules().

HGCalGeometryMode HGCalDDDConstants::mode_
private
int32_t HGCalDDDConstants::modHalf_
private

Definition at line 109 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxModules().

double HGCalDDDConstants::rmax_
private
double HGCalDDDConstants::tan30deg_ = 0.5773502693
staticprivate

Definition at line 106 of file HGCalDDDConstants.h.

Referenced by cellHex(), HGCalDDDConstants(), waferFromPosition(), and waferInLayer().

std::array<uint32_t,2> HGCalDDDConstants::tot_layers_
private

Definition at line 110 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and layers().

int32_t HGCalDDDConstants::tot_wafers_
private

Definition at line 109 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants().