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 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, 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_
 

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 105 of file HGCalDDDConstants.h.

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

Definition at line 104 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(), mode_, HGCalParameters::mode_, modHalf_, modulesInit(), rmax_, sectors(), HGCalGeometryMode::Square, tan30deg_, tot_layers_, tot_wafers_, waferInLayer(), waferLayer_, 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  for (unsigned int i=0; i<getTrFormN(); ++i) {
79  int lay0 = getTrForm(i).lay;
80  int wmin(9999999), wmax(0), kount(0);
81  for (int wafer=0; wafer<sectors(); ++wafer) {
82  if (waferInLayer(wafer,lay0,true)) {
83  if (wafer < wmin) wmin = wafer;
84  if (wafer > wmax) wmax = wafer;
85  ++kount;
86  }
87  }
88 #ifdef EDM_ML_DEBUG
89  int lay1 = getIndex(lay0,true).first;
90  std::cout << "Index " << i << " Layer " << lay0 << ":" << lay1
91  << " Wafer " << wmin << ":" << wmax << ":" << kount << std::endl;
92 #endif
93  HGCWaferParam a1{ {wmin,wmax,kount} };
94  waferLayer_[lay0] = a1;
95  }
96 }
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
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 98 of file HGCalDDDConstants.cc.

98 {}

Member Function Documentation

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

Definition at line 100 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().

101  {
102  std::pair<int,float> index = getIndex(lay, reco);
103  std::pair<int,int> cellAssignment(-1,-1);
104  int i = index.first;
105  if (i < 0) return cellAssignment;
107  float alpha, h, bl, tl;
108  getParameterSquare(i,subSec,reco,h,bl,tl,alpha);
109  cellAssignment = assignCellSquare(x, y, h, bl, tl, alpha, index.second);
110  } else {
111  float xx = (reco) ? x : k_ScaleFromDDD*x;
112  float yy = (reco) ? y : k_ScaleFromDDD*y;
113  cellAssignment = assignCellHexagon(xx,yy);
114  }
115  return cellAssignment;
116 }
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 161 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().

162  {
163  double xx(x), yy(y);
164  //First the wafer
165  int wafer = cellHex(xx, yy, rmax_, hgpar_->waferPosX_, hgpar_->waferPosY_);
166  // Now the cell
167  xx -= hgpar_->waferPosX_[wafer];
168  yy -= hgpar_->waferPosY_[wafer];
169  int cell(0);
170  if (hgpar_->waferTypeT_[wafer] == 1)
172  else
174  return std::pair<int,int>(wafer,cell);
175 }
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 118 of file HGCalDDDConstants.cc.

References a, b, h, and k_horizontalShift.

Referenced by assignCell().

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

753  {
754  int num(0);
755  const double tol(0.00001);
756  double cellY = 2.0*cellR*tan30deg_;
757  for (unsigned int k=0; k<posX.size(); ++k) {
758  double dx = std::abs(xx - posX[k]);
759  double dy = std::abs(yy - posY[k]);
760  if (dx <= (cellR+tol) && dy <= (cellY+tol)) {
761  double xmax = (dy<=0.5*cellY) ? cellR : (cellR-(dy-0.5*cellY)/tan30deg_);
762  if (dx <= (xmax+tol)) {
763  num = k;
764  break;
765  }
766  }
767  }
768  return num;
769 }
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 177 of file HGCalDDDConstants.cc.

References HGCalParameters::cellSize_, hgpar_, and k_ScaleFromDDD.

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

177  {
178  int indx = (type == 1) ? 0 : 1;
179  double cell = (0.5*k_ScaleFromDDD*hgpar_->cellSize_[indx]);
180  return cell;
181 }
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 183 of file HGCalDDDConstants.cc.

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

Referenced by locateCell(), and newCell().

184  {
185 
186  std::pair<int,float> index = getIndex(lay, reco);
187  int i = index.first;
188  if (i < 0) return std::pair<int,int>(-1,-1);
190  return std::pair<int,int>(-1,-1);
191  } else {
192  float alpha, h, bl, tl;
193  getParameterSquare(i,subSec,reco,h,bl,tl,alpha);
194  return findCellSquare(cell, h, bl, tl, alpha, index.second);
195  }
196 }
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 198 of file HGCalDDDConstants.cc.

