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::array< int, 5 > assignCellHex (float x, float y, int lay, bool reco) const
 
std::array< int, 3 > assignCellTrap (float x, float y, float z, int lay, bool reco) const
 
bool cellInLayer (int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
 
double cellSizeHex (int type) const
 
double cellThickness (int layer, int waferU, int waferV) const
 
double distFromEdgeHex (double x, double y, double z) const
 
double distFromEdgeTrap (double x, double y, double z) const
 
void etaPhiFromPosition (const double x, const double y, const double z, const int layer, int &ieta, int &iphi, int &type, double &wt) const
 
int firstLayer () const
 
HGCalGeometryMode::GeometryMode geomMode () const
 
int getLayer (double z, bool reco) const
 
HGCalParameters::hgtrap getModule (unsigned int k, bool hexType, bool reco) const
 
std::vector< HGCalParameters::hgtrapgetModules () const
 
const HGCalParametersgetParameter () const
 
HGCalParameters::hgtrform getTrForm (unsigned int k) const
 
unsigned int getTrFormN () const
 
std::vector< HGCalParameters::hgtrformgetTrForms () const
 
int getTypeHex (int layer, int waferU, int waferV) const
 
int getTypeTrap (int layer) const
 
 HGCalDDDConstants (const HGCalParameters *hp, const std::string &name)
 
bool isHalfCell (int waferType, int cell) const
 
bool isValidHex (int lay, int mod, int cell, bool reco) const
 
bool isValidHex8 (int lay, int modU, int modV, int cellU, int cellV) const
 
bool isValidTrap (int lay, int ieta, int iphi) const
 
int layerIndex (int lay, bool reco) const
 
unsigned int layers (bool reco) const
 
unsigned int layersInit (bool reco) const
 
int levelTop (int ind=0) const
 
std::pair< float, float > locateCell (int cell, int lay, int type, bool reco) const
 
std::pair< float, float > locateCell (int lay, int waferU, int waferV, int cellU, int cellV, bool reco, bool all, bool debug=false) const
 
std::pair< float, float > locateCellHex (int cell, int wafer, bool reco) const
 
std::pair< float, float > locateCellTrap (int lay, int ieta, int iphi, bool reco) const
 
int maxCells (bool reco) const
 
int maxCells (int lay, bool reco) const
 
int maxCellUV () const
 
int maxModules () const
 
int maxMoudlesPerLayer () 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
 
double mouseBite (bool reco) const
 
int numberCells (bool reco) const
 
std::vector< int > numberCells (int lay, bool reco) const
 
int numberCellsHexagon (int wafer) const
 
int numberCellsHexagon (int lay, int waferU, int waferV, bool flag) const
 
std::pair< double, double > rangeR (double z, bool reco) const
 
std::pair< double, double > rangeZ (bool reco) 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
 
void waferFromPosition (const double x, const double y, const int layer, int &waferU, int &waferV, int &cellU, int &cellV, int &celltype, double &wt, bool debug=false) const
 
bool waferFullInLayer (int wafer, int lay, bool reco) 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) const
 
std::pair< double, double > waferPosition (int waferU, int waferV, bool reco) const
 
int wafers () const
 
int wafers (int layer, int type) const
 
double waferSepar (bool reco) const
 
double waferSize (bool reco) const
 
int waferToCopy (int wafer) const
 
int waferType (DetId const &id) const
 
int waferTypeL (int wafer) const
 
int waferTypeT (int wafer) const
 
int waferUVMax () 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 cellHex (double xloc, double yloc, int cellType, int &cellU, int &cellV, bool debug=false) const
 
std::pair< int, float > getIndex (int lay, bool reco) const
 
bool isValidCell (int layindex, int wafer, int cell) const
 
bool waferInLayerTest (int wafer, int lay, bool full) const
 

Private Attributes

const float dPhiMin = 0.02
 
double hexside_
 
const HGCalParametershgpar_
 
const double k_horizontalShift = 1.0
 
Simrecovecs max_modules_layer_
 
int32_t maxWafersPerLayer_
 
HGCalGeometryMode::GeometryMode mode_
 
int32_t modHalf_
 
double rmax_
 
const double sqrt3_
 
std::array< uint32_t, 2 > tot_layers_
 
int32_t tot_wafers_
 
std::unordered_map< int32_t, bool > waferIn_
 
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 24 of file HGCalDDDConstants.h.

Member Typedef Documentation

typedef std::array<int,3> HGCalDDDConstants::HGCWaferParam
private

Definition at line 140 of file HGCalDDDConstants.h.

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

Definition at line 139 of file HGCalDDDConstants.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file HGCalDDDConstants.cc.

References HGCalParameters::cellSize_, funct::cos(), getIndex(), getTrForm(), getTrFormN(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, hexside_, hgpar_, mps_fire::i, HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrform::lay, layers(), layersInit(), SiStripPI::max, max_modules_layer_, maxCells(), maxWafersPerLayer_, HGCalParameters::mode_, mode_, modHalf_, modulesInit(), rmax_, sectors(), tan30deg_, tot_layers_, tot_wafers_, HGCalParameters::waferCopy_, waferIn_, HGCalWaferIndex::waferIndex(), waferInLayer(), waferLayer_, waferMax_, HGCalParameters::waferR_, wafers(), HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

26  : hgpar_(hp),
27  sqrt3_(std::sqrt(3.0)) {
28  mode_ = hgpar_->mode_;
34  std::cos(30.0*CLHEP::deg));
35  hexside_ = 2.0 * rmax_ * tan30deg_;
36 #ifdef EDM_ML_DEBUG
37  edm::LogVerbatim("HGCalGeom") << "rmax_ " << rmax_ << ":" << hexside_
38  << " CellSize " << 0.5*HGCalParameters::k_ScaleFromDDD*hgpar_->cellSize_[0]
40 #endif
41  }
42  // init maps and constants
43  modHalf_ = 0;
45  for (int simreco = 0; simreco < 2; ++simreco) {
46  tot_layers_[simreco] = layersInit((bool)simreco);
47  max_modules_layer_[simreco].resize(tot_layers_[simreco]+1);
48  for (unsigned int layer=1; layer <= tot_layers_[simreco]; ++layer) {
49  max_modules_layer_[simreco][layer] = modulesInit(layer,(bool)simreco);
50  if (simreco == 1) {
51  modHalf_ += max_modules_layer_[simreco][layer];
53  max_modules_layer_[simreco][layer]);
54 #ifdef EDM_ML_DEBUG
55  edm::LogVerbatim("HGCalGeom") << "Layer " << layer << " with "
56  << max_modules_layer_[simreco][layer]
57  << ":" << modHalf_ << " modules";
58 #endif
59  }
60  }
61  }
62  tot_wafers_ = wafers();
63 
64 #ifdef EDM_ML_DEBUG
65  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants initialized for "
66  << name << " with " << layers(false) << ":"
67  << layers(true) << " layers, " << wafers()
68  << ":" << 2*modHalf_ << " wafers with maximum "
69  << maxWafersPerLayer_ << " per layer and "
70  << "maximum of " << maxCells(false) << ":"
71  << maxCells(true) << " cells";
72 #endif
77  int wminT(9999999), wmaxT(-9999999), kount1(0), kount2(0);
78  for (unsigned int i=0; i<getTrFormN(); ++i) {
79  int lay0 = getTrForm(i).lay;
80  int wmin(9999999), wmax(-9999999), kount(0);
81  for (int wafer=0; wafer<sectors(); ++wafer) {
82  bool waferIn = waferInLayer(wafer,lay0,true);
86  waferIn_[kndx] = waferIn;
87  }
88  if (waferIn) {
89  int waferU = (((mode_ == HGCalGeometryMode::Hexagon) ||
92  if (waferU < wmin) wmin = waferU;
93  if (waferU > wmax) wmax = waferU;
94  ++kount;
95  }
96  }
97  if (wminT > wmin) wminT = wmin;
98  if (wmaxT < wmax) wmaxT = wmax;
99  if (kount1 < kount) kount1= kount;
100  kount2 += kount;
101 #ifdef EDM_ML_DEBUG
102  int lay1 = getIndex(lay0,true).first;
103  edm::LogVerbatim("HGCalGeom") << "Index " << i << " Layer " << lay0
104  << ":" << lay1 << " Wafer " << wmin
105  << ":" << wmax << ":" << kount;
106 #endif
107  HGCWaferParam a1{ {wmin,wmax,kount} };
108  waferLayer_[lay0] = a1;
109  }
110  waferMax_ = std::array<int,4>{ {wminT,wmaxT,kount1,kount2} };
111 #ifdef EDM_ML_DEBUG
112  edm::LogVerbatim("HGCalGeom") << "Overall wafer statistics: " << wminT
113  << ":" << wmaxT << ":" << kount1 << ":"
114  << kount2;
115 #endif
116  }
117 }
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
static int32_t waferV(const int32_t index)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
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_
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< int, float > getIndex(int lay, bool reco) const
static double k_ScaleFromDDD
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::unordered_map< int32_t, bool > waferIn_
static int32_t waferU(const int32_t index)
int sectors() const
std::vector< int > waferCopy_
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 119 of file HGCalDDDConstants.cc.

119 {}

Member Function Documentation

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

