CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
HGCalDDDConstants Class Reference

#include <HGCalDDDConstants.h>

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::GeometryMode 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::hgtrapgetModules () const
 
HGCalParameters::hgtrform getTrForm (unsigned int k) const
 
unsigned int getTrFormN () const
 
std::vector< HGCalParameters::hgtrformgetTrForms () 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 waferCount (const int type) 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
 
int waferMax () const
 
int waferMin () const
 
std::pair< double, double > waferPosition (int wafer, bool reco=true) const
 
int wafers () const
 
int wafers (int layer, int type) 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 Types

typedef std::array< int, 3 > HGCWaferParam
 
typedef std::array< std::vector< int32_t >, 2 > Simrecovecs
 

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::GeometryMode mode_
 
int32_t modHalf_
 
double rmax_
 
std::array< uint32_t, 2 > tot_layers_
 
int32_t tot_wafers_
 
std::map< int, HGCWaferParamwaferLayer_
 
std::array< int, 4 > waferMax_
 

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<int,3> HGCalDDDConstants::HGCWaferParam
private

Definition at line 108 of file HGCalDDDConstants.h.

typedef std::array<std::vector<int32_t>, 2> HGCalDDDConstants::Simrecovecs
private

Definition at line 107 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, getIndex(), getTrForm(), getTrFormN(), hexside_, hgpar_, mps_fire::i, k_ScaleFromDDD, HGCalParameters::hgtrform::lay, layers(), layersInit(), max_modules_layer_, maxCells(), HGCalParameters::mode_, mode_, modHalf_, modulesInit(), rmax_, sectors(), HGCalGeometryMode::Square, tan30deg_, tot_layers_, tot_wafers_, waferInLayer(), waferLayer_, waferMax_, HGCalParameters::waferR_, and wafers().

16  : hgpar_(hp) {
17  mode_ = hgpar_->mode_;
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  << ":" << 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  int wminT(9999999), wmaxT(0), kount1(0), kount2(0);
79  for (unsigned int i=0; i<getTrFormN(); ++i) {
80  int lay0 = getTrForm(i).lay;
81  int wmin(9999999), wmax(0), kount(0);
82  for (int wafer=0; wafer<sectors(); ++wafer) {
83  if (waferInLayer(wafer,lay0,true)) {
84  if (wafer < wmin) wmin = wafer;
85  if (wafer > wmax) wmax = wafer;
86  ++kount;
87  }
88  }
89  if (wminT > wmin) wminT = wmin;
90  if (wmaxT < wmax) wmaxT = wmax;
91  if (kount1 < kount) kount1= kount;
92  kount2 += kount;
93 #ifdef EDM_ML_DEBUG
94  int lay1 = getIndex(lay0,true).first;
95  std::cout << "Index " << i << " Layer " << lay0 << ":" << lay1
96  << " Wafer " << wmin << ":" << wmax << ":" << kount << std::endl;
97 #endif
98  HGCWaferParam a1{ {wmin,wmax,kount} };
99  waferLayer_[lay0] = a1;
100  }
101  waferMax_ = std::array<int,4>{ {wminT,wmaxT,kount1,kount2} };
102 #ifdef EDM_ML_DEBUG
103  std::cout << "Overall wafer statistics: " << wminT << ":" << wmaxT << ":"
104  << kount1 << ":" << kount2 << std::endl;
105 #endif
106 }
std::array< uint32_t, 2 > tot_layers_
std::map< int, HGCWaferParam > waferLayer_
HGCalParameters::hgtrform getTrForm(unsigned int k) const
Simrecovecs max_modules_layer_
unsigned int layersInit(bool reco) const
std::array< int, 4 > waferMax_
int modulesInit(int lay, bool reco) const
HGCalGeometryMode::GeometryMode mode_
HGCalGeometryMode::GeometryMode mode_
unsigned int getTrFormN() const
unsigned int layers(bool reco) const
std::vector< double > cellSize_
std::pair< int, float > getIndex(int lay, bool reco) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int sectors() const
double k_ScaleFromDDD
const HGCalParameters * hgpar_
int maxCells(bool reco) const
static double tan30deg_
std::array< int, 3 > HGCWaferParam
bool waferInLayer(int wafer, int lay, bool reco) const
HGCalDDDConstants::~HGCalDDDConstants ( )

Definition at line 108 of file HGCalDDDConstants.cc.

108 {}

Member Function Documentation

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

Definition at line 110 of file HGCalDDDConstants.cc.

References alpha, assignCellHexagon(), assignCellSquare(), getIndex(), getParameterSquare(), h, mps_fire::i, diffTreeTool::index, k_ScaleFromDDD, mode_, trackingPlots::reco, HGCalGeometryMode::Square, geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

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

111  {
112  std::pair<int,float> index = getIndex(lay, reco);
113  std::pair<int,int> cellAssignment(-1,-1);
114  int i = index.first;
115  if (i < 0) return cellAssignment;
117  float alpha, h, bl, tl;
118  getParameterSquare(i,subSec,reco,h,bl,tl,alpha);
119  cellAssignment = assignCellSquare(x, y, h, bl, tl, alpha, index.second);
120  } else {
121  float xx = (reco) ? x : k_ScaleFromDDD*x;
122  float yy = (reco) ? y : k_ScaleFromDDD*y;
123  cellAssignment = assignCellHexagon(xx,yy);
124  }
125  return cellAssignment;
126 }
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
HGCalGeometryMode::GeometryMode mode_
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
fixed size matrix
double k_ScaleFromDDD
std::pair< int, int > HGCalDDDConstants::assignCellHexagon ( float  x,
float  y 
) const

