CMS 3D CMS Logo

HcalDDDRecConstants.h
Go to the documentation of this file.
1 #ifndef Geometry_HcalTowerAlgo_HcalDDDRecConstants_h
2 #define Geometry_HcalTowerAlgo_HcalDDDRecConstants_h
3 
13 #include <map>
14 #include <string>
15 #include <vector>
16 #include <iostream>
17 
22 
24 public:
27 
28  struct HcalID {
29  int subdet, eta, phi, depth;
30  HcalID(int sub = 0, int et = 0, int fi = 0, int d = 0) : subdet(sub), eta(et), phi(fi), depth(d) {}
31  };
32  struct HcalEtaBin {
34  double dphi, etaMin, etaMax;
35  std::vector<std::pair<int, int>> layer;
36  std::vector<std::pair<int, double>> phis;
37  HcalEtaBin(int eta = 0, int zs = 1, double dfi = 0, double et1 = 0, double et2 = 0)
38  : ieta(eta), zside(zs), depthStart(0), dphi(dfi), etaMin(et1), etaMax(et2) {}
39  };
42  double eta, thick;
43  std::vector<int> iphis;
44  HcalActiveLength(int ie = 0, int d = 0, int z = 0, int s = 0, double et = 0, double t = 0)
45  : ieta(ie), depth(d), zside(z), stype(s), eta(et), thick(t) {}
46  };
49  double rMin, rMax;
50  HFCellParameters(int ie = 0, int d = 1, int ffi = 1, int sfi = 2, int nfi = 36, double r1 = 0, double r2 = 0)
51  : ieta(ie), depth(d), firstPhi(ffi), stepPhi(sfi), nPhi(nfi), rMin(r1), rMax(r2) {}
52  };
53 
54  std::vector<std::pair<double, double>> getConstHBHE(const int& type) const {
55  if (type == 0)
56  return gconsHB;
57  else if (type == 1)
58  return gconsHE;
59  else {
60  std::vector<std::pair<double, double>> gcons;
61  return gcons;
62  }
63  }
64  std::vector<int> getDepth(const int& det, const int& phi, const int& zside, const unsigned int& eta) const;
65  std::vector<int> getDepth(const unsigned int& eta, const bool& extra) const;
66  int getDepthEta16(const int& det, const int& iphi, const int& zside) const {
67  return hcons.getDepthEta16(det, iphi, zside);
68  }
69  int getDepthEta29(const int& iphi, const int& zside, const int& type) const {
70  return hcons.getDepthEta29(iphi, zside, type);
71  }
72  std::vector<HcalEtaBin> getEtaBins(const int& itype) const;
73  std::pair<double, double> getEtaPhi(const int& subdet, const int& ieta, const int& iphi) const;
74  std::pair<int, int> getEtaRange(const int& i) const { return std::pair<int, int>(iEtaMin[i], iEtaMax[i]); }
75  const std::vector<double>& getEtaTable() const { return etaTable; }
76  const std::vector<double>& getEtaTableHF() const { return hpar->etaTableHF; }
77  std::pair<double, double> getEtaLimit(const int& i) const {
78  return std::pair<double, double>(etaTable[i], etaTable[i + 1]);
79  }
80  HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const;
81  std::vector<HFCellParameters> getHFCellParameters() const;
82  void getLayerDepth(const int& ieta, std::map<int, int>& layers) const;
83  int getLayerBack(const int& det, const int& eta, const int& phi, const int& depth) const;
84  int getLayerFront(const int& det, const int& eta, const int& phi, const int& depth) const;
85  double getLayer0Wt(const int& det, const int& phi, const int& zside) const {
86  return hcons.getLayer0Wt(det, phi, zside);
87  }
88  int getMaxDepth(const int& type) const { return maxDepth[type]; }
89  int getMaxDepth(const int& itype, const int& ieta, const int& iphi, const int& zside) const;
90  int getMinDepth(const int& itype, const int& ieta, const int& iphi, const int& zside) const;
91  int getNEta() const { return hpar->etagroup.size(); }
92  int getNoff(const int& i) const { return hpar->noff[i]; }
93  int getNPhi(const int& type) const { return nPhiBins[type]; }
94  double getPhiBin(const int& i) const { return phibin[i]; }
95  double getPhiOff(const int& i) const { return hpar->phioff[i]; }
96  const std::vector<double>& getPhiOffs() const { return hpar->phioff; }
97  std::vector<std::pair<int, double>> getPhis(const int& subdet, const int& ieta) const;
98  const std::vector<double>& getPhiTable() const { return phibin; }
99  const std::vector<double>& getPhiTableHF() const { return hpar->phitable; }
100  int getPhiZOne(std::vector<std::pair<int, int>>& phiz) const;
101  double getRZ(const int& subdet, const int& ieta, const int& depth) const;
102  double getRZ(const int& subdet, const int& ieta, const int& iphi, const int& depth) const;
103  double getRZ(const int& subdet, const int& layer) const;
104  std::pair<double, double> getRZ(const HcalDetId& id) const;
105  std::vector<HcalActiveLength> getThickActive(const int& type) const;
106  int getTopoMode() const { return ((hpar->topologyMode) & 0xFF); }
107  int getTriggerMode() const { return (((hpar->topologyMode) >> 8) & 0xFF); }
108  std::vector<HcalCellType> HcalCellTypes(HcalSubdetector) const;
109  bool isBH() const { return hcons.isBH(); }
110  bool isHE() const { return hcons.isHE(); }
111  bool isPlan1(const HcalDetId& id) const { return detIdSp_.find(id) != detIdSp_.end(); };
112  int maxHFDepth(int ieta, int iphi) const { return hcons.maxHFDepth(ieta, iphi); }
113  bool mergedDepthList29(int ieta, int iphi, int depth) const;
114  std::vector<int> mergedDepthList29(int ieta, int iphi) const;
115  unsigned int numberOfCells(HcalSubdetector) const;
116  unsigned int nCells(HcalSubdetector) const;
117  unsigned int nCells() const;
118  HcalDetId mergedDepthDetId(const HcalDetId& id) const;
119  HcalDetId idFront(const HcalDetId& id) const;
120  HcalDetId idBack(const HcalDetId& id) const;
121  void unmergeDepthDetId(const HcalDetId& id, std::vector<HcalDetId>& ids) const;
122  void specialRBXHBHE(const std::vector<HcalDetId>&, std::vector<HcalDetId>&) const;
123  bool specialRBXHBHE(bool flag, std::vector<HcalDetId>&) const;
124  bool withSpecialRBXHBHE() const { return (hcons.ldMap()->getSubdet() != 0); }
125  bool isPlan1ToBeMergedId(const HcalDetId& id) const { return detIdSp_.find(id) != detIdSp_.end(); };
126  bool isPlan1MergedId(const HcalDetId& id) const { return detIdSpR_.find(id) != detIdSpR_.end(); };
127  const HcalDDDSimConstants* dddConstants() const { return &hcons; }
128 
129 private:
130  void getOneEtaBin(HcalSubdetector subdet,
131  int ieta,
132  int zside,
133  std::vector<std::pair<int, double>>& phis,
134  std::map<int, int>& layers,
135  bool planOne,
136  std::vector<HcalDDDRecConstants::HcalEtaBin>& bins) const;
137  void initialize(void);
138  unsigned int layerGroupSize(int eta) const;
139  unsigned int layerGroup(int eta, int i) const;
140 
141  static const int maxLayer_ = 18;
142  static const int maxLayerHB_ = 16;
145  std::vector<std::pair<int, int>> etaSimValu; // eta ranges at Sim stage
146  std::vector<double> etaTable; // Eta table (HB+HE)
147  std::vector<int> ietaMap; // Map Sim level ieta to Rec level ieta
148  std::vector<int> iEtaMin, iEtaMax; // Minimum and maximum eta
149  std::vector<int> maxDepth; // Maximum depth in HB/HE/HF/HO
150  std::vector<int> nPhiBins; // Number of phi bis for HB/HE/HF/HO
151  std::vector<double> phibin; // Phi step for all eta bins (HB, HE, HO)
152  std::vector<int> phiUnitS; // Phi unit at SIM stage
153  std::vector<std::pair<double, double>> gconsHB; // Geometry constatnts HB
154  std::vector<std::pair<double, double>> gconsHE; // Geometry constatnts HE
155  int nModule[2], nHalves[2]; // Modules, Halves for HB/HE
156  std::pair<int, int> depthMaxDf_, depthMaxSp_; // (subdet,maximum depth) default,special
157  std::map<HcalDetId, HcalDetId> detIdSp_; // Map of Id's for special RBX
158  std::map<HcalDetId, std::vector<HcalDetId>> detIdSpR_; // Reverse map for RBX
159 };
160 
161 #endif
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
std::map< HcalDetId, HcalDetId > detIdSp_
double getRZ(const int &subdet, const int &ieta, const int &depth) const
std::pair< int, int > getEtaRange(const int &i) const
std::vector< int > iEtaMin
std::vector< int > etagroup
const std::vector< double > & getPhiOffs() const
std::pair< int, int > depthMaxSp_
int getDepthEta16(const int &det, const int &iphi, const int &zside) const
bool withSpecialRBXHBHE() const
HcalDetId mergedDepthDetId(const HcalDetId &id) const
double getPhiBin(const int &i) const
void getOneEtaBin(HcalSubdetector subdet, int ieta, int zside, std::vector< std::pair< int, double >> &phis, std::map< int, int > &layers, bool planOne, std::vector< HcalDDDRecConstants::HcalEtaBin > &bins) const
int getNPhi(const int &type) const
std::vector< std::pair< int, double > > getPhis(const int &subdet, const int &ieta) const
int maxHFDepth(const int &ieta, const int &iphi) const
bool mergedDepthList29(int ieta, int iphi, int depth) const
int getDepthEta29(const int &phi, const int &zside, const int &i) const
double getLayer0Wt(const int &det, const int &phi, const int &zside) const
static const int maxLayer_
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
HcalDetId idBack(const HcalDetId &id) const
std::vector< int > maxDepth
int zside(DetId const &)
unsigned int nCells() const
std::vector< HcalEtaBin > getEtaBins(const int &itype) const
std::vector< double > etaTableHF
HcalEtaBin(int eta=0, int zs=1, double dfi=0, double et1=0, double et2=0)
std::vector< int > phiUnitS
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< HFCellParameters > getHFCellParameters() const
std::vector< std::pair< double, double > > gconsHE
const HcalParameters * hpar
std::pair< double, double > getEtaPhi(const int &subdet, const int &ieta, const int &iphi) const
void specialRBXHBHE(const std::vector< HcalDetId > &, std::vector< HcalDetId > &) const
std::pair< int, int > depthMaxDf_
std::vector< double > phibin
HFCellParameters(int ie=0, int d=1, int ffi=1, int sfi=2, int nfi=36, double r1=0, double r2=0)
std::pair< double, double > getEtaLimit(const int &i) const
double getPhiOff(const int &i) const
HcalActiveLength(int ie=0, int d=0, int z=0, int s=0, double et=0, double t=0)
std::vector< int > iEtaMax
HcalSubdetector
Definition: HcalAssistant.h:31
const std::vector< double > & getEtaTable() const
std::vector< int > ietaMap
std::vector< int > nPhiBins
const HcalLayerDepthMap * ldMap() const
std::vector< std::pair< int, int > > layer
std::vector< std::pair< int, int > > etaSimValu
int getMaxDepth(const int &type) const
unsigned int layerGroupSize(int eta) const
d
Definition: ztail.py:151
std::vector< HcalCellType > HcalCellTypes(HcalSubdetector) const
const std::vector< double > & getEtaTableHF() const
std::vector< std::pair< double, double > > gconsHB
bool isPlan1ToBeMergedId(const HcalDetId &id) const
std::vector< double > phioff
int getPhiZOne(std::vector< std::pair< int, int >> &phiz) const
std::vector< double > etaTable
HcalDDDRecConstants(const HcalParameters *hp, const HcalDDDSimConstants &hc)
HcalID(int sub=0, int et=0, int fi=0, int d=0)
unsigned int numberOfCells(HcalSubdetector) const
void getLayerDepth(const int &ieta, std::map< int, int > &layers) const
int maxHFDepth(int ieta, int iphi) const
double getLayer0Wt(const int &det, const int &phi, const int &zside) const
std::vector< double > phitable
HcalDetId idFront(const HcalDetId &id) const
int getNoff(const int &i) const
int getLayerFront(const int &det, const int &eta, const int &phi, const int &depth) const
bool isPlan1MergedId(const HcalDetId &id) const
const HcalDDDSimConstants & hcons
std::vector< HcalActiveLength > getThickActive(const int &type) const
unsigned int layerGroup(int eta, int i) const
const std::vector< double > & getPhiTable() const
const HcalDDDSimConstants * dddConstants() const
std::vector< int > noff
std::vector< std::pair< int, double > > phis
std::vector< std::pair< double, double > > getConstHBHE(const int &type) const
const std::vector< double > & getPhiTableHF() const
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
int getDepthEta29(const int &iphi, const int &zside, const int &type) const
std::vector< int > getDepth(const int &det, const int &phi, const int &zside, const unsigned int &eta) const
bool isPlan1(const HcalDetId &id) const
static const int maxLayerHB_
int getDepthEta16(const int &det, const int &phi, const int &zside) const
int getLayerBack(const int &det, const int &eta, const int &phi, const int &depth) const
std::map< HcalDetId, std::vector< HcalDetId > > detIdSpR_