CMS 3D CMS Logo

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

#include <HGCalDDDConstants.h>

Public Types

enum  CellType {
  CellType::UndefinedType =-1, CellType::CentralType =0, CellType::BottomLeftEdge =1, CellType::LeftEdge =2,
  CellType::TopLeftEdge =3, CellType::TopRightEdge =4, CellType::RightEdge =5, CellType::BottomRightEdge =6,
  CellType::BottomCorner =11, CellType::BottomLeftCorner =12, CellType::TopLeftCorner =13, CellType::TopCorner =14,
  CellType::TopRightCorner =15, CellType::BottomRightCorner =16
}
 

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
 
std::pair< double, double > cellSizeTrap (int type, int irad) const
 
double cellThickness (int layer, int waferU, int waferV) const
 
CellType cellType (int type, 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
 
int getUVMax (int type) 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 lastLayer (bool reco) 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
 
bool maskCell (const DetId &id, int corners) 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 modifyUV (int uv, int type1, int type2) 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
 
bool waferVirtual (int layer, int waferU, int waferV) 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 157 of file HGCalDDDConstants.h.

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

Definition at line 156 of file HGCalDDDConstants.h.

Member Enumeration Documentation

Enumerator
UndefinedType 
CentralType 
BottomLeftEdge 
LeftEdge 
TopLeftEdge 
TopRightEdge 
RightEdge 
BottomRightEdge 
BottomCorner 
BottomLeftCorner 
TopLeftCorner 
TopCorner 
TopRightCorner 
BottomRightCorner 

Definition at line 31 of file HGCalDDDConstants.h.

31  {
32  UndefinedType=-1, CentralType=0, BottomLeftEdge=1, LeftEdge=2,
33  TopLeftEdge=3, TopRightEdge=4, RightEdge=5, BottomRightEdge=6,
34  BottomCorner=11, BottomLeftCorner=12, TopLeftCorner=13,
35  TopCorner=14, TopRightCorner=15, BottomRightCorner=16};

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)
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)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
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 1322 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().

1325  {
1326  int num(0);
1327  const double tol(0.00001);
1328  double cellY = 2.0*cellR*tan30deg_;
1329  for (unsigned int k=0; k<posX.size(); ++k) {
1330  double dx = std::abs(xx - posX[k]);
1331  double dy = std::abs(yy - posY[k]);
1332  if (dx <= (cellR+tol) && dy <= (cellY+tol)) {
1333  double xmax = (dy<=0.5*cellY) ? cellR : (cellR-(dy-0.5*cellY)/tan30deg_);
1334  if (dx <= (xmax+tol)) {
1335  num = k;
1336  break;
1337  }
1338  }
1339  }
1340  return num;
1341 }
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 1343 of file HGCalDDDConstants.cc.

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