References a, b, and k_horizontalShift.

Referenced by findCell(), and simToReco().

201  {
202 
203  //check if cell number is meaningful
204  if(cell<0) return std::pair<int,int>(-1,-1);
205 
206  //parameterization of the boundary of the trapezoid
207  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
208  float b = 2*h*bl/(tl-bl);
209  int kx(cell), ky(0);
210  int kymax( floor((2*h)/cellSize) );
211  int testCell(0);
212  for (int iky=0; iky<kymax; ++iky) {
213 
214  //check if adding all the cells in this row is above the required cell
215  //notice the top of the cell is used to maximize space
216  int cellsInRow(floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize)));
217  if (testCell+cellsInRow > cell) break;
218  testCell += cellsInRow;
219  ky++;
220  kx -= cellsInRow;
221  }
222 
223  return std::pair<int,int>(kx,ky);
224 }
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 771 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().

771  {
772 
773  if (lay<1 || lay>(int)(hgpar_->layerIndex_.size())) return std::pair<int,float>(-1,0);
774  if (reco && lay>(int)(hgpar_->depthIndex_.size())) return std::pair<int,float>(-1,0);
775  int indx(0);
776  float cell(0);
778  indx = (reco ? hgpar_->depthIndex_[lay-1] : hgpar_->layerIndex_[lay-1]);
779  cell = (reco ? hgpar_->moduleCellR_[indx] : hgpar_->moduleCellS_[indx]);
780  } else {
781  indx = (reco ? hgpar_->depthLayerF_[lay-1] : hgpar_->layerIndex_[lay-1]);
782  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
783  }
784  return std::pair<int,float>(indx,cell);
785 }
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 226 of file HGCalDDDConstants.cc.

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

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

228  {
229 
231  if (hexType) {
232  unsigned int type = (indx < hgpar_->waferTypeL_.size()) ?
233  hgpar_->waferTypeL_[indx] : 3;
234  if (type > 0) --type;
235  mytr = hgpar_->getModule(type, true);
236  } else {
237  if (reco) mytr = hgpar_->getModule(indx,true);
238  else mytr = hgpar_->getModule(indx,false);
239  }
240  return mytr;
241 }
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 243 of file HGCalDDDConstants.cc.

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

243  {
244 
245  std::vector<HGCalParameters::hgtrap> mytrs;
246  for (unsigned int k=0; k<hgpar_->moduleLayR_.size(); ++k)
247  mytrs.push_back(hgpar_->getModule(k,true));
248  return mytrs;
249 }
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 787 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().

789  {
790  if (reco) {
791  h = hgpar_->moduleHR_[lay];
792  bl = hgpar_->moduleBlR_[lay];
793  tl = hgpar_->moduleTlR_[lay];
794  alpha= hgpar_->moduleAlphaR_[lay];
795  if ((subSec>0 && alpha<0) || (subSec<=0 && alpha>0)) alpha = -alpha;
796  } else {
797  h = hgpar_->moduleHS_[lay];
798  bl = hgpar_->moduleBlS_[lay];
799  tl = hgpar_->moduleTlS_[lay];
800  alpha= hgpar_->moduleAlphaS_[lay];
801  }
802 }
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 90 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::trformIndex_.

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

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

Definition at line 251 of file HGCalDDDConstants.cc.

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

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

251  {
252 
253  std::vector<HGCalParameters::hgtrform> mytrs;
254  for (unsigned int k=0; k<hgpar_->trformIndex_.size(); ++k)
255  mytrs.push_back(hgpar_->getTrForm(k));
256  return mytrs;
257 }
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 745 of file HGCalDDDConstants.cc.

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

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

745  {
746  if( waferType < 1 || cell < 0) return false;
747  return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell];
748 }
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 259 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().