Definition at line 121 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellHex(), HGCalParameters::cellSize_, getIndex(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, hgpar_, HGCalParameters::k_ScaleFromDDD, mode_, trackingPlots::reco, rmax_, findQualityFiles::size, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

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

122  {
123  const auto & index = getIndex(lay, reco);
124  if (index.first < 0) return std::make_pair(-1,-1);
127  float xx = (reco) ? x : HGCalParameters::k_ScaleFromDDD*x;
128  float yy = (reco) ? y : HGCalParameters::k_ScaleFromDDD*y;
129 
130  //First the wafer
131  int wafer = cellHex(xx, yy, rmax_, hgpar_->waferPosX_, hgpar_->waferPosY_);
132  if (wafer < 0 || wafer >= (int)(hgpar_->waferTypeT_.size())) {
133  edm::LogWarning("HGCalGeom") << "Wafer no. out of bound for " << wafer
134  << ":" << (hgpar_->waferTypeT_).size()
135  << ":" << (hgpar_->waferPosX_).size()
136  << ":" << (hgpar_->waferPosY_).size()
137  << " ***** ERROR *****";
138  return std::make_pair(-1,-1);
139  } else {
140  // Now the cell
141  xx -= hgpar_->waferPosX_[wafer];
142  yy -= hgpar_->waferPosY_[wafer];
143  if (hgpar_->waferTypeT_[wafer] == 1)
144  return std::make_pair(wafer,cellHex(xx, yy,
147  else
148  return std::make_pair(wafer,cellHex(xx, yy,
151  }
152  } else {
153  return std::make_pair(-1,-1);
154  }
155 }
size
Write out results.
std::vector< double > waferPosY_
std::vector< double > cellFineY_
HGCalGeometryMode::GeometryMode mode_
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::pair< int, float > getIndex(int lay, bool reco) const
static double k_ScaleFromDDD
std::vector< double > cellFineX_
fixed size matrix
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::array< int, 5 > HGCalDDDConstants::assignCellHex ( float  x,
float  y,
int  lay,
bool  reco 
) const

Definition at line 157 of file HGCalDDDConstants.cc.

References HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalParameters::k_ScaleToDDD, mode_, trackingPlots::reco, waferFromPosition(), waferType(), geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

Referenced by HGCalGeometry::getClosestCell().

158  {
159  int waferU(0), waferV(0), waferType(-1), cellU(0), cellV(0);
162  double xx = (reco) ? HGCalParameters::k_ScaleToDDD*x : x;
163  double yy = (reco) ? HGCalParameters::k_ScaleToDDD*y : y;
164  double wt(1.0);
165  waferFromPosition(xx,yy,lay,waferU,waferV,cellU,cellV,waferType,wt);
166  }
167  return std::array<int,5>{ {waferU,waferV,waferType,cellU,cellV} };
168 }
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
HGCalGeometryMode::GeometryMode mode_
int waferType(DetId const &id) const
static double k_ScaleToDDD
std::array< int, 3 > HGCalDDDConstants::assignCellTrap ( float  x,
float  y,
float  z,
int  lay,
bool  reco 
) const

Definition at line 170 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, createfilelist::int, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, HGCalParameters::k_ScaleFromDDD, M_PI, SiStripPI::max, min(), phi, alignCSCRings::r, HGCalParameters::radiusLayer_, HGCalParameters::scintType(), mathSSE::sqrt(), and geometryCSVtoXML::xx.

Referenced by HGCalGeometry::getClosestCell(), and HGCalNumberingScheme::getUnitID().

172  {
173 
174  int irad(-1), iphi(-1), type(-1);
175  const auto & indx = getIndex(layer,reco);
176  if (indx.first < 0) return std::array<int,3>{ {irad,iphi,type} };
177  double xx = (z > 0) ? x : -x;
178  double r = (reco ? std::sqrt(x*x+y*y) :
179  HGCalParameters::k_ScaleFromDDD*std::sqrt(x*x+y*y));
180  double phi = (r == 0. ? 0. : std::atan2(y,xx));
181  if (phi < 0) phi += (2.0*M_PI);
182  type = hgpar_->scintType(layer);
183  auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(),
184  hgpar_->radiusLayer_[type].end(), r);
185  irad = (int)(ir - hgpar_->radiusLayer_[type].begin());
186  irad = std::min(std::max(irad,hgpar_->iradMinBH_[indx.first]),
187  hgpar_->iradMaxBH_[indx.first]);
188  iphi = 1 + (int)(phi/indx.second);
189 #ifdef EDM_ML_DEBUG
190  edm::LogVerbatim("HGCalGeom") << "assignCellTrap Input " << x << ":" << y
191  << ":" << z << ":" << layer << ":" << reco
192  << " x|r " << xx << ":" << r << " phi "
193  << phi << " o/p " << irad << ":" << iphi
194  << ":" << type;
195 #endif
196  return std::array<int,3>{ {irad,iphi,type} };
197 }
std::vector< int > iradMaxBH_
type
Definition: HCALResponse.h:21
int scintType(const int layer) const
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< int, float > getIndex(int lay, bool reco) const
T min(T a, T b)
Definition: MathUtil.h:58
#define M_PI
std::vector< int > iradMinBH_
fixed size matrix
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_
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 1136 of file HGCalDDDConstants.cc.

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

Referenced by assignCell(), waferFromPosition(), and waferUVMax().

1139  {
1140  int num(0);
1141  const double tol(0.00001);
1142  double cellY = 2.0*cellR*tan30deg_;
1143  for (unsigned int k=0; k<posX.size(); ++k) {
1144  double dx = std::abs(xx - posX[k]);
1145  double dy = std::abs(yy - posY[k]);
1146  if (dx <= (cellR+tol) && dy <= (cellY+tol)) {
1147  double xmax = (dy<=0.5*cellY) ? cellR : (cellR-(dy-0.5*cellY)/tan30deg_);
1148  if (dx <= (xmax+tol)) {
1149  num = k;
1150  break;
1151  }
1152  }
1153  }
1154  return num;
1155 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
static double tan30deg_
void HGCalDDDConstants::cellHex ( double  xloc,
double  yloc,
int  cellType,
int &  cellU,
int &  cellV,
bool  debug = false 
) const
private

Definition at line 1157 of file HGCalDDDConstants.cc.

References funct::abs(), debug, runEdmFileComparison::found, hgpar_, SiStripPI::max, min(), N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, rmax_, edm::shift, and sqrt3_.

1162  {
1163  int N = (cellType == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
1164  double Rc = 2*rmax_/(3*N);
1165  double rc = 0.5*Rc*sqrt3_;
1166  double v0 = ((xloc/Rc -1.0)/1.5);
1167  int cv0 = (v0 > 0) ? (N + (int)(v0+0.5)) : (N - (int)(-v0+0.5));
1168  double u0 = (0.5*yloc/rc+0.5*cv0);
1169  int cu0 = (u0 > 0) ? (N/2 + (int)(u0+0.5)) : (N/2 - (int)(-u0+0.5));
1170  cu0 = std::max(0,std::min(cu0,2*N-1));
1171  cv0 = std::max(0,std::min(cv0,2*N-1));
1172  if (cv0-cu0 >= N) cv0 = cu0+N-1;
1173 #ifdef EDM_ML_DEBUG
1174  if (debug)
1175  edm::LogVerbatim("HGCalGeom") << "cellHex: input " << xloc << ":"
1176  << yloc << ":" << cellType << " parameter "
1177  << rc << ":" << Rc << " u0 " << u0 << ":"
1178  << cu0 << " v0 " << v0 << ":" << cv0;
1179 #endif
1180  bool found(false);
1181  static const int shift[3] = {0,1,-1};
1182  for (int i1=0; i1<3; ++i1) {
1183  cellU = cu0 + shift[i1];
1184  for (int i2=0; i2<3; ++i2) {
1185  cellV = cv0 + shift[i2];
1186  if (((cellV-cellU) < N) && ((cellU-cellV) <= N) && (cellU >= 0) &&
1187  (cellV >= 0) && (cellU < 2*N) && (cellV < 2*N)) {
1188  double xc = (1.5*(cellV-N)+1.0)*Rc;
1189  double yc = (2*cellU-cellV-N)*rc;
1190  if ((std::abs(yloc-yc) <= rc) && (std::abs(xloc-xc) <= Rc) &&
1191  ((std::abs(xloc-xc) <= 0.5*Rc) ||
1192  (std::abs(yloc-yc) <= sqrt3_*(Rc-std::abs(xloc-xc))))) {
1193 #ifdef EDM_ML_DEBUG
1194  if (debug)
1195  edm::LogVerbatim("HGCalGeom") << "cellHex: local " << xc << ":"
1196  << yc << " difference "
1197  << std::abs(xloc-xc) << ":"
1198  << std::abs(yloc-yc) << ":"
1199  << sqrt3_*(Rc-std::abs(yloc-yc))
1200  << " comparator " << rc << ":" << Rc
1201  << " (u,v) = (" << cellU << ","
1202  << cellV << ")";
1203 #endif
1204  found = true; break;
1205  }
1206  }
1207  }
1208  if (found) break;
1209  }
1210  if (!found) { cellU = cu0; cellV = cv0; }
1211 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
#define debug
Definition: HDRShower.cc:19
#define N
Definition: blowfish.cc:9
static unsigned int const shift
const HGCalParameters * hgpar_
bool HGCalDDDConstants::cellInLayer ( int  waferU,
int  waferV,
int  cellU,
int  cellV,
int  lay,
bool  reco 
) const

Definition at line 199 of file HGCalDDDConstants.cc.

References getIndex(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, hgpar_, locateCell(), mode_, HGCalParameters::rMinLayHex_, mathSSE::sqrt(), and geometryCSVtoXML::xy.

Referenced by HGCalGeometry::newCell().

200  {
201  const auto & indx = getIndex(lay,true);
202  if (indx.first >= 0) {
207  const auto & xy = ((mode_ == HGCalGeometryMode::Hexagon8) ||
209  locateCell(lay, waferU, waferV, cellU, cellV, reco, true, false) :
210  locateCell(cellU, lay, waferU, reco);
211  double rpos = sqrt(xy.first*xy.first + xy.second*xy.second);
212  return ((rpos >= hgpar_->rMinLayHex_[indx.first]) &&
213  (rpos <= hgpar_->rMaxLayHex_[indx.first]));
214  } else {
215  return true;
216  }
217  } else {
218  return false;
219  }
220 }
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
HGCalGeometryMode::GeometryMode mode_
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > rMinLayHex_
fixed size matrix
const HGCalParameters * hgpar_
double HGCalDDDConstants::cellSizeHex ( int  type) const

Definition at line 241 of file HGCalDDDConstants.cc.

References HGCalParameters::cellSize_, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, hgpar_, HGCalParameters::k_ScaleFromDDD, and mode_.

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

241  {
242  int indx = (((mode_ == HGCalGeometryMode::Hexagon8) ||
244  ((type >= 1) ? 1 : 0) : ((type == 1) ? 0 : 1));
245  double cell = (0.5*HGCalParameters::k_ScaleFromDDD*hgpar_->cellSize_[indx]);
246  return cell;
247 }
type
Definition: HCALResponse.h:21
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellSize_
static double k_ScaleFromDDD
const HGCalParameters * hgpar_
double HGCalDDDConstants::cellThickness ( int  layer,
int  waferU,
int  waferV 
) const

Definition at line 222 of file HGCalDDDConstants.cc.

References HGCalParameters::cellThickness_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, hgpar_, maxType, minType, mode_, HGCalParameters::typesInLayers_, HGCalWaferIndex::waferIndex(), and HGCalParameters::waferTypeL_.

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

223  {
224 
225  double thick(-1);
228  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer,waferU,waferV));
229  int type = ((itr == hgpar_->typesInLayers_.end() ? maxType :
230  hgpar_->waferTypeL_[itr->second]));
231  thick = 10000.0*hgpar_->cellThickness_[type];
232  } else if ((mode_ == HGCalGeometryMode::Hexagon) ||
234  int type = (((waferU>=0)&&(waferU<(int)(hgpar_->waferTypeL_.size()))) ?
235  hgpar_->waferTypeL_[waferU] : minType);
236  thick = 100.0*type;
237  }
238  return thick;
239 }
type
Definition: HCALResponse.h:21
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
HGCalGeometryMode::GeometryMode mode_
static const int maxType
std::vector< double > cellThickness_
wafer_map typesInLayers_
static const int minType
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
double HGCalDDDConstants::distFromEdgeHex ( double  x,
double  y,
double  z 
) const

Definition at line 249 of file HGCalDDDConstants.cc.

References funct::abs(), PVValHelper::dx, PVValHelper::dy, hexside_, hgpar_, createfilelist::int, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, rmax_, sqrt3_, tan30deg_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

Referenced by HFNoseSD::isItinFidVolume(), and HGCalSD::isItinFidVolume().

249  {
250 
251  //Assming the point is within a hexagonal plane of the wafer, calculate
252  //the shortest distance from the edge
253  if (z < 0) x = -x;
254  double dist(0);
255  //Input x, y in Geant4 unit and transformed to CMSSW standard
258  int sizew = (int)(hgpar_->waferPosX_.size());
259  int wafer = sizew;
260  //Transform to the local coordinate frame of the wafer first
261  for (int k=0; k<sizew; ++k) {
262  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
263  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
264  if (dx <= rmax_ && dy <= hexside_ &&
265  ((dy <= 0.5*hexside_) || (dx*tan30deg_ <= (hexside_-dy)))) {
266  wafer = k;
267  xx -= hgpar_->waferPosX_[k];
268  yy -= hgpar_->waferPosY_[k];
269  break;
270  }
271  }
272  //Look at only one quarter (both x,y are positive)
273  if (wafer < sizew) {
274  if (std::abs(yy) < 0.5*hexside_) {
275  dist = rmax_ - std::abs(xx);
276  } else {
277  dist = 0.5*((rmax_-std::abs(xx))-sqrt3_*(std::abs(yy)-0.5*hexside_));
278  }
279  } else {
280  dist = 0;
281  }
283 #ifdef EDM_ML_DEBUG
284  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeHex: Local " << xx << ":"
285  << yy << " wafer " << wafer << " flag "
286  << (wafer < sizew) << " Distance " << rmax_
287  << ":" << (rmax_-std::abs(xx)) << ":"
288  << (std::abs(yy)-0.5*hexside_) << ":"
289  << 0.5*hexside_ << ":" << dist;
290 #endif
291  return dist;
292 }
std::vector< double > waferPosY_
static double k_ScaleFromDDD
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
static double k_ScaleToDDD
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
static double tan30deg_
double HGCalDDDConstants::distFromEdgeTrap ( double  x,
double  y,
double  z 
) const

Definition at line 294 of file HGCalDDDConstants.cc.

References funct::abs(), getLayer(), hgpar_, createfilelist::int, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, layerIndex(), M_PI, SiStripPI::max, min(), phi, alignCSCRings::r, HGCalParameters::radiusLayer_, HGCalParameters::scintCellSize(), HGCalParameters::scintType(), mathSSE::sqrt(), and geometryCSVtoXML::xx.

Referenced by HGCScintSD::isItinFidVolume().

294  {
295 
296  //Assming the point is within the eta-phi plane of the scintillator tile,
297  //calculate the shortest distance from the edge
298  int lay = getLayer(z,false);
299  double xx = (z < 0) ? -x : x;
300  int indx = layerIndex(lay,false);
302  double phi = (r == 0. ? 0. : std::atan2(y,xx));
303  if (phi < 0) phi += (2.0*M_PI);
304  int type = hgpar_->scintType(lay);
305  double cell = hgpar_->scintCellSize(lay);
306  //Compare with the center of the tile find distances along R and also phi
307  //Take the smaller value
308  auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(),
309  hgpar_->radiusLayer_[type].end(), r);
310  int irad = (int)(ir-hgpar_->radiusLayer_[type].begin());
311  if (irad < hgpar_->iradMinBH_[indx]) irad = hgpar_->iradMinBH_[indx];
312  else if (irad > hgpar_->iradMaxBH_[indx]) irad = hgpar_->iradMaxBH_[indx];
313  int iphi = 1 + (int)(phi/cell);
314  double dphi = std::max(0.0,(0.5*cell-std::abs(phi-(iphi-0.5)*cell)));
315  double dist = std::min((r-hgpar_->radiusLayer_[type][irad-1]),
316  (hgpar_->radiusLayer_[type][irad]-r));
317 #ifdef EDM_ML_DEBUG
318  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeTrap: Global " << x << ":"
319  << y << ":" << z << " Layer " << lay
320  << " Index " << indx << ":" << type << " xx "
321  << xx << " R " << r << ":" << irad << ":"
322  << hgpar_->radiusLayer_[type][irad-1] << ":"
323  << hgpar_->radiusLayer_[type][irad]
324  << " Phi " << phi << ":" << iphi << ":"
325  << (iphi-0.5)*cell << " cell " << cell
326  << " Dphi " << dphi << " Dist " << dist
327  << ":" << r*dphi;
328 #endif
329  return HGCalParameters::k_ScaleToDDD*std::min(r*dphi,dist);
330 }
std::vector< int > iradMaxBH_
type
Definition: HCALResponse.h:21
int getLayer(double z, bool reco) const
int scintType(const int layer) const
double scintCellSize(const int layer) const
int layerIndex(int lay, bool reco) const
T sqrt(T t)
Definition: SSEVec.h:18
static double k_ScaleFromDDD
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
#define M_PI
static double k_ScaleToDDD
std::vector< int > iradMinBH_
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_
void HGCalDDDConstants::etaPhiFromPosition ( const double  x,
const double  y,
const double  z,
const int  layer,
int &  ieta,
int &  iphi,
int &  type,
double &  wt 
) const
int HGCalDDDConstants::firstLayer ( ) const
inline
HGCalGeometryMode::GeometryMode HGCalDDDConstants::geomMode ( ) const
inline
std::pair< int, float > HGCalDDDConstants::getIndex ( int  lay,
bool  reco 
) const
private

Definition at line 1213 of file HGCalDDDConstants.cc.

References HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, hgpar_, layerIndex(), mode_, HGCalParameters::moduleCellR_, HGCalParameters::moduleCellS_, and HGCalParameters::scintCellSize().

Referenced by assignCell(), assignCellTrap(), cellInLayer(), HGCalDDDConstants(), isValidTrap(), locateCell(), locateCellTrap(), maxCells(), maxRows(), modules(), modulesInit(), numberCells(), simToReco(), waferFullInLayer(), waferInLayer(), wafers(), waferUVMax(), and waferZ().

1213  {
1214 
1215  int indx = layerIndex(lay,reco);
1216  if (indx<0) return std::make_pair(-1,0);
1217  float cell(0);
1218  if ((mode_ == HGCalGeometryMode::Hexagon) ||
1220  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1221  } else {
1224  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1225  } else {
1226  cell = hgpar_->scintCellSize(lay);
1227  }
1228  }
1229  return std::make_pair(indx,cell);
1230 }
std::vector< double > moduleCellR_
HGCalGeometryMode::GeometryMode mode_
double scintCellSize(const int layer) const
int layerIndex(int lay, bool reco) const
std::vector< double > moduleCellS_
fixed size matrix
const HGCalParameters * hgpar_
int HGCalDDDConstants::getLayer ( double  z,
bool  reco 
) const

Definition at line 332 of file HGCalDDDConstants.cc.

References funct::abs(), HGCalParameters::firstLayer_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, hgpar_, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerGroup_, layerIndex(), mode_, trackingPlots::reco, HGCalParameters::zLayerHex_, and geometryCSVtoXML::zz.

Referenced by distFromEdgeTrap(), geomMode(), and HGCalGeometry::getClosestCell().

332  {
333 
334  //Get the layer # from the gloabl z coordinate
335  unsigned int k = 0;
336  double zz = (reco ? std::abs(z) :
337  HGCalParameters::k_ScaleFromDDD*std::abs(z));
338  const auto& zLayerHex = hgpar_->zLayerHex_;
339  std::find_if(zLayerHex.begin()+1,zLayerHex.end(),[&k,&zz,&zLayerHex](double zLayer){ ++k; return zz < 0.5*(zLayerHex[k-1]+zLayerHex[k]);});
340  int lay = k;
341  if (((mode_ == HGCalGeometryMode::Hexagon) ||
343  int indx = layerIndex(lay,false);
344  if (indx >= 0) lay = hgpar_->layerGroup_[indx];
345  } else {
346  lay += (hgpar_->firstLayer_ - 1);
347  }
348  return lay;
349 }
HGCalGeometryMode::GeometryMode mode_
int layerIndex(int lay, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > zLayerHex_
int k[5][pyjets_maxn]
std::vector< int > layerGroup_
fixed size matrix
const HGCalParameters * hgpar_
HGCalParameters::hgtrap HGCalDDDConstants::getModule ( unsigned int  k,
bool  hexType,
bool  reco 
) const

Definition at line 351 of file HGCalDDDConstants.cc.

References HGCalParameters::getModule(), hgpar_, findQualityFiles::size, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, and HGCalParameters::waferTypeL_.

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

353  {
354 
356  if (hexType) {
357  if (indx >= hgpar_->waferTypeL_.size())
358  edm::LogWarning("HGCalGeom") << "Wafer no. out bound for index " << indx
359  << ":" << (hgpar_->waferTypeL_).size()
360  << ":" << (hgpar_->waferPosX_).size()
361  << ":" << (hgpar_->waferPosY_).size()
362  << " ***** ERROR *****";
363  unsigned int type = (indx < hgpar_->waferTypeL_.size()) ?
364  hgpar_->waferTypeL_[indx] : 3;
365  if (type > 0) --type;
366  mytr = hgpar_->getModule(type, reco);
367  } else {
368  mytr = hgpar_->getModule(indx,reco);
369  }
370  return mytr;
371 }
size
Write out results.
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
hgtrap getModule(unsigned int k, bool reco) const
fixed size matrix
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_
std::vector< HGCalParameters::hgtrap > HGCalDDDConstants::getModules ( ) const

Definition at line 373 of file HGCalDDDConstants.cc.

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

Referenced by geomMode().

373  {
374 
375  std::vector<HGCalParameters::hgtrap> mytrs;
376  for (unsigned int k=0; k<hgpar_->moduleLayR_.size(); ++k)
377  mytrs.emplace_back(hgpar_->getModule(k,true));
378  return mytrs;
379 }
std::vector< int > moduleLayR_
hgtrap getModule(unsigned int k, bool reco) const
int k[5][pyjets_maxn]
const HGCalParameters * hgpar_
const HGCalParameters* HGCalDDDConstants::getParameter ( ) const
inline

Definition at line 52 of file HGCalDDDConstants.h.

References hgpar_.

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

52 {return hgpar_;}
const HGCalParameters * hgpar_
HGCalParameters::hgtrform HGCalDDDConstants::getTrForm ( unsigned int  k) const
inline

Definition at line 53 of file HGCalDDDConstants.h.

References HGCalParameters::getTrForm(), and hgpar_.

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

53 {return hgpar_->getTrForm(k);}
hgtrform getTrForm(unsigned int k) const
int k[5][pyjets_maxn]
const HGCalParameters * hgpar_
unsigned int HGCalDDDConstants::getTrFormN ( ) const
inline
std::vector< HGCalParameters::hgtrform > HGCalDDDConstants::getTrForms ( ) const

Definition at line 381 of file HGCalDDDConstants.cc.

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

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

381  {
382 
383  std::vector<HGCalParameters::hgtrform> mytrs;
384  for (unsigned int k=0; k<hgpar_->trformIndex_.size(); ++k)
385  mytrs.emplace_back(hgpar_->getTrForm(k));
386  return mytrs;
387 }
std::vector< uint32_t > trformIndex_
hgtrform getTrForm(unsigned int k) const
int k[5][pyjets_maxn]
const HGCalParameters * hgpar_
int HGCalDDDConstants::getTypeHex ( int  layer,
int  waferU,
int  waferV 
) const

Definition at line 398 of file HGCalDDDConstants.cc.

References HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, hgpar_, mode_, HGCalParameters::typesInLayers_, HGCalWaferIndex::waferIndex(), and HGCalParameters::waferTypeL_.

Referenced by HGCalGeometryLoader::build(), HGCalTriggerGeometryV9Imp1::detIdWaferType(), and getTrFormN().

398  {
399  //Get the module type for a silicon wafer
402  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer,waferU,waferV));
403  return ((itr == hgpar_->typesInLayers_.end() ? 2 :
404  hgpar_->waferTypeL_[itr->second]));
405  } else {
406  return -1;
407  }
408 }
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
HGCalGeometryMode::GeometryMode mode_
wafer_map typesInLayers_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
int HGCalDDDConstants::getTypeTrap ( int  layer) const

Definition at line 389 of file HGCalDDDConstants.cc.

References hgpar_, mode_, HGCalParameters::scintType(), and HGCalGeometryMode::Trapezoid.

Referenced by HGCalTriggerGeometryV9Imp1::fillInvalidTriggerCells(), HGCalTriggerGeometryV9Imp1::getCellsFromTriggerCell(), HGCalTriggerGeometryV9Imp1::getNeighborsFromTriggerCell(), and getTrFormN().

389  {
390  //Get the module type for scinitllator
392  return hgpar_->scintType(layer);
393  } else {
394  return -1;
395  }
396 }
int scintType(const int layer) const
HGCalGeometryMode::GeometryMode mode_
const HGCalParameters * hgpar_
bool HGCalDDDConstants::isHalfCell ( int  waferType,
int  cell 
) const

