CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HcalHardcodeGeometryLoader Class Reference

#include <HcalHardcodeGeometryLoader.h>

Public Types

typedef CaloSubdetectorGeometryReturnType
 

Public Member Functions

 HcalHardcodeGeometryLoader ()
 
 HcalHardcodeGeometryLoader (const HcalTopology &ht)
 
ReturnType load (DetId::Detector det, int subdet)
 
ReturnType load ()
 Load all of HCAL. More...
 
virtual ~HcalHardcodeGeometryLoader ()
 

Private Member Functions

void fill (HcalSubdetector subdet, int firstEtaRing, int lastEtaRing, ReturnType cg)
 
void init ()
 
CaloCellGeometrymakeCell (const HcalDetId &detId, ReturnType geom) const
 

Private Attributes

const HcalTopologyextTopology
 
double theBarrelRadius
 
double theHB15aThickness
 
double theHB15bThickness
 
double theHB16aThickness
 
double theHB16bThickness
 
double theHBThickness
 
double theHEZPos [4]
 
double theHFThickness
 
double theHFZPos [2]
 
double theHOThickness
 
double theOuterRadius
 
HcalTopologytheTopology
 

Detailed Description

Note
The HE geometry is not currently correct. The z positions must be corrected.
Date:
2008/04/21 22:19:36
Revision:
1.6
Author
R. Wilkinson - Caltech

Definition at line 19 of file HcalHardcodeGeometryLoader.h.

Member Typedef Documentation

Definition at line 23 of file HcalHardcodeGeometryLoader.h.

Constructor & Destructor Documentation

HcalHardcodeGeometryLoader::HcalHardcodeGeometryLoader ( )

Definition at line 10 of file HcalHardcodeGeometryLoader.cc.

References init().

HcalHardcodeGeometryLoader::HcalHardcodeGeometryLoader ( const HcalTopology ht)
explicit

Definition at line 17 of file HcalHardcodeGeometryLoader.cc.

References init().

17  :
18  theTopology ( 0 ) ,
19  extTopology ( &ht )
20 {
21  init();
22 }
virtual HcalHardcodeGeometryLoader::~HcalHardcodeGeometryLoader ( )
inlinevirtual

Definition at line 27 of file HcalHardcodeGeometryLoader.h.

References theTopology.

27 { delete theTopology ; }

Member Function Documentation

void HcalHardcodeGeometryLoader::fill ( HcalSubdetector  subdet,
int  firstEtaRing,
int  lastEtaRing,
ReturnType  cg 
)
private

helper functions to make all the ids and cells, and put them into the vectors and mpas passed in.

Definition at line 89 of file HcalHardcodeGeometryLoader.cc.

References CaloSubdetectorGeometry::addCell(), HcalTopology::depthBinInformation(), extTopology, makeCell(), max(), HcalTopology::nPhiBins(), and HcalTopology::valid().

Referenced by load().

93 {
94  // start by making the new HcalDetIds
95  std::vector<HcalDetId> hcalIds;
96  int nDepthSegments, startingDepthSegment;
97  for(int etaRing = firstEtaRing; etaRing <= lastEtaRing; ++etaRing) {
98  extTopology->depthBinInformation(subdet, etaRing, nDepthSegments, startingDepthSegment);
99  unsigned int nPhiBins = extTopology->nPhiBins(etaRing);
100  unsigned int phiInc=72/std::max(36u,nPhiBins);
101  for(int idepth = 0; idepth < nDepthSegments; ++idepth) {
102  int depthBin = startingDepthSegment + idepth;
103 
104  for(unsigned iphi = 1; iphi <= 72; iphi+=phiInc) {
105  for(int zsign = -1; zsign <= 1; zsign += 2) {
106  HcalDetId id( subdet, zsign * etaRing, iphi, depthBin);
107  if (extTopology->valid(id)) hcalIds.push_back(id);
108  }
109  }
110  }
111  }
112 
113  edm::LogInfo("HcalHardcodeGeometry") << "Number of HCAL DetIds made: "
114  << subdet
115  << " " << hcalIds.size();
116  // for each new HcalDetId, make a CaloCellGeometry
117  for(std::vector<HcalDetId>::const_iterator hcalIdItr = hcalIds.begin();
118  hcalIdItr != hcalIds.end(); ++hcalIdItr)
119  {
120  geom->addCell( *hcalIdItr, makeCell(*hcalIdItr,geom) );
121  }
122 }
virtual bool valid(const HcalDetId &id) const
Definition: HcalTopology.cc:32
int nPhiBins(int etaRing) const
how many phi segments in this ring
CaloCellGeometry * makeCell(const HcalDetId &detId, ReturnType geom) const
const T & max(const T &a, const T &b)
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
void HcalHardcodeGeometryLoader::init ( void  )
private