259  {
260 
261  bool ok(false);
262  int cellmax(0), modmax(0);
264  cellmax = maxCells(lay,reco);
265  modmax = sectors();
266  ok = ((lay > 0 && lay <= (int)(layers(reco))) &&
267  (mod > 0 && mod <= modmax) &&
268  (cell >=0 && cell <= cellmax));
269  } else {
270  int32_t copyNumber = hgpar_->waferCopy_[mod];
271  ok = ((lay > 0 && lay <= (int)(layers(reco))));
272  if (ok) {
273  const int32_t lay_idx = reco ? (lay-1)*3 + 1 : lay;
274  const auto& the_modules = hgpar_->copiesInLayers_[lay_idx];
275  auto moditr = the_modules.find(copyNumber);
276  ok = (moditr != the_modules.end());
277 #ifdef EDM_ML_DEBUG
278  if (!ok) std::cout << "HGCalDDDConstants: Layer " << lay << ":"
279  << lay_idx << " Copy " << copyNumber << ":" << mod
280  << " Flag " << ok << std::endl;
281 #endif
282  if (ok) {
283  if (moditr->second >= 0) {
284  cellmax = (hgpar_->waferTypeT_[mod]==1) ?
285  (int)(hgpar_->cellFineX_.size()) : (int)(hgpar_->cellCoarseX_.size());
286  ok = (cell >=0 && cell <= cellmax);
287  } else {
288  ok = isValidCell(lay_idx, mod, cell);
289  }
290  }
291  }
292  }
293 
294 #ifdef EDM_ML_DEBUG
295  if (!ok) std::cout << "HGCalDDDConstants: Layer " << lay << ":"
296  << (lay > 0 && (lay <= (int)(layers(reco)))) << " Module "
297  << mod << ":" << modmax << ":"
298  << (mod > 0 && mod <= modmax) << " Cell " << cell << ":"
299  << cellmax << ":" << (cell >=0 && cell <= cellmax)
300  << ":" << maxCells(reco) << std::endl;
301 #endif
302  return ok;
303 }
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 305 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().

305  {
306 
307  // Calculate the position of the cell
308  double x = hgpar_->waferPosX_[wafer];
309  double y = hgpar_->waferPosY_[wafer];
310  if (hgpar_->waferTypeT_[wafer] == 1) {
311  x += hgpar_->cellFineX_[cell];
312  y += hgpar_->cellFineY_[cell];
313  } else {
314  x += hgpar_->cellCoarseX_[cell];
315  y += hgpar_->cellCoarseY_[cell];
316  }
317  double rr = sqrt(x*x+y*y);
318  bool ok = ((rr >= hgpar_->rMinLayHex_[lay-1]) &
319  (rr <= hgpar_->rMaxLayHex_[lay-1]));
320 #ifdef EDM_ML_DEBUG
321  if (!ok)
322  std::cout << "Input " << lay << ":" << wafer << ":" << cell << " Position "
323  << x << ":" << y << ":" << rr << " Compare Limits "
324  << hgpar_->rMinLayHex_[lay-1] << ":" <<hgpar_->rMaxLayHex_[lay-1]
325  << " Flag " << ok << std::endl;
326 #endif
327  return ok;
328 }
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 334 of file HGCalDDDConstants.cc.

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

Referenced by geomMode(), and HGCalDDDConstants().

334  {
335  return (reco ? hgpar_->depthIndex_.size() : hgpar_->layerIndex_.size());
336 }
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 338 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().