Definition at line 410 of file HGCalDDDConstants.cc.

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

Referenced by getTrFormN(), and hgcal::RecHitTools::isHalfCell().

410  {
411  if (waferType < 1 || cell < 0) return false;
412  return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell];
413 }
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
int waferType(DetId const &id) const
const HGCalParameters * hgpar_
bool HGCalDDDConstants::isValidCell ( int  layindex,
int  wafer,
int  cell 
) const
private

Definition at line 1232 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, hgpar_, createfilelist::int, mps_fire::result, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, findQualityFiles::rr, mathSSE::sqrt(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, x, and y.

Referenced by isValidHex(), and waferUVMax().

1232  {
1233 
1234  // Calculate the position of the cell
1235  // Works for options HGCalHexagon/HGCalHexagonFull
1236  double x = hgpar_->waferPosX_[wafer];
1237  double y = hgpar_->waferPosY_[wafer];
1238  if (hgpar_->waferTypeT_[wafer] == 1) {
1239  x += hgpar_->cellFineX_[cell];
1240  y += hgpar_->cellFineY_[cell];
1241  } else {
1242  x += hgpar_->cellCoarseX_[cell];
1243  y += hgpar_->cellCoarseY_[cell];
1244  }
1245  double rr = sqrt(x*x+y*y);
1246  bool result = ((rr >= hgpar_->rMinLayHex_[lay-1]) &&
1247  (rr <= hgpar_->rMaxLayHex_[lay-1]) &&
1248  (wafer < (int)(hgpar_->waferPosX_.size())));
1249 #ifdef EDM_ML_DEBUG
1250  if (!result)
1251  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << wafer << ":"
1252  << cell << " Position " << x << ":" << y
1253  << ":" << rr << " Compare Limits "
1254  << hgpar_->rMinLayHex_[lay-1] << ":"
1255  << hgpar_->rMaxLayHex_[lay-1]
1256  << " Flag " << result;
1257 #endif
1258  return result;
1259 }
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_
bool HGCalDDDConstants::isValidHex ( int  lay,
int  mod,
int  cell,
bool  reco 
) const

Definition at line 415 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, HGCalParameters::copiesInLayers_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, hgpar_, createfilelist::int, isValidCell(), layers(), maxCells(), mod(), mode_, mps_fire::result, findQualityFiles::size, HGCalParameters::waferCopy_, and HGCalParameters::waferTypeT_.

Referenced by getTrFormN(), HGCNumberingScheme::getUnitID(), and HGCalTopology::valid().

416  {
417  //Check validity for a layer|wafer|cell of pre-TDR version
418  bool result(false), resultMod(false);
419  int cellmax(0);
422  int32_t copyNumber = hgpar_->waferCopy_[mod];
423  result = ((lay > 0 && lay <= (int)(layers(reco))));
424  if (result) {
425  const int32_t lay_idx = reco ? (lay-1)*3 + 1 : lay;
426  const auto& the_modules = hgpar_->copiesInLayers_[lay_idx];
427  auto moditr = the_modules.find(copyNumber);
428  result = resultMod = (moditr != the_modules.end());
429 #ifdef EDM_ML_DEBUG
430  if (!result)
431  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay
432  << ":" << lay_idx << " Copy "
433  << copyNumber << ":" << mod
434  << " Flag " << result;
435 #endif
436  if (result) {
437  if (moditr->second >= 0) {
438  if (mod >= (int)(hgpar_->waferTypeT_.size()))
439  edm::LogWarning("HGCalGeom") << "Module no. out of bound for "
440  << mod << " to be compared with "
441  << (hgpar_->waferTypeT_).size()
442  << " ***** ERROR *****";
443  cellmax = (hgpar_->waferTypeT_[mod]==1) ?
444  (int)(hgpar_->cellFineX_.size()) : (int)(hgpar_->cellCoarseX_.size());
445  result = (cell >=0 && cell <= cellmax);
446  } else {
447  result = isValidCell(lay_idx, mod, cell);
448  }
449  }
450  }
451  }
452 
453 #ifdef EDM_ML_DEBUG
454  if (!result)
455  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay << ":"
456  << (lay > 0 && (lay <= (int)(layers(reco))))
457  << " Module " << mod << ":" << resultMod
458  << " Cell " << cell << ":" << cellmax << ":"
459  << (cell >=0 && cell <= cellmax)
460  << ":" << maxCells(reco);
461 #endif
462  return result;
463 }
size
Write out results.
layer_map copiesInLayers_
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellCoarseX_
unsigned int layers(bool reco) const
bool isValidCell(int layindex, int wafer, int cell) 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::isValidHex8 ( int  lay,
int  modU,
int  modV,
int  cellU,
int  cellV 
) const

