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,
46  bool reco) const;
47  std::array<int, 5> assignCellHex(float x, float y, int lay, bool reco) const;
48  std::array<int, 3> assignCellTrap(float x, float y, float z, int lay,
49  bool reco) const;
50  std::pair<double, double> cellEtaPhiTrap(int type, int irad) const;
51  bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay,
52  bool reco) const;
53  double cellSizeHex(int type) const;
54  std::pair<double, double> cellSizeTrap(int type, int irad) const {
55  return std::make_pair(hgpar_->radiusLayer_[type][irad - 1],
56  hgpar_->radiusLayer_[type][irad]);
57  }
58  double cellThickness(int layer, int waferU, int waferV) const;
59  CellType cellType(int type, int waferU, int waferV) const;
60  double distFromEdgeHex(double x, double y, double z) const;
61  double distFromEdgeTrap(double x, double y, double z) const;
62  void etaPhiFromPosition(const double x, const double y, const double z,
63  const int layer, int& ieta, int& iphi, int& type,
64  double& wt) const;
65  int firstLayer() const { return hgpar_->firstLayer_; }
67  int getLayer(double z, bool reco) const;
68  HGCalParameters::hgtrap getModule(unsigned int k, bool hexType,
69  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) ?
76  hgpar_->scintType(layer) : 0);
77  return hgpar_->radiusLayer_[type];
78  }
79  HGCalParameters::hgtrform getTrForm(unsigned int k) const {
80  return hgpar_->getTrForm(k);
81  }
82  unsigned int getTrFormN() const { return hgpar_->trformIndex_.size(); }
83  std::vector<HGCalParameters::hgtrform> getTrForms() const;
84  int getTypeTrap(int layer) const;
85  int getTypeHex(int layer, int waferU, int waferV) const;
86  int getUVMax(int type) const {
87  return ((type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_);
88  }
89  bool isHalfCell(int waferType, int cell) const;
90  bool isValidHex(int lay, int mod, int cell, bool reco) const;
91  bool isValidHex8(int lay, int modU, int modV, int cellU, int cellV) const;
92  bool isValidTrap(int lay, int ieta, int iphi) const;
93  int lastLayer(bool reco) const;
94  int layerIndex(int lay, bool reco) const;
95  unsigned int layers(bool reco) const;
96  unsigned int layersInit(bool reco) const;
97  std::pair<float, float> locateCell(int cell, int lay, int type,
98  bool reco) const;
99  std::pair<float, float> locateCell(int lay, int waferU, int waferV, int cellU,
100  int cellV, bool reco, bool all,
101  bool debug = false) const;
102  std::pair<float, float> locateCellHex(int cell, int wafer, bool reco) const;
103  std::pair<float, float> locateCellTrap(int lay, int ieta, int iphi,
104  bool reco) const;
105  int levelTop(int ind = 0) const { return hgpar_->levelT_[ind]; }
106  bool maskCell(const DetId& id, int corners) const;
107  int maxCellUV() const {
109  : 2 * hgpar_->nCellsFine_);
110  }
111  int maxCells(bool reco) const;
112  int maxCells(int lay, bool reco) const;
113  int maxModules() const { return modHalf_; }
114  int maxModulesPerLayer() const { return maxWafersPerLayer_; }
115  int maxRows(int lay, bool reco) const;
116  double minSlope() const { return hgpar_->slopeMin_[0]; }
117  int modifyUV(int uv, int type1, int type2) const;
118  int modules(int lay, bool reco) const;
119  int modulesInit(int lay, bool reco) const;
120  double mouseBite(bool reco) const;
121  int numberCells(bool reco) const;
122  std::vector<int> numberCells(int lay, bool reco) const;
123  int numberCellsHexagon(int wafer) const;
124  int numberCellsHexagon(int lay, int waferU, int waferV, bool flag) const;
125  std::pair<double, double> rangeR(double z, bool reco) const;
126  std::pair<double, double> rangeZ(bool reco) const;
127  std::pair<int, int> rowColumnWafer(const int wafer) const;
128  int sectors() const { return hgpar_->nSectors_; }
129  std::pair<int, int> simToReco(int cell, int layer, int mod, bool half) const;
130  unsigned int volumes() const { return hgpar_->moduleLayR_.size(); }
131  int waferFromCopy(int copy) const;
132  void waferFromPosition(const double x, const double y, int& wafer, int& icell,
133  int& celltyp) const;
134  void waferFromPosition(const double x, const double y, const int layer,
135  int& waferU, int& waferV, int& cellU, int& cellV,
136  int& celltype, double& wt, bool debug = false) const;
137  bool waferInLayer(int wafer, int lay, bool reco) const;
138  bool waferFullInLayer(int wafer, int lay, bool reco) const;
139  int waferCount(const int type) const {
140  return ((type == 0) ? waferMax_[2] : waferMax_[3]);
141  }
142  int waferMax() const { return waferMax_[1]; }
143  int waferMin() const { return waferMax_[0]; }
144  std::pair<double, double> waferPosition(int wafer, bool reco) const;
145  std::pair<double, double> waferPosition(int waferU, int waferV,
146  bool reco) const;
147  double waferSepar(bool reco) const {
148  return (reco ? hgpar_->sensorSeparation_
150  }
151  double waferSize(bool reco) const {
152  return (reco ? hgpar_->waferSize_
154  }
155  int wafers() const;
156  int wafers(int layer, int type) const;
157  int waferToCopy(int wafer) const {
158  return ((wafer >= 0) && (wafer < (int)(hgpar_->waferCopy_.size())))
159  ? hgpar_->waferCopy_[wafer]
160  : (int)(hgpar_->waferCopy_.size());
161  }
162  // wafer transverse thickness classification (2 = coarse, 1 = fine)
163  int waferTypeT(int wafer) const {
164  return ((wafer >= 0) && (wafer < (int)(hgpar_->waferTypeT_.size())))
165  ? hgpar_->waferTypeT_[wafer]
166  : 0;
167  }
168  // wafer longitudinal thickness classification (1 = 100um, 2 = 200um, 3=300um)
169  int waferTypeL(int wafer) const {
170  return ((wafer >= 0) && (wafer < (int)(hgpar_->waferTypeL_.size())))
171  ? hgpar_->waferTypeL_[wafer]
172  : 0;
173  }
174  int waferType(DetId const& id) const;
175  int waferUVMax() const { return hgpar_->waferUVMax_; }
176  bool waferVirtual(int layer, int waferU, int waferV) const;
177  double waferZ(int layer, bool reco) const;
178 
179  private:
180  int cellHex(double xx, double yy, const double& cellR,
181  const std::vector<double>& posX,
182  const std::vector<double>& posY) const;
183  void cellHex(double xloc, double yloc, int cellType, int& cellU, int& cellV,
184  bool debug = false) const;
185  std::pair<int, float> getIndex(int lay, bool reco) const;
186  bool isValidCell(int layindex, int wafer, int cell) const;
187  bool waferInLayerTest(int wafer, int lay, bool full) const;
188 
189  const double k_horizontalShift = 1.0;
190  const float dPhiMin = 0.02;
191  typedef std::array<std::vector<int32_t>, 2> Simrecovecs;
192  typedef std::array<int, 3> HGCWaferParam;
194  constexpr static double tan30deg_ = 0.5773502693;
195  const double sqrt3_;
196  double rmax_, hexside_;
199  std::array<uint32_t, 2> tot_layers_;
200  Simrecovecs max_modules_layer_;
202  std::map<int, HGCWaferParam> waferLayer_;
203  std::array<int, 4> waferMax_;
204  std::unordered_map<int32_t, bool> waferIn_;
205 };
206 
207 #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
def copy(args, dbName)
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
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 k[5][pyjets_maxn]
int waferType(DetId const &id) const
bool waferVirtual(int layer, int waferU, int waferV) const
std::vector< double > slopeMin_
Definition: DetId.h:18
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