CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalHardcodeGeometryLoader.cc
Go to the documentation of this file.
8 #include <algorithm>
9 
11 
13  theTopology ( 0 ) ,
14  extTopology ( &ht )
15 {
16  init();
17 }
18 
19 void
21 {
22  theBarrelRadius = 190.;
23  theHBThickness = 93.6; // just from drawings. All thicknesses needs to be done right
24 
25  theHB15aThickness = theHBThickness * 12.0/17.0; // relative weight from layer count!
26  theHB15bThickness = theHBThickness * 4.0/17.0; // relative weight from layer count!
27  theHB16aThickness = theHBThickness * 1.0/17.0; // relative weight from layer count!
28  theHB16bThickness = theHBThickness * 7.0/17.0; // relative weight from layer count!
29 
30  theOuterRadius = 406;
31  theHOThickness = 1.;
32 
33  theHEZPos[0] = 388.0;
34  theHEZPos[1] = 397.0;
35  theHEZPos[2] = 450.0;
36  theHEZPos[3] = 568.0;
37 
38  theHFZPos[0] = 1100.0;
39  theHFZPos[1] = 1120.0;
40  theHFThickness = 165;
41 
42 }
43 
44 
47  int subdet )
48 {
49  HcalSubdetector hsub=static_cast<HcalSubdetector>( subdet );
50  ReturnType hg( new HcalGeometry( *extTopology) );
51 
52  if( hg->cornersMgr() == 0 ) hg->allocateCorners( extTopology->ncells() );
53  if( hg->parMgr() == 0 ) hg->allocatePar(
56 
57  switch (hsub)
58  {
59  case (HcalBarrel) : fill(hsub, extTopology->firstHBRing(), extTopology->lastHBRing(), hg ); break;
60  case (HcalEndcap) : fill(hsub, extTopology->firstHERing(), extTopology->lastHERing(), hg ); break;
61  case (HcalForward) : fill(hsub, extTopology->firstHFRing(), extTopology->lastHFRing(), hg ); break;
62  case (HcalOuter) : fill(hsub, extTopology->firstHORing(), extTopology->lastHORing(), hg ); break;
63  default: break;
64  }
65  return hg;
66 }
67 
70 {
71  ReturnType hg( new HcalGeometry( *extTopology ) ) ;
72 
73  if( hg->cornersMgr() == 0 ) hg->allocateCorners( extTopology->ncells() );
74  if( hg->parMgr() == 0 ) hg->allocatePar( 500, 5 ) ;
75 
80  return hg;
81 }
82 
83 void
85  int firstEtaRing,
86  int lastEtaRing,
87  ReturnType geom )
88 {
89  // start by making the new HcalDetIds
90  std::vector<HcalDetId> hcalIds;
91  int nDepthSegments, startingDepthSegment;
92  for(int etaRing = firstEtaRing; etaRing <= lastEtaRing; ++etaRing) {
93  extTopology->depthBinInformation(subdet, etaRing, nDepthSegments, startingDepthSegment);
94  unsigned int nPhiBins = extTopology->nPhiBins(etaRing);
95  unsigned int phiInc=72/std::max(36u,nPhiBins);
96  for(int idepth = 0; idepth < nDepthSegments; ++idepth) {
97  int depthBin = startingDepthSegment + idepth;
98 
99  for(unsigned iphi = 1; iphi <= 72; iphi+=phiInc) {
100  for(int zsign = -1; zsign <= 1; zsign += 2) {
101  HcalDetId id( subdet, zsign * etaRing, iphi, depthBin);
102  if (extTopology->valid(id)) hcalIds.push_back(id);
103  }
104  }
105  }
106  }
107 
108  edm::LogInfo("HcalHardcodeGeometry") << "Number of HCAL DetIds made: "
109  << subdet
110  << " " << hcalIds.size();
111  // for each new HcalDetId, make a CaloCellGeometry
112  for(std::vector<HcalDetId>::const_iterator hcalIdItr = hcalIds.begin();
113  hcalIdItr != hcalIds.end(); ++hcalIdItr)
114  {
115  makeCell(*hcalIdItr,geom) ;
116  }
117 }
118 
119 
120 inline double theta_from_eta(double eta){return (2.0*atan(exp(-eta)));}
121 
122 void
124  ReturnType geom ) const
125 {
126  // the two eta boundaries of the cell
127  double eta1, eta2;
128  HcalSubdetector subdet = detId.subdet();
129  int etaRing = detId.ietaAbs();
130  if(subdet == HcalForward)
131  {
132  eta1 = theHFEtaBounds[etaRing-extTopology->firstHFRing()];
133  eta2 = theHFEtaBounds[etaRing-extTopology->firstHFRing()+1];
134  }
135  else if (etaRing==28 && detId.depth()==3)
136  {
137  // double-width in eta at depth 3 in ieta=28
138  eta1 = theHBHEEtaBounds[etaRing-1];
139  eta2 = theHBHEEtaBounds[etaRing+1];
140  }
141  else
142  {
143  eta1 = theHBHEEtaBounds[etaRing-1];
144  eta2 = theHBHEEtaBounds[etaRing];
145  }
146  double eta = 0.5*(eta1+eta2) * detId.zside();
147  double deta = 0.5*(eta2-eta1);
148  double theta = theta_from_eta(eta);
149 
150  int nDepthBins, startingBin;
151  extTopology->depthBinInformation(subdet,etaRing,nDepthBins,startingBin);
152 
153  // in radians
154  double dphi_nominal = 2.0*M_PI / extTopology->nPhiBins(1); // always the same
155  double dphi_half = M_PI / extTopology->nPhiBins(etaRing); // half-width
156 
157  double phi_low = dphi_nominal*(detId.iphi()-1); // low-edge boundaries are constant...
158  double phi = phi_low+dphi_half;
159 
160  bool isBarrel = (subdet == HcalBarrel || subdet == HcalOuter);
161 
162  double x,y,z,r;
163  double thickness;
164 
165  if(isBarrel)
166  {
167  if(subdet == HcalBarrel)
168  {
169  if (detId.ietaAbs()==15)
170  {
171  if (detId.depth()==1)
172  {
173  r = theBarrelRadius;
174  thickness = theHB15aThickness;
175  }
176  else
177  {
179  thickness = theHB15bThickness;
180  }
181  }
182  else if (detId.ietaAbs()==16)
183  {
184  if (detId.depth()==1)
185  {
186  r = theBarrelRadius;
187  thickness = theHB16aThickness;
188  }
189  else
190  {
192  thickness = theHB16bThickness;
193  }
194  }
195  else
196  {
197  r = theBarrelRadius;
198  thickness = theHBThickness;
199  }
200  }
201  else
202  { // HO
203  r = theOuterRadius;
204  thickness = theHOThickness;
205  }
206  z = r * sinh(eta); // sinh(eta) == 1/tan(theta)
207  thickness *= cosh(eta); // cosh(eta) == 1/sin(theta)
208  }
209  else
210  {
211  int depth = detId.depth();
212  if(subdet == HcalEndcap)
213  { // Sadly, Z must be made a function of ieta.
214  if (nDepthBins==1)
215  {
216  z = theHEZPos[depth - 1];
217  thickness = theHEZPos[3] - z;
218  }
219  else if (nDepthBins==2 && depth==2)
220  {
221  z = theHEZPos[depth - 1];
222  if (etaRing==29) // special case for tower 29
223  thickness = theHEZPos[depth] - z;
224  else
225  thickness = theHEZPos[3] - z;
226  }
227  else
228  {
229  z = theHEZPos[depth - 1];
230  thickness = theHEZPos[depth] - z;
231  }
232  thickness /= fabs(tanh(eta));
233  }
234  else
235  {
236  z = theHFZPos[depth - 1];
237  thickness = theHFThickness-(theHFZPos[depth-1]-theHFZPos[0]);
238  }
239  z*=detId.zside(); // get the sign right.
240  r = z * tan(theta);
241  assert(r>0.);
242  }
243 
244  x = r * cos(phi);
245  y = r * sin(phi);
246  GlobalPoint point(x,y,z);
247 
248  std::vector<CCGFloat> hp ;
249  hp.reserve(5) ;
250 
251  if (subdet==HcalForward)
252  {
253  hp.push_back( deta ) ;
254  hp.push_back( dphi_half ) ;
255  hp.push_back( thickness/2 ) ;
256  hp.push_back( fabs( point.eta() ) ) ;
257  hp.push_back( fabs( point.z() ) ) ;
258  }
259  else
260  {
261  const double mysign ( isBarrel ? 1 : -1 ) ;
262  hp.push_back( deta ) ;
263  hp.push_back( dphi_half ) ;
264  hp.push_back( mysign*thickness/2. ) ;
265  hp.push_back( fabs( point.eta() ) ) ;
266  hp.push_back( fabs( point.z() ) ) ;
267  }
268  geom->newCell( point, point, point,
270  geom->parMgr(),
271  geom->parVecVec() ),
272  detId );
273 }
274 
275 
int firstHFRing() const
Definition: HcalTopology.h:81
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:30
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:32
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
Geom::Theta< T > theta() const
double theta_from_eta(double eta)
int nPhiBins(int etaRing) const
how many phi segments in this ring
int firstHBRing() const
Definition: HcalTopology.h:77
int lastHBRing() const
Definition: HcalTopology.h:78
T eta() const
void allocatePar(ParVec::size_type n, unsigned int m)
float float float z
HcalHardcodeGeometryLoader(const HcalTopology &ht)
int depth() const
get the tower depth
Definition: HcalDetId.h:40
const T & max(const T &a, const T &b)
virtual unsigned int numberOfShapes() const
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int lastHFRing() const
Definition: HcalTopology.h:82
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
HcalSubdetector
Definition: HcalAssistant.h:31
CaloCellGeometry::CCGFloat CCGFloat
void depthBinInformation(HcalSubdetector subdet, int etaRing, int &nDepthBins, int &startingBin) const
finds the number of depth bins and which is the number to start with
int firstHORing() const
Definition: HcalTopology.h:83
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:34
int iphi() const
get the cell iphi
Definition: HcalDetId.h:38
#define M_PI
Definition: BFit3D.cc:3
void fill(HcalSubdetector subdet, int firstEtaRing, int lastEtaRing, ReturnType cg)
static const double theHFEtaBounds[]
CaloCellGeometry::CornersMgr * cornersMgr()
Detector
Definition: DetId.h:24
int firstHERing() const
Definition: HcalTopology.h:79
virtual bool valid(const DetId &id) const
Definition: HcalTopology.cc:58
void makeCell(const HcalDetId &detId, ReturnType geom) const
T eta() const
Definition: PV3DBase.h:76
ReturnType load()
Load all of HCAL.
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
Definition: DDAxes.h:10
static const double theHBHEEtaBounds[]
int lastHORing() const
Definition: HcalTopology.h:84
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)
*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