Definition at line 465 of file HGCalDDDConstants.cc.

References hgpar_, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::typesInLayers_, waferIn_, HGCalWaferIndex::waferIndex(), and HGCalParameters::waferTypeL_.

Referenced by getTrFormN(), and HGCalTopology::valid().

466  {
467  //Check validity for a layer|wafer|cell of post-TDR version
468  int indx = HGCalWaferIndex::waferIndex(layer,modU,modV);
469  auto itr = hgpar_->typesInLayers_.find(indx);
470  if (itr == hgpar_->typesInLayers_.end()) return false;
471  auto jtr = waferIn_.find(indx);
472  if (!(jtr->second)) return false;
473  int N = ((hgpar_->waferTypeL_[itr->second] == 0) ? hgpar_->nCellsFine_ :
475  if ((cellU >= 0) && (cellU < 2*N) && (cellV >= 0) && (cellV < 2*N)) {
476  return (((cellV-cellU) < N) && ((cellU-cellV) <= N));
477  } else {
478  return false;
479  }
480 }
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
std::unordered_map< int32_t, bool > waferIn_
#define N
Definition: blowfish.cc:9
wafer_map typesInLayers_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
bool HGCalDDDConstants::isValidTrap ( int  lay,
int  ieta,
int  iphi 
) const

Definition at line 482 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, and HGCalParameters::iradMinBH_.

Referenced by getTrFormN(), and HGCalTopology::valid().

482  {
483  //Check validity for a layer|eta|phi of scintillator
484  const auto & indx = getIndex(layer,true);
485  if (indx.first < 0) return false;
486  return ((irad >= hgpar_->iradMinBH_[indx.first]) &&
487  (irad <= hgpar_->iradMaxBH_[indx.first]) &&
488  (iphi > 0) && (iphi <= hgpar_->scintCells(layer)));
489 }
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< int > iradMinBH_
const HGCalParameters * hgpar_
int HGCalDDDConstants::layerIndex ( int  lay,
bool  reco 
) const

Definition at line 495 of file HGCalDDDConstants.cc.

References HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::firstLayer_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, hgpar_, HGCalParameters::layerIndex_, and mode_.

Referenced by HGCalGeometryLoader::build(), distFromEdgeTrap(), getIndex(), getLayer(), HGCalGeometry::getSummary(), and getTrFormN().

495  {
496  int ll = lay - hgpar_->firstLayer_;
497  if (ll<0 || ll>=(int)(hgpar_->layerIndex_.size())) return -1;
500  if (reco && ll>=(int)(hgpar_->depthIndex_.size())) return -1;
501  return (reco ? hgpar_->depthLayerF_[ll] : hgpar_->layerIndex_[ll]);
502  } else {
503  return (hgpar_->layerIndex_[ll]);
504  }
505 }
std::vector< int > depthLayerF_
HGCalGeometryMode::GeometryMode mode_
std::vector< int > layerIndex_
fixed size matrix
std::vector< int > depthIndex_
const HGCalParameters * hgpar_
unsigned int HGCalDDDConstants::layers ( bool  reco) const
unsigned int HGCalDDDConstants::layersInit ( bool  reco) const

