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  int findDepth(const int& det, const int& eta, const int& phi, const int& zside, const int& lay) const;
65  std::vector<int> getDepth(const int& det, const int& phi, const int& zside, const unsigned int& eta) const;
66  std::vector<int> getDepth(const unsigned int& eta, const bool& extra) const;
67  int getDepthEta16(const int& det, const int& iphi, const int& zside) const {
68  return hcons.getDepthEta16(det, iphi, zside);
69  }
70  int getDepthEta29(const int& iphi, const int& zside, const int& type) const {
71  return hcons.getDepthEta29(iphi, zside, type);
72  }
73  std::vector<HcalEtaBin> getEtaBins(const int& itype) const;
74  std::pair<double, double> getEtaPhi(const int& subdet, const int& ieta, const int& iphi) const;
75  std::pair<int, int> getEtaRange(const int& i) const { return std::pair<int, int>(iEtaMin[i], iEtaMax[i]); }
76  const std::vector<double>& getEtaTable() const { return etaTable; }
77  const std::vector<double>& getEtaTableHF() const { return hpar->etaTableHF; }
78  std::pair<double, double> getEtaLimit(const int& i) const {
79  return std::pair<double, double>(etaTable[i], etaTable[i + 1]);
80  }
81  HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const;
82  std::vector<HFCellParameters> getHFCellParameters() const;
83  void getLayerDepth(const int& ieta, std::map<int, int>& layers) const;
84  int getLayerBack(const int& det, const int& eta, const int& phi, const int& depth) const;
85  int getLayerFront(const int& det, const int& eta, const int& phi, const int& depth) const;
86  double getLayer0Wt(const int& det, const int& phi, const int& zside) const {
87  return hcons.getLayer0Wt(det, phi, zside);
88  }
89  int getMaxDepth(const int& type) const { return maxDepth[type]; }
90  int getMaxDepth(const int& itype, const int& ieta, const int& iphi, const int& zside) const;
91  int getMinDepth(const int& itype, const int& ieta, const int& iphi, const int& zside) const;
92  int getNEta() const { return hpar->etagroup.size(); }
93  int getNoff(const int& i) const { return hpar->noff[i]; }
94  int getNPhi(const int& type) const { return nPhiBins[type]; }
95  double getPhiBin(const int& i) const { return phibin[i]; }
96  double getPhiOff(const int& i) const { return hpar->phioff[i]; }
97  const std::vector<double>& getPhiOffs() const { return hpar->phioff; }
98  std::vector<std::pair<int, double>> getPhis(const int& subdet, const int& ieta) const;
99  const std::vector<double>& getPhiTable() const { return phibin; }
100  const std::vector<double>& getPhiTableHF() const { return hpar->phitable; }
101  int getPhiZOne(std::vector<std::pair<int, int>>& phiz) const;
102  double getRZ(const int& subdet, const int& ieta, const int& depth) const;
103  double getRZ(const int& subdet, const int& ieta, const int& iphi, const int& depth) const;
104  double getRZ(const int& subdet, const int& layer) const;
105  std::pair<double, double> getRZ(const HcalDetId& id) const;
106  std::vector<HcalActiveLength> getThickActive(const int& type) const;
107  int getTopoMode() const { return ((hpar->topologyMode) & 0xFF); }
108  int getTriggerMode() const { return (((hpar->topologyMode) >> 8) & 0xFF); }
109  std::vector<HcalCellType> HcalCellTypes(HcalSubdetector) const;
110  bool isBH() const { return hcons.isBH(); }
111  bool isHE() const { return hcons.isHE(); }
112  bool isPlan1(const HcalDetId& id) const { return detIdSp_.find(id) != detIdSp_.end(); };
113  int maxHFDepth(int ieta, int iphi) const { return hcons.maxHFDepth(ieta, iphi); }
114  bool mergedDepthList29(int ieta, int iphi, int depth) const;
115  std::vector<int> mergedDepthList29(int ieta, int iphi) const;
116  unsigned int numberOfCells(HcalSubdetector) const;
117  unsigned int nCells(HcalSubdetector) const;
118  unsigned int nCells() const;
119  HcalDetId mergedDepthDetId(const HcalDetId& id) const;
120  HcalDetId idFront(const HcalDetId& id) const;
121  HcalDetId idBack(const HcalDetId& id) const;
122  void unmergeDepthDetId(const HcalDetId& id, std::vector<HcalDetId>& ids) const;
123  void specialRBXHBHE(const std::vector<HcalDetId>&, std::vector<HcalDetId>&) const;
124  bool specialRBXHBHE(bool flag, std::vector<HcalDetId>&) const;
125  bool withSpecialRBXHBHE() const { return (hcons.ldMap()->getSubdet() != 0); }
126  bool isPlan1ToBeMergedId(const HcalDetId& id) const { return detIdSp_.find(id) != detIdSp_.end(); };
127  bool isPlan1MergedId(const HcalDetId& id) const { return detIdSpR_.find(id) != detIdSpR_.end(); };
128  const HcalDDDSimConstants* dddConstants() const { return &hcons; }
129 
130 private:
131  void getOneEtaBin(HcalSubdetector subdet,
132  int ieta,
133  int zside,
134  std::vector<std::pair<int, double>>& phis,
135  std::map<int, int>& layers,
136  bool planOne,
137  std::vector<HcalDDDRecConstants::HcalEtaBin>& bins) const;
138  void initialize(void);
139  unsigned int layerGroupSize(int eta) const;
140  unsigned int layerGroup(int eta, int i) const;
141 
142  static const int maxLayer_ = 18;
143  static const int maxLayerHB_ = 16;
146  std::vector<std::pair<int, int>> etaSimValu; // eta ranges at Sim stage
147  std::vector<double> etaTable; // Eta table (HB+HE)
148  std::vector<int> ietaMap; // Map Sim level ieta to Rec level ieta
149  std::vector<int> iEtaMin, iEtaMax; // Minimum and maximum eta
150  std::vector<int> maxDepth; // Maximum depth in HB/HE/HF/HO
151  std::vector<int> nPhiBins; // Number of phi bis for HB/HE/HF/HO
152  std::vector<double> phibin; // Phi step for all eta bins (HB, HE, HO)
153  std::vector<int> phiUnitS; // Phi unit at SIM stage
154  std::vector<std::pair<double, double>> gconsHB; // Geometry constatnts HB
155  std::vector<std::pair<double, double>> gconsHE; // Geometry constatnts HE
156  int nModule[2], nHalves[2]; // Modules, Halves for HB/HE
157  std::pair<int, int> depthMaxDf_, depthMaxSp_; // (subdet,maximum depth) default,special
158  std::map<HcalDetId, HcalDetId> detIdSp_; // Map of Id's for special RBX
159  std::map<HcalDetId, std::vector<HcalDetId>> detIdSpR_; // Reverse map for RBX
160 };
161 
162 #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
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_
int findDepth(const int &det, const int &eta, const int &phi, const int &zside, const int &lay) const
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_