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.
7 
9 
10 std::auto_ptr<CaloSubdetectorGeometry> CaloTowerHardcodeGeometryLoader::load(const HcalTopology *limits) {
11  m_limits = limits;
12 
14 
15  if( 0 == geom->cornersMgr() ) geom->allocateCorners (
17  if( 0 == geom->parMgr() ) geom->allocatePar (
20 
21  int nnn=0;
22  // simple loop
23  for (int ieta=-m_limits->lastHFRing(); ieta<=m_limits->lastHFRing(); ieta++) {
24  if (ieta==0) continue; // skip not existing eta=0 ring
25  for (int iphi=1; iphi<=72; iphi++) {
26  if (abs(ieta)>=m_limits->firstHFQuadPhiRing() && ((iphi-1)%4)==0) continue;
27  if (abs(ieta)>=m_limits->firstHEDoublePhiRing() && ((iphi-1)%2)!=0) continue;
28  ++nnn;
29  }
30  }
31  if( geom->cornersMgr() == 0 ) geom->allocateCorners( nnn ) ;
32  if( geom->parMgr() == 0 ) geom->allocatePar( 41, 3 ) ;
33 
34  int n=0;
35  // simple loop
36  for (int ieta=-m_limits->lastHFRing(); ieta<=m_limits->lastHFRing(); ieta++) {
37  if (ieta==0) continue; // skip not existing eta=0 ring
38  for (int iphi=1; iphi<=72; iphi++) {
39  if (abs(ieta)>=m_limits->firstHFQuadPhiRing() && ((iphi-1)%4)==0) continue;
40  if (abs(ieta)>=m_limits->firstHEDoublePhiRing() && ((iphi-1)%2)!=0) continue;
41  makeCell(ieta,iphi, geom);
42  n++;
43  }
44  }
45  edm::LogInfo("Geometry") << "CaloTowersHardcodeGeometry made " << n << " towers.";
46  return std::auto_ptr<CaloSubdetectorGeometry>(geom);
47 }
48 
49 void
51  int iphi,
52  CaloSubdetectorGeometry* geom ) const {
53  const double EBradius = 143.0; // cm
54  const double HOradius = 406.0+1.0;
55  const double EEz = 320.0; // rough (cm)
56  const double HEz = 568.0; // back (cm)
57  const double HFz = 1100.0;
58  const double HFthick = 165;
59  // Tower 17 is the last EB tower
60 
61  int etaRing=abs(ieta);
62  int sign=(ieta>0)?(1):(-1);
63  double eta1, eta2;
64  if (etaRing>m_limits->lastHERing()) {
65  eta1 = theHFEtaBounds[etaRing-m_limits->firstHFRing()];
66  eta2 = theHFEtaBounds[etaRing-m_limits->firstHFRing()+1];
67  } else {
68  eta1 = theHBHEEtaBounds[etaRing-1];
69  eta2 = theHBHEEtaBounds[etaRing];
70  }
71  double eta = 0.5*(eta1+eta2);
72  double deta = (eta2-eta1);
73 
74  // in radians
75  double dphi_nominal = 2.0*M_PI / m_limits->nPhiBins(1); // always the same
76  double dphi_half = M_PI / m_limits->nPhiBins(etaRing); // half-width
77 
78  double phi_low = dphi_nominal*(iphi-1); // low-edge boundaries are constant...
79  double phi = phi_low+dphi_half;
80 
81  double x,y,z,thickness;
82  bool alongZ=true;
83  if (etaRing>m_limits->lastHERing()) { // forward
84  z=HFz;
85  double r=z/sinh(eta);
86  x=r * cos(phi);
87  y=r * sin(phi);
88  thickness=HFthick/tanh(eta);
89  } else if (etaRing>17) { // EE-containing
90  z=EEz;
91  double r=z/sinh(eta);
92  x=r * cos(phi);
93  y=r * sin(phi);
94  thickness=(HEz-EEz)/tanh(eta);
95  } else { // EB-containing
96  x=EBradius * cos(phi);
97  y=EBradius * sin(phi);
98  alongZ=false;
99  z=EBradius * sinh(eta);
100  thickness=(HOradius-EBradius) * cosh(eta);
101  }
102 
103  z*=sign;
104  GlobalPoint point(x,y,z);
105 
106  const double mysign ( !alongZ ? 1 : -1 ) ;
107  std::vector<CCGFloat> hh ;
108  hh.reserve(5) ;
109  hh.push_back( deta/2 ) ;
110  hh.push_back( dphi_half ) ;
111  hh.push_back( mysign*thickness/2. ) ;
112 
113  hh.push_back( fabs( eta ) ) ;
114  hh.push_back( fabs( z ) ) ;
115 
116  geom->newCell( point, point, point,
118  geom->parMgr(),
119  geom->parVecVec() ),
120  CaloTowerDetId( ieta, iphi ) ) ;
121 }
int firstHFRing() const
Definition: HcalTopology.h:81
void makeCell(int ieta, int iphi, CaloSubdetectorGeometry *geom) const
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)=0
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int nPhiBins(int etaRing) const
how many phi segments in this ring
T eta() const
void allocatePar(ParVec::size_type n, unsigned int m)
float float float z
std::auto_ptr< CaloSubdetectorGeometry > load(const HcalTopology *limits)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int lastHFRing() const
Definition: HcalTopology.h:82
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)
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:86
#define M_PI
Definition: BFit3D.cc:3
static const double theHFEtaBounds[]
CaloCellGeometry::CornersMgr * cornersMgr()
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:87
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
Definition: DDAxes.h:10
static const double theHBHEEtaBounds[]
*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
int lastHERing() const
Definition: HcalTopology.h:80
Definition: DDAxes.h:10