1 #ifndef HGCalCommonData_HGCalDDDConstants_h
2 #define HGCalCommonData_HGCalDDDConstants_h
23 #include <CLHEP/Geometry/Point3D.h>
27 #include <unordered_map>
34 std::pair<int, int>
assignCell(
float x,
float y,
int lay,
int subSec,
bool reco)
const;
35 std::array<int, 5>
assignCellHex(
float x,
float y,
int lay,
bool reco,
bool extend =
false,
bool debug =
false)
const;
36 std::array<int, 3>
assignCellTrap(
float x,
float y,
float z,
int lay,
bool reco)
const;
57 int getLayer(
double z,
bool reco)
const;
60 std::vector<HGCalParameters::hgtrap>
getModules()
const;
70 std::vector<HGCalParameters::hgtrform>
getTrForms()
const;
73 std::pair<double, double>
getXY(
int layer,
double x,
double y,
bool forwd)
const;
77 bool isValidHex8(
int lay,
int waferU,
int waferV,
bool fullAndPart =
false)
const;
78 bool isValidHex8(
int lay,
int modU,
int modV,
int cellU,
int cellV,
bool fullAndPart =
false)
const;
79 bool isValidTrap(
int lay,
int ieta,
int iphi)
const;
82 unsigned int layers(
bool reco)
const;
85 int lay,
int waferU,
int waferV,
double localX,
double localY,
bool reco,
bool debug)
const;
86 std::pair<float, float>
locateCell(
int cell,
int lay,
int type,
bool reco)
const;
95 bool debug =
false)
const;
98 std::pair<float, float>
locateCellHex(
int cell,
int wafer,
bool reco)
const;
99 std::pair<float, float>
locateCellTrap(
int lay,
int ieta,
int iphi,
bool reco)
const;
104 int maxCells(
int lay,
bool reco)
const;
107 int maxRows(
int lay,
bool reco)
const;
109 int modifyUV(
int uv,
int type1,
int type2)
const;
110 int modules(
int lay,
bool reco)
const;
114 std::vector<int>
numberCells(
int lay,
bool reco)
const;
117 std::pair<double, double>
rangeR(
double z,
bool reco)
const;
118 std::pair<double, double>
rangeRLayer(
int lay,
bool reco)
const;
119 std::pair<double, double>
rangeZ(
bool reco)
const;
136 return std::make_pair(0, 0);
145 int type(-1), sipm(-1);
148 type = 1 + (itr->second).type;
151 return std::make_pair(type, sipm);
155 void waferFromPosition(
const double x,
const double y,
int& wafer,
int& icell,
int& celltyp)
const;
166 bool debug =
false)
const;
180 std::pair<double, double>
waferPosition(
int wafer,
bool reco)
const;
181 std::pair<double, double>
waferPosition(
int lay,
int waferU,
int waferV,
bool reco,
bool debug =
false)
const;
184 if (kk < hgpar_->waferInfoMap_.size()) {
186 std::advance(itr, kk);
192 if (kk < hgpar_->waferInfoMap_.size()) {
194 std::advance(itr, kk);
195 return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient);
197 return std::make_tuple(0, 0, 0);
202 return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient);
204 return std::make_tuple(0, 0, 0);
211 HepGeom::Point3D<float>& loc,
const DetId&
id,
bool useWafer,
bool reco,
bool debug)
const {
219 auto xy =
getXY(detid.
layer(), (x + loc.x()), (y + loc.y()),
false);
222 double xx = (detid.
zside() < 0) ? -
xy.first :
xy.first;
231 return ((wafer >= 0) && (wafer < static_cast<int>(
hgpar_->
waferCopy_.size())))
244 int waferType(
int layer,
int waferU,
int waferV,
bool fromFile =
false)
const;
247 int layer,
int waferU,
int waferV,
bool fromFile =
false,
bool debug =
false)
const;
256 const std::vector<double>& posX,
257 const std::vector<double>& posY)
const;
259 double xloc,
double yloc,
int cellType,
int& cellU,
int& cellV,
bool extend =
false,
bool debug =
false)
const;
260 std::pair<int, float>
getIndex(
int lay,
bool reco)
const;
262 bool isValidCell(
int layindex,
int wafer,
int cell)
const;
263 bool isValidCell8(
int lay,
int waferU,
int waferV,
int cellU,
int cellV,
int type)
const;
266 std::pair<double, double>
waferPositionNoRot(
int lay,
int waferU,
int waferV,
bool reco,
bool debug =
false)
const;
267 std::pair<double, double>
waferPosition(
int waferU,
int waferV,
bool reco)
const;
bool isHalfCell(int waferType, int cell) const
std::pair< double, double > cellSizeTrap(int type, int irad) const
bool isValidTrap(int lay, int ieta, int iphi) const
std::tuple< int, int, int > waferFileInfo(unsigned int kk) const
int getTypeTrap(int layer) const
GlobalPoint waferLocal2Global(HepGeom::Point3D< float > &loc, const DetId &id, bool useWafer, bool reco, bool debug) const
int getLayer(double z, bool reco) const
std::vector< HGCalParameters::hgtrap > getModules() const
bool waferHexagon6() const
int scintType(const int layer) const
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
int tileSiPM(int sipm) const
int waferFileIndex(unsigned int kk) const
std::vector< int > moduleLayR_
double cellSizeHex(int type) const
int32_t maxWafersPerLayer_
HGCalParameters::hgtrform getTrForm(unsigned int k) const
Simrecovecs max_modules_layer_
int lastLayer(bool reco) const
std::pair< int, int > waferTypeRotation(int layer, int waferU, int waferV, bool fromFile=false, bool debug=false) const
double cellThickness(int layer, int waferU, int waferV) const
unsigned int layersInit(bool reco) const
std::array< std::vector< int32_t >, 2 > Simrecovecs
int32_t waferU(const int32_t index)
const HGCalParameters * getParameter() const
bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
int maxRows(int lay, bool reco) const
int getTypeHex(int layer, int waferU, int waferV) const
unsigned int waferFileSize() const
bool waferInLayerTest(int wafer, int lay, bool full) const
bool tileExist(int zside, int layer, int ring, int phi) const
int zside() const
get the z-side of the cell (1/-1)
std::unordered_map< int32_t, bool > waferIn_
int modulesInit(int lay, bool reco) const
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
std::vector< uint32_t > trformIndex_
bool isValidHex(int lay, int mod, int cell, bool reco) const
bool isValidCell8(int lay, int waferU, int waferV, int cellU, int cellV, int type) const
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
int32_t waferIndex(int wafer, int index) const
int layerIndex(int lay, bool reco) const
constexpr std::array< uint8_t, layerIndexSize > layer
HGCalGeomTools geomTools_
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
const std::vector< double > & getRadiusLayer(int layer) const
std::pair< double, double > rangeR(double z, bool reco) const
std::map< int, HGCWaferParam > waferLayer_
int32_t tileIndex(int32_t layer, int32_t ring, int32_t phi)
std::vector< std::pair< int, int > > tileRingRange_
int modules(int lay, bool reco) const
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
unsigned int getTrFormN() const
double distFromEdgeTrap(double x, double y, double z) const
std::pair< double, double > rangeZ(bool reco) const
std::pair< int, int > tileRings(int layer) const
unsigned int layers(bool reco) const
int numberCellsHexagon(int wafer) const
std::vector< HGCalParameters::hgtrform > getTrForms() const
std::pair< double, double > cellEtaPhiTrap(int type, int irad) const
double mouseBite(bool reco) const
hgtrform getTrForm(unsigned int k) const
std::pair< int, float > getIndex(int lay, bool reco) const
int layer() const
get the layer #
HGCalDDDConstants(const HGCalParameters *hp, const std::string &name)
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
std::pair< float, float > localToGlobal8(int lay, int waferU, int waferV, double localX, double localY, bool reco, bool debug) const
double waferSepar(bool reco) const
bool tileTrapezoid() const
HGCalGeometryMode::GeometryMode geomMode() const
double waferSize(bool reco) const
bool isValidCell(int layindex, int wafer, int cell) const
int waferTypeL(int wafer) const
int getPhiBins(int lay) const
HGCalTypes::CellType cellType(int type, int waferU, int waferV) const
std::pair< int, int > getREtaRange(int lay) const
std::pair< int, int > rowColumnWafer(const int wafer) const
double waferZ(int layer, bool reco) const
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
bool waferVirtual(int layer, int waferU, int waferV) const
std::vector< double > slopeMin_
Basic2DVector< T > xy() const
std::array< int, 4 > waferMax_
int waferFromCopy(int copy) const
static constexpr double k_ScaleToDDD
constexpr uint16_t localX(uint16_t px)
int waferToCopy(int wafer) const
bool maskCell(const DetId &id, int corners) const
constexpr uint16_t localY(uint16_t py, uint16_t n)
std::array< int, 5 > assignCellHex(float x, float y, int lay, bool reco, bool extend=false, bool debug=false) const
int numberCells(bool reco) const
bool waferFullInLayer(int wafer, int lay, bool reco) const
bool isValidHex8(int lay, int waferU, int waferV, bool fullAndPart=false) const
const HGCalGeometryMode::GeometryMode mode_
int waferCount(const int type) const
std::pair< double, double > waferParameters(bool reco) const
bool waferFileInfoExist(int kk) const
std::array< int, 3 > HGCWaferParam
int32_t waferV(const int32_t index)
std::vector< int > waferCopy_
std::tuple< int, int, int > waferFileInfoFromIndex(int kk) const
bool waferHexagon8() const
int tileCount(int layer, int ring) const
bool tileExist(const int32_t *hex, int32_t zside, int32_t phi)
std::pair< double, double > waferPosition(int wafer, bool reco) const
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
static constexpr double tan30deg_
const double k_horizontalShift
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
std::vector< double > radiusLayer_[2]
std::array< uint32_t, 2 > tot_layers_
std::vector< int > waferTypeT_
std::vector< int > levelT_
int levelTop(int ind=0) const
int maxModulesPerLayer() const
waferInfo_map waferInfoMap_
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug=false) const
const HGCalParameters * hgpar_
std::pair< int, int > tileType(int layer, int ring, int phi) const
int layerFromIndex(int index, bool reco) const
int maxCells(bool reco) const
int modifyUV(int uv, int type1, int type2) const
T mod(const T &a, const T &b)
tileInfo_map tileInfoMap_
void etaPhiFromPosition(const double x, const double y, const double z, const int layer, int &ieta, int &iphi, int &type, double &wt) const
int waferTypeT(int wafer) const
std::vector< int > waferTypeL_
std::pair< double, double > rangeRLayer(int lay, bool reco) const
int getUVMax(int type) const
int getLayerOffset() const
double distFromEdgeHex(double x, double y, double z) const
bool waferInLayer(int wafer, int lay, bool reco) const
int waferType(DetId const &id, bool fromFile=false) const
unsigned int volumes() const