Definition at line 25 of file HcalHardcodeGeometryLoader.cc.

References theBarrelRadius, theHB15aThickness, theHB15bThickness, theHB16aThickness, theHB16bThickness, theHBThickness, theHEZPos, theHFThickness, theHFZPos, theHOThickness, and theOuterRadius.

Referenced by HcalHardcodeGeometryLoader().

26 {
27  theBarrelRadius = 190.;
28  theHBThickness = 93.6; // just from drawings. All thicknesses needs to be done right
29 
30  theHB15aThickness = theHBThickness * 12.0/17.0; // relative weight from layer count!
31  theHB15bThickness = theHBThickness * 4.0/17.0; // relative weight from layer count!
32  theHB16aThickness = theHBThickness * 1.0/17.0; // relative weight from layer count!
33  theHB16bThickness = theHBThickness * 7.0/17.0; // relative weight from layer count!
34 
35  theOuterRadius = 406;
36  theHOThickness = 1.;
37 
38  theHEZPos[0] = 388.0;
39  theHEZPos[1] = 397.0;
40  theHEZPos[2] = 450.0;
41  theHEZPos[3] = 568.0;
42 
43  theHFZPos[0] = 1100.0;
44  theHFZPos[1] = 1120.0;
45  theHFThickness = 165;
46 
47 }
HcalHardcodeGeometryLoader::ReturnType HcalHardcodeGeometryLoader::load ( DetId::Detector  det,
int  subdet 
)

Definition at line 51 of file HcalHardcodeGeometryLoader.cc.

References CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), extTopology, fill(), HcalTopology::firstHBRing(), HcalTopology::firstHERing(), HcalTopology::firstHFRing(), HcalTopology::firstHORing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalGeometry::k_NumberOfCellsForCorners, HcalGeometry::k_NumberOfParametersPerShape, HcalGeometry::k_NumberOfShapes, HcalTopology::lastHBRing(), HcalTopology::lastHERing(), HcalTopology::lastHFRing(), HcalTopology::lastHORing(), and CaloSubdetectorGeometry::parMgr().

53 {
54  HcalSubdetector hsub=static_cast<HcalSubdetector>( subdet );
56 
57  if( hg->cornersMgr() == 0 ) hg->allocateCorners( HcalGeometry::k_NumberOfCellsForCorners ) ;
58  if( hg->parMgr() == 0 ) hg->allocatePar(
61 
62  switch (hsub)
63  {
64  case (HcalBarrel) : fill(hsub, extTopology->firstHBRing(), extTopology->lastHBRing(), hg ); break;
65  case (HcalEndcap) : fill(hsub, extTopology->firstHERing(), extTopology->lastHERing(), hg ); break;
66  case (HcalForward) : fill(hsub, extTopology->firstHFRing(), extTopology->lastHFRing(), hg ); break;
67  case (HcalOuter) : fill(hsub, extTopology->firstHORing(), extTopology->lastHORing(), hg ); break;
68  default: break;
69  }
70  return hg;
71 }
int firstHFRing() const
Definition: HcalTopology.h:65
CaloSubdetectorGeometry * ReturnType
int firstHBRing() const
Definition: HcalTopology.h:61
int lastHBRing() const
Definition: HcalTopology.h:62
int lastHFRing() const
Definition: HcalTopology.h:66
HcalSubdetector
Definition: HcalAssistant.h:32
int firstHORing() const
Definition: HcalTopology.h:67
void fill(HcalSubdetector subdet, int firstEtaRing, int lastEtaRing, ReturnType cg)
int firstHERing() const
Definition: HcalTopology.h:63
int lastHORing() const
Definition: HcalTopology.h:68
int lastHERing() const
Definition: HcalTopology.h:64
HcalHardcodeGeometryLoader::ReturnType HcalHardcodeGeometryLoader::load ( )

Load all of HCAL.

Definition at line 74 of file HcalHardcodeGeometryLoader.cc.

References CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), extTopology, fill(), HcalTopology::firstHBRing(), HcalTopology::firstHERing(), HcalTopology::firstHFRing(), HcalTopology::firstHORing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::kSizeForDenseIndexing, HcalTopology::lastHBRing(), HcalTopology::lastHERing(), HcalTopology::lastHFRing(), HcalTopology::lastHORing(), and CaloSubdetectorGeometry::parMgr().