Definition at line 171 of file HGCalDDDConstants.cc.

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

Referenced by assignCell().

172  {
173  double xx(x), yy(y);
174  //First the wafer
175  int wafer = cellHex(xx, yy, rmax_, hgpar_->waferPosX_, hgpar_->waferPosY_);
176  // Now the cell
177  xx -= hgpar_->waferPosX_[wafer];
178  yy -= hgpar_->waferPosY_[wafer];
179  int cell(0);
180  if (hgpar_->waferTypeT_[wafer] == 1)
182  else
184  return std::pair<int,int>(wafer,cell);
185 }
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 128 of file HGCalDDDConstants.cc.

References a, b, h, and k_horizontalShift.

Referenced by assignCell().

131  {
132 
133  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
134  float b = 2*h*bl/(tl-bl);
135 
136  float x0(x);
137  int phiSector = (x0 > 0) ? 1 : 0;
138  if (alpha < 0) {x0 -= 0.5*(tl+bl); phiSector = 0;}
139  else if (alpha > 0) {x0 += 0.5*(tl+bl); phiSector = 1;}
140 
141  //determine the i-y
142  int ky = floor((y+h)/cellSize);
143  if (ky*cellSize> y+h) ky--;
144  if (ky<0) return std::pair<int,int>(-1,-1);
145  if ((ky+1)*cellSize < (y+h) ) ky++;
146  int max_ky_allowed=floor(2*h/cellSize);
147  if (ky>max_ky_allowed-1) return std::pair<int,int>(-1,-1);
148 
149  //determine the i-x
150  //notice we substitute y by the top of the candidate cell to reduce the dead zones
151  int kx = floor(fabs(x0)/cellSize);
152  if (kx*cellSize > fabs(x0) ) kx--;
153  if (kx<0) return std::pair<int,int>(-1,-1);
154  if ((kx+1)*cellSize < fabs(x0)) kx++;
155  int max_kx_allowed=floor( ((ky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize) );
156  if (kx>max_kx_allowed-1) return std::pair<int,int>(-1,-1);
157 
158  //count cells summing in rows until required height
159  //notice the bottom of the cell must be used
160  int icell(0);
161  for (int iky=0; iky<ky; ++iky) {
162  int cellsInRow( floor( ((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize) ) );
163  icell += cellsInRow;
164  }
165  icell += kx;
166 
167  //return result
168  return std::pair<int,int>(phiSector,icell);
169 }
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 760 of file HGCalDDDConstants.cc.

References funct::abs(), PVValHelper::dx, PVValHelper::dy, gen::k, pileupDistInMC::num, tan30deg_, and TrackerOfflineValidation_Dqm_cff::xmax.

Referenced by assignCellHexagon(), getTrForm(), and waferFromPosition().

763  {
764  int num(0);
765  const double tol(0.00001);
766  double cellY = 2.0*cellR*tan30deg_;
767  for (unsigned int k=0; k<posX.size(); ++k) {
768  double dx = std::abs(xx - posX[k]);
769  double dy = std::abs(yy - posY[k]);
770  if (dx <= (cellR+tol) && dy <= (cellY+tol)) {
771  double xmax = (dy<=0.5*cellY) ? cellR : (cellR-(dy-0.5*cellY)/tan30deg_);
772  if (dx <= (xmax+tol)) {
773  num = k;
774  break;
775  }
776  }
777  }
778  return num;
779 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
static double tan30deg_
double HGCalDDDConstants::cellSizeHex ( int  type) const

Definition at line 187 of file HGCalDDDConstants.cc.

References HGCalParameters::cellSize_, hgpar_, and k_ScaleFromDDD.

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

187  {
188  int indx = (type == 1) ? 0 : 1;
189  double cell = (0.5*k_ScaleFromDDD*hgpar_->cellSize_[indx]);
190  return cell;
191 }
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 193 of file HGCalDDDConstants.cc.

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

Referenced by locateCell(), and newCell().

194  {
195 
196  std::pair<int,float> index = getIndex(lay, reco);
197  int i = index.first;
198  if (i < 0) return std::pair<int,int>(-1,-1);
200  return std::pair<int,int>(-1,-1);
201  } else {
202  float alpha, h, bl, tl;
203  getParameterSquare(i,subSec,reco,h,bl,tl,alpha);
204  return findCellSquare(cell, h, bl, tl, alpha, index.second);
205  }
206 }
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
HGCalGeometryMode::GeometryMode mode_
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
fixed size matrix
std::pair< int, int > HGCalDDDConstants::findCellSquare ( int  cell,
float  h,
float  bl,
float  tl,
float  alpha,
float  cellSize 
) const

Definition at line 208 of file HGCalDDDConstants.cc.

References a, b, and k_horizontalShift.

Referenced by findCell(), and simToReco().

211  {
212 
213  //check if cell number is meaningful
214  if(cell<0) return std::pair<int,int>(-1,-1);
215 
216  //parameterization of the boundary of the trapezoid
217  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
218  float b = 2*h*bl/(tl-bl);
219  int kx(cell), ky(0);
220  int kymax( floor((2*h)/cellSize) );
221  int testCell(0);
222  for (int iky=0; iky<kymax; ++iky) {
223 
224  //check if adding all the cells in this row is above the required cell
225  //notice the top of the cell is used to maximize space
226  int cellsInRow(floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize)));
227  if (testCell+cellsInRow > cell) break;
228  testCell += cellsInRow;
229  ky++;
230  kx -= cellsInRow;
231  }
232 
233  return std::pair<int,int>(kx,ky);
234 }
double k_horizontalShift
float alpha
Definition: AMPTWrapper.h:95
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
HGCalGeometryMode::GeometryMode HGCalDDDConstants::geomMode ( ) const
inline
std::pair< int, float > HGCalDDDConstants::getIndex ( int  lay,
bool  reco 
) const