Definition at line 507 of file HGCalDDDConstants.cc.

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

Referenced by getTrFormN(), and HGCalDDDConstants().

507  {
508  return (reco ? hgpar_->depthIndex_.size() : hgpar_->layerIndex_.size());
509 }
std::vector< int > layerIndex_
fixed size matrix
std::vector< int > depthIndex_
const HGCalParameters * hgpar_
int HGCalDDDConstants::levelTop ( int  ind = 0) const
inline

Definition at line 74 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::levelT_.

Referenced by HGCScintSD::update(), HGCalSD::update(), HFNoseSD::update(), HGCSD::update(), and SimG4HGCalValidation::update().

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

Definition at line 511 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, getIndex(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, hgpar_, mps_fire::i, HGCalParameters::k_ScaleToDDD, mode_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, x, and y.

Referenced by HGCalSimHitValidation::analyzeHits(), HGCalTBAnalyzer::analyzeSimHits(), cellInLayer(), HGCalNumberingScheme::checkPosition(), HGCalGeometry::get8Corners(), HGCalGeometry::getCorners(), HGCNumberingScheme::getLocalCoords(), HGCalGeometry::getPosition(), and getTrFormN().

512  {
513  // type refers to wafer # for hexagon cell
514  float x(999999.), y(999999.);
515  const auto & index = getIndex(lay, reco);
516  int i = index.first;
517  if (i < 0) return std::make_pair(x,y);
520  x = hgpar_->waferPosX_[type];
521  y = hgpar_->waferPosY_[type];
522  if (hgpar_->waferTypeT_[type] == 1) {
523  x += hgpar_->cellFineX_[cell];
524  y += hgpar_->cellFineY_[cell];
525  } else {
526  x += hgpar_->cellCoarseX_[cell];
527  y += hgpar_->cellCoarseY_[cell];
528  }
529  if (!reco) {
532  }
533  }
534  return std::make_pair(x,y);
535 }
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
std::vector< double > cellFineY_
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellCoarseX_
std::pair< int, float > getIndex(int lay, bool reco) const
static double k_ScaleToDDD
std::vector< double > cellFineX_
fixed size matrix
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::pair< float, float > HGCalDDDConstants::locateCell ( int  lay,
int  waferU,
int  waferV,
int  cellU,
int  cellV,
bool  reco,
bool  all,
bool  debug = false 
) const

Definition at line 537 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseIndex_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineIndex_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, debug, hgpar_, HGCalParameters::k_ScaleToDDD, HGCalParameters::typesInLayers_, HGCalWaferIndex::waferIndex(), waferPosition(), HGCalParameters::waferTypeL_, x, geometryCSVtoXML::xy, and y.

544  {
545 
546  float x(0), y(0);
547  int indx = HGCalWaferIndex::waferIndex(lay,waferU,waferV);
548  auto itr = hgpar_->typesInLayers_.find(indx);
549  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
550  hgpar_->waferTypeL_[itr->second]);
551 #ifdef EDM_ML_DEBUG
552  if (debug)
553  edm::LogVerbatim("HGCalGeom") << "LocateCell " << lay << ":" << waferU
554  << ":" << waferV << ":" << indx << ":"
555  << (itr == hgpar_->typesInLayers_.end())
556  << ":" << type;
557 #endif
558  int kndx = cellV*100 + cellU;
559  if (type == 0) {
560  auto ktr = hgpar_->cellFineIndex_.find(kndx);
561  if (ktr != hgpar_->cellFineIndex_.end()) {
562  x = hgpar_->cellFineX_[ktr->second];
563  y = hgpar_->cellFineY_[ktr->second];
564  }
565 #ifdef EDM_ML_DEBUG
566  if (debug)
567  edm::LogVerbatim("HGCalGeom") << "Fine " << cellU << ":" << cellV << ":"
568  << kndx << ":" << x << ":" << y << ":"
569  << (ktr != hgpar_->cellFineIndex_.end());
570 #endif
571  } else {
572  auto ktr = hgpar_->cellCoarseIndex_.find(kndx);
573  if (ktr != hgpar_->cellCoarseIndex_.end()) {
574  x = hgpar_->cellCoarseX_[ktr->second];
575  y = hgpar_->cellCoarseY_[ktr->second];
576  }
577 #ifdef EDM_ML_DEBUG
578  if (debug)
579  edm::LogVerbatim("HGCalGeom") << "Coarse " << cellU << ":" << cellV <<":"
580  << kndx << ":" << x << ":" << y << ":"
581  << (ktr != hgpar_->cellCoarseIndex_.end());
582 #endif
583  }
584  if (!reco) {
587  }
588  if (all) {
589  const auto & xy = waferPosition(waferU, waferV, reco);
590  x += xy.first;
591  y += xy.second;
592 #ifdef EDM_ML_DEBUG
593  if (debug)
594  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << ":"
595  << xy.first << ":" << xy.second;
596 #endif
597  }
598  return std::make_pair(x,y);
599 }
type
Definition: HCALResponse.h:21
wafer_map cellFineIndex_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
#define debug
Definition: HDRShower.cc:19
static double k_ScaleToDDD
wafer_map cellCoarseIndex_
std::vector< double > cellFineX_
wafer_map typesInLayers_
fixed size matrix
std::pair< double, double > waferPosition(int wafer, bool reco) const
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
std::pair< float, float > HGCalDDDConstants::locateCellHex ( int  cell,
int  wafer,
bool  reco 
) const

Definition at line 601 of file HGCalDDDConstants.cc.

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

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

602  {
603  float x(0), y(0);
604  if (hgpar_->waferTypeT_[wafer] == 1) {
605  x = hgpar_->cellFineX_[cell];
606  y = hgpar_->cellFineY_[cell];
607  } else {
608  x = hgpar_->cellCoarseX_[cell];
609  y = hgpar_->cellCoarseY_[cell];
610  }
611  if (!reco) {
614  }
615  return std::make_pair(x,y);
616 }
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
static double k_ScaleToDDD
std::vector< double > cellFineX_
fixed size matrix
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::pair< float, float > HGCalDDDConstants::locateCellTrap ( int  lay,
int  ieta,
int  iphi,
bool  reco 
) const

Definition at line 618 of file HGCalDDDConstants.cc.

References funct::abs(), funct::cos(), getIndex(), hgpar_, HGCalParameters::k_ScaleToDDD, SiStripPI::max, min(), phi, alignCSCRings::r, HGCalParameters::radiusLayer_, rangeR(), HGCalParameters::scintType(), funct::sin(), x, y, z, and HGCalParameters::zLayerHex_.

Referenced by HGCalSimHitValidation::analyzeHits(), HGCalGeometryLoader::build(), HGCalNumberingScheme::checkPosition(), HGCalGeometry::get8Corners(), HGCalGeometry::getCorners(), and getTrFormN().

619  {
620 
621  float x(0), y(0);
622  const auto & indx = getIndex(lay,reco);
623  if (indx.first >= 0) {
624  int ir = std::abs(irad);
625  int type = hgpar_->scintType(lay);
626  double phi = (iphi-0.5)*indx.second;
627  double z = hgpar_->zLayerHex_[indx.first];
628  double r = 0.5*(hgpar_->radiusLayer_[type][ir-1] +
629  hgpar_->radiusLayer_[type][ir]);
630  std::pair<double,double> range = rangeR(z,true);
631  r = std::max(range.first, std::min(r,range.second));
632  x = r*std::cos(phi);
633  y = r*std::sin(phi);
634  if (irad < 0) x =-x;
635  }
636  if (!reco) {
639  }
640  return std::make_pair(x,y);
641 }
type
Definition: HCALResponse.h:21
int scintType(const int layer) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::pair< double, double > rangeR(double z, bool reco) const
std::pair< int, float > getIndex(int lay, bool reco) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > zLayerHex_
static double k_ScaleToDDD
fixed size matrix
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_
int HGCalDDDConstants::maxCells ( bool  reco) const

Definition at line 643 of file HGCalDDDConstants.cc.

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

Referenced by HGCalDDDConstants(), HGCalTopology::HGCalTopology(), isValidHex(), and maxCellUV().