339  {
340  // type refers to subsector # for square cell and wafer # for hexagon cell
341  float x(999999.), y(999999.);
342  std::pair<int,float> index = getIndex(lay, reco);
343  int i = index.first;
344  if (i < 0) return std::pair<float,float>(x,y);
346  std::pair<int,int> kxy = findCell(cell, lay, type, reco);
347  float alpha, h, bl, tl;
348  getParameterSquare(i,type,reco,h,bl,tl,alpha);
349  float cellSize = index.second;
350  x = (kxy.first+0.5)*cellSize;
351  if (alpha < 0) x -= 0.5*(tl+bl);
352  else if (alpha > 0) x -= 0.5*(tl+bl);
353  if (type != 1) x = -x;
354  y = ((kxy.second+0.5)*cellSize-h);
355  } else {
356  x = hgpar_->waferPosX_[type];
357  y = hgpar_->waferPosY_[type];
358  if (hgpar_->waferTypeT_[type] == 1) {
359  x += hgpar_->cellFineX_[cell];
360  y += hgpar_->cellFineY_[cell];
361  } else {
362  x += hgpar_->cellCoarseX_[cell];
363  y += hgpar_->cellCoarseY_[cell];
364  }
365  if (!reco) {
366  x /= k_ScaleFromDDD;
367  y /= k_ScaleFromDDD;
368  }
369  }
370  return std::pair<float,float>(x,y);
371 }
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 373 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().

374  {
375  float x(0), y(0);
376  if (hgpar_->waferTypeT_[wafer] == 1) {
377  x = hgpar_->cellFineX_[cell];
378  y = hgpar_->cellFineY_[cell];
379  } else {
380  x = hgpar_->cellCoarseX_[cell];
381  y = hgpar_->cellCoarseY_[cell];
382  }
383  if (!reco) {
384  x /= k_ScaleFromDDD;
385  y /= k_ScaleFromDDD;
386  }
387  return std::pair<float,float>(x,y);
388 }
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 390 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().

390  {
391 
392  int cells(0);
393  for (unsigned int i = 0; i<layers(reco); ++i) {
394  int lay = reco ? hgpar_->depth_[i] : hgpar_->layer_[i];
395  if (cells < maxCells(lay, reco)) cells = maxCells(lay, reco);
396  }
397  return cells;
398 }
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 400 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_.

400  {
401 
402  std::pair<int,float> index = getIndex(lay, reco);
403  int i = index.first;
404  if (i < 0) return 0;
406  float h, bl, tl, alpha;
407  getParameterSquare(i,0,reco,h,bl,tl,alpha);
408  return maxCellsSquare(h, bl, tl, alpha, index.second);
409  } else {
410  unsigned int cells(0);
411  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
412  if (waferInLayer(k,index.first)) {
413  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
414  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
415  if (cell > cells) cells = cell;
416  }
417  }
418  return (int)(cells);
419  }
420 }
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 422 of file HGCalDDDConstants.cc.

References a, b, and k_horizontalShift.

Referenced by levelTop(), and maxCells().

423  {
424 
425  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
426  float b = 2*h*bl/(tl-bl);
427 
428  int ncells(0);
429  //always use the top of the cell to maximize space
430  int kymax = floor((2*h)/cellSize);
431  for (int iky=0; iky<kymax; ++iky) {
432  int cellsInRow=floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize));
433  ncells += cellsInRow;
434  }
435 
436  return ncells;
437 }
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 439 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().

439  {
440 
441  int kymax(0);
442  std::pair<int,float> index = getIndex(lay, reco);
443  int i = index.first;
444  if (i < 0) return kymax;
446  float h = (reco) ? hgpar_->moduleHR_[i] : hgpar_->moduleHS_[i];
447  kymax = floor((2*h)/index.second);
448  } else {
449  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
450  if (waferInLayer(k,i)) {
451  int ky = ((hgpar_->waferCopy_[k])/100)%100;
452  if (ky > kymax) kymax = ky;
453  }
454  }
455  }
456  return kymax;
457 }
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 459 of file HGCalDDDConstants.cc.

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

Referenced by minSlope(), and wafers().

459  {
460  if( getIndex(lay,reco).first < 0 ) return 0;
461  return max_modules_layer_[(int)reco][lay];
462 }
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 464 of file HGCalDDDConstants.cc.

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

Referenced by HGCalDDDConstants(), and minSlope().

464  {
465  int nmod(0);
466  std::pair<int,float> index = getIndex(lay, reco);
467  if (index.first < 0) return nmod;
468  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
469  if (waferInLayer(k,index.first)) ++nmod;
470  }
471  return nmod;
472 }
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 474 of file HGCalDDDConstants.cc.

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

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