75 {
76  ReturnType hg( new HcalGeometry( extTopology ) ) ;
77 
78  if( hg->cornersMgr() == 0 ) hg->allocateCorners( HcalDetId::kSizeForDenseIndexing ) ;
79  if( hg->parMgr() == 0 ) hg->allocatePar( 500, 5 ) ;
80 
85  return hg;
86 }
int firstHFRing() const
Definition: HcalTopology.h:65
CaloSubdetectorGeometry * ReturnType
int firstHBRing() const
Definition: HcalTopology.h:61
int lastHBRing() const
Definition: HcalTopology.h:62
int lastHFRing() const
Definition: HcalTopology.h:66
int firstHORing() const
Definition: HcalTopology.h:67
void fill(HcalSubdetector subdet, int firstEtaRing, int lastEtaRing, ReturnType cg)
int firstHERing() const
Definition: HcalTopology.h:63
int lastHORing() const
Definition: HcalTopology.h:68
int lastHERing() const
Definition: HcalTopology.h:64
CaloCellGeometry * HcalHardcodeGeometryLoader::makeCell ( const HcalDetId detId,
ReturnType  geom 
) const
private

Definition at line 128 of file HcalHardcodeGeometryLoader.cc.

References CaloSubdetectorGeometry::cornersMgr(), funct::cos(), HcalDetId::depth(), HcalTopology::depthBinInformation(), PV3DBase< T, PVType, FrameType >::eta(), eta(), extTopology, HcalTopology::firstHFRing(), CaloCellGeometry::getParmPtr(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::ietaAbs(), HcalDetId::iphi(), M_PI, HcalTopology::nPhiBins(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), phi, point, csvReporter::r, funct::sin(), HcalDetId::subdet(), funct::tan(), theBarrelRadius, theHB15aThickness, theHB15bThickness, theHB16aThickness, theHB16bThickness, theHBHEEtaBounds, theHBThickness, theHEZPos, theHFEtaBounds, theHFThickness, theHFZPos, theHOThickness, theOuterRadius, theta(), theta_from_eta(), x, detailsBasic3DVector::y, detailsBasic3DVector::z, PV3DBase< T, PVType, FrameType >::z(), and HcalDetId::zside().

Referenced by fill().

130 {
131  // the two eta boundaries of the cell
132  double eta1, eta2;
133  HcalSubdetector subdet = detId.subdet();
134  int etaRing = detId.ietaAbs();
135  if(subdet == HcalForward)
136  {
137  eta1 = theHFEtaBounds[etaRing-extTopology->firstHFRing()];
138  eta2 = theHFEtaBounds[etaRing-extTopology->firstHFRing()+1];
139  }
140  else if (etaRing==28 && detId.depth()==3)
141  {
142  // double-width in eta at depth 3 in ieta=28
143  eta1 = theHBHEEtaBounds[etaRing-1];
144  eta2 = theHBHEEtaBounds[etaRing+1];
145  }
146  else
147  {
148  eta1 = theHBHEEtaBounds[etaRing-1];
149  eta2 = theHBHEEtaBounds[etaRing];
150  }
151  double eta = 0.5*(eta1+eta2) * detId.zside();
152  double deta = 0.5*(eta2-eta1);
153  double theta = theta_from_eta(eta);
154 
155  int nDepthBins, startingBin;
156  extTopology->depthBinInformation(subdet,etaRing,nDepthBins,startingBin);
157 
158  // in radians
159  double dphi_nominal = 2.0*M_PI / extTopology->nPhiBins(1); // always the same
160  double dphi_half = M_PI / extTopology->nPhiBins(etaRing); // half-width
161 
162  double phi_low = dphi_nominal*(detId.iphi()-1); // low-edge boundaries are constant...
163  double phi = phi_low+dphi_half;
164 
165  bool isBarrel = (subdet == HcalBarrel || subdet == HcalOuter);
166 
167  double x,y,z,r;
168  double thickness;
169 
170  if(isBarrel)
171  {
172  if(subdet == HcalBarrel)
173  {
174  if (detId.ietaAbs()==15)
175  {
176  if (detId.depth()==1)
177  {
178  r = theBarrelRadius;
179  thickness = theHB15aThickness;
180  }
181  else
182  {
184  thickness = theHB15bThickness;
185  }
186  }
187  else if (detId.ietaAbs()==16)
188  {
189  if (detId.depth()==1)
190  {
191  r = theBarrelRadius;
192  thickness = theHB16aThickness;
193  }
194  else
195  {
197  thickness = theHB16bThickness;
198  }
199  }
200  else
201  {
202  r = theBarrelRadius;
203  thickness = theHBThickness;
204  }
205  }
206  else
207  { // HO
208  r = theOuterRadius;
209  thickness = theHOThickness;
210  }
211  z = r * sinh(eta); // sinh(eta) == 1/tan(theta)
212  thickness *= cosh(eta); // cosh(eta) == 1/sin(theta)
213  }
214  else
215  {
216  int depth = detId.depth();
217  if(subdet == HcalEndcap)
218  { // Sadly, Z must be made a function of ieta.
219  if (nDepthBins==1)
220  {
221  z = theHEZPos[depth - 1];
222  thickness = theHEZPos[3] - z;
223  }
224  else if (nDepthBins==2 && depth==2)
225  {
226  z = theHEZPos[depth - 1];
227  if (etaRing==29) // special case for tower 29
228  thickness = theHEZPos[depth] - z;
229  else
230  thickness = theHEZPos[3] - z;
231  }
232  else
233  {
234  z = theHEZPos[depth - 1];
235  thickness = theHEZPos[depth] - z;
236  }
237  thickness /= fabs(tanh(eta));
238  }
239  else
240  {
241  z = theHFZPos[depth - 1];
242  thickness = theHFThickness-(theHFZPos[depth-1]-theHFZPos[0]);
243  }
244  z*=detId.zside(); // get the sign right.
245  r = z * tan(theta);
246  assert(r>0.);
247  }
248 
249  x = r * cos(phi);
250  y = r * sin(phi);
251  GlobalPoint point(x,y,z);
252 
253 
254  if (subdet==HcalForward)
255  {
256  std::vector<double> hf ;
257  hf.reserve(5) ;
258  hf.push_back( deta ) ;
259  hf.push_back( dphi_half ) ;
260  hf.push_back( thickness/2 ) ;
261  hf.push_back( fabs( point.eta() ) ) ;
262  hf.push_back( fabs( point.z() ) ) ;
263  return new calogeom::IdealZPrism(
264  point,
265  geom->cornersMgr(),
267  geom->parMgr(),
268  geom->parVecVec() ) );
269  }
270  else
271  {
272  const double mysign ( isBarrel ? 1 : -1 ) ;
273  std::vector<double> hh ;
274  hh.reserve(5) ;
275  hh.push_back( deta ) ;
276  hh.push_back( dphi_half ) ;
277  hh.push_back( mysign*thickness/2. ) ;
278  hh.push_back( fabs( point.eta() ) ) ;
279  hh.push_back( fabs( point.z() ) ) ;
280  return new calogeom::IdealObliquePrism(
281  point,
282  geom->cornersMgr(),
284  geom->parMgr(),
285  geom->parVecVec() ) );
286  }
287 }
int firstHFRing() const
Definition: HcalTopology.h:65
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:32
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:34
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
T eta() const
double double double z
int depth() const
get the tower depth
Definition: HcalDetId.h:42
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
HcalSubdetector
Definition: HcalAssistant.h:32
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 ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:36
int iphi() const
get the cell iphi
Definition: HcalDetId.h:40
#define M_PI
Definition: BFit3D.cc:3
static const double theHFEtaBounds[]
static const double * getParmPtr(const std::vector< double > &vd, ParMgr *mgr, ParVecVec &pvv)
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
Definition: DDAxes.h:10

Member Data Documentation

const HcalTopology* HcalHardcodeGeometryLoader::extTopology
private

Definition at line 47 of file HcalHardcodeGeometryLoader.h.

Referenced by fill(), load(), and makeCell().

double HcalHardcodeGeometryLoader::theBarrelRadius
private

Definition at line 49 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theHB15aThickness
private

Definition at line 55 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theHB15bThickness
private

Definition at line 55 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theHB16aThickness
private

Definition at line 56 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theHB16bThickness
private

Definition at line 56 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theHBThickness
private

Definition at line 54 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theHEZPos[4]
private

Definition at line 51 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theHFThickness
private

Definition at line 57 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theHFZPos[2]
private

Definition at line 52 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theHOThickness
private

Definition at line 58 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

double HcalHardcodeGeometryLoader::theOuterRadius
private

Definition at line 50 of file HcalHardcodeGeometryLoader.h.

Referenced by init(), and makeCell().

HcalTopology* HcalHardcodeGeometryLoader::theTopology
private

Definition at line 46 of file HcalHardcodeGeometryLoader.h.

Referenced by ~HcalHardcodeGeometryLoader().