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;
88 int lay,
int waferU,
int waferV,
int cellU,
int cellV,
bool reco,
bool all,
bool debug =
false)
const;
91 std::pair<float, float>
locateCellHex(
int cell,
int wafer,
bool reco)
const;
92 std::pair<float, float>
locateCellTrap(
int lay,
int ieta,
int iphi,
bool reco)
const;
97 int maxCells(
int lay,
bool reco)
const;
100 int maxRows(
int lay,
bool reco)
const;
102 int modifyUV(
int uv,
int type1,
int type2)
const;
103 int modules(
int lay,
bool reco)
const;
107 std::vector<int>
numberCells(
int lay,
bool reco)
const;
110 std::pair<double, double>
rangeR(
double z,
bool reco)
const;
111 std::pair<double, double>
rangeRLayer(
int lay,
bool reco)
const;
112 std::pair<double, double>
rangeZ(
bool reco)
const;
129 return std::make_pair(0, 0);
138 int type(-1), sipm(-1);
141 type = 1 + (itr->second).type;
144 return std::make_pair(type, sipm);
148 void waferFromPosition(
const double x,
const double y,
int& wafer,
int& icell,
int& celltyp)
const;
159 bool debug =
false)
const;
173 std::pair<double, double>
waferPosition(
int wafer,
bool reco)
const;
174 std::pair<double, double>
waferPosition(
int lay,
int waferU,
int waferV,
bool reco,
bool debug =
false)
const;
177 if (kk < hgpar_->waferInfoMap_.size()) {
179 std::advance(itr, kk);
185 if (kk < hgpar_->waferInfoMap_.size()) {
187 std::advance(itr, kk);
188 return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient);
190 return std::make_tuple(0, 0, 0);
195 return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient);
197 return std::make_tuple(0, 0, 0);
204 HepGeom::Point3D<float>& loc,
const DetId&
id,
bool useWafer,
bool reco,
bool debug)
const {
212 auto xy =
getXY(detid.
layer(), (x + loc.x()), (y + loc.y()),
false);
215 double xx = (detid.
zside() < 0) ? -
xy.first :
xy.first;
224 return ((wafer >= 0) && (wafer < static_cast<int>(
hgpar_->
waferCopy_.size())))
237 int waferType(
int layer,
int waferU,
int waferV,
bool fromFile =
false)
const;
240 int layer,
int waferU,
int waferV,
bool fromFile =
false,
bool debug =
false)
const;
249 const std::vector<double>& posX,
250 const std::vector<double>& posY)
const;
252 double xloc,
double yloc,
int cellType,
int& cellU,
int& cellV,
bool extend =
false,
bool debug =
false)
const;
253 std::pair<int, float>
getIndex(
int lay,
bool reco)
const;
255 bool isValidCell(
int layindex,
int wafer,
int cell)
const;
256 bool isValidCell8(
int lay,
int waferU,
int waferV,
int cellU,
int cellV,
int type)
const;
259 std::pair<double, double>
waferPositionNoRot(
int lay,
int waferU,
int waferV,
bool reco,
bool debug =
false)
const;
260 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
constexpr uint16_t localY(uint16_t py)
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
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