Definition at line 781 of file HGCalDDDConstants.cc.

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

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

781  {
782 
783  if (lay<1 || lay>(int)(hgpar_->layerIndex_.size())) return std::pair<int,float>(-1,0);
784  if (reco && lay>(int)(hgpar_->depthIndex_.size())) return std::pair<int,float>(-1,0);
785  int indx(0);
786  float cell(0);
788  indx = (reco ? hgpar_->depthIndex_[lay-1] : hgpar_->layerIndex_[lay-1]);
789  cell = (reco ? hgpar_->moduleCellR_[indx] : hgpar_->moduleCellS_[indx]);
790  } else {
791  indx = (reco ? hgpar_->depthLayerF_[lay-1] : hgpar_->layerIndex_[lay-1]);
792  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
793  }
794  return std::pair<int,float>(indx,cell);
795 }
std::vector< int > depthLayerF_
std::vector< double > moduleCellR_
HGCalGeometryMode::GeometryMode mode_
std::vector< int > layerIndex_
std::vector< double > moduleCellS_
fixed size matrix
std::vector< int > depthIndex_
const HGCalParameters * hgpar_
HGCalParameters::hgtrap HGCalDDDConstants::getModule ( unsigned int  k,
bool  hexType,
bool  reco 
) const

Definition at line 236 of file HGCalDDDConstants.cc.

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

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

238  {
239 
241  if (hexType) {
242  unsigned int type = (indx < hgpar_->waferTypeL_.size()) ?
243  hgpar_->waferTypeL_[indx] : 3;
244  if (type > 0) --type;
245  mytr = hgpar_->getModule(type, true);
246  } else {
247  if (reco) mytr = hgpar_->getModule(indx,true);
248  else mytr = hgpar_->getModule(indx,false);
249  }
250  return mytr;
251 }
type
Definition: HCALResponse.h:21
hgtrap getModule(unsigned int k, bool reco) const
fixed size matrix
if(dp >Float(M_PI)) dp-
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
std::vector< HGCalParameters::hgtrap > HGCalDDDConstants::getModules ( ) const

Definition at line 253 of file HGCalDDDConstants.cc.

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

253  {
254 
255  std::vector<HGCalParameters::hgtrap> mytrs;
256  for (unsigned int k=0; k<hgpar_->moduleLayR_.size(); ++k)
257  mytrs.emplace_back(hgpar_->getModule(k,true));
258  return mytrs;
259 }
std::vector< int > moduleLayR_
hgtrap getModule(unsigned int k, bool reco) const
int k[5][pyjets_maxn]
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 797 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(), getTrForm(), locateCell(), maxCells(), and numberCells().

799  {
800  if (reco) {
801  h = hgpar_->moduleHR_[lay];
802  bl = hgpar_->moduleBlR_[lay];
803  tl = hgpar_->moduleTlR_[lay];
804  alpha= hgpar_->moduleAlphaR_[lay];
805  if ((subSec>0 && alpha<0) || (subSec<=0 && alpha>0)) alpha = -alpha;
806  } else {
807  h = hgpar_->moduleHS_[lay];
808  bl = hgpar_->moduleBlS_[lay];
809  tl = hgpar_->moduleTlS_[lay];
810  alpha= hgpar_->moduleAlphaS_[lay];
811  }
812 }
float alpha
Definition: AMPTWrapper.h:95
std::vector< double > moduleHR_
std::vector< double > moduleHS_
std::vector< double > moduleAlphaR_
std::vector< double > moduleBlR_
std::vector< double > moduleTlS_
std::vector< double > moduleAlphaS_
fixed size matrix
std::vector< double > moduleBlS_
const HGCalParameters * hgpar_
std::vector< double > moduleTlR_
HGCalParameters::hgtrform HGCalDDDConstants::getTrForm ( unsigned int  k) const
inline
unsigned int HGCalDDDConstants::getTrFormN ( ) const
inline

Definition at line 93 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::trformIndex_.

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

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

Definition at line 261 of file HGCalDDDConstants.cc.

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

Referenced by HGCalTrackCollectionProducer::beginLuminosityBlock(), and getTrForm().

261  {
262 
263  std::vector<HGCalParameters::hgtrform> mytrs;
264  for (unsigned int k=0; k<hgpar_->trformIndex_.size(); ++k)
265  mytrs.emplace_back(hgpar_->getTrForm(k));
266  return mytrs;
267 }
std::vector< uint32_t > trformIndex_
hgtrform getTrForm(unsigned int k) const
int k[5][pyjets_maxn]
const HGCalParameters * hgpar_
bool HGCalDDDConstants::isHalfCell ( int  waferType,
int  cell 
) const

Definition at line 755 of file HGCalDDDConstants.cc.

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

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

755  {
756  if( waferType < 1 || cell < 0) return false;
757  return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell];
758 }
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 269 of file HGCalDDDConstants.cc.

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

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