643  {
644 
645  int cells(0);
646  for (unsigned int i = 0; i<layers(reco); ++i) {
647  int lay = reco ? hgpar_->depth_[i] : hgpar_->layer_[i];
648  if (cells < maxCells(lay, reco)) cells = maxCells(lay, reco);
649  }
650  return cells;
651 }
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 653 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, HGCalParameters::defineFull_, HGCalParameters::firstLayer_, getIndex(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, hgpar_, gen::k, SiStripPI::max, mode_, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::scintCells(), HGCalGeometryMode::Trapezoid, HGCalParameters::typesInLayers_, HGCalParameters::waferCopy_, HGCalWaferIndex::waferIndex(), waferInLayerTest(), HGCalParameters::waferTypeL_, HGCalParameters::waferTypeT_, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

653  {
654 
655  const auto & index = getIndex(lay, reco);
656  if (index.first < 0) return 0;
659  unsigned int cells(0);
660  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
661  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) {
662  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
663  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
664  if (cell > cells) cells = cell;
665  }
666  }
667  return (int)(cells);
668  } else if ((mode_ == HGCalGeometryMode::Hexagon8) ||
670  int cells(0);
671  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
672  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) {
674  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
675  hgpar_->waferTypeL_[itr->second]);
676  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
677  cells = std::max(cells,3*N*N);
678  }
679  }
680  return cells;
681  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
682  return hgpar_->scintCells(index.first+hgpar_->firstLayer_);
683  } else {
684  return 0;
685  }
686 }
type
Definition: HCALResponse.h:21
static int32_t waferV(const int32_t index)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
bool waferInLayerTest(int wafer, int lay, bool full) const
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellCoarseX_
std::pair< int, float > getIndex(int lay, bool reco) const
int scintCells(const int layer) const
static int32_t waferU(const int32_t index)
int k[5][pyjets_maxn]
#define N
Definition: blowfish.cc:9
std::vector< double > cellFineX_
wafer_map typesInLayers_
fixed size matrix
std::vector< int > waferCopy_
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
int HGCalDDDConstants::maxCellUV ( ) const
inline
int HGCalDDDConstants::maxModules ( ) const
inline

Definition at line 80 of file HGCalDDDConstants.h.

References modHalf_.

80 {return modHalf_;}
int HGCalDDDConstants::maxMoudlesPerLayer ( ) const
inline

Definition at line 81 of file HGCalDDDConstants.h.

References maxRows(), and maxWafersPerLayer_.

81 {return maxWafersPerLayer_;}
int HGCalDDDConstants::maxRows ( int  lay,
bool  reco 
) const

Definition at line 688 of file HGCalDDDConstants.cc.

References HGCalParameters::defineFull_, getIndex(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, hgpar_, mps_fire::i, gen::k, mode_, HGCalParameters::waferCopy_, waferInLayerTest(), and HGCalParameters::waferUVMaxLayer_.

Referenced by maxMoudlesPerLayer().

688  {
689 
690  int kymax(0);
691  const auto & index = getIndex(lay, reco);
692  int i = index.first;
693  if (i < 0) return kymax;
696  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
698  int ky = ((hgpar_->waferCopy_[k])/100)%100;
699  if (ky > kymax) kymax = ky;
700  }
701  }
702  } else if ((mode_ == HGCalGeometryMode::Hexagon8) ||
704  kymax = 1+2*hgpar_->waferUVMaxLayer_[index.first];
705  }
706  return kymax;
707 }
bool waferInLayerTest(int wafer, int lay, bool full) const
HGCalGeometryMode::GeometryMode mode_
std::vector< int > waferUVMaxLayer_
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_
double HGCalDDDConstants::minSlope ( ) const
inline
int HGCalDDDConstants::modules ( int  lay,
bool  reco 
) const

Definition at line 709 of file HGCalDDDConstants.cc.

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

Referenced by minSlope(), and wafers().

709  {
710  if (getIndex(lay,reco).first < 0) return 0;
711  else return max_modules_layer_[(int)reco][lay];
712 }
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 714 of file HGCalDDDConstants.cc.

References HGCalParameters::defineFull_, HGCalParameters::firstModule_, getIndex(), hgpar_, gen::k, HGCalParameters::lastModule_, mode_, HGCalGeometryMode::Trapezoid, waferInLayerTest(), and HGCalParameters::waferPosX_.

Referenced by HGCalDDDConstants(), and minSlope().

714  {
715  int nmod(0);
716  const auto & index = getIndex(lay, reco);
717  if (index.first < 0) return nmod;
719  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
720  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) ++nmod;
721  }
722  } else {
723  nmod = 1+hgpar_->lastModule_[index.first]-hgpar_->firstModule_[index.first];
724  }
725  return nmod;
726 }
bool waferInLayerTest(int wafer, int lay, bool full) const
HGCalGeometryMode::GeometryMode mode_
std::vector< int > firstModule_
std::pair< int, float > getIndex(int lay, bool reco) const
int k[5][pyjets_maxn]
std::vector< int > lastModule_
fixed size matrix
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
double HGCalDDDConstants::mouseBite ( bool  reco) const

Definition at line 728 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::k_ScaleToDDD, and HGCalParameters::mouseBite_.

Referenced by minSlope(), HGCalSD::update(), and HFNoseSD::update().

728  {
729 
731 }
static double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_
int HGCalDDDConstants::numberCells ( bool  reco) const

Definition at line 733 of file HGCalDDDConstants.cc.

References HGCalParameters::depth_, hgpar_, gen::k, HGCalParameters::layer_, and trackingPlots::reco.

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

733  {
734 
735  int cells(0);
736  unsigned int nlayer = (reco) ? hgpar_->depth_.size() : hgpar_->layer_.size();
737  for (unsigned k=0; k<nlayer; ++k) {
738  std::vector<int> ncells = numberCells(((reco) ? hgpar_->depth_[k] : hgpar_->layer_[k]), reco);
739  cells = std::accumulate(ncells.begin(),ncells.end(),cells);
740  }
741  return cells;
742 }
std::vector< int > layer_
std::vector< int > depth_
int k[5][pyjets_maxn]
int numberCells(bool reco) const
fixed size matrix
const HGCalParameters * hgpar_
std::vector< int > HGCalDDDConstants::numberCells ( int  lay,
bool  reco 
) const

Definition at line 744 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, HGCalParameters::defineFull_, HGCalParameters::firstModule_, getIndex(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, hgpar_, mps_fire::i, gen::k, mode_, numberCellsHexagon(), HGCalParameters::scintCells(), HGCalGeometryMode::Trapezoid, HGCalParameters::waferCopy_, waferInLayerTest(), HGCalParameters::waferTypeT_, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

744  {
745 
746  const auto & index = getIndex(lay, reco);
747  int i = index.first;
748  std::vector<int> ncell;
749  if (i >= 0) {
752  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
754  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
755  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
756  ncell.emplace_back((int)(cell));
757  }
758  }
759  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
760  int nphi = hgpar_->scintCells(lay);
761  for (int k=hgpar_->firstModule_[i]; k<=hgpar_->lastModule_[i]; ++k)
762  ncell.emplace_back(nphi);
763  } else {
764  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
765  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) {
766  int cell = numberCellsHexagon(lay,
769  true);
770  ncell.emplace_back(cell);
771  }
772  }
773  }
774  }
775  return ncell;
776 }
static int32_t waferV(const int32_t index)
bool waferInLayerTest(int wafer, int lay, bool full) const
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellCoarseX_
std::vector< int > firstModule_
int numberCellsHexagon(int wafer) const
std::pair< int, float > getIndex(int lay, bool reco) const
int scintCells(const int layer) const
static int32_t waferU(const int32_t index)
int k[5][pyjets_maxn]
std::vector< double > cellFineX_
fixed size matrix
std::vector< int > waferCopy_
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
int HGCalDDDConstants::numberCellsHexagon ( int  wafer) const

Definition at line 778 of file HGCalDDDConstants.cc.

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

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

778  {
779 
780  if (wafer >= 0 && wafer < (int)(hgpar_->waferTypeT_.size())) {
781  if (hgpar_->waferTypeT_[wafer]==1)
782  return (int)(hgpar_->cellFineX_.size());
783  else
784  return (int)(hgpar_->cellCoarseX_.size());
785  } else {
786  return 0;
787  }
788 }
std::vector< double > cellCoarseX_
std::vector< double > cellFineX_
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
int HGCalDDDConstants::numberCellsHexagon ( int  lay,
int  waferU,
int  waferV,
bool  flag 
) const

Definition at line 790 of file HGCalDDDConstants.cc.

References hgpar_, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::typesInLayers_, HGCalWaferIndex::waferIndex(), and HGCalParameters::waferTypeL_.

791  {
792  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(lay,waferU,waferV));
793  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
794  hgpar_->waferTypeL_[itr->second]);
795  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
796  if (flag) return (3*N*N);
797  else return N;
798 }
type
Definition: HCALResponse.h:21
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
#define N
Definition: blowfish.cc:9
wafer_map typesInLayers_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
std::pair< double, double > HGCalDDDConstants::rangeR ( double  z,
bool  reco 
) const

Definition at line 800 of file HGCalDDDConstants.cc.

References funct::abs(), HGCalParameters::detectorType_, HGCalParameters::firstLayer_, HGCalParameters::firstMixedLayer_, hgpar_, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalGeomTools::radius(), HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zLayerHex_, and geometryCSVtoXML::zz.

Referenced by HGCalNumberingScheme::checkPosition(), HGCDigitizer::checkPosition(), locateCellTrap(), and minSlope().

800  {
801  double rmin(0), rmax(0), zz(0);
802  if (hgpar_->detectorType_ > 0) {
803  zz = (reco ? std::abs(z) : HGCalParameters::k_ScaleFromDDD*std::abs(z));
804  if (hgpar_->detectorType_ <= 2) {
807  } else {
812  }
813  if ((hgpar_->detectorType_ == 2) &&
819  } else {
822  }
823  }
824  if (!reco) {
827  }
828 #ifdef EDM_ML_DEBUG
829  edm::LogVerbatim("HGCalGeom") << "DDHGCalEEAlgo:rangeR: " << z << ":" << zz
830  << " R " << rmin << ":" << rmax;
831 #endif
832  return std::pair<double,double>(rmin,rmax);
833 }
std::vector< double > zFrontMin_
static double radius(double z, std::vector< double > const &zFront, std::vector< double > const &rFront, std::vector< double > const &slope)
std::vector< double > rMaxFront_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > slopeTop_
std::vector< double > zLayerHex_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
static double k_ScaleToDDD
std::vector< double > rMinFront_
fixed size matrix
std::vector< double > zFrontTop_
const HGCalParameters * hgpar_
std::pair< double, double > HGCalDDDConstants::rangeZ ( bool  reco) const

Definition at line 835 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::k_ScaleToDDD, HGCalParameters::waferThick_, and HGCalParameters::zLayerHex_.

Referenced by HGCalNumberingScheme::checkPosition(), HGCDigitizer::checkPosition(), and minSlope().