1348  {
1349  int N = (cellType == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
1350  double Rc = 2*rmax_/(3*N);
1351  double rc = 0.5*Rc*sqrt3_;
1352  double v0 = ((xloc/Rc -1.0)/1.5);
1353  int cv0 = (v0 > 0) ? (N + (int)(v0+0.5)) : (N - (int)(-v0+0.5));
1354  double u0 = (0.5*yloc/rc+0.5*cv0);
1355  int cu0 = (u0 > 0) ? (N/2 + (int)(u0+0.5)) : (N/2 - (int)(-u0+0.5));
1356  cu0 = std::max(0,std::min(cu0,2*N-1));
1357  cv0 = std::max(0,std::min(cv0,2*N-1));
1358  if (cv0-cu0 >= N) cv0 = cu0+N-1;
1359 #ifdef EDM_ML_DEBUG
1360  if (debug)
1361  edm::LogVerbatim("HGCalGeom") << "cellHex: input " << xloc << ":"
1362  << yloc << ":" << cellType << " parameter "
1363  << rc << ":" << Rc << " u0 " << u0 << ":"
1364  << cu0 << " v0 " << v0 << ":" << cv0;
1365 #endif
1366  bool found(false);
1367  static const int shift[3] = {0,1,-1};
1368  for (int i1=0; i1<3; ++i1) {
1369  cellU = cu0 + shift[i1];
1370  for (int i2=0; i2<3; ++i2) {
1371  cellV = cv0 + shift[i2];
1372  if (((cellV-cellU) < N) && ((cellU-cellV) <= N) && (cellU >= 0) &&
1373  (cellV >= 0) && (cellU < 2*N) && (cellV < 2*N)) {
1374  double xc = (1.5*(cellV-N)+1.0)*Rc;
1375  double yc = (2*cellU-cellV-N)*rc;
1376  if ((std::abs(yloc-yc) <= rc) && (std::abs(xloc-xc) <= Rc) &&
1377  ((std::abs(xloc-xc) <= 0.5*Rc) ||
1378  (std::abs(yloc-yc) <= sqrt3_*(Rc-std::abs(xloc-xc))))) {
1379 #ifdef EDM_ML_DEBUG
1380  if (debug)
1381  edm::LogVerbatim("HGCalGeom") << "cellHex: local " << xc << ":"
1382  << yc << " difference "
1383  << std::abs(xloc-xc) << ":"
1384  << std::abs(yloc-yc) << ":"
1385  << sqrt3_*(Rc-std::abs(yloc-yc))
1386  << " comparator " << rc << ":" << Rc
1387  << " (u,v) = (" << cellU << ","
1388  << cellV << ")";
1389 #endif
1390  found = true; break;
1391  }
1392  }
1393  }
1394  if (found) break;
1395  }
1396  if (!found) { cellU = cu0; cellV = cv0; }
1397 }
CellType cellType(int type, int waferU, int waferV) const
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
std::pair<double,double> HGCalDDDConstants::cellSizeTrap ( int  type,
int  irad 
) const
inline

Definition at line 46 of file HGCalDDDConstants.h.

References cellThickness(), cellType(), distFromEdgeHex(), distFromEdgeTrap(), etaPhiFromPosition(), hgpar_, and HGCalParameters::radiusLayer_.

Referenced by HGCalGeometry::get8Corners(), HGCalGeometry::getCorners(), and HGCalGeometry::getNewCorners().

46  {
47  return std::pair<double,double>(hgpar_->radiusLayer_[type][irad-1],
48  hgpar_->radiusLayer_[type][irad]);
49  }
type
Definition: HCALResponse.h:21
std::vector< double > radiusLayer_[2]
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 cellSizeTrap(), and 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
HGCalGeometryMode::GeometryMode mode_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
static const int maxType
std::vector< double > cellThickness_
wafer_map typesInLayers_
static const int minType
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
HGCalDDDConstants::CellType HGCalDDDConstants::cellType ( int  type,
int  waferU,
int  waferV 
) const

Definition at line 251 of file HGCalDDDConstants.cc.

References BottomCorner, BottomLeftCorner, BottomLeftEdge, BottomRightCorner, BottomRightEdge, CentralType, hgpar_, LeftEdge, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, RightEdge, TopCorner, TopLeftCorner, TopLeftEdge, TopRightCorner, TopRightEdge, and UndefinedType.

Referenced by cellSizeTrap(), and HGCalTopology::neighbors().

252  {
253  // type=0: in the middle; 1..6: the edges clocwise from bottom left;
254  // =11..16: the corners clockwise from bottom
255  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
256  if (cellU == 0) {
257  if (cellV == 0) return HGCalDDDConstants::CellType::BottomLeftCorner;
258  else if (cellV-cellU == N-1) return HGCalDDDConstants::CellType::BottomCorner;
260  } else if (cellV == 0) {
261  if (cellU-cellV == N) return HGCalDDDConstants::CellType::TopLeftCorner;
263  } else if (cellU-cellV == N) {
264  if (cellU == 2*N-1) return HGCalDDDConstants::CellType::TopCorner;
266  } else if (cellU == 2*N-1) {
267  if (cellV == 2*N-1) return HGCalDDDConstants::CellType::TopRightCorner;
269  } else if (cellV == 2*N-1) {
270  if (cellV-cellU == N-1) return HGCalDDDConstants::CellType::BottomRightCorner;
272  } else if (cellV-cellU == N-1) {
274  } else if ((cellU > 2*N-1) || (cellV > 2*N-1) || (cellV >= (cellU+N)) ||
275  (cellU > (cellV+N))) {
277  } else {
279  }
280 }
type
Definition: HCALResponse.h:21
#define N
Definition: blowfish.cc:9
const HGCalParameters * hgpar_
double HGCalDDDConstants::distFromEdgeHex ( double  x,
double  y,
double  z 
) const

Definition at line 282 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 cellSizeTrap(), HGCalSD::isItinFidVolume(), and HFNoseSD::isItinFidVolume().

282  {
283 
284  //Assming the point is within a hexagonal plane of the wafer, calculate
285  //the shortest distance from the edge
286  if (z < 0) x = -x;
287  double dist(0);
288  //Input x, y in Geant4 unit and transformed to CMSSW standard
291  int sizew = (int)(hgpar_->waferPosX_.size());
292  int wafer = sizew;
293  //Transform to the local coordinate frame of the wafer first
294  for (int k=0; k<sizew; ++k) {
295  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
296  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
297  if ((dx <= rmax_) && (dy <= hexside_) &&
298  ((dy <= 0.5*hexside_) || (dx*tan30deg_ <= (hexside_-dy)))) {
299  wafer = k;
300  xx -= hgpar_->waferPosX_[k];
301  yy -= hgpar_->waferPosY_[k];
302  break;
303  }
304  }
305  //Look at only one quarter (both x,y are positive)
306  if (wafer < sizew) {
307  if (std::abs(yy) < 0.5*hexside_) {
308  dist = rmax_ - std::abs(xx);
309  } else {
310  dist = 0.5*((rmax_-std::abs(xx))-sqrt3_*(std::abs(yy)-0.5*hexside_));
311  }
312  } else {
313  dist = 0;
314  }
316 #ifdef EDM_ML_DEBUG
317  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeHex: Local " << xx << ":"
318  << yy << " wafer " << wafer << " flag "
319  << (wafer < sizew) << " Distance " << rmax_
320  << ":" << (rmax_-std::abs(xx)) << ":"
321  << (std::abs(yy)-0.5*hexside_) << ":"
322  << 0.5*hexside_ << ":" << dist;
323 #endif
324  return dist;
325 }
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 327 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 cellSizeTrap(), and HGCScintSD::isItinFidVolume().

327  {
328 
329  //Assming the point is within the eta-phi plane of the scintillator tile,
330  //calculate the shortest distance from the edge
331  int lay = getLayer(z,false);
332  double xx = (z < 0) ? -x : x;
333  int indx = layerIndex(lay,false);
335  double phi = (r == 0. ? 0. : std::atan2(y,xx));
336  if (phi < 0) phi += (2.0*M_PI);
337  int type = hgpar_->scintType(lay);
338  double cell = hgpar_->scintCellSize(lay);
339  //Compare with the center of the tile find distances along R and also phi
340  //Take the smaller value
341  auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(),
342  hgpar_->radiusLayer_[type].end(), r);
343  int irad = (int)(ir-hgpar_->radiusLayer_[type].begin());
344  if (irad < hgpar_->iradMinBH_[indx]) irad = hgpar_->iradMinBH_[indx];
345  else if (irad > hgpar_->iradMaxBH_[indx]) irad = hgpar_->iradMaxBH_[indx];
346  int iphi = 1 + (int)(phi/cell);
347  double dphi = std::max(0.0,(0.5*cell-std::abs(phi-(iphi-0.5)*cell)));
348  double dist = std::min((r-hgpar_->radiusLayer_[type][irad-1]),
349  (hgpar_->radiusLayer_[type][irad]-r));
350 #ifdef EDM_ML_DEBUG
351  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeTrap: Global " << x << ":"
352  << y << ":" << z << " Layer " << lay
353  << " Index " << indx << ":" << type << " xx "
354  << xx << " R " << r << ":" << irad << ":"
355  << hgpar_->radiusLayer_[type][irad-1] << ":"
356  << hgpar_->radiusLayer_[type][irad]
357  << " Phi " << phi << ":" << iphi << ":"
358  << (iphi-0.5)*cell << " cell " << cell
359  << " Dphi " << dphi << " Dist " << dist
360  << ":" << r*dphi;
361 #endif
362  return HGCalParameters::k_ScaleToDDD*std::min(r*dphi,dist);
363 }
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

Referenced by cellSizeTrap().

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 1399 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().

1399  {
1400 
1401  int indx = layerIndex(lay,reco);
1402  if (indx<0) return std::make_pair(-1,0);
1403  float cell(0);
1404  if ((mode_ == HGCalGeometryMode::Hexagon) ||
1406  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1407  } else {
1410  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1411  } else {
1412  cell = hgpar_->scintCellSize(lay);
1413  }
1414  }
1415  return std::make_pair(indx,cell);
1416 }
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 365 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().