476  {
477 
478  int subSec = half ? subsector : 0;
479  std::pair<int,int> kxy = findCell(cell, layer, subSec, true);
480  int kx = kxy.first + incrx;
481  int ky = kxy.second + incry;
482  if (ky < 0 || ky > maxRows(layer, true)) {
483  cell = maxCells(true);
484  return std::pair<int,int>(cell,sector*subsector);
485  } else if (kx < 0) {
486  kx =-kx;
487  subsector =-subsector;
488  } else if (kx > maxCells(layer, true)) {
489  kx -= maxCells(layer, true);
490  sector += subsector;
491  subsector =-subsector;
492  if (sector < 1) sector = hgpar_->nSectors_;
493  else if (sector > hgpar_->nSectors_) sector = 1;
494  }
495  cell = newCell(kx, ky, layer, subSec);
496  return std::pair<int,int>(cell,sector*subsector);
497 }
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 499 of file HGCalDDDConstants.cc.

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

500  {
501 
502  int layer = lay + incrz;
503  if (layer <= 0 || layer > (int)(layers(true))) return std::pair<int,int>(cell,0);
504  int subSec = half ? subsector : 0;
505  std::pair<float,float> xy = locateCell(cell, lay, subSec, true);
506  std::pair<int,int> kcell = assignCell(xy.first, xy.second, layer, subSec,
507  true);
508  return std::pair<int,int>(kcell.second,layer);
509 }
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 511 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_.

511  {
512 
513  std::pair<int,float> index = getIndex(lay, true);
514  int i = index.first;
515  if (i < 0) return maxCells(true);
516  float alpha = (subSec == 0) ? hgpar_->moduleAlphaS_[i] : subSec;
517  float cellSize = index.second;
518  float a = (alpha==0) ?
521  float b = 2*hgpar_->moduleHR_[i]*hgpar_->moduleBlR_[i]/
523  int icell(kx);
524  for (int iky=0; iky<ky; ++iky)
525  icell += floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize));
526  return icell;
527 }
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 529 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().

529  {
530 
531  std::pair<int,float> index = getIndex(lay, reco);
532  int i = index.first;
533  std::vector<int> ncell;
534  if (i >= 0) {
536  float h, bl, tl, alpha;
537  getParameterSquare(i,0,reco,h,bl,tl,alpha);
538  return numberCellsSquare(h, bl, tl, alpha, index.second);
539  } else {
540  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
541  if (waferInLayer(k,i)) {
542  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
543  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
544  ncell.push_back((int)(cell));
545  }
546  }
547  }
548  }
549  return ncell;
550 }
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 565 of file HGCalDDDConstants.cc.

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

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

565  {
566 
567  int ncell(0);
568  if (wafer >= 0 && wafer < (int)(hgpar_->waferTypeT_.size())) {
569  if (hgpar_->waferTypeT_[wafer]==1)
570  ncell = (int)(hgpar_->cellFineX_.size());
571  else
572  ncell = (int)(hgpar_->cellCoarseX_.size());
573  }
574  return ncell;
575 }
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 552 of file HGCalDDDConstants.cc.

References a, b, and k_horizontalShift.

Referenced by minSlope(), and numberCells().

554  {
555 
556  float a = (alpha==0) ? (2*h/(tl-bl)) : (h/(tl-bl));
557  float b = 2*h*bl/(tl-bl);
558  int kymax = floor((2*h)/cellSize);
559  std::vector<int> ncell;
560  for (int iky=0; iky<kymax; ++iky)
561  ncell.push_back(floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize)));
562  return ncell;
563 }
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 577 of file HGCalDDDConstants.cc.

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

Referenced by minSlope().

577  {
578  int row(0), col(0);
579  if (wafer < (int)(hgpar_->waferCopy_.size())) {
580  int copy = hgpar_->waferCopy_[wafer];
581  col = copy%100;
582  if ((copy/10000)%10 != 0) col = -col;
583  row = (copy/100)%100;
584  if ((copy/100000)%10 != 0) row = -row;
585  }
586  return std::pair<int,int>(row,col);
587 }
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 589 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 HGCalTBAnalyzer::analyzeSimHits(), CaloTruthAccumulator::fillSimHits(), HGCalTriggerBackend::HGCalTriggerSimCluster< FECODEC, DATA >::run(), sectors(), and HGCalTriggerNtupleHGCDigis::simhits().

