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>
16 #include <iostream>
21 
22 #include <unordered_map>
23 
25 
26 public:
27 
30 
31  enum class CellType {
36 
37  std::pair<int,int> assignCell(float x, float y, int lay, int subSec,
38  bool reco) const;
39  std::array<int,5> assignCellHex(float x, float y, int lay,
40  bool reco) const;
41  std::array<int,3> assignCellTrap(float x, float y, float z, int lay,
42  bool reco) const;
43  bool cellInLayer(int waferU, int waferV, int cellU, int cellV,
44  int lay, bool reco) const;
45  double cellSizeHex(int type) const;
46  std::pair<double,double> cellSizeTrap(int type, int irad) const {
47  return std::pair<double,double>(hgpar_->radiusLayer_[type][irad-1],
48  hgpar_->radiusLayer_[type][irad]);
49  }
50  double cellThickness(int layer, int waferU, int waferV) const;
51  CellType cellType(int type, int waferU, int waferV) const;
52  double distFromEdgeHex(double x, double y, double z) const;
53  double distFromEdgeTrap(double x, double y, double z) const;
54  void etaPhiFromPosition(const double x, const double y,
55  const double z, const int layer,
56  int& ieta, int& iphi, int& type,
57  double& wt) const;
58  int firstLayer() const {return hgpar_->firstLayer_;}
60  int getLayer(double z, bool reco) const;
61  HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const;
62  std::vector<HGCalParameters::hgtrap> getModules() const;
63  const HGCalParameters* getParameter() const {return hgpar_;}
64  HGCalParameters::hgtrform getTrForm(unsigned int k) const {return hgpar_->getTrForm(k);}
65  unsigned int getTrFormN() const {return hgpar_->trformIndex_.size();}
66  std::vector<HGCalParameters::hgtrform> getTrForms() const ;
67  int getTypeTrap(int layer) const;
68  int getTypeHex(int layer, int waferU, int waferV) const;
69  int getUVMax(int type) const
70  {return ((type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_);}
71  bool isHalfCell(int waferType, int cell) const;
72  bool isValidHex(int lay, int mod, int cell, bool reco) const;
73  bool isValidHex8(int lay, int modU, int modV, int cellU,
74  int cellV) const;
75  bool isValidTrap(int lay, int ieta, int iphi) const;
76  int lastLayer(bool reco) const;
77  int layerIndex(int lay, bool reco) const;
78  unsigned int layers(bool reco) const;
79  unsigned int layersInit(bool reco) const;
80  std::pair<float,float> locateCell(int cell, int lay, int type,
81  bool reco) const;
82  std::pair<float,float> locateCell(int lay, int waferU, int waferV, int cellU,
83  int cellV, bool reco, bool all,
84  bool debug=false) const;
85  std::pair<float,float> locateCellHex(int cell, int wafer, bool reco) const;
86  std::pair<float,float> locateCellTrap(int lay, int ieta, int iphi,
87  bool reco) const;
88  int levelTop(int ind=0) const {return hgpar_->levelT_[ind];}
89  bool maskCell(const DetId& id, int corners) const;
90  int maxCellUV() const {
92  2*hgpar_->nCellsFine_);}
93  int maxCells(bool reco) const;
94  int maxCells(int lay, bool reco) const;
95  int maxModules() const {return modHalf_;}
96  int maxMoudlesPerLayer() const {return maxWafersPerLayer_;}
97  int maxRows(int lay, bool reco) const;
98  double minSlope() const {return hgpar_->slopeMin_[0];}
99  int modifyUV(int uv, int type1, int type2) const;
100  int modules(int lay, bool reco) const;
101  int modulesInit(int lay, bool reco) const;
102  double mouseBite(bool reco) const;
103  int numberCells(bool reco) const;
104  std::vector<int> numberCells(int lay, bool reco) const;
105  int numberCellsHexagon(int wafer) const;
106  int numberCellsHexagon(int lay, int waferU, int waferV,
107  bool flag) const;
108  std::pair<double,double> rangeR(double z, bool reco) const;
109  std::pair<double,double> rangeZ(bool reco) const;
110  std::pair<int,int> rowColumnWafer(const int wafer) const;
111  int sectors() const {return hgpar_->nSectors_;}
112  std::pair<int,int> simToReco(int cell, int layer, int mod, bool half) const;
113  unsigned int volumes() const {return hgpar_->moduleLayR_.size();}
114  int waferFromCopy(int copy) const;
115  void waferFromPosition(const double x, const double y,
116  int& wafer, int& icell,
117  int& celltyp) const;
118  void waferFromPosition(const double x, const double y,
119  const int layer, int& waferU,
120  int& waferV, int& cellU, int& cellV,
121  int& celltype, double& wt,
122  bool debug=false) const;
123  bool waferInLayer(int wafer, int lay, bool reco) const;
124  bool waferFullInLayer(int wafer, int lay, bool reco) const;
125  int waferCount(const int type) const {return ((type == 0) ? waferMax_[2] : waferMax_[3]);}
126  int waferMax() const {return waferMax_[1];}
127  int waferMin() const {return waferMax_[0];}
128  std::pair<double,double> waferPosition(int wafer, bool reco) const;
129  std::pair<double,double> waferPosition(int waferU, int waferV, bool reco) const;
131  double waferSize(bool reco) const {return (reco ? hgpar_->waferSize_ : HGCalParameters::k_ScaleToDDD*hgpar_->waferSize_);}
132  int wafers() const;
133  int wafers(int layer, int type) const;
134  int waferToCopy(int wafer) const {return ((wafer>=0)&&(wafer< (int)(hgpar_->waferCopy_.size()))) ? hgpar_->waferCopy_[wafer] : (int)(hgpar_->waferCopy_.size());}
135  // wafer transverse thickness classification (2 = coarse, 1 = fine)
136  int waferTypeT(int wafer) const {return ((wafer>=0)&&(wafer<(int)(hgpar_->waferTypeT_.size()))) ? hgpar_->waferTypeT_[wafer] : 0;}
137  // wafer longitudinal thickness classification (1 = 100um, 2 = 200um, 3=300um)
138  int waferTypeL(int wafer) const {return ((wafer>=0)&&(wafer<(int)(hgpar_->waferTypeL_.size()))) ? hgpar_->waferTypeL_[wafer] : 0;}
139  int waferType(DetId const& id) const;
140  int waferUVMax() const {return hgpar_->waferUVMax_;}
141  bool waferVirtual(int layer, int waferU, int waferV) const;
142  double waferZ(int layer, bool reco) const;
143 
144 private:
145  int cellHex(double xx, double yy, const double& cellR,
146  const std::vector<double>& posX,
147  const std::vector<double>& posY) const;
148  void cellHex(double xloc, double yloc, int cellType, int& cellU,
149  int& cellV, bool debug=false) const;
150  std::pair<int,float> getIndex(int lay, bool reco) const;
151  bool isValidCell(int layindex, int wafer, int cell) const;
152  bool waferInLayerTest(int wafer, int lay, bool full) const;
153 
154  const double k_horizontalShift = 1.0;
155  const float dPhiMin = 0.02;
156  typedef std::array<std::vector<int32_t>, 2> Simrecovecs;
157  typedef std::array<int,3> HGCWaferParam;
159  constexpr static double tan30deg_ = 0.5773502693;
160  const double sqrt3_;
161  double rmax_, hexside_;
164  std::array<uint32_t,2> tot_layers_;
165  Simrecovecs max_modules_layer_;
167  std::map<int,HGCWaferParam> waferLayer_;
168  std::array<int,4> waferMax_;
169  std::unordered_map<int32_t,bool> waferIn_;
170 };
171 
172 #endif
bool isHalfCell(int waferType, int cell) const
type
Definition: HCALResponse.h:21
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
std::pair< double, double > cellSizeTrap(int type, int irad) const
std::array< uint32_t, 2 > tot_layers_
def copy(args, dbName)
std::map< int, HGCWaferParam > waferLayer_
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
std::array< int, 4 > waferMax_
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
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_
#define constexpr
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
std::pair< double, double > rangeR(double z, bool reco) const
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
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:180
double minSlope() const
CellType cellType(int type, int waferU, int waferV) const
std::unordered_map< int32_t, bool > waferIn_
HGCalGeometryMode::GeometryMode geomMode() const
double waferSize(bool reco) const
bool isValidCell(int layindex, int wafer, int cell) const
int waferTypeL(int wafer) const
int maxCellUV() 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
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::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]
int maxMoudlesPerLayer() const
int firstLayer() const
std::vector< int > waferTypeT_
std::vector< int > levelT_
int maxModules() const
int levelTop(int ind=0) 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_
double distFromEdgeHex(double x, double y, double z) const
std::array< int, 3 > HGCWaferParam
bool waferInLayer(int wafer, int lay, bool reco) const
unsigned int volumes() const