365  {
366 
367  //Get the layer # from the gloabl z coordinate
368  unsigned int k = 0;
369  double zz = (reco ? std::abs(z) :
370  HGCalParameters::k_ScaleFromDDD*std::abs(z));
371  const auto& zLayerHex = hgpar_->zLayerHex_;
372  std::find_if(zLayerHex.begin()+1,zLayerHex.end(),[&k,&zz,&zLayerHex](double zLayer){ ++k; return zz < 0.5*(zLayerHex[k-1]+zLayerHex[k]);});
373  int lay = k;
374  if (((mode_ == HGCalGeometryMode::Hexagon) ||
376  int indx = layerIndex(lay,false);
377  if (indx >= 0) lay = hgpar_->layerGroup_[indx];
378  } else {
379  lay += (hgpar_->firstLayer_ - 1);
380  }
381  return lay;
382 }
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 384 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().

386  {
387 
389  if (hexType) {
390  if (indx >= hgpar_->waferTypeL_.size())
391  edm::LogWarning("HGCalGeom") << "Wafer no. out bound for index " << indx
392  << ":" << (hgpar_->waferTypeL_).size()
393  << ":" << (hgpar_->waferPosX_).size()
394  << ":" << (hgpar_->waferPosY_).size()
395  << " ***** ERROR *****";
396  unsigned int type = ((indx < hgpar_->waferTypeL_.size()) ?
397  hgpar_->waferTypeL_[indx] : 3);
398  if (type > 0) --type;
399  mytr = hgpar_->getModule(type, reco);
400  } else {
401  mytr = hgpar_->getModule(indx,reco);
402  }
403  return mytr;
404 }
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 406 of file HGCalDDDConstants.cc.

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

Referenced by geomMode().

406  {
407 
408  std::vector<HGCalParameters::hgtrap> mytrs;
409  for (unsigned int k=0; k<hgpar_->moduleLayR_.size(); ++k)
410  mytrs.emplace_back(hgpar_->getModule(k,true));
411  return mytrs;
412 }
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 63 of file HGCalDDDConstants.h.

References hgpar_.

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

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

Definition at line 64 of file HGCalDDDConstants.h.

References HGCalParameters::getTrForm(), and hgpar_.

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

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

Definition at line 65 of file HGCalDDDConstants.h.

References getTrForms(), getTypeHex(), getTypeTrap(), hgpar_, and HGCalParameters::trformIndex_.

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

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

Definition at line 414 of file HGCalDDDConstants.cc.

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

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

414  {
415 
416  std::vector<HGCalParameters::hgtrform> mytrs;
417  for (unsigned int k=0; k<hgpar_->trformIndex_.size(); ++k)
418  mytrs.emplace_back(hgpar_->getTrForm(k));
419  return mytrs;
420 }
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 431 of file HGCalDDDConstants.cc.

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

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

431  {
432  //Get the module type for a silicon wafer
435  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer,waferU,waferV));
436  return ((itr == hgpar_->typesInLayers_.end() ? 2 :
437  hgpar_->waferTypeL_[itr->second]));
438  } else {
439  return -1;
440  }
441 }
HGCalGeometryMode::GeometryMode mode_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
wafer_map typesInLayers_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
int HGCalDDDConstants::getTypeTrap ( int  layer) const

Definition at line 422 of file HGCalDDDConstants.cc.

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

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

422  {
423  //Get the module type for scinitllator
425  return hgpar_->scintType(layer);
426  } else {
427  return -1;
428  }
429 }
int scintType(const int layer) const
HGCalGeometryMode::GeometryMode mode_
const HGCalParameters * hgpar_
int HGCalDDDConstants::getUVMax ( int  type) const
inline
bool HGCalDDDConstants::isHalfCell ( int  waferType,
int  cell 
) const

Definition at line 443 of file HGCalDDDConstants.cc.

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

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

443  {
444  if (waferType < 1 || cell < 0) return false;
445  return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell];
446 }
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 1418 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().

1418  {
1419 
1420  // Calculate the position of the cell
1421  // Works for options HGCalHexagon/HGCalHexagonFull
1422  double x = hgpar_->waferPosX_[wafer];
1423  double y = hgpar_->waferPosY_[wafer];
1424  if (hgpar_->waferTypeT_[wafer] == 1) {
1425  x += hgpar_->cellFineX_[cell];
1426  y += hgpar_->cellFineY_[cell];
1427  } else {
1428  x += hgpar_->cellCoarseX_[cell];
1429  y += hgpar_->cellCoarseY_[cell];
1430  }
1431  double rr = sqrt(x*x+y*y);
1432  bool result = ((rr >= hgpar_->rMinLayHex_[lay-1]) &&
1433  (rr <= hgpar_->rMaxLayHex_[lay-1]) &&
1434  (wafer < (int)(hgpar_->waferPosX_.size())));
1435 #ifdef EDM_ML_DEBUG
1436  if (!result)
1437  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << wafer << ":"
1438  << cell << " Position " << x << ":" << y
1439  << ":" << rr << " Compare Limits "
1440  << hgpar_->rMinLayHex_[lay-1] << ":"
1441  << hgpar_->rMaxLayHex_[lay-1]
1442  << " Flag " << result;
1443 #endif
1444  return result;
1445 }
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 448 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 HGCNumberingScheme::getUnitID(), getUVMax(), and HGCalTopology::valid().

449  {
450  //Check validity for a layer|wafer|cell of pre-TDR version
451  bool result(false), resultMod(false);
452  int cellmax(0);
455  int32_t copyNumber = hgpar_->waferCopy_[mod];
456  result = ((lay > 0 && lay <= (int)(layers(reco))));
457  if (result) {
458  const int32_t lay_idx = reco ? (lay-1)*3 + 1 : lay;
459  const auto& the_modules = hgpar_->copiesInLayers_[lay_idx];
460  auto moditr = the_modules.find(copyNumber);
461  result = resultMod = (moditr != the_modules.end());
462 #ifdef EDM_ML_DEBUG
463  if (!result)
464  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay
465  << ":" << lay_idx << " Copy "
466  << copyNumber << ":" << mod
467  << " Flag " << result;
468 #endif
469  if (result) {
470  if (moditr->second >= 0) {
471  if (mod >= (int)(hgpar_->waferTypeT_.size()))
472  edm::LogWarning("HGCalGeom") << "Module no. out of bound for "
473  << mod << " to be compared with "
474  << (hgpar_->waferTypeT_).size()
475  << " ***** ERROR *****";
476  cellmax = ((hgpar_->waferTypeT_[mod]==1) ?
477  (int)(hgpar_->cellFineX_.size()) :
478  (int)(hgpar_->cellCoarseX_.size()));
479  result = (cell >=0 && cell <= cellmax);
480  } else {
481  result = isValidCell(lay_idx, mod, cell);
482  }
483  }
484  }
485  }
486 
487 #ifdef EDM_ML_DEBUG
488  if (!result)
489  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay << ":"
490  << (lay > 0 && (lay <= (int)(layers(reco))))
491  << " Module " << mod << ":" << resultMod
492  << " Cell " << cell << ":" << cellmax << ":"
493  << (cell >=0 && cell <= cellmax)
494  << ":" << maxCells(reco);
495 #endif
496  return result;
497 }
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 499 of file HGCalDDDConstants.cc.

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

Referenced by HGCalTopology::addHGCSiliconId(), getUVMax(), and HGCalTopology::valid().