269  {
270 
271  bool ok(false);
272  int cellmax(0), modmax(0);
274  cellmax = maxCells(lay,reco);
275  modmax = sectors();
276  ok = ((lay > 0 && lay <= (int)(layers(reco))) &&
277  (mod > 0 && mod <= modmax) &&
278  (cell >=0 && cell <= cellmax));
279  } else {
280  int32_t copyNumber = hgpar_->waferCopy_[mod];
281  ok = ((lay > 0 && lay <= (int)(layers(reco))));
282  if (ok) {
283  const int32_t lay_idx = reco ? (lay-1)*3 + 1 : lay;
284  const auto& the_modules = hgpar_->copiesInLayers_[lay_idx];
285  auto moditr = the_modules.find(copyNumber);
286  ok = (moditr != the_modules.end());
287 #ifdef EDM_ML_DEBUG
288  if (!ok) std::cout << "HGCalDDDConstants: Layer " << lay << ":"
289  << lay_idx << " Copy " << copyNumber << ":" << mod
290  << " Flag " << ok << std::endl;
291 #endif
292  if (ok) {
293  if (moditr->second >= 0) {
294  cellmax = (hgpar_->waferTypeT_[mod]==1) ?
295  (int)(hgpar_->cellFineX_.size()) : (int)(hgpar_->cellCoarseX_.size());
296  ok = (cell >=0 && cell <= cellmax);
297  } else {
298  ok = isValidCell(lay_idx, mod, cell);
299  }
300  }
301  }
302  }
303 
304 #ifdef EDM_ML_DEBUG
305  if (!ok) std::cout << "HGCalDDDConstants: Layer " << lay << ":"
306  << (lay > 0 && (lay <= (int)(layers(reco)))) << " Module "
307  << mod << ":" << modmax << ":"
308  << (mod > 0 && mod <= modmax) << " Cell " << cell << ":"
309  << cellmax << ":" << (cell >=0 && cell <= cellmax)
310  << ":" << maxCells(reco) << std::endl;
311 #endif
312  return ok;
313 }
layer_map copiesInLayers_
static const int modmax
Definition: herwig.h:133
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellCoarseX_
unsigned int layers(bool reco) const
bool isValidCell(int layindex, int wafer, int cell) const
int sectors() const
std::vector< double > cellFineX_
fixed size matrix
std::vector< int > waferCopy_
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 315 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 geomMode(), and isValid().

315  {
316 
317  // Calculate the position of the cell
318  double x = hgpar_->waferPosX_[wafer];
319  double y = hgpar_->waferPosY_[wafer];
320  if (hgpar_->waferTypeT_[wafer] == 1) {
321  x += hgpar_->cellFineX_[cell];
322  y += hgpar_->cellFineY_[cell];
323  } else {
324  x += hgpar_->cellCoarseX_[cell];
325  y += hgpar_->cellCoarseY_[cell];
326  }
327  double rr = sqrt(x*x+y*y);
328  bool ok = ((rr >= hgpar_->rMinLayHex_[lay-1]) &
329  (rr <= hgpar_->rMaxLayHex_[lay-1]));
330 #ifdef EDM_ML_DEBUG
331  if (!ok)
332  std::cout << "Input " << lay << ":" << wafer << ":" << cell << " Position "
333  << x << ":" << y << ":" << rr << " Compare Limits "
334  << hgpar_->rMinLayHex_[lay-1] << ":" <<hgpar_->rMaxLayHex_[lay-1]
335  << " Flag " << ok << std::endl;
336 #endif
337  return ok;
338 }
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_
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 344 of file HGCalDDDConstants.cc.

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

Referenced by geomMode(), and HGCalDDDConstants().

344  {
345  return (reco ? hgpar_->depthIndex_.size() : hgpar_->layerIndex_.size());
346 }
std::vector< int > layerIndex_
fixed size matrix
std::vector< int > depthIndex_
const HGCalParameters * hgpar_
int HGCalDDDConstants::levelTop ( ) const
inline

Definition at line 48 of file HGCalDDDConstants.h.

References hgpar_, HGCalParameters::levelT_, maxCells(), and maxCellsSquare().

Referenced by HGCSD::update().

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

Definition at line 348 of file HGCalDDDConstants.cc.

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

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

349  {
350  // type refers to subsector # for square cell and wafer # for hexagon cell
351  float x(999999.), y(999999.);
352  std::pair<int,float> index = getIndex(lay, reco);
353  int i = index.first;
354  if (i < 0) return std::pair<float,float>(x,y);
356  std::pair<int,int> kxy = findCell(cell, lay, type, reco);
357  float alpha, h, bl, tl;
358  getParameterSquare(i,type,reco,h,bl,tl,alpha);
359  float cellSize = index.second;
360  x = (kxy.first+0.5)*cellSize;
361  if (alpha < 0) x -= 0.5*(tl+bl);
362  else if (alpha > 0) x -= 0.5*(tl+bl);
363  if (type != 1) x = -x;
364  y = ((kxy.second+0.5)*cellSize-h);
365  } else {
366  x = hgpar_->waferPosX_[type];
367  y = hgpar_->waferPosY_[type];
368  if (hgpar_->waferTypeT_[type] == 1) {
369  x += hgpar_->cellFineX_[cell];
370  y += hgpar_->cellFineY_[cell];
371  } else {
372  x += hgpar_->cellCoarseX_[cell];
373  y += hgpar_->cellCoarseY_[cell];
374  }
375  if (!reco) {
376  x /= k_ScaleFromDDD;
377  y /= k_ScaleFromDDD;
378  }
379  }
380  return std::pair<float,float>(x,y);
381 }
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< double > cellFineY_
HGCalGeometryMode::GeometryMode mode_
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
std::vector< double > cellFineX_
fixed size matrix
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 383 of file HGCalDDDConstants.cc.

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

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