590  {
591 
592  std::pair<int,float> index = getIndex(lay, false);
593  int i = index.first;
594  if (i < 0) {
595  return std::pair<int,int>(-1,-1);
596  }
597  int kx(-1), depth(-1);
599  float h = hgpar_->moduleHS_[i];
600  float bl = hgpar_->moduleBlS_[i];
601  float tl = hgpar_->moduleTlS_[i];
602  float cellSize = hgpar_->cellFactor_[i]*index.second;
603 
604  std::pair<int,int> kxy = findCellSquare(cell, h, bl, tl, hgpar_->moduleAlphaS_[i], index.second);
606  if (depth<0) return std::pair<int,int>(-1,-1);
607  kx = kxy.first/hgpar_->cellFactor_[i];
608  int ky = kxy.second/hgpar_->cellFactor_[i];
609 
610  float a = (half) ? (h/(tl-bl)) : (2*h/(tl-bl));
611  float b = 2*h*bl/(tl-bl);
612  for (int iky=0; iky<ky; ++iky)
613  kx += floor(((iky+1)*cellSize+b+k_horizontalShift*cellSize)/(a*cellSize));
614 #ifdef EDM_ML_DEBUG
615  std::cout << "simToReco: input " << cell << ":" << lay << ":" << half
616  << " kxy " << kxy.first << ":" << kxy.second << " output "
617  << kx << ":" << depth << " cell factor="
618  << hgpar_->cellFactor_[i] << std::endl;
619 #endif
620  } else {
621  kx = cell;
622  int type = hgpar_->waferTypeL_[mod];
623  if (type == 1) {
625  } else if (type == 2) {
627  } else {
629  }
630  }
631  return std::pair<int,int>(kx,depth);
632 }
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::waferFromCopy ( int  copy) const

Definition at line 634 of file HGCalDDDConstants.cc.

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

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

634  {
635  const int ncopies = hgpar_->waferCopy_.size();
636  int wafer(ncopies);
637 #ifdef EDM_ML_DEBUG
638  bool ok(false);
639 #endif
640  for (int k=0; k<ncopies; ++k) {
641  if (copy == hgpar_->waferCopy_[k]) {
642  wafer = k;
643 #ifdef EDM_ML_DEBUG
644  ok = true;
645 #endif
646  break;
647  }
648  }
649 #ifdef EDM_ML_DEBUG
650  if (!ok) {
651  std::cout << "Cannot find " << copy << " in a list of " << ncopies << "\n";
652  for (int k=0; k<ncopies; ++k) std::cout << " " << hgpar_->waferCopy_[k];
653  std::cout << std::endl;
654  }
655 #endif
656  return wafer;
657 }
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 659 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().