500  {
501  //Check validity for a layer|wafer|cell of post-TDR version
502  int indx = HGCalWaferIndex::waferIndex(layer,modU,modV);
503  auto itr = hgpar_->typesInLayers_.find(indx);
504 #ifdef EDM_ML_DEBUG
505  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferType "
506  << layer << ":" << modU << ":" << modV << ":"
507  << indx << " Test "
508  << (itr == hgpar_->typesInLayers_.end());
509 #endif
510  if (itr == hgpar_->typesInLayers_.end()) return false;
511  auto jtr = waferIn_.find(indx);
512 #ifdef EDM_ML_DEBUG
513  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferIn "
514  << jtr->first << ":" << jtr->second;
515 #endif
516  if (!(jtr->second)) return false;
517  int N = ((hgpar_->waferTypeL_[itr->second] == 0) ? hgpar_->nCellsFine_ :
519 #ifdef EDM_ML_DEBUG
520  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:Cell "
521  << cellU << ":" << cellV << ":" << N
522  << " Tests " << (cellU >= 0) << ":"
523  << (cellU < 2*N) << ":" << (cellV >= 0) << ":"
524  << (cellV < 2*N) << ":" << ((cellV-cellU) < N)
525  << ":" << ((cellU-cellV) <= N);
526 #endif
527  if ((cellU >= 0) && (cellU < 2*N) && (cellV >= 0) && (cellV < 2*N)) {
528  return (((cellV-cellU) < N) && ((cellU-cellV) <= N));
529  } else {
530  return false;
531  }
532 }
std::unordered_map< int32_t, bool > waferIn_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
#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 534 of file HGCalDDDConstants.cc.

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

Referenced by HGCalTopology::addHGCSCintillatorId(), getUVMax(), and HGCalTopology::valid().

534  {
535  //Check validity for a layer|eta|phi of scintillator
536  const auto & indx = getIndex(layer,true);
537  if (indx.first < 0) return false;
538  return ((irad >= hgpar_->iradMinBH_[indx.first]) &&
539  (irad <= hgpar_->iradMaxBH_[indx.first]) &&
540  (iphi > 0) && (iphi <= hgpar_->scintCells(layer)));
541 }
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< int > iradMinBH_
const HGCalParameters * hgpar_
int HGCalDDDConstants::lastLayer ( bool  reco) const

Definition at line 543 of file HGCalDDDConstants.cc.

References HGCalParameters::firstLayer_, hgpar_, and tot_layers_.

Referenced by getUVMax(), and HGCalGeometry::neighborZ().

543  {
544  return (hgpar_->firstLayer_+tot_layers_[(int)reco]-1);
545 }
std::array< uint32_t, 2 > tot_layers_
fixed size matrix
const HGCalParameters * hgpar_
int HGCalDDDConstants::layerIndex ( int  lay,
bool  reco 
) const

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

551  {
552  int ll = lay - hgpar_->firstLayer_;
553  if (ll<0 || ll>=(int)(hgpar_->layerIndex_.size())) return -1;
556  if (reco && ll>=(int)(hgpar_->depthIndex_.size())) return -1;
557  return (reco ? hgpar_->depthLayerF_[ll] : hgpar_->layerIndex_[ll]);
558  } else {
559  return (hgpar_->layerIndex_[ll]);
560  }
561 }
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 563 of file HGCalDDDConstants.cc.

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

Referenced by getUVMax(), and HGCalDDDConstants().

563  {
564  return (reco ? hgpar_->depthIndex_.size() : hgpar_->layerIndex_.size());
565 }
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 88 of file HGCalDDDConstants.h.

References hgpar_, HGCalParameters::levelT_, and maskCell().

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

88 {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 567 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::getNewCorners(), HGCalGeometry::getPosition(), and getUVMax().

568  {
569  // type refers to wafer # for hexagon cell
570  float x(999999.), y(999999.);
571  const auto & index = getIndex(lay, reco);
572  int i = index.first;
573  if (i < 0) return std::make_pair(x,y);
576  x = hgpar_->waferPosX_[type];
577  y = hgpar_->waferPosY_[type];
578  if (hgpar_->waferTypeT_[type] == 1) {
579  x += hgpar_->cellFineX_[cell];
580  y += hgpar_->cellFineY_[cell];
581  } else {
582  x += hgpar_->cellCoarseX_[cell];
583  y += hgpar_->cellCoarseY_[cell];
584  }
585  if (!reco) {
588  }
589  }
590  return std::make_pair(x,y);
591 }
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 593 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.

600  {
601 
602  float x(0), y(0);
603  int indx = HGCalWaferIndex::waferIndex(lay,waferU,waferV);
604  auto itr = hgpar_->typesInLayers_.find(indx);
605  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
606  hgpar_->waferTypeL_[itr->second]);
607 #ifdef EDM_ML_DEBUG
608  if (debug)
609  edm::LogVerbatim("HGCalGeom") << "LocateCell " << lay << ":" << waferU
610  << ":" << waferV << ":" << indx << ":"
611  << (itr == hgpar_->typesInLayers_.end())
612  << ":" << type;
613 #endif
614  int kndx = cellV*100 + cellU;
615  if (type == 0) {
616  auto ktr = hgpar_->cellFineIndex_.find(kndx);
617  if (ktr != hgpar_->cellFineIndex_.end()) {
618  x = hgpar_->cellFineX_[ktr->second];
619  y = hgpar_->cellFineY_[ktr->second];
620  }
621 #ifdef EDM_ML_DEBUG
622  if (debug)
623  edm::LogVerbatim("HGCalGeom") << "Fine " << cellU << ":" << cellV << ":"
624  << kndx << ":" << x << ":" << y << ":"
625  << (ktr != hgpar_->cellFineIndex_.end());
626 #endif
627  } else {
628  auto ktr = hgpar_->cellCoarseIndex_.find(kndx);
629  if (ktr != hgpar_->cellCoarseIndex_.end()) {
630  x = hgpar_->cellCoarseX_[ktr->second];
631  y = hgpar_->cellCoarseY_[ktr->second];
632  }
633 #ifdef EDM_ML_DEBUG
634  if (debug)
635  edm::LogVerbatim("HGCalGeom") << "Coarse " << cellU << ":" << cellV <<":"
636  << kndx << ":" << x << ":" << y << ":"
637  << (ktr != hgpar_->cellCoarseIndex_.end());
638 #endif
639  }
640  if (!reco) {
643  }
644  if (all) {
645  const auto & xy = waferPosition(waferU, waferV, reco);
646  x += xy.first;
647  y += xy.second;
648 #ifdef EDM_ML_DEBUG
649  if (debug)
650  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << ":"
651  << xy.first << ":" << xy.second;
652 #endif
653  }
654  return std::make_pair(x,y);
655 }
type
Definition: HCALResponse.h:21
wafer_map cellFineIndex_
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
#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 657 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::getNewCorners(), HGCalGeometry::getPosition(), and getUVMax().

658  {
659  float x(0), y(0);
660  if (hgpar_->waferTypeT_[wafer] == 1) {
661  x = hgpar_->cellFineX_[cell];
662  y = hgpar_->cellFineY_[cell];
663  } else {
664  x = hgpar_->cellCoarseX_[cell];
665  y = hgpar_->cellCoarseY_[cell];
666  }
667  if (!reco) {
670  }
671  return std::make_pair(x,y);
672 }
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 674 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(), and getUVMax().