384  {
385  float x(0), y(0);
386  if (hgpar_->waferTypeT_[wafer] == 1) {
387  x = hgpar_->cellFineX_[cell];
388  y = hgpar_->cellFineY_[cell];
389  } else {
390  x = hgpar_->cellCoarseX_[cell];
391  y = hgpar_->cellCoarseY_[cell];
392  }
393  if (!reco) {
394  x /= k_ScaleFromDDD;
395  y /= k_ScaleFromDDD;
396  }
397  return std::pair<float,float>(x,y);
398 }
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
std::vector< double > cellFineX_
fixed size matrix
double k_ScaleFromDDD
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
int HGCalDDDConstants::maxCells ( bool  reco) const

Definition at line 400 of file HGCalDDDConstants.cc.

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

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

400  {
401 
402  int cells(0);
403  for (unsigned int i = 0; i<layers(reco); ++i) {
404  int lay = reco ? hgpar_->depth_[i] : hgpar_->layer_[i];
405  if (cells < maxCells(lay, reco)) cells = maxCells(lay, reco);
406  }
407  return cells;
408 }
std::vector< int > layer_
std::vector< int > depth_
unsigned int layers(bool reco) const
fixed size matrix
const HGCalParameters * hgpar_
int maxCells(bool reco) const
int HGCalDDDConstants::maxCells ( int  lay,
bool  reco 
) const

Definition at line 410 of file HGCalDDDConstants.cc.

References alpha, HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, getIndex(), getParameterSquare(), h, hgpar_, mps_fire::i, diffTreeTool::index, gen::k, maxCellsSquare(), mode_, HGCalGeometryMode::Square, waferInLayer(), and HGCalParameters::waferTypeT_.

410  {
411 
412  std::pair<int,float> index = getIndex(lay, reco);
413  int i = index.first;
414  if (i < 0) return 0;
416  float h, bl, tl, alpha;
417  getParameterSquare(i,0,reco,h,bl,tl,alpha);
418  return maxCellsSquare(h, bl, tl, alpha, index.second);
419  } else {
420  unsigned int cells(0);
421  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
422  if (waferInLayer(k,index.first)) {
423  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
424  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
425  if (cell > cells) cells = cell;
426  }
427  }
428  return (int)(cells);
429  }
430 }
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.
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellCoarseX_
std::pair< int, float > getIndex(int lay, bool reco) const
int k[5][pyjets_maxn]
void getParameterSquare(int lay, int subSec, bool reco, float &h, float &bl, float &tl, float &alpha) const
std::vector< double > cellFineX_
fixed size matrix
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 432 of file HGCalDDDConstants.cc.

References a, b, and k_horizontalShift.

Referenced by levelTop(), and maxCells().

433  {
434 
435  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
436  float b = 2*h*bl/(tl-bl);
437 
438  int ncells(0);
439  //always use the top of the cell to maximize space
440  int kymax = floor((2*h)/cellSize);
441  for (int iky=0; iky<kymax; ++iky) {
442  int cellsInRow=floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize));
443  ncells += cellsInRow;
444  }
445 
446  return ncells;
447 }
double k_horizontalShift
float alpha
Definition: AMPTWrapper.h:95
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
int HGCalDDDConstants::maxModules ( ) const
inline

Definition at line 53 of file HGCalDDDConstants.h.

References maxRows(), and modHalf_.

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

Definition at line 449 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, mps_fire::i, diffTreeTool::index, gen::k, mode_, HGCalParameters::moduleHR_, HGCalParameters::moduleHS_, trackingPlots::reco, HGCalGeometryMode::Square, HGCalParameters::waferCopy_, and waferInLayer().

Referenced by maxModules(), and newCell().

449  {
450 
451  int kymax(0);
452  std::pair<int,float> index = getIndex(lay, reco);
453  int i = index.first;
454  if (i < 0) return kymax;
456  float h = (reco) ? hgpar_->moduleHR_[i] : hgpar_->moduleHS_[i];
457  kymax = floor((2*h)/index.second);
458  } else {
459  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
460  if (waferInLayer(k,i)) {
461  int ky = ((hgpar_->waferCopy_[k])/100)%100;
462  if (ky > kymax) kymax = ky;
463  }
464  }
465  }
466  return kymax;
467 }
std::vector< double > moduleHR_
std::vector< double > moduleHS_
HGCalGeometryMode::GeometryMode mode_
std::pair< int, float > getIndex(int lay, bool reco) const
int k[5][pyjets_maxn]
fixed size matrix
std::vector< int > waferCopy_
const HGCalParameters * hgpar_
bool waferInLayer(int wafer, int lay, bool reco) const
double HGCalDDDConstants::minSlope ( ) const
inline
int HGCalDDDConstants::modules ( int  lay,
bool  reco 
) const

Definition at line 469 of file HGCalDDDConstants.cc.

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

Referenced by minSlope(), and wafers().

469  {
470  if( getIndex(lay,reco).first < 0 ) return 0;
471  return max_modules_layer_[(int)reco][lay];
472 }
Simrecovecs max_modules_layer_
std::pair< int, float > getIndex(int lay, bool reco) const
fixed size matrix
int HGCalDDDConstants::modulesInit ( int  lay,
bool  reco 
) const

Definition at line 474 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, diffTreeTool::index, gen::k, waferInLayer(), and HGCalParameters::waferPosX_.

Referenced by HGCalDDDConstants(), and minSlope().

474  {
475  int nmod(0);
476  std::pair<int,float> index = getIndex(lay, reco);
477  if (index.first < 0) return nmod;
478  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
479  if (waferInLayer(k,index.first)) ++nmod;
480  }
481  return nmod;
482 }
std::pair< int, float > getIndex(int lay, bool reco) const
int k[5][pyjets_maxn]
fixed size matrix
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 484 of file HGCalDDDConstants.cc.

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

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

