CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTowerHardcodeGeometryLoader.cc
Go to the documentation of this file.
6 
8 
9 std::auto_ptr<CaloSubdetectorGeometry> CaloTowerHardcodeGeometryLoader::load(const CaloTowerTopology *limits, const HcalTopology *hcaltopo, const HcalDDDRecConstants* hcons) {
10 
11  m_limits = limits;
12  m_hcaltopo = hcaltopo;
13  m_hcons = hcons;
14 
15  //get eta limits from hcal rec constants
18 
20 
21  if( 0 == geom->cornersMgr() ) geom->allocateCorners (
22  geom->numberOfCellsForCorners() ) ;
23  if( 0 == geom->parMgr() ) geom->allocatePar (
25  geom->numberOfParametersPerShape() ) ;
26 
27  // simple loop
28  for (uint32_t din = 0; din < m_limits->sizeForDenseIndexing(); ++din) {
29  makeCell(din, geom);
30  }
31  edm::LogInfo("Geometry") << "CaloTowersHardcodeGeometry made " << m_limits->sizeForDenseIndexing() << " towers.";
32  return std::auto_ptr<CaloSubdetectorGeometry>(geom);
33 }
34 
35 void
37  CaloSubdetectorGeometry* geom ) const {
38  const double EBradius = 143.0; // cm
39  const double HOradius = 406.0+1.0;
40  const double EEz = 320.0; // rough (cm)
41  const double HEz = 568.0; // back (cm)
42  const double HFz = 1100.0;
43  const double HFthick = 165;
44  // Tower 17 is the last EB tower
45 
46  //use CT topology to get the DetId for this dense index
48  int ieta = id.ieta();
49  int iphi = id.iphi();
50 
51  //use CT topology to get proper ieta for hcal
52  int etaRing=m_limits->convertCTtoHcal(abs(ieta));
53  int sign=(ieta>0)?(1):(-1);
54  double eta1, eta2;
55  if (abs(ieta)>m_limits->lastHERing()) {
56  eta1 = theHFEtaBounds[etaRing-m_hcaltopo->firstHFRing()];
57  eta2 = theHFEtaBounds[etaRing-m_hcaltopo->firstHFRing()+1];
58  } else {
59  eta1 = theHBHEEtaBounds[etaRing-1];
60  eta2 = theHBHEEtaBounds[etaRing];
61  }
62  double eta = 0.5*(eta1+eta2);
63  double deta = (eta2-eta1);
64 
65  // in radians
66  double dphi_nominal = 2.0*M_PI / m_hcaltopo->nPhiBins(1); // always the same
67  double dphi_half = M_PI / m_hcaltopo->nPhiBins(etaRing); // half-width
68 
69  double phi_low = dphi_nominal*(iphi-1); // low-edge boundaries are constant...
70  double phi = phi_low+dphi_half;
71 
72  double x,y,z,thickness;
73  bool alongZ=true;
74  if (abs(ieta)>m_limits->lastHERing()) { // forward
75  z=HFz;
76  double r=z/sinh(eta);
77  x=r * cos(phi);
78  y=r * sin(phi);
79  thickness=HFthick/tanh(eta);
80  } else if (abs(ieta)>m_limits->firstHERing()+1) { // EE-containing
81  z=EEz;
82  double r=z/sinh(eta);
83  x=r * cos(phi);
84  y=r * sin(phi);
85  thickness=(HEz-EEz)/tanh(eta);
86  } else { // EB-containing
87  x=EBradius * cos(phi);
88  y=EBradius * sin(phi);
89  alongZ=false;
90  z=EBradius * sinh(eta);
91  thickness=(HOradius-EBradius) * cosh(eta);
92  }
93 
94  z*=sign;
95  GlobalPoint point(x,y,z);
96 
97  const double mysign ( !alongZ ? 1 : -1 ) ;
98  std::vector<CCGFloat> hh ;
99  hh.reserve(5) ;
100  hh.push_back( deta/2 ) ;
101  hh.push_back( dphi_half ) ;
102  hh.push_back( mysign*thickness/2. ) ;
103 
104  hh.push_back( fabs( eta ) ) ;
105  hh.push_back( fabs( z ) ) ;
106 
107  geom->newCell( point, point, point,
109  geom->parMgr(),
110  geom->parVecVec() ),
111  id ) ;
112 }
int firstHFRing() const
Definition: HcalTopology.h:87
virtual unsigned int numberOfCellsForCorners() const
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)=0
double sign(double x)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const std::vector< double > & getEtaTableHF() const
int nPhiBins(int etaRing) const
how many phi segments in this ring
void allocatePar(ParVec::size_type n, unsigned int m)
int firstHERing() const
std::auto_ptr< CaloSubdetectorGeometry > load(const CaloTowerTopology *limits, const HcalTopology *hcaltopo, const HcalDDDRecConstants *hcons)
CaloTowerDetId detIdFromDenseIndex(uint32_t din) const
virtual unsigned int numberOfParametersPerShape() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CaloCellGeometry::CCGFloat CCGFloat
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
#define M_PI
CaloCellGeometry::CornersMgr * cornersMgr()
const std::vector< double > & getEtaTable() const
virtual unsigned int numberOfShapes() const
int lastHERing() const
void makeCell(uint32_t din, CaloSubdetectorGeometry *geom) const
int convertCTtoHcal(int ct_ieta) const
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
int ieta() const
get the tower ieta
uint32_t sizeForDenseIndexing() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5