675  {
676 
677  float x(0), y(0);
678  const auto & indx = getIndex(lay,reco);
679  if (indx.first >= 0) {
680  int ir = std::abs(irad);
681  int type = hgpar_->scintType(lay);
682  double phi = (iphi-0.5)*indx.second;
683  double z = hgpar_->zLayerHex_[indx.first];
684  double r = 0.5*(hgpar_->radiusLayer_[type][ir-1] +
685  hgpar_->radiusLayer_[type][ir]);
686  std::pair<double,double> range = rangeR(z,true);
687  r = std::max(range.first, std::min(r,range.second));
688  x = r*std::cos(phi);
689  y = r*std::sin(phi);
690  if (irad < 0) x =-x;
691  }
692  if (!reco) {
695  }
696  return std::make_pair(x,y);
697 }
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_
bool HGCalDDDConstants::maskCell ( const DetId id,
int  corners 
) const

Definition at line 699 of file HGCalDDDConstants.cc.

References DetId::det(), plotBeamSpotDB::first, DetId::Forward, getUVMax(), HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, hgpar_, triggerObjects_cff::id, HGCalParameters::k_CornerSize, RecoTauDiscriminantConfiguration::mask, mode_, N, edm::second(), findQualityFiles::v, HGCalWaferIndex::waferIndex(), and HGCalParameters::waferTypes_.

Referenced by levelTop(), HGCalSD::setDetUnitId(), and HFNoseSD::setDetUnitId().

699  {
700  bool mask(false);
701  if (corners > 2 && corners < (int)(HGCalParameters::k_CornerSize)) {
704  int N(0), layer(0), waferU(0), waferV(0), u(0), v(0);
705  if (detId.det() == DetId::Forward) {
706  HFNoseDetId id(detId);
707  N = getUVMax(id.type());
708  layer = id.layer();
709  waferU = id.waferU();
710  waferV = id.waferV();
711  u = id.cellU();
712  v = id.cellV();
713  } else {
714  HGCSiliconDetId id(detId);
715  N = getUVMax(id.type());
716  layer = id.layer();
717  waferU = id.waferU();
718  waferV = id.waferV();
719  u = id.cellU();
720  v = id.cellV();
721  }
722  int wl = HGCalWaferIndex::waferIndex(layer,waferU,waferV);
723  auto itr = hgpar_->waferTypes_.find(wl);
724 #ifdef EDM_ML_DEBUG
725  edm::LogVerbatim("HGCalGeom") << "MaskCell: Layer " << layer
726  << " Wafer " << waferU << ":"
727  << waferV << " Index " << wl << ":"
728  << (itr != hgpar_->waferTypes_.end());
729 #endif
730  if (itr != hgpar_->waferTypes_.end()) {
731  int ncor = (itr->second).first;
732  int fcor = (itr->second).second;
733  if (ncor < corners) {
734  mask = true;
735  } else {
736  if (ncor == 4) {
737  switch (fcor) {
738  case(0): { mask = (v >= N); break; }
739  case(1): { mask = (u >= N); break; }
740  case(2): { mask = (u <= v); break; }
741  case(3): { mask = (v < N); break; }
742  case(4): { mask = (u < N); break; }
743  default: { mask = (u > v); break; }
744  }
745  } else {
746  switch (fcor) {
747  case(0): {
748  if (ncor == 3) {
749  mask = !((u > 2*v) && (v < N));
750  } else {
751  mask = ((u >= N) && (v >= N) && ((u+v) > (3*N-2)));
752  }
753  break;
754  }
755  case(1): {
756  if (ncor == 3) {
757  mask = !((u+v) < N);
758  } else {
759  mask = ((u >= N) && (u > v) && ((2*u-v) > 2*N));
760  }
761  break;
762  }
763  case(2): {
764  if (ncor == 3) {
765  mask = !((u < N) && (v > u) && (v > (2*u-1)));
766  } else {
767  mask = ((u > 2*v) && (v < N));
768  }
769  break;
770  }
771  case(3): {
772  if (ncor == 3) {
773  mask = !((v >= u) && ((2*v-u) > (2*N-2)));
774  } else {
775  mask = ((u+v) < N);
776  }
777  break;
778  }
779  case(4) : {
780  if (ncor == 3) {
781  mask = !((u >= N) && (v >= N) && ((u+v) > (3*N-2)));
782  } else {
783  mask = ((u < N) && (v > u) && (v > (2*u-1)));
784  }
785  break;
786  }
787  default: {
788  if (ncor == 3) {
789  mask = !((u >= N) && (u > v) && ((2*u-v) > 2*N));
790  } else {
791  mask = ((v >= u) && ((2*v-u) > (2*N-2)));
792  }
793  break;
794  }
795  }
796  }
797 #ifdef EDM_ML_DEBUG
798  edm::LogVerbatim("HGCalGeom") << "Corners: " << ncor << ":" << fcor
799  << " N " << N << " u " << u << " v "
800  << v << " Mask " << mask;
801 #endif
802  }
803  }
804  }
805  }
806  return mask;
807 }
type
Definition: HCALResponse.h:21
HGCalGeometryMode::GeometryMode mode_
U second(std::pair< T, U > const &p)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
static uint32_t k_CornerSize
#define N
Definition: blowfish.cc:9
const HGCalParameters * hgpar_
int getUVMax(int type) const
int HGCalDDDConstants::maxCells ( bool  reco) const

Definition at line 809 of file HGCalDDDConstants.cc.

References postprocess-scan-build::cells, HGCalParameters::depth_, hgpar_, mps_fire::i, HGCalParameters::layer_, and layers().

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

809  {
810 
811  int cells(0);
812  for (unsigned int i = 0; i<layers(reco); ++i) {
813  int lay = reco ? hgpar_->depth_[i] : hgpar_->layer_[i];
814  if (cells < maxCells(lay, reco)) cells = maxCells(lay, reco);
815  }
816  return cells;
817 }
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 819 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, postprocess-scan-build::cells, 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().

819  {
820 
821  const auto & index = getIndex(lay, reco);
822  if (index.first < 0) return 0;
825  unsigned int cells(0);
826  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
827  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) {
828  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
829  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
830  if (cell > cells) cells = cell;
831  }
832  }
833  return (int)(cells);
834  } else if ((mode_ == HGCalGeometryMode::Hexagon8) ||
836  int cells(0);
837  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
838  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) {
840  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
841  hgpar_->waferTypeL_[itr->second]);
842  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
843  cells = std::max(cells,3*N*N);
844  }
845  }
846  return cells;
847  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
848  return hgpar_->scintCells(index.first+hgpar_->firstLayer_);
849  } else {
850  return 0;
851  }
852 }
type
Definition: HCALResponse.h:21
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::pair< int, float > getIndex(int lay, bool reco) const
int scintCells(const int layer) const
static int32_t waferU(const int32_t index)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
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 95 of file HGCalDDDConstants.h.