486  {
487 
488  int subSec = half ? subsector : 0;
489  std::pair<int,int> kxy = findCell(cell, layer, subSec, true);
490  int kx = kxy.first + incrx;
491  int ky = kxy.second + incry;
492  if (ky < 0 || ky > maxRows(layer, true)) {
493  cell = maxCells(true);
494  return std::pair<int,int>(cell,sector*subsector);
495  } else if (kx < 0) {
496  kx =-kx;
497  subsector =-subsector;
498  } else if (kx > maxCells(layer, true)) {
499  kx -= maxCells(layer, true);
500  sector += subsector;
501  subsector =-subsector;
502  if (sector < 1) sector = hgpar_->nSectors_;
503  else if (sector > hgpar_->nSectors_) sector = 1;
504  }
505  cell = newCell(kx, ky, layer, subSec);
506  return std::pair<int,int>(cell,sector*subsector);
507 }
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 509 of file HGCalDDDConstants.cc.

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

510  {
511 
512  int layer = lay + incrz;
513  if (layer <= 0 || layer > (int)(layers(true))) return std::pair<int,int>(cell,0);
514  int subSec = half ? subsector : 0;
515  std::pair<float,float> xy = locateCell(cell, lay, subSec, true);
516  std::pair<int,int> kcell = assignCell(xy.first, xy.second, layer, subSec,
517  true);
518  return std::pair<int,int>(kcell.second,layer);
519 }
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 521 of file HGCalDDDConstants.cc.

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

521  {
522 
523  std::pair<int,float> index = getIndex(lay, true);
524  int i = index.first;
525  if (i < 0) return maxCells(true);
526  float alpha = (subSec == 0) ? hgpar_->moduleAlphaS_[i] : subSec;
527  float cellSize = index.second;
528  float a = (alpha==0) ?
531  float b = 2*hgpar_->moduleHR_[i]*hgpar_->moduleBlR_[i]/
533  int icell(kx);
534  for (int iky=0; iky<ky; ++iky)
535  icell += floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize));
536  return icell;
537 }
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 539 of file HGCalDDDConstants.cc.

References alpha, HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, getIndex(), getParameterSquare(), h, hgpar_, mps_fire::i, diffTreeTool::index, gen::k, mode_, numberCellsSquare(), HGCalGeometryMode::Square, waferInLayer(), and HGCalParameters::waferTypeT_.

Referenced by minSlope().

539  {
540 
541  std::pair<int,float> index = getIndex(lay, reco);
542  int i = index.first;
543  std::vector<int> ncell;
544  if (i >= 0) {
546  float h, bl, tl, alpha;
547  getParameterSquare(i,0,reco,h,bl,tl,alpha);
548  return numberCellsSquare(h, bl, tl, alpha, index.second);
549  } else {
550  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
551  if (waferInLayer(k,i)) {
552  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
553  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
554  ncell.emplace_back((int)(cell));
555  }
556  }
557  }
558  }
559  return ncell;
560 }
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.
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellCoarseX_
std::pair< int, float > getIndex(int lay, bool reco) const
int k[5][pyjets_maxn]
void getParameterSquare(int lay, int subSec, bool reco, float &h, float &bl, float &tl, float &alpha) const
std::vector< double > cellFineX_
fixed size matrix
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 575 of file HGCalDDDConstants.cc.

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

Referenced by HGCalTriggerGeometryHexImp1::fillMaps(), minSlope(), and HGCalGeometry::newCell().

575  {
576 
577  int ncell(0);
578  if (wafer >= 0 && wafer < (int)(hgpar_->waferTypeT_.size())) {
579  if (hgpar_->waferTypeT_[wafer]==1)
580  ncell = (int)(hgpar_->cellFineX_.size());
581  else
582  ncell = (int)(hgpar_->cellCoarseX_.size());
583  }
584  return ncell;
585 }
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 562 of file HGCalDDDConstants.cc.

References a, b, and k_horizontalShift.

Referenced by minSlope(), and numberCells().

564  {
565 
566  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
567  float b = 2*h*bl/(tl-bl);
568  int kymax = floor((2*h)/cellSize);
569  std::vector<int> ncell;
570  for (int iky=0; iky<kymax; ++iky)
571  ncell.emplace_back(floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize)));
572  return ncell;
573 }
double k_horizontalShift
float alpha
Definition: AMPTWrapper.h:95
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 587 of file HGCalDDDConstants.cc.

References cuy::col, popcon2dropbox::copy(), hgpar_, and HGCalParameters::waferCopy_.

Referenced by minSlope().

587  {
588  int row(0), col(0);
589  if (wafer < (int)(hgpar_->waferCopy_.size())) {
590  int copy = hgpar_->waferCopy_[wafer];
591  col = copy%100;
592  if ((copy/10000)%10 != 0) col = -col;
593  row = (copy/100)%100;
594  if ((copy/100000)%10 != 0) row = -row;
595  }
596  return std::pair<int,int>(row,col);
597 }
std::vector< int > waferCopy_
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 599 of file HGCalDDDConstants.cc.

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

Referenced by HGCalTimingAnalyzer::analyzeSimHits(), HGCalTBAnalyzer::analyzeSimHits(), CaloTruthAccumulator::fillSimHits(), HGCalTriggerBackend::HGCalTriggerSimCluster< FECODEC, DATA >::run(), sectors(), and HGCalTriggerNtupleHGCDigis::simhits().