835  {
836  double zmin = (hgpar_->zLayerHex_[0] - hgpar_->waferThick_);
837  double zmax = (hgpar_->zLayerHex_[hgpar_->zLayerHex_.size()-1] +
839 #ifdef EDM_ML_DEBUG
840  edm::LogVerbatim("HGCalGeom") << "DDHGCalEEAlgo:rangeZ: " << zmin << ":"
841  << zmax << ":" << hgpar_->waferThick_;
842 #endif
843  if (!reco) {
846  }
847  return std::pair<double,double>(zmin,zmax);
848 }
std::vector< double > zLayerHex_
static double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_
std::pair< int, int > HGCalDDDConstants::rowColumnWafer ( const int  wafer) const

Definition at line 850 of file HGCalDDDConstants.cc.

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

Referenced by minSlope().

850  {
851  int row(0), col(0);
852  if (wafer < (int)(hgpar_->waferCopy_.size())) {
853  int copy = hgpar_->waferCopy_[wafer];
854  col = copy%100;
855  if ((copy/10000)%10 != 0) col = -col;
856  row = (copy/100)%100;
857  if ((copy/100000)%10 != 0) row = -row;
858  }
859  return std::make_pair(row,col);
860 }
def copy(args, dbName)
std::vector< int > waferCopy_
col
Definition: cuy.py:1010
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 862 of file HGCalDDDConstants.cc.

References egammaForCoreTracking_cff::depth, getIndex(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, hgpar_, mps_fire::i, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, mod(), mode_, findQualityFiles::size, and HGCalParameters::waferTypeL_.

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

863  {
864 
867  return std::make_pair(cell,lay);
868  } else {
869  const auto & index = getIndex(lay, false);
870  int i = index.first;
871  if (i < 0) {
872  edm::LogWarning("HGCalGeom") << "Wrong Layer # " << lay
873  << " not in the list ***** ERROR *****";
874  return std::make_pair(-1,-1);
875  }
876  if (mod >= (int)(hgpar_->waferTypeL_).size()) {
877  edm::LogWarning("HGCalGeom") << "Invalid Wafer # " << mod
878  << "should be < "
879  << (hgpar_->waferTypeL_).size()
880  << " ***** ERROR *****";
881  return std::make_pair(-1,-1);
882  }
883  int depth(-1);
884  int kx = cell;
885  int type = hgpar_->waferTypeL_[mod];
886  if (type == 1) {
888  } else if (type == 2) {
890  } else {
892  }
893  return std::make_pair(kx,depth);
894  }
895 }
size
Write out results.
type
Definition: HCALResponse.h:21
std::vector< int > layerGroupM_
HGCalGeometryMode::GeometryMode mode_
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< int > layerGroup_
std::vector< int > layerGroupO_
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 109 of file HGCalDDDConstants.h.

References waferMax_.

109 {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 897 of file HGCalDDDConstants.cc.

References hgpar_, gen::k, mps_fire::result, and HGCalParameters::waferCopy_.

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

897  {
898  const int ncopies = hgpar_->waferCopy_.size();
899  int wafer(ncopies);
900  bool result(false);
901  for (int k=0; k<ncopies; ++k) {
902  if (copy == hgpar_->waferCopy_[k]) {
903  wafer = k;
904  result = true;
905  break;
906  }
907  }
908  if (!result) {
909  wafer = -1;
910 #ifdef EDM_ML_DEBUG
911  edm::LogVerbatim("HGCalGeom") << "Cannot find " << copy << " in a list of "
912  << ncopies << " members";
913  for (int k=0; k<ncopies; ++k)
914  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << hgpar_->waferCopy_[k];
915 #endif
916  }
917  return wafer;
918 }
def copy(args, dbName)
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 920 of file HGCalDDDConstants.cc.

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

Referenced by assignCellHex(), HGCalNumberingScheme::checkPosition(), HFNoseNumberingScheme::getUnitID(), HGCNumberingScheme::getUnitID(), HGCalNumberingScheme::getUnitID(), and volumes().

922  {
923  //Input x, y in Geant4 unit and transformed to CMSSW standard
926  int size_ = (int)(hgpar_->waferCopy_.size());
927  wafer = size_;
928  for (int k=0; k<size_; ++k) {
929  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
930  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
931  if (dx <= rmax_ && dy <= hexside_) {
932  if ((dy <= 0.5*hexside_) || (dx*tan30deg_ <= (hexside_-dy))) {
933  wafer = k;
934  celltyp = hgpar_->waferTypeT_[k];
935  xx -= hgpar_->waferPosX_[k];
936  yy -= hgpar_->waferPosY_[k];
937  break;
938  }
939  }
940  }
941  if (wafer < size_) {
942  if (celltyp == 1)
943  icell = cellHex(xx, yy, 0.5*HGCalParameters::k_ScaleFromDDD*hgpar_->cellSize_[0],
945  else
948  } else {
949  wafer = -1;
950 #ifdef EDM_ML_DEBUG
951  edm::LogWarning("HGCalGeom") << "Cannot get wafer type corresponding to "
952  << x << ":" << y << " " << xx << ":" << yy;
953 #endif
954  }
955 #ifdef EDM_ML_DEBUG
956  edm::LogVerbatim("HGCalGeom") << "Position " << x << ":" << y << " Wafer "
957  << wafer << ":" << size_ << " XX " << xx << ":"
958  << yy << " Cell " << icell << " Type " << celltyp;
959 #endif
960 }
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_
static double k_ScaleFromDDD
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
std::vector< double > cellFineX_
std::vector< int > waferCopy_
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
static double tan30deg_
void HGCalDDDConstants::waferFromPosition ( const double  x,
const double  y,
const int  layer,
int &  waferU,
int &  waferV,
int &  cellU,
int &  cellV,
int &  celltype,
double &  wt,
bool  debug = false 
) const

Definition at line 962 of file HGCalDDDConstants.cc.

References funct::abs(), cellHex(), HGCalParameters::cellThickness_, debug, PVValHelper::dx, PVValHelper::dy, EDM_ML_DEBUG, hexside_, hgpar_, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::nCellsFine_, rmax_, tan30deg_, HGCalParameters::typesInLayers_, HGCalParameters::waferCopy_, HGCalWaferIndex::waferIndex(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferThick_, HGCalParameters::waferTypeL_, HGCalWaferIndex::waferU(), HGCalParameters::waferUVMax_, HGCalWaferIndex::waferV(), globals_cff::x1, geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

969  {
970 
973  waferU = waferV = 1+hgpar_->waferUVMax_;
974  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
975  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
976  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
977  if (dx <= rmax_ && dy <= hexside_) {
978  if ((dy <= 0.5*hexside_) || (dx*tan30deg_ <= (hexside_-dy))) {
981  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer,waferU,waferV));
982  celltype = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
983  hgpar_->waferTypeL_[itr->second]);
984 #ifdef EDM_ML_DEBUG
985  if (debug)
986  edm::LogVerbatim("HGCalGeom") << "WaferFromPosition:: Input " << xx
987  << ":" << yy << " compared with "
988  << hgpar_->waferPosX_[k] << ":"
989  << hgpar_->waferPosY_[k]
990  << " difference " << dx << ":" << dy
991  << ":" << dx*tan30deg_ << ":"
992  << (hexside_-dy) << " comparator "
993  << rmax_ << ":" << hexside_ <<" wafer "
994  << waferU << ":" << waferV << ":"
995  << celltype;
996 #endif
997  xx -= hgpar_->waferPosX_[k];
998  yy -= hgpar_->waferPosY_[k];
999  break;
1000  }
1001  }
1002  }
1003  if (std::abs(waferU) <= hgpar_->waferUVMax_) {
1004  cellHex(xx, yy, celltype, cellU, cellV
1005 #ifdef EDM_ML_DEBUG
1006  , debug
1007 #endif
1008  );
1009  wt = ((celltype < 2) ?
1010  (hgpar_->cellThickness_[celltype]/hgpar_->waferThick_) : 1.0);
1011  } else {
1012  cellU = cellV = 2*hgpar_->nCellsFine_;
1013  wt = 1.0;
1014  celltype =-1;
1015  }
1016 #ifdef EDM_ML_DEBUG
1017  if (celltype < 0) {
1020  edm::LogVerbatim("HGCalGeom") << "waferFromPosition: Bad type for X "
1021  << x << ":" << x1 << ":" << xx << " Y " << y
1022  << ":" << y1 << ":" << yy << " Wafer "
1023  << waferU << ":" << waferV << " Cell "
1024  << cellU << ":" << cellV;
1025  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
1026  double dx = std::abs(x1-hgpar_->waferPosX_[k]);
1027  double dy = std::abs(y1-hgpar_->waferPosY_[k]);
1028  edm::LogVerbatim("HGCalGeom") << "Wafer [" << k << "] Position ("
1029  << hgpar_->waferPosX_[k] << ", "
1030  << hgpar_->waferPosY_[k] << ") difference "
1031  << dx << ":" << dy << ":" << dx*tan30deg_
1032  << ":" << hexside_-dy << " Paramerers "
1033  << rmax_ << ":" << hexside_;
1034  }
1035  }
1036 #endif
1037 }
std::vector< double > waferPosY_
static int32_t waferV(const int32_t index)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
static double k_ScaleFromDDD
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int32_t waferU(const int32_t index)
int k[5][pyjets_maxn]
#define debug
Definition: HDRShower.cc:19
std::vector< double > cellThickness_
wafer_map typesInLayers_
std::vector< int > waferCopy_
#define EDM_ML_DEBUG
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_
static double tan30deg_
bool HGCalDDDConstants::waferFullInLayer ( int  wafer,
int  lay,
bool  reco 
) const

Definition at line 1046 of file HGCalDDDConstants.cc.

References getIndex(), and waferInLayerTest().

Referenced by volumes().

1046  {
1047  const auto & indx = getIndex(lay, reco);
1048  if (indx.first < 0) return false;
1049  return waferInLayerTest(wafer,indx.first,false);
1050 }
bool waferInLayerTest(int wafer, int lay, bool full) const
std::pair< int, float > getIndex(int lay, bool reco) const
fixed size matrix
bool HGCalDDDConstants::waferInLayer ( int  wafer,
int  lay,
bool  reco 
) const

Definition at line 1039 of file HGCalDDDConstants.cc.