References modHalf_.

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

Definition at line 96 of file HGCalDDDConstants.h.

References maxRows(), and maxWafersPerLayer_.

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

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

854  {
855 
856  int kymax(0);
857  const auto & index = getIndex(lay, reco);
858  int i = index.first;
859  if (i < 0) return kymax;
862  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
864  int ky = ((hgpar_->waferCopy_[k])/100)%100;
865  if (ky > kymax) kymax = ky;
866  }
867  }
868  } else if ((mode_ == HGCalGeometryMode::Hexagon8) ||
870  kymax = 1+2*hgpar_->waferUVMaxLayer_[index.first];
871  }
872  return kymax;
873 }
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::modifyUV ( int  uv,
int  type1,
int  type2 
) const

Definition at line 875 of file HGCalDDDConstants.cc.

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

875  {
876  // Modify u/v for transition of type1 to type2
877  return (((type1==type2) || (type1*type2 !=0)) ? uv :
878  ((type1==0) ? (2*uv+1)/3 : (3*uv)/2));
879 }
int HGCalDDDConstants::modules ( int  lay,
bool  reco 
) const

Definition at line 881 of file HGCalDDDConstants.cc.

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

Referenced by minSlope(), and wafers().

881  {
882  if (getIndex(lay,reco).first < 0) return 0;
883  else return max_modules_layer_[(int)reco][lay];
884 }
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 886 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().

886  {
887  int nmod(0);
888  const auto & index = getIndex(lay, reco);
889  if (index.first < 0) return nmod;
891  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
892  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) ++nmod;
893  }
894  } else {
895  nmod = 1+hgpar_->lastModule_[index.first]-hgpar_->firstModule_[index.first];
896  }
897  return nmod;
898 }
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 900 of file HGCalDDDConstants.cc.

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

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

900  {
901 
903 }
static double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_
int HGCalDDDConstants::numberCells ( bool  reco) const

Definition at line 905 of file HGCalDDDConstants.cc.

References postprocess-scan-build::cells, HGCalParameters::depth_, hgpar_, gen::k, HGCalParameters::layer_, and trackingPlots::reco.

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

905  {
906 
907  int cells(0);
908  unsigned int nlayer = (reco) ? hgpar_->depth_.size() : hgpar_->layer_.size();
909  for (unsigned k=0; k<nlayer; ++k) {
910  std::vector<int> ncells = numberCells(((reco) ? hgpar_->depth_[k] : hgpar_->layer_[k]), reco);
911  cells = std::accumulate(ncells.begin(),ncells.end(),cells);
912  }
913  return cells;
914 }
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 916 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().

916  {
917 
918  const auto & index = getIndex(lay, reco);
919  int i = index.first;
920  std::vector<int> ncell;
921  if (i >= 0) {
924  for (unsigned int k=0; k<hgpar_->waferTypeT_.size(); ++k) {
926  unsigned int cell = (hgpar_->waferTypeT_[k]==1) ?
927  (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
928  ncell.emplace_back((int)(cell));
929  }
930  }
931  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
932  int nphi = hgpar_->scintCells(lay);
933  for (int k=hgpar_->firstModule_[i]; k<=hgpar_->lastModule_[i]; ++k)
934  ncell.emplace_back(nphi);
935  } else {
936  for (unsigned int k=0; k<hgpar_->waferCopy_.size(); ++k) {
937  if (waferInLayerTest(k,index.first,hgpar_->defineFull_)) {
938  int cell = numberCellsHexagon(lay,
941  true);
942  ncell.emplace_back(cell);
943  }
944  }
945  }
946  }
947  return ncell;
948 }
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 950 of file HGCalDDDConstants.cc.

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

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

950  {
951 
952  if (wafer >= 0 && wafer < (int)(hgpar_->waferTypeT_.size())) {
953  if (hgpar_->waferTypeT_[wafer]==1)
954  return (int)(hgpar_->cellFineX_.size());
955  else
956  return (int)(hgpar_->cellCoarseX_.size());
957  } else {
958  return 0;
959  }
960 }
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 962 of file HGCalDDDConstants.cc.

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

963  {
964  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(lay,waferU,waferV));
965  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
966  hgpar_->waferTypeL_[itr->second]);
967  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
968  if (flag) return (3*N*N);
969  else return N;
970 }
type
Definition: HCALResponse.h:21
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
#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 972 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(), minSlope(), and HGCalGeometry::neighborZ().

972  {
973  double rmin(0), rmax(0), zz(0);
974  if (hgpar_->detectorType_ > 0) {
975  zz = (reco ? std::abs(z) : HGCalParameters::k_ScaleFromDDD*std::abs(z));
976  if (hgpar_->detectorType_ <= 2) {
979  } else {
984  }
985  if ((hgpar_->detectorType_ == 2) &&
991  } else {
994  }
995  }
996  if (!reco) {
999  }
1000 #ifdef EDM_ML_DEBUG
1001  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeR: " << z << ":"
1002  << zz << " R " << rmin << ":" << rmax;
1003 #endif
1004  return std::pair<double,double>(rmin,rmax);
1005 }
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 1007 of file HGCalDDDConstants.cc.

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

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

1007  {
1008  double zmin = (hgpar_->zLayerHex_[0] - hgpar_->waferThick_);
1009  double zmax = (hgpar_->zLayerHex_[hgpar_->zLayerHex_.size()-1] +
1010  hgpar_->waferThick_);
1011 #ifdef EDM_ML_DEBUG
1012  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeZ: " << zmin << ":"
1013  << zmax << ":" << hgpar_->waferThick_;
1014 #endif
1015  if (!reco) {
1018  }
1019  return std::pair<double,double>(zmin,zmax);
1020 }
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 1022 of file HGCalDDDConstants.cc.

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

Referenced by minSlope().

1022  {
1023  int row(0), col(0);
1024  if (wafer < (int)(hgpar_->waferCopy_.size())) {
1025  int copy = hgpar_->waferCopy_[wafer];
1026  col = copy%100;
1027  if ((copy/10000)%10 != 0) col = -col;
1028  row = (copy/100)%100;
1029  if ((copy/100000)%10 != 0) row = -row;
1030  }
1031  return std::make_pair(row,col);
1032 }
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 1034 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(), sectors(), HGCalTriggerNtupleHGCTriggerCells::simhits(), and HGCalTriggerNtupleHGCDigis::simhits().