600  {
601 
602  std::pair<int,float> index = getIndex(lay, false);
603  int i = index.first;
604  if (i < 0) {
605  return std::pair<int,int>(-1,-1);
606  }
607  int kx(-1), depth(-1);
609  float h = hgpar_->moduleHS_[i];
610  float bl = hgpar_->moduleBlS_[i];
611  float tl = hgpar_->moduleTlS_[i];
612  float cellSize = hgpar_->cellFactor_[i]*index.second;
613 
614  std::pair<int,int> kxy = findCellSquare(cell, h, bl, tl, hgpar_->moduleAlphaS_[i], index.second);
616  if (depth<0) return std::pair<int,int>(-1,-1);
617  kx = kxy.first/hgpar_->cellFactor_[i];
618  int ky = kxy.second/hgpar_->cellFactor_[i];
619 
620  float a = (half) ? (h/(tl-bl)) : (2*h/(tl-bl));
621  float b = 2*h*bl/(tl-bl);
622  for (int iky=0; iky<ky; ++iky)
623  kx += floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize));
624 #ifdef EDM_ML_DEBUG
625  std::cout << "simToReco: input " << cell << ":" << lay << ":" << half
626  << " kxy " << kxy.first << ":" << kxy.second << " output "
627  << kx << ":" << depth << " cell factor="
628  << hgpar_->cellFactor_[i] << std::endl;
629 #endif
630  } else {
631  kx = cell;
632  int type = hgpar_->waferTypeL_[mod];
633  if (type == 1) {
635  } else if (type == 2) {
637  } else {
639  }
640  }
641  return std::pair<int,int>(kx,depth);
642 }
type
Definition: HCALResponse.h:21
double k_horizontalShift
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_
HGCalGeometryMode::GeometryMode mode_
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
std::vector< double > moduleAlphaS_
std::vector< int > layerGroupO_
std::vector< double > moduleBlS_
double a
Definition: hdecay.h:121
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
int HGCalDDDConstants::waferCount ( const int  type) const
inline

Definition at line 76 of file HGCalDDDConstants.h.

References waferMax_.

76 {return ((type == 0) ? waferMax_[2] : waferMax_[3]);}
type
Definition: HCALResponse.h:21
std::array< int, 4 > waferMax_
int HGCalDDDConstants::waferFromCopy ( int  copy) const

Definition at line 644 of file HGCalDDDConstants.cc.

References gather_cfg::cout, hgpar_, gen::k, convertSQLiteXML::ok, and HGCalParameters::waferCopy_.

Referenced by HGCNumberingScheme::getUnitID(), and volumes().

644  {
645  const int ncopies = hgpar_->waferCopy_.size();
646  int wafer(ncopies);
647 #ifdef EDM_ML_DEBUG
648  bool ok(false);
649 #endif
650  for (int k=0; k<ncopies; ++k) {
651  if (copy == hgpar_->waferCopy_[k]) {
652  wafer = k;
653 #ifdef EDM_ML_DEBUG
654  ok = true;
655 #endif
656  break;
657  }
658  }
659 #ifdef EDM_ML_DEBUG
660  if (!ok) {
661  std::cout << "Cannot find " << copy << " in a list of " << ncopies << "\n";
662  for (int k=0; k<ncopies; ++k) std::cout << " " << hgpar_->waferCopy_[k];
663  std::cout << std::endl;
664  }
665 #endif
666  return wafer;
667 }
int k[5][pyjets_maxn]
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 669 of file HGCalDDDConstants.cc.

References funct::abs(), HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellHex(), HGCalParameters::cellSize_, gather_cfg::cout, PVValHelper::dx, PVValHelper::dy, hexside_, hgpar_, createfilelist::int, gen::k, k_ScaleFromDDD, rmax_, tan30deg_, HGCalParameters::waferCopy_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

Referenced by HGCNumberingScheme::getUnitID(), and volumes().