661  {
662 
663  double xx(k_ScaleFromDDD*x), yy(k_ScaleFromDDD*y);
664  int size_ = (int)(hgpar_->waferCopy_.size());
665  wafer = size_;
666  for (int k=0; k<size_; ++k) {
667  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
668  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
669  if (dx <= rmax_ && dy <= hexside_) {
670  if ((dy <= 0.5*hexside_) || (dx <= (2.*rmax_-dy/tan30deg_))) {
671  wafer = k;
672  celltyp = hgpar_->waferTypeT_[k];
673  xx -= hgpar_->waferPosX_[k];
674  yy -= hgpar_->waferPosY_[k];
675  break;
676  }
677  }
678  }
679  if (wafer < size_) {
680  if (celltyp == 1)
681  icell = cellHex(xx, yy, 0.5*k_ScaleFromDDD*hgpar_->cellSize_[0],
683  else
684  icell = cellHex(xx, yy, 0.5*k_ScaleFromDDD*hgpar_->cellSize_[1],
686  }
687 #ifdef EDM_ML_DEBUG
688  std::cout << "Position " << x << ":" << y << " Wafer " << wafer << ":"
689  << size_ << " XX " << xx << ":" << yy << " Cell " << icell
690  << " Type " << celltyp << std::endl;
691 #endif
692 }
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 694 of file HGCalDDDConstants.cc.

References getIndex().

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

694  {
695 
696  std::pair<int,float> indx = getIndex(lay, reco);
697  if (indx.first < 0) return false;
698  return waferInLayer(wafer,indx.first);
699 }
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 804 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_.

804  {
805 
806  const double rr = 2*rmax_*tan30deg_;
807  const double waferX = hgpar_->waferPosX_[wafer];
808  const double waferY = hgpar_->waferPosY_[wafer];
809  double xc[6], yc[6];
810  xc[0] = waferX+rmax_; yc[0] = waferY-0.5*rr;
811  xc[1] = waferX+rmax_; yc[1] = waferY+0.5*rr;
812  xc[2] = waferX; yc[2] = waferY+rr;
813  xc[3] = waferX-rmax_; yc[3] = waferY+0.5*rr;
814  xc[4] = waferX+rmax_; yc[4] = waferY-0.5*rr;
815  xc[5] = waferX; yc[5] = waferY-rr;
816  bool cornerOne(false), cornerAll(true);
817  for (int k=0; k<6; ++k) {
818  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
819  if ((rpos >= hgpar_->rMinLayHex_[lay]) &&
820  (rpos <= hgpar_->rMaxLayHex_[lay])) cornerOne = true;
821  else cornerAll = false;
822  }
823  bool in(false);
825  in = cornerAll;
827  in = cornerOne;
828  return in;
829 }
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_
std::pair< double, double > HGCalDDDConstants::waferPosition ( int  wafer,
bool  reco = true 
) const

Definition at line 701 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 volumes().

702  {
703 
704  double xx(0), yy(0);
705  if (wafer >= 0 && wafer < (int)(hgpar_->waferPosX_.size())) {
706  xx = hgpar_->waferPosX_[wafer];
707  yy = hgpar_->waferPosY_[wafer];
708  }
709  if (!reco) {
710  xx /= k_ScaleFromDDD;
711  yy /= k_ScaleFromDDD;
712  }
713  std::pair<double,double> xy(xx,yy);
714  return xy;
715 }
std::vector< double > waferPosY_
fixed size matrix
double k_ScaleFromDDD
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int HGCalDDDConstants::wafers ( ) const

Definition at line 724 of file HGCalDDDConstants.cc.

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

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

724  {
725 
726  int wafer(0);
727  for (unsigned int i = 0; i<layers(true); ++i) {
728  int lay = hgpar_->depth_[i];
729  wafer += modules(lay, true);
730  }
731  return wafer;
732 }
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 734 of file HGCalDDDConstants.cc.

References waferLayer_.

734  {
735 
736  int wafer(0);
737  auto itr = waferLayer_.find(layer);
738  if (itr != waferLayer_.end()) {
739  unsigned ity = (type > 0 && type <= 2) ? type : 0;
740  wafer = (itr->second)[ity];
741  }
742  return wafer;
743 }
type
Definition: HCALResponse.h:21
std::map< int, HGCWaferParam > waferLayer_
int HGCalDDDConstants::waferToCopy ( int  wafer) const
inline

Definition at line 79 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferCopy_.

79 {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 83 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferTypeL_.

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

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

Definition at line 717 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().

717  {
718  std::pair<int,float> index = getIndex(lay, reco);
719  int i = index.first;
720  if (i < 0) return 0;
721  else return hgpar_->zLayerHex_[i];
722 }
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 108 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and waferFromPosition().

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

Definition at line 112 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and modules().

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

Definition at line 110 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxModules().

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

Definition at line 107 of file HGCalDDDConstants.h.

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

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

Definition at line 111 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and layers().

int32_t HGCalDDDConstants::tot_wafers_
private

Definition at line 110 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants().

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

Definition at line 113 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and wafers().