1035  {
1036 
1037  if ((mode_ != HGCalGeometryMode::Hexagon) &&
1039  return std::make_pair(cell,lay);
1040  } else {
1041  const auto & index = getIndex(lay, false);
1042  int i = index.first;
1043  if (i < 0) {
1044  edm::LogWarning("HGCalGeom") << "Wrong Layer # " << lay
1045  << " not in the list ***** ERROR *****";
1046  return std::make_pair(-1,-1);
1047  }
1048  if (mod >= (int)(hgpar_->waferTypeL_).size()) {
1049  edm::LogWarning("HGCalGeom") << "Invalid Wafer # " << mod
1050  << "should be < "
1051  << (hgpar_->waferTypeL_).size()
1052  << " ***** ERROR *****";
1053  return std::make_pair(-1,-1);
1054  }
1055  int depth(-1);
1056  int kx = cell;
1057  int type = hgpar_->waferTypeL_[mod];
1058  if (type == 1) {
1059  depth = hgpar_->layerGroup_[i];
1060  } else if (type == 2) {
1061  depth = hgpar_->layerGroupM_[i];
1062  } else {
1063  depth = hgpar_->layerGroupO_[i];
1064  }
1065  return std::make_pair(kx,depth);
1066  }
1067 }
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 125 of file HGCalDDDConstants.h.

References waferMax_.

125 {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 1069 of file HGCalDDDConstants.cc.

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

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

1069  {
1070  const int ncopies = hgpar_->waferCopy_.size();
1071  int wafer(ncopies);
1072  bool result(false);
1073  for (int k=0; k<ncopies; ++k) {
1074  if (copy == hgpar_->waferCopy_[k]) {
1075  wafer = k;
1076  result = true;
1077  break;
1078  }
1079  }
1080  if (!result) {
1081  wafer = -1;
1082 #ifdef EDM_ML_DEBUG
1083  edm::LogVerbatim("HGCalGeom") << "Cannot find " << copy << " in a list of "
1084  << ncopies << " members";
1085  for (int k=0; k<ncopies; ++k)
1086  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << hgpar_->waferCopy_[k];
1087 #endif
1088  }
1089  return wafer;
1090 }
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 1092 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().

1094  {
1095  //Input x, y in Geant4 unit and transformed to CMSSW standard
1098  int size_ = (int)(hgpar_->waferCopy_.size());
1099  wafer = size_;
1100  for (int k=0; k<size_; ++k) {
1101  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
1102  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
1103  if (dx <= rmax_ && dy <= hexside_) {
1104  if ((dy <= 0.5*hexside_) || (dx*tan30deg_ <= (hexside_-dy))) {
1105  wafer = k;
1106  celltyp = hgpar_->waferTypeT_[k];
1107  xx -= hgpar_->waferPosX_[k];
1108  yy -= hgpar_->waferPosY_[k];
1109  break;
1110  }
1111  }
1112  }
1113  if (wafer < size_) {
1114  if (celltyp == 1)
1115  icell = cellHex(xx, yy, 0.5*HGCalParameters::k_ScaleFromDDD*hgpar_->cellSize_[0],
1117  else
1118  icell = cellHex(xx, yy, 0.5*HGCalParameters::k_ScaleFromDDD*hgpar_->cellSize_[1],
1120  } else {
1121  wafer = -1;
1122 #ifdef EDM_ML_DEBUG
1123  edm::LogWarning("HGCalGeom") << "Cannot get wafer type corresponding to "
1124  << x << ":" << y << " " << xx << ":" << yy;
1125 #endif
1126  }
1127 #ifdef EDM_ML_DEBUG
1128  edm::LogVerbatim("HGCalGeom") << "Position " << x << ":" << y << " Wafer "
1129  << wafer << ":" << size_ << " XX " << xx << ":"
1130  << yy << " Cell " << icell << " Type " << celltyp;
1131 #endif
1132 }
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 1134 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.

1141  {
1142 
1145  waferU = waferV = 1+hgpar_->waferUVMax_;
1146  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
1147  double dx = std::abs(xx-hgpar_->waferPosX_[k]);
1148  double dy = std::abs(yy-hgpar_->waferPosY_[k]);
1149  if (dx <= rmax_ && dy <= hexside_) {
1150  if ((dy <= 0.5*hexside_) || (dx*tan30deg_ <= (hexside_-dy))) {
1153  auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer,waferU,waferV));
1154  celltype = ((itr == hgpar_->typesInLayers_.end()) ? 2 :
1155  hgpar_->waferTypeL_[itr->second]);
1156 #ifdef EDM_ML_DEBUG
1157  if (debug)
1158  edm::LogVerbatim("HGCalGeom") << "WaferFromPosition:: Input " << xx
1159  << ":" << yy << " compared with "
1160  << hgpar_->waferPosX_[k] << ":"
1161  << hgpar_->waferPosY_[k]
1162  << " difference " << dx << ":" << dy
1163  << ":" << dx*tan30deg_ << ":"
1164  << (hexside_-dy) << " comparator "
1165  << rmax_ << ":" << hexside_ <<" wafer "
1166  << waferU << ":" << waferV << ":"
1167  << celltype;
1168 #endif
1169  xx -= hgpar_->waferPosX_[k];
1170  yy -= hgpar_->waferPosY_[k];
1171  break;
1172  }
1173  }
1174  }
1175  if (std::abs(waferU) <= hgpar_->waferUVMax_) {
1176  cellHex(xx, yy, celltype, cellU, cellV
1177 #ifdef EDM_ML_DEBUG
1178  , debug
1179 #endif
1180  );
1181  wt = ((celltype < 2) ?
1182  (hgpar_->cellThickness_[celltype]/hgpar_->waferThick_) : 1.0);
1183  } else {
1184  cellU = cellV = 2*hgpar_->nCellsFine_;
1185  wt = 1.0;
1186  celltype =-1;
1187  }
1188 #ifdef EDM_ML_DEBUG
1189  if (celltype < 0) {
1192  edm::LogVerbatim("HGCalGeom") << "waferFromPosition: Bad type for X "
1193  << x << ":" << x1 << ":" << xx << " Y " << y
1194  << ":" << y1 << ":" << yy << " Wafer "
1195  << waferU << ":" << waferV << " Cell "
1196  << cellU << ":" << cellV;
1197  for (unsigned int k=0; k<hgpar_->waferPosX_.size(); ++k) {
1198  double dx = std::abs(x1-hgpar_->waferPosX_[k]);
1199  double dy = std::abs(y1-hgpar_->waferPosY_[k]);
1200  edm::LogVerbatim("HGCalGeom") << "Wafer [" << k << "] Position ("
1201  << hgpar_->waferPosX_[k] << ", "
1202  << hgpar_->waferPosY_[k] << ") difference "
1203  << dx << ":" << dy << ":" << dx*tan30deg_
1204  << ":" << hexside_-dy << " Paramerers "
1205  << rmax_ << ":" << hexside_;
1206  }
1207  }
1208 #endif
1209 }
std::vector< double > waferPosY_
static int32_t waferV(const int32_t index)
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)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
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 1218 of file HGCalDDDConstants.cc.

References getIndex(), and waferInLayerTest().

Referenced by volumes().

