CMS 3D CMS Logo

HGCalTBDDDConstants.h
Go to the documentation of this file.
1 #ifndef HGCalCommonData_HGCalTBDDDConstants_h
2 #define HGCalCommonData_HGCalTBDDDConstants_h
3 
23 #include <CLHEP/Geometry/Point3D.h>
24 
25 #include <array>
26 #include <memory>
27 #include <string>
28 #include <vector>
29 #include <unordered_map>
30 
32 public:
34  ~HGCalTBDDDConstants() = default;
35 
36  std::pair<int, int> assignCell(float x, float y, int lay, int subSec, bool reco) const;
37  double cellSizeHex(int type) const;
38  double cellThickness(int layer, int wafer) const;
39  double distFromEdgeHex(double x, double y, double z) const;
40  inline int firstLayer() const { return hgpar_->firstLayer_; }
41  inline HGCalGeometryMode::GeometryMode geomMode() const { return mode_; }
42  int getLayer(double z, bool reco) const;
43  HGCalTBParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const;
44  std::vector<HGCalTBParameters::hgtrap> getModules() const;
45  inline const HGCalTBParameters* getParameter() const { return hgpar_; }
46  inline HGCalTBParameters::hgtrform getTrForm(unsigned int k) const { return hgpar_->getTrForm(k); }
47  inline unsigned int getTrFormN() const { return hgpar_->trformIndex_.size(); }
48  std::vector<HGCalTBParameters::hgtrform> getTrForms() const;
49  int getTypeHex(int layer, int wafer) const { return -1; }
50  bool isHalfCell(int waferType, int cell) const;
51  bool isValidHex(int lay, int mod, int cell, bool reco) const;
52  int lastLayer(bool reco) const;
53  int layerIndex(int lay, bool reco) const;
54  unsigned int layers(bool reco) const;
55  unsigned int layersInit(bool reco) const;
56  inline int layerType(int lay) const { return HGCalTypes::WaferCenter; }
57  std::pair<float, float> locateCell(int cell, int lay, int type, bool reco) const;
58  std::pair<float, float> locateCellHex(int cell, int wafer, bool reco) const;
59  inline int levelTop(int ind = 0) const { return hgpar_->levelT_[ind]; }
60  int maxCells(bool reco) const;
61  int maxCells(int lay, bool reco) const;
62  inline int maxModules() const { return modHalf_; }
63  inline int maxModulesPerLayer() const { return maxWafersPerLayer_; }
64  int maxRows(int lay, bool reco) const;
65  inline double minSlope() const { return hgpar_->slopeMin_[0]; }
66  int modifyUV(int uv, int type1, int type2) const;
67  int modules(int lay, bool reco) const;
68  int modulesInit(int lay, bool reco) const;
69  double mouseBite(bool reco) const;
70  int numberCells(bool reco) const;
71  std::vector<int> numberCells(int lay, bool reco) const;
72  int numberCellsHexagon(int wafer) const;
73  std::pair<double, double> rangeR(double z, bool reco) const;
74  std::pair<double, double> rangeRLayer(int lay, bool reco) const;
75  std::pair<double, double> rangeZ(bool reco) const;
76  std::pair<int, int> rowColumnWafer(const int wafer) const;
77  inline int sectors() const { return hgpar_->nSectors_; }
78  std::pair<int, int> simToReco(int cell, int layer, int mod, bool half) const;
79  inline unsigned int volumes() const { return hgpar_->moduleLayR_.size(); }
80  int waferFromCopy(int copy) const;
81  void waferFromPosition(const double x, const double y, int& wafer, int& icell, int& celltyp) const;
82  inline bool waferHexagon6() const {
84  }
85  bool waferInLayer(int wafer, int lay, bool reco) const;
86  bool waferFullInLayer(int wafer, int lay, bool reco) const;
87  inline int waferCount(const int type) const { return ((type == 0) ? waferMax_[2] : waferMax_[3]); }
88  inline int waferMax() const { return waferMax_[1]; }
89  inline int waferMin() const { return waferMax_[0]; }
90  std::pair<double, double> waferParameters(bool reco) const;
91  std::pair<double, double> waferPosition(int wafer, bool reco) const;
93  HepGeom::Point3D<float>& loc, const DetId& id, bool useWafer, bool reco, bool debug) const;
94  inline double waferSepar(bool reco) const {
96  }
97  inline double waferSize(bool reco) const {
99  }
100  int wafers() const;
101  int wafers(int layer, int type) const;
102  inline int waferToCopy(int wafer) const {
103  return ((wafer >= 0) && (wafer < static_cast<int>(hgpar_->waferCopy_.size())))
104  ? hgpar_->waferCopy_[wafer]
105  : static_cast<int>(hgpar_->waferCopy_.size());
106  }
107  // wafer transverse thickness classification (2 = coarse, 1 = fine)
108  inline int waferTypeT(int wafer) const {
109  return ((wafer >= 0) && (wafer < static_cast<int>(hgpar_->waferTypeT_.size()))) ? hgpar_->waferTypeT_[wafer] : 0;
110  }
111  // wafer longitudinal thickness classification (1 = 100um, 2 = 200um, 3=300um)
112  inline int waferTypeL(int wafer) const {
113  return ((wafer >= 0) && (wafer < static_cast<int>(hgpar_->waferTypeL_.size()))) ? hgpar_->waferTypeL_[wafer] : 0;
114  }
115  int waferType(DetId const& id) const;
116  int waferType(int layer, int wafer) const;
117  std::tuple<int, int, int> waferType(HGCSiliconDetId const& id, bool fromFile = false) const;
118  inline int waferUVMax() const { return hgpar_->waferUVMax_; }
119  bool waferVirtual(int layer, int wafer) const;
120  double waferZ(int layer, bool reco) const;
121 
122 private:
123  int cellHex(double xx,
124  double yy,
125  const double& cellR,
126  const std::vector<double>& posX,
127  const std::vector<double>& posY) const;
128  std::pair<int, float> getIndex(int lay, bool reco) const;
129  int layerFromIndex(int index, bool reco) const;
130  bool isValidCell(int layindex, int wafer, int cell) const;
131  int32_t waferIndex(int wafer, int index) const;
132  bool waferInLayerTest(int wafer, int lay) const { return waferHexagon6(); }
133 
135  const double k_horizontalShift = 1.0;
136  const float dPhiMin = 0.02;
137  typedef std::array<std::vector<int32_t>, 2> Simrecovecs;
138  typedef std::array<int, 3> HGCWaferParam;
140  constexpr static double tan30deg_ = 0.5773502693;
141  const double sqrt3_;
143  double rmax_, hexside_;
144  double rmaxT_, hexsideT_;
146  std::array<uint32_t, 2> tot_layers_;
149  std::map<int, HGCWaferParam> waferLayer_;
150  std::array<int, 4> waferMax_;
151  std::unordered_map<int32_t, bool> waferIn_;
152 };
153 
154 #endif
const HGCalGeometryMode::GeometryMode mode_
int layerType(int lay) const
std::pair< double, double > rangeZ(bool reco) const
int waferToCopy(int wafer) const
static constexpr int32_t WaferCenter
Definition: HGCalTypes.h:21
GlobalPoint waferLocal2Global(HepGeom::Point3D< float > &loc, const DetId &id, bool useWafer, bool reco, bool debug) const
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
int32_t waferIndex(int wafer, int index) const
bool waferInLayer(int wafer, int lay, bool reco) const
const HGCalTBParameters * getParameter() const
int lastLayer(bool reco) const
std::vector< int > waferCopy_
int levelTop(int ind=0) const
std::vector< HGCalTBParameters::hgtrform > getTrForms() const
std::array< uint32_t, 2 > tot_layers_
const double k_horizontalShift
int numberCellsHexagon(int wafer) const
double waferZ(int layer, bool reco) const
bool isHalfCell(int waferType, int cell) const
std::vector< int > waferTypeL_
std::pair< double, double > waferParameters(bool reco) const
bool waferVirtual(int layer, int wafer) const
std::vector< int > moduleLayR_
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
std::array< int, 4 > waferMax_
std::vector< HGCalTBParameters::hgtrap > getModules() const
const HGCalTBParameters * hgpar_
int waferTypeL(int wafer) const
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
double mouseBite(bool reco) const
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > slopeMin_
std::pair< double, double > rangeR(double z, bool reco) const
static constexpr double k_ScaleToDDD
hgtrform getTrForm(unsigned int k) const
int waferTypeT(int wafer) const
unsigned int layersInit(bool reco) const
double waferSepar(bool reco) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::pair< double, double > rangeRLayer(int lay, bool reco) const
int layerFromIndex(int index, bool reco) const
int maxRows(int lay, bool reco) const
std::vector< int > waferTypeT_
std::map< int, HGCWaferParam > waferLayer_
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
unsigned int volumes() const
std::array< int, 3 > HGCWaferParam
std::pair< double, double > waferPosition(int wafer, bool reco) const
bool isValidCell(int layindex, int wafer, int cell) const
std::vector< int > levelT_
int layerIndex(int lay, bool reco) const
~HGCalTBDDDConstants()=default
std::array< std::vector< int32_t >, 2 > Simrecovecs
Definition: DetId.h:17
double cellThickness(int layer, int wafer) const
double cellSizeHex(int type) const
bool waferFullInLayer(int wafer, int lay, bool reco) const
unsigned int getTrFormN() const
#define debug
Definition: HDRShower.cc:19
HGCalTBParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
int getTypeHex(int layer, int wafer) const
static constexpr double tan30deg_
int waferCount(const int type) const
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
std::pair< int, int > rowColumnWafer(const int wafer) const
double distFromEdgeHex(double x, double y, double z) const
int modifyUV(int uv, int type1, int type2) const
int maxModulesPerLayer() const
std::vector< uint32_t > trformIndex_
std::unordered_map< int32_t, bool > waferIn_
fixed size matrix
unsigned int layers(bool reco) const
HGCalGeometryMode::GeometryMode geomMode() const
int waferType(DetId const &id) const
bool isValidHex(int lay, int mod, int cell, bool reco) const
bool waferInLayerTest(int wafer, int lay) const
int maxCells(bool reco) const
int modulesInit(int lay, bool reco) const
double waferSize(bool reco) const
int getLayer(double z, bool reco) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
int modules(int lay, bool reco) const
int waferFromCopy(int copy) const
HGCalTBParameters::hgtrform getTrForm(unsigned int k) const
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
int numberCells(bool reco) const
HGCalTBDDDConstants(const HGCalTBParameters *hp, const std::string &name)