References HGCalParameters::defineFull_, getIndex(), hgpar_, and waferInLayerTest().

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

1039  {
1040 
1041  const auto & indx = getIndex(lay, reco);
1042  if (indx.first < 0) return false;
1043  return waferInLayerTest(wafer,indx.first,hgpar_->defineFull_);
1044 }
bool waferInLayerTest(int wafer, int lay, bool full) const
std::pair< int, float > getIndex(int lay, bool reco) const
fixed size matrix
const HGCalParameters * hgpar_
bool HGCalDDDConstants::waferInLayerTest ( int  wafer,
int  lay,
bool  full 
) const
private

Definition at line 1261 of file HGCalDDDConstants.cc.

References hexside_, hgpar_, recoMuon::in, gen::k, HGCalParameters::k_CornerSize, rmax_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, mathSSE::sqrt(), HGCalParameters::waferPosX_, and HGCalParameters::waferPosY_.

Referenced by maxCells(), maxRows(), modulesInit(), numberCells(), waferFullInLayer(), waferInLayer(), and waferUVMax().

1261  {
1262 
1263  const double waferX = hgpar_->waferPosX_[wafer];
1264  const double waferY = hgpar_->waferPosY_[wafer];
1266  xc[0] = waferX+rmax_; yc[0] = waferY-0.5*hexside_;
1267  xc[1] = waferX+rmax_; yc[1] = waferY+0.5*hexside_;
1268  xc[2] = waferX; yc[2] = waferY+hexside_;
1269  xc[3] = waferX-rmax_; yc[3] = waferY+0.5*hexside_;
1270  xc[4] = waferX+rmax_; yc[4] = waferY-0.5*hexside_;
1271  xc[5] = waferX; yc[5] = waferY-hexside_;
1272  bool cornerOne(false), cornerAll(true);
1273  for (unsigned int k=0; k<HGCalParameters::k_CornerSize; ++k) {
1274  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
1275  if ((rpos >= hgpar_->rMinLayHex_[lay]) &&
1276  (rpos <= hgpar_->rMaxLayHex_[lay])) cornerOne = true;
1277  else cornerAll = false;
1278  }
1279  bool in = full ? cornerOne : cornerAll;
1280 #ifdef EDM_ML_DEBUG
1281  edm::LogVerbatim("HGCalGeom") << "WaferInLayerTest: Layer " << lay
1282  << " wafer " << wafer << " R-limits "
1283  << hgpar_->rMinLayHex_[lay] << ":"
1284  << hgpar_->rMaxLayHex_[lay] << " Corners "
1285  << cornerOne << ":" << cornerAll << " In "
1286  << in;
1287 #endif
1288  return in;
1289 }
std::vector< double > waferPosY_
T sqrt(T t)
Definition: SSEVec.h:18
Definition: GenABIO.cc:180
std::vector< double > rMinLayHex_
int k[5][pyjets_maxn]
std::vector< double > rMaxLayHex_
static uint32_t k_CornerSize
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int HGCalDDDConstants::waferMax ( ) const
inline

Definition at line 110 of file HGCalDDDConstants.h.

References waferMax_.

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

Definition at line 111 of file HGCalDDDConstants.h.

References waferMax_, and waferPosition().

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

Definition at line 1052 of file HGCalDDDConstants.cc.

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

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

1053  {
1054 
1055  double xx(0), yy(0);
1056  if (wafer >= 0 && wafer < (int)(hgpar_->waferPosX_.size())) {
1057  xx = hgpar_->waferPosX_[wafer];
1058  yy = hgpar_->waferPosY_[wafer];
1059  }
1060  if (!reco) {
1063  }
1064  return std::make_pair(xx,yy);
1065 }
std::vector< double > waferPosY_
static double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::pair< double, double > HGCalDDDConstants::waferPosition ( int  waferU,
int  waferV,
bool  reco 
) const

Definition at line 1067 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::k_ScaleToDDD, HGCalWaferIndex::waferIndex(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::wafersInLayers_, geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

1069  {
1070 
1071  double xx(0), yy(0);
1072  int indx = HGCalWaferIndex::waferIndex(0,waferU,waferV);
1073  auto itr = hgpar_->wafersInLayers_.find(indx);
1074  if (itr != hgpar_->wafersInLayers_.end()) {
1075  xx = hgpar_->waferPosX_[itr->second];
1076  yy = hgpar_->waferPosY_[itr->second];
1077  }
1078  if (!reco) {
1081  }
1082  return std::make_pair(xx,yy);
1083 }
std::vector< double > waferPosY_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
wafer_map wafersInLayers_
static double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int HGCalDDDConstants::wafers ( ) const

Definition at line 1106 of file HGCalDDDConstants.cc.

References HGCalParameters::depth_, hgpar_, mps_fire::i, createfilelist::int, layers(), mode_, HGCalParameters::moduleLayR_, modules(), and HGCalGeometryMode::Trapezoid.

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

1106  {
1107 
1108  int wafer(0);
1110  for (unsigned int i = 0; i<layers(true); ++i) {
1111  int lay = hgpar_->depth_[i];
1112  wafer += modules(lay, true);
1113  }
1114  } else {
1115  wafer = (int)(hgpar_->moduleLayR_.size());
1116  }
1117  return wafer;
1118 }
std::vector< int > depth_
std::vector< int > moduleLayR_
HGCalGeometryMode::GeometryMode mode_
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 1120 of file HGCalDDDConstants.cc.

References HGCalParameters::firstModule_, getIndex(), hgpar_, HGCalParameters::lastModule_, mode_, HGCalGeometryMode::Trapezoid, and waferLayer_.

1120  {
1121 
1122  int wafer(0);
1124  auto itr = waferLayer_.find(layer);
1125  if (itr != waferLayer_.end()) {
1126  unsigned ity = (type > 0 && type <= 2) ? type : 0;
1127  wafer = (itr->second)[ity];
1128  }
1129  } else {
1130  const auto & index = getIndex(layer, true);
1131  wafer = 1+hgpar_->lastModule_[index.first]-hgpar_->firstModule_[index.first];
1132  }
1133  return wafer;
1134 }
type
Definition: HCALResponse.h:21
std::map< int, HGCWaferParam > waferLayer_
HGCalGeometryMode::GeometryMode mode_
std::vector< int > firstModule_
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< int > lastModule_
const HGCalParameters * hgpar_
double HGCalDDDConstants::waferSepar ( bool  reco) const
inline
double HGCalDDDConstants::waferSize ( bool  reco) const
inline

Definition at line 115 of file HGCalDDDConstants.h.

References hgpar_, HGCalParameters::k_ScaleToDDD, wafers(), and HGCalParameters::waferSize_.

Referenced by HFNoseSD::update(), and HGCalSD::update().

static double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_
int HGCalDDDConstants::waferToCopy ( int  wafer) const
inline

Definition at line 118 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferCopy_.

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

Definition at line 1085 of file HGCalDDDConstants.cc.

References DetId::Forward, HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, mode_, HGCSiliconDetId::type(), HFNoseDetId::type(), and waferTypeL().

Referenced by hgc_digi_utils::addCellMetadata(), assignCellHex(), getTrFormN(), and HGCalUncalibRecHitRecWeightsAlgo< HGCDataFrame >::makeRecHit().

1085  {
1086 
1087  int type(1);
1090  type = ((id.det() != DetId::Forward) ? (1 + HGCSiliconDetId(id).type()) :
1091  (1 + HFNoseDetId(id).type()));
1092  } else if ((mode_ == HGCalGeometryMode::Hexagon) ||
1094  type = waferTypeL(HGCalDetId(id).wafer());
1095  }
1096  return type;
1097 }
type
Definition: HCALResponse.h:21
int type() const
get the type
Definition: HFNoseDetId.h:52
HGCalGeometryMode::GeometryMode mode_
int type() const
get the type
int waferTypeL(int wafer) const
int HGCalDDDConstants::waferTypeL ( int  wafer) const
inline

Definition at line 122 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferTypeL_.

Referenced by HGCalTriggerNtupleHGCTriggerCells::fill(), HGCalTriggerCellThresholdCodecImpl::triggerCellSums(), HGCalTriggerCellBestChoiceCodecImpl::triggerCellSums(), and waferType().

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

Definition at line 1099 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, HGCalParameters::k_ScaleToDDD, and HGCalParameters::zLayerHex_.

Referenced by HGCalSimHitValidation::analyzeHits(), HGCalTBAnalyzer::analyzeRecHits(), HGCalTBAnalyzer::analyzeSimHits(), HGCalNumberingScheme::checkPosition(), HGCalTriggerTools::getLayerZ(), hgcal::RecHitTools::getPositionLayer(), and waferUVMax().

1099  {
1100  const auto & index = getIndex(lay, reco);
1101  if (index.first < 0) return 0;
1102  else return (reco ? hgpar_->zLayerHex_[index.first] :
1104 }
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > zLayerHex_
static double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

Member Data Documentation

const float HGCalDDDConstants::dPhiMin = 0.02
private

Definition at line 138 of file HGCalDDDConstants.h.

double HGCalDDDConstants::hexside_
private
const HGCalParameters* HGCalDDDConstants::hgpar_
private
const double HGCalDDDConstants::k_horizontalShift = 1.0
private

Definition at line 137 of file HGCalDDDConstants.h.

Simrecovecs HGCalDDDConstants::max_modules_layer_
private

Definition at line 148 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and modules().

int32_t HGCalDDDConstants::maxWafersPerLayer_
private

Definition at line 149 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxMoudlesPerLayer().

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

Definition at line 146 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxModules().

double HGCalDDDConstants::rmax_
private
const double HGCalDDDConstants::sqrt3_
private

Definition at line 143 of file HGCalDDDConstants.h.

Referenced by cellHex(), and distFromEdgeHex().

double HGCalDDDConstants::tan30deg_ = 0.5773502693
staticprivate
std::array<uint32_t,2> HGCalDDDConstants::tot_layers_
private

Definition at line 147 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and layers().

int32_t HGCalDDDConstants::tot_wafers_
private

Definition at line 146 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants().

std::unordered_map<int32_t,bool> HGCalDDDConstants::waferIn_
private

Definition at line 152 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and isValidHex8().

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

Definition at line 150 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and wafers().

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

Definition at line 151 of file HGCalDDDConstants.h.

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