1218  {
1219  const auto & indx = getIndex(lay, reco);
1220  if (indx.first < 0) return false;
1221  return waferInLayerTest(wafer,indx.first,false);
1222 }
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 1211 of file HGCalDDDConstants.cc.

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

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

1211  {
1212 
1213  const auto & indx = getIndex(lay, reco);
1214  if (indx.first < 0) return false;
1215  return waferInLayerTest(wafer,indx.first,hgpar_->defineFull_);
1216 }
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 1447 of file HGCalDDDConstants.cc.

References TCMET_cfi::corner, RemoveAddSevLevel::flag, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, hexside_, hgpar_, recoMuon::in, HGCalParameters::k_CornerSize, mode_, rmax_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalGeomTools::waferCorner(), HGCalParameters::waferPosX_, and HGCalParameters::waferPosY_.

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

1447  {
1448 
1449  bool flag = ((mode_ == HGCalGeometryMode::Hexagon) ||
1450  (mode_ == HGCalGeometryMode::HexagonFull)) ? true : false;
1451  std::pair<int,int> corner =
1453  hgpar_->waferPosY_[wafer],
1454  rmax_, hexside_,
1455  hgpar_->rMinLayHex_[lay],
1456  hgpar_->rMaxLayHex_[lay], flag);
1457  bool in = (full ? (corner.first > 0) :
1458  (corner.first == (int)(HGCalParameters::k_CornerSize)));
1459 #ifdef EDM_ML_DEBUG
1460  edm::LogVerbatim("HGCalGeom") << "WaferInLayerTest: Layer " << lay
1461  << " wafer " << wafer << " R-limits "
1462  << hgpar_->rMinLayHex_[lay] << ":"
1463  << hgpar_->rMaxLayHex_[lay] << " Corners "
1464  << corner.first << ":" << corner.second
1465  << " In " << in;
1466 #endif
1467  return in;
1468 }
std::vector< double > waferPosY_
HGCalGeometryMode::GeometryMode mode_
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
Definition: GenABIO.cc:180
std::vector< double > rMinLayHex_
std::vector< double > rMaxLayHex_
static uint32_t k_CornerSize
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int HGCalDDDConstants::waferMax ( ) const
inline

Definition at line 126 of file HGCalDDDConstants.h.

References waferMax_.

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

Definition at line 127 of file HGCalDDDConstants.h.

References waferMax_, and waferPosition().

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

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

1225  {
1226 
1227  double xx(0), yy(0);
1228  if (wafer >= 0 && wafer < (int)(hgpar_->waferPosX_.size())) {
1229  xx = hgpar_->waferPosX_[wafer];
1230  yy = hgpar_->waferPosY_[wafer];
1231  }
1232  if (!reco) {
1235  }
1236  return std::make_pair(xx,yy);
1237 }
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 1239 of file HGCalDDDConstants.cc.

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

1241  {
1242 
1243  double xx(0), yy(0);
1244  int indx = HGCalWaferIndex::waferIndex(0,waferU,waferV);
1245  auto itr = hgpar_->wafersInLayers_.find(indx);
1246  if (itr != hgpar_->wafersInLayers_.end()) {
1247  xx = hgpar_->waferPosX_[itr->second];
1248  yy = hgpar_->waferPosY_[itr->second];
1249  }
1250  if (!reco) {
1253  }
1254  return std::make_pair(xx,yy);
1255 }
std::vector< double > waferPosY_
wafer_map wafersInLayers_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
static double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int HGCalDDDConstants::wafers ( ) const

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

1292  {
1293 
1294  int wafer(0);
1296  for (unsigned int i = 0; i<layers(true); ++i) {
1297  int lay = hgpar_->depth_[i];
1298  wafer += modules(lay, true);
1299  }
1300  } else {
1301  wafer = (int)(hgpar_->moduleLayR_.size());
1302  }
1303  return wafer;
1304 }
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 1306 of file HGCalDDDConstants.cc.

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

1306  {
1307 
1308  int wafer(0);
1310  auto itr = waferLayer_.find(layer);
1311  if (itr != waferLayer_.end()) {
1312  unsigned ity = (type > 0 && type <= 2) ? type : 0;
1313  wafer = (itr->second)[ity];
1314  }
1315  } else {
1316  const auto & index = getIndex(layer, true);
1317  wafer = 1+hgpar_->lastModule_[index.first]-hgpar_->firstModule_[index.first];
1318  }
1319  return wafer;
1320 }
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 131 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 134 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferCopy_.

134 {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 1257 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(), getUVMax(), and HGCalUncalibRecHitRecWeightsAlgo< HGCDataFrame >::makeRecHit().

1257  {
1258 
1259  int type(1);
1262  type = ((id.det() != DetId::Forward) ? (1 + HGCSiliconDetId(id).type()) :
1263  (1 + HFNoseDetId(id).type()));
1264  } else if ((mode_ == HGCalGeometryMode::Hexagon) ||
1266  type = waferTypeL(HGCalDetId(id).wafer());
1267  }
1268  return type;
1269 }
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 138 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferTypeL_.

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

138 {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
bool HGCalDDDConstants::waferVirtual ( int  layer,
int  waferU,
int  waferV 
) const

Definition at line 1271 of file HGCalDDDConstants.cc.

References HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, hgpar_, mode_, HGCalWaferIndex::waferIndex(), and HGCalParameters::waferTypes_.

Referenced by waferUVMax().

1271  {
1272  bool type(false);
1275  int wl = HGCalWaferIndex::waferIndex(layer,waferU,waferV,false);
1276  type = (hgpar_->waferTypes_.find(wl) != hgpar_->waferTypes_.end());
1277  } else if ((mode_ == HGCalGeometryMode::Hexagon) ||
1279  int wl = HGCalWaferIndex::waferIndex(layer,waferU,0,true);
1280  type = (hgpar_->waferTypes_.find(wl) != hgpar_->waferTypes_.end());
1281  }
1282  return type;
1283 }
type
Definition: HCALResponse.h:21
HGCalGeometryMode::GeometryMode mode_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
const HGCalParameters * hgpar_
double HGCalDDDConstants::waferZ ( int  layer,
bool  reco 
) const

Member Data Documentation

const float HGCalDDDConstants::dPhiMin = 0.02
private

Definition at line 155 of file HGCalDDDConstants.h.

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

Definition at line 154 of file HGCalDDDConstants.h.

Simrecovecs HGCalDDDConstants::max_modules_layer_
private

Definition at line 165 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and modules().

int32_t HGCalDDDConstants::maxWafersPerLayer_
private

Definition at line 166 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxMoudlesPerLayer().

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

Definition at line 163 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxModules().

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

Definition at line 160 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 164 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), lastLayer(), and layers().

int32_t HGCalDDDConstants::tot_wafers_
private

Definition at line 163 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants().

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

Definition at line 169 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and isValidHex8().

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

Definition at line 167 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and wafers().

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

Definition at line 168 of file HGCalDDDConstants.h.

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