671  {
672 
673  double xx(k_ScaleFromDDD*x), yy(k_ScaleFromDDD*y);
674  int size_ = (int)(hgpar_->waferCopy_.size());
675  wafer = size_;
676  for (int k=0; k<size_; ++k) {
677  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
678  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
679  if (dx <= rmax_ && dy <= hexside_) {
680  if ((dy <= 0.5*hexside_) || (dx <= (2.*rmax_-dy/tan30deg_))) {
681  wafer = k;
682  celltyp = hgpar_->waferTypeT_[k];
683  xx -= hgpar_->waferPosX_[k];
684  yy -= hgpar_->waferPosY_[k];
685  break;
686  }
687  }
688  }
689  if (wafer < size_) {
690  if (celltyp == 1)
691  icell = cellHex(xx, yy, 0.5*k_ScaleFromDDD*hgpar_->cellSize_[0],
693  else
694  icell = cellHex(xx, yy, 0.5*k_ScaleFromDDD*hgpar_->cellSize_[1],
696  }
697 #ifdef EDM_ML_DEBUG
698  std::cout << "Position " << x << ":" << y << " Wafer " << wafer << ":"
699  << size_ << " XX " << xx << ":" << yy << " Cell " << icell
700  << " Type " << celltyp << std::endl;
701 #endif
702 }
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
int k[5][pyjets_maxn]
std::vector< double > cellFineX_
std::vector< int > waferCopy_
double k_ScaleFromDDD
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 704 of file HGCalDDDConstants.cc.

References getIndex().

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

704  {
705 
706  std::pair<int,float> indx = getIndex(lay, reco);
707  if (indx.first < 0) return false;
708  return waferInLayer(wafer,indx.first);
709 }
std::pair< int, float > getIndex(int lay, bool reco) const
fixed size matrix
bool waferInLayer(int wafer, int lay, bool reco) const
bool HGCalDDDConstants::waferInLayer ( int  wafer,
int  lay 
) const
private

Definition at line 814 of file HGCalDDDConstants.cc.

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

814  {
815 
816  const double rr = 2*rmax_*tan30deg_;
817  const double waferX = hgpar_->waferPosX_[wafer];
818  const double waferY = hgpar_->waferPosY_[wafer];
819  double xc[6], yc[6];
820  xc[0] = waferX+rmax_; yc[0] = waferY-0.5*rr;
821  xc[1] = waferX+rmax_; yc[1] = waferY+0.5*rr;
822  xc[2] = waferX; yc[2] = waferY+rr;
823  xc[3] = waferX-rmax_; yc[3] = waferY+0.5*rr;
824  xc[4] = waferX+rmax_; yc[4] = waferY-0.5*rr;
825  xc[5] = waferX; yc[5] = waferY-rr;
826  bool cornerOne(false), cornerAll(true);
827  for (int k=0; k<6; ++k) {
828  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
829  if ((rpos >= hgpar_->rMinLayHex_[lay]) &&
830  (rpos <= hgpar_->rMaxLayHex_[lay])) cornerOne = true;
831  else cornerAll = false;
832  }
833  bool in(false);
835  in = cornerAll;
837  in = cornerOne;
838  return in;
839 }
std::vector< double > waferPosY_
HGCalGeometryMode::GeometryMode mode_
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< double > rMinLayHex_
int k[5][pyjets_maxn]
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
static double tan30deg_
int HGCalDDDConstants::waferMax ( ) const
inline

Definition at line 77 of file HGCalDDDConstants.h.

References waferMax_.

77 {return waferMax_[1];}
std::array< int, 4 > waferMax_
int HGCalDDDConstants::waferMin ( ) const
inline

Definition at line 78 of file HGCalDDDConstants.h.

References waferMax_, waferPosition(), and wafers().

78 {return waferMax_[0];}
std::array< int, 4 > waferMax_
std::pair< double, double > HGCalDDDConstants::waferPosition ( int  wafer,
bool  reco = true 
) const

Definition at line 711 of file HGCalDDDConstants.cc.

References hgpar_, k_ScaleFromDDD, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, geometryCSVtoXML::xx, geometryCSVtoXML::xy, and geometryCSVtoXML::yy.

Referenced by HGCalGeometryLoader::build(), HGCMouseBite::exclude(), and waferMin().

712  {
713 
714  double xx(0), yy(0);
715  if (wafer >= 0 && wafer < (int)(hgpar_->waferPosX_.size())) {
716  xx = hgpar_->waferPosX_[wafer];
717  yy = hgpar_->waferPosY_[wafer];
718  }
719  if (!reco) {
720  xx /= k_ScaleFromDDD;
721  yy /= k_ScaleFromDDD;
722  }
723  std::pair<double,double> xy(xx,yy);
724  return xy;
725 }
std::vector< double > waferPosY_
fixed size matrix
double k_ScaleFromDDD
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int HGCalDDDConstants::wafers ( ) const

Definition at line 734 of file HGCalDDDConstants.cc.

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

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

734  {
735 
736  int wafer(0);
737  for (unsigned int i = 0; i<layers(true); ++i) {
738  int lay = hgpar_->depth_[i];
739  wafer += modules(lay, true);
740  }
741  return wafer;
742 }
std::vector< int > depth_
int modules(int lay, bool reco) const
unsigned int layers(bool reco) const
const HGCalParameters * hgpar_
int HGCalDDDConstants::wafers ( int  layer,
int  type 
) const

Definition at line 744 of file HGCalDDDConstants.cc.

References waferLayer_.

744  {
745 
746  int wafer(0);
747  auto itr = waferLayer_.find(layer);
748  if (itr != waferLayer_.end()) {
749  unsigned ity = (type > 0 && type <= 2) ? type : 0;
750  wafer = (itr->second)[ity];
751  }
752  return wafer;
753 }
type
Definition: HCALResponse.h:21
std::map< int, HGCWaferParam > waferLayer_
int HGCalDDDConstants::waferToCopy ( int  wafer) const
inline

Definition at line 82 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferCopy_.

82 {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
int HGCalDDDConstants::waferTypeT ( int  wafer) const
inline
double HGCalDDDConstants::waferZ ( int  layer,
bool  reco 
) const

Definition at line 727 of file HGCalDDDConstants.cc.

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

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

727  {
728  std::pair<int,float> index = getIndex(lay, reco);
729  int i = index.first;
730  if (i < 0) return 0;
731  else return hgpar_->zLayerHex_[i];
732 }
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > zLayerHex_
fixed size matrix
const HGCalParameters * hgpar_

Member Data Documentation

double HGCalDDDConstants::hexside_
private

Definition at line 111 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and waferFromPosition().

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

Definition at line 115 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and modules().

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

Definition at line 113 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxModules().

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

Definition at line 110 of file HGCalDDDConstants.h.

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

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

Definition at line 114 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and layers().

int32_t HGCalDDDConstants::tot_wafers_
private

Definition at line 113 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants().

std::map<int,HGCWaferParam> HGCalDDDConstants::waferLayer_
private

Definition at line 116 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and wafers().

std::array<int,4> HGCalDDDConstants::waferMax_
private

Definition at line 117 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), waferCount(), waferMax(), and waferMin().