CMS 3D CMS Logo

HGCalDDDConstants.h
Go to the documentation of this file.
1 #ifndef HGCalCommonData_HGCalDDDConstants_h
2 #define HGCalCommonData_HGCalDDDConstants_h
3 
14 #include <string>
15 #include <vector>
20 
21 #include <unordered_map>
22 
24 public:
27 
28  enum class CellType {
29  UndefinedType = -1,
30  CentralType = 0,
31  BottomLeftEdge = 1,
32  LeftEdge = 2,
33  TopLeftEdge = 3,
34  TopRightEdge = 4,
35  RightEdge = 5,
36  BottomRightEdge = 6,
37  BottomCorner = 11,
38  BottomLeftCorner = 12,
39  TopLeftCorner = 13,
40  TopCorner = 14,
41  TopRightCorner = 15,
43  };
44 
45  std::pair<int, int> assignCell(float x, float y, int lay, int subSec, bool reco) const;
46  std::array<int, 5> assignCellHex(float x, float y, int lay, bool reco) const;
47  std::array<int, 3> assignCellTrap(float x, float y, float z, int lay, bool reco) const;
48  std::pair<double, double> cellEtaPhiTrap(int type, int irad) const;
49  bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const;
50  double cellSizeHex(int type) const;
51  std::pair<double, double> cellSizeTrap(int type, int irad) const {
52  return std::make_pair(hgpar_->radiusLayer_[type][irad - 1], hgpar_->radiusLayer_[type][irad]);
53  }
54  double cellThickness(int layer, int waferU, int waferV) const;
55  CellType cellType(int type, int waferU, int waferV) const;
56  double distFromEdgeHex(double x, double y, double z) const;
57  double distFromEdgeTrap(double x, double y, double z) const;
58  void etaPhiFromPosition(const double x,
59  const double y,
60  const double z,
61  const int layer,
62  int& ieta,
63  int& iphi,
64  int& type,
65  double& wt) const;
66  int firstLayer() const { return hgpar_->firstLayer_; }
68  int getLayer(double z, bool reco) const;
69  HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const;
70  std::vector<HGCalParameters::hgtrap> getModules() const;
71  const HGCalParameters* getParameter() const { return hgpar_; }
72  int getPhiBins(int lay) const;
73  std::pair<int, int> getREtaRange(int lay) const;
74  const std::vector<double>& getRadiusLayer(int layer) const {
75  int type = ((mode_ == HGCalGeometryMode::Trapezoid) ? hgpar_->scintType(layer) : 0);
76  return hgpar_->radiusLayer_[type];
77  }
78  HGCalParameters::hgtrform getTrForm(unsigned int k) const { return hgpar_->getTrForm(k); }
79  unsigned int getTrFormN() const { return hgpar_->trformIndex_.size(); }
80  std::vector<HGCalParameters::hgtrform> getTrForms() const;
81  int getTypeTrap(int layer) const;
82  int getTypeHex(int layer, int waferU, int waferV) const;
83  int getUVMax(int type) const { return ((type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_); }
84  bool isHalfCell(int waferType, int cell) const;
85  bool isValidHex(int lay, int mod, int cell, bool reco) const;
86  bool isValidHex8(int lay, int modU, int modV, int cellU, int cellV) const;
87  bool isValidTrap(int lay, int ieta, int iphi) const;
88  int lastLayer(bool reco) const;
89  int layerIndex(int lay, bool reco) const;
90  unsigned int layers(bool reco) const;
91  unsigned int layersInit(bool reco) const;
92  std::pair<float, float> locateCell(int cell, int lay, int type, bool reco) const;
93  std::pair<float, float> locateCell(
94  int lay, int waferU, int waferV, int cellU, int cellV, bool reco, bool all, bool debug = false) const;
95  std::pair<float, float> locateCellHex(int cell, int wafer, bool reco) const;
96  std::pair<float, float> locateCellTrap(int lay, int ieta, int iphi, bool reco) const;
97  int levelTop(int ind = 0) const { return hgpar_->levelT_[ind]; }
98  bool maskCell(const DetId& id, int corners) const;
99  int maxCellUV() const {
101  }
102  int maxCells(bool reco) const;
103  int maxCells(int lay, bool reco) const;
104  int maxModules() const { return modHalf_; }
105  int maxModulesPerLayer() const { return maxWafersPerLayer_; }
106  int maxRows(int lay, bool reco) const;
107  double minSlope() const { return hgpar_->slopeMin_[0]; }
108  int modifyUV(int uv, int type1, int type2) const;
109  int modules(int lay, bool reco) const;
110  int modulesInit(int lay, bool reco) const;
111  double mouseBite(bool reco) const;
112  int numberCells(bool reco) const;
113  std::vector<int> numberCells(int lay, bool reco) const;
114  int numberCellsHexagon(int wafer) const;
115  int numberCellsHexagon(int lay, int waferU, int waferV, bool flag) const;
116  std::pair<double, double> rangeR(double z, bool reco) const;
117  std::pair<double, double> rangeZ(bool reco) const;
118  std::pair<int, int> rowColumnWafer(const int wafer) const;
119  int sectors() const { return hgpar_->nSectors_; }
120  std::pair<int, int> simToReco(int cell, int layer, int mod, bool half) const;
121  unsigned int volumes() const { return hgpar_->moduleLayR_.size(); }
122  int waferFromCopy(int copy) const;
123  void waferFromPosition(const double x, const double y, int& wafer, int& icell, int& celltyp) const;
124  void waferFromPosition(const double x,
125  const double y,
126  const int layer,
127  int& waferU,
128  int& waferV,
129  int& cellU,
130  int& cellV,
131  int& celltype,
132  double& wt,
133  bool debug = false) const;
134  bool waferInLayer(int wafer, int lay, bool reco) const;
135  bool waferFullInLayer(int wafer, int lay, bool reco) const;
136  int waferCount(const int type) const { return ((type == 0) ? waferMax_[2] : waferMax_[3]); }
137  int waferMax() const { return waferMax_[1]; }
138  int waferMin() const { return waferMax_[0]; }
139  std::pair<double, double> waferPosition(int wafer, bool reco) const;
140  std::pair<double, double> waferPosition(int lay, int waferU, int waferV, bool reco, bool debug = false) const;
141  double waferSepar(bool reco) const {
143  }
144  double waferSize(bool reco) const {
146  }
147  int wafers() const;
148  int wafers(int layer, int type) const;
149  int waferToCopy(int wafer) const {
150  return ((wafer >= 0) && (wafer < (int)(hgpar_->waferCopy_.size()))) ? hgpar_->waferCopy_[wafer]
151  : (int)(hgpar_->waferCopy_.size());
152  }
153  // wafer transverse thickness classification (2 = coarse, 1 = fine)
154  int waferTypeT(int wafer) const {
155  return ((wafer >= 0) && (wafer < (int)(hgpar_->waferTypeT_.size()))) ? hgpar_->waferTypeT_[wafer] : 0;
156  }
157  // wafer longitudinal thickness classification (1 = 100um, 2 = 200um, 3=300um)
158  int waferTypeL(int wafer) const {
159  return ((wafer >= 0) && (wafer < (int)(hgpar_->waferTypeL_.size()))) ? hgpar_->waferTypeL_[wafer] : 0;
160  }
161  int waferType(DetId const& id) const;
162  int waferType(int layer, int waferU, int waferV) const;
163  int waferUVMax() const { return hgpar_->waferUVMax_; }
164  bool waferVirtual(int layer, int waferU, int waferV) const;
165  double waferZ(int layer, bool reco) const;
166 
167 private:
168  int cellHex(double xx,
169  double yy,
170  const double& cellR,
171  const std::vector<double>& posX,
172  const std::vector<double>& posY) const;
173  void cellHex(double xloc, double yloc, int cellType, int& cellU, int& cellV, bool debug = false) const;
174  std::pair<int, float> getIndex(int lay, bool reco) const;
175  bool isValidCell(int layindex, int wafer, int cell) const;
176  bool isValidCell8(int lay, int waferU, int waferV, int cellU, int cellV, int type) const;
177  bool waferInLayerTest(int wafer, int lay, bool full) const;
178  std::pair<double, double> waferPosition(int waferU, int waferV, bool reco) const;
179 
180  const double k_horizontalShift = 1.0;
181  const float dPhiMin = 0.02;
182  typedef std::array<std::vector<int32_t>, 2> Simrecovecs;
183  typedef std::array<int, 3> HGCWaferParam;
185  constexpr static double tan30deg_ = 0.5773502693;
186  const double sqrt3_;
187  double rmax_, hexside_;
190  std::array<uint32_t, 2> tot_layers_;
191  Simrecovecs max_modules_layer_;
193  std::map<int, HGCWaferParam> waferLayer_;
194  std::array<int, 4> waferMax_;
195  std::unordered_map<int32_t, bool> waferIn_;
196 };
197 
198 #endif
bool isHalfCell(int waferType, int cell) const
type
Definition: HCALResponse.h:21
std::pair< double, double > cellSizeTrap(int type, int irad) const
bool isValidTrap(int lay, int ieta, int iphi) const
int getTypeTrap(int layer) const
int getLayer(double z, bool reco) const
std::vector< HGCalParameters::hgtrap > getModules() const
int scintType(const int layer) const
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
std::vector< int > moduleLayR_
double cellSizeHex(int type) const
HGCalParameters::hgtrform getTrForm(unsigned int k) const
Simrecovecs max_modules_layer_
int lastLayer(bool reco) const
double cellThickness(int layer, int waferU, int waferV) const
unsigned int layersInit(bool reco) const
std::array< std::vector< int32_t >, 2 > Simrecovecs
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
bool waferInLayerTest(int wafer, int lay, bool full) const
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
HGCalGeometryMode::GeometryMode mode_
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
int layerIndex(int lay, bool reco) const
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_
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
unsigned int layers(bool reco) const
bool isValidHex8(int lay, int modU, int modV, int cellU, int cellV) 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
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
hgtrform getTrForm(unsigned int k) const
std::pair< int, float > getIndex(int lay, bool reco) const
HGCalDDDConstants(const HGCalParameters *hp, const std::string &name)
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
double waferSepar(bool reco) const
Definition: GenABIO.cc:168
double minSlope() const
CellType cellType(int type, int waferU, int waferV) 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
int maxCellUV() 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
int waferType(DetId const &id) const
bool waferVirtual(int layer, int waferU, int waferV) const
std::vector< double > slopeMin_
Definition: DetId.h:17
std::array< int, 4 > waferMax_
int waferFromCopy(int copy) const
#define debug
Definition: HDRShower.cc:19
static double k_ScaleToDDD
int waferToCopy(int wafer) const
bool maskCell(const DetId &id, int corners) const
int waferUVMax() const
int numberCells(bool reco) const
bool waferFullInLayer(int wafer, int lay, bool reco) const
int waferCount(const int type) const
fixed size matrix
std::array< int, 5 > assignCellHex(float x, float y, int lay, bool reco) const
std::array< int, 3 > HGCWaferParam
std::vector< int > waferCopy_
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
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_
int firstLayer() const
std::vector< int > waferTypeT_
std::vector< int > levelT_
int maxModules() const
int levelTop(int ind=0) const
int maxModulesPerLayer() const
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
const HGCalParameters * hgpar_
int maxCells(bool reco) const
int modifyUV(int uv, int type1, int type2) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
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_
int getUVMax(int type) const
static double tan30deg_
#define constexpr
double distFromEdgeHex(double x, double y, double z) const
bool waferInLayer(int wafer, int lay, bool reco) const
unsigned int volumes() const