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 ()
 
void makeCell (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:
2011/06/04 19:07:18
Revision:
1.8
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 12 of file HcalHardcodeGeometryLoader.cc.

References init().

HcalHardcodeGeometryLoader::HcalHardcodeGeometryLoader ( const HcalTopology ht)
explicit

Definition at line 19 of file HcalHardcodeGeometryLoader.cc.

References init().

19  :
20  theTopology ( 0 ) ,
21  extTopology ( &ht )
22 {
23  init();
24 }
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 91 of file HcalHardcodeGeometryLoader.cc.

References HcalTopology::depthBinInformation(), extTopology, errorMatrix2Lands_multiChannel::id, makeCell(), max(), HcalTopology::nPhiBins(), and HcalTopology::valid().

Referenced by load().

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

Definition at line 27 of file HcalHardcodeGeometryLoader.cc.

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

Referenced by HcalHardcodeGeometryLoader().

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

Definition at line 53 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().

55 {
56  HcalSubdetector hsub=static_cast<HcalSubdetector>( subdet );
58 
59  if( hg->cornersMgr() == 0 ) hg->allocateCorners( HcalGeometry::k_NumberOfCellsForCorners ) ;
60  if( hg->parMgr() == 0 ) hg->allocatePar(
63 
64  switch (hsub)
65  {
66  case (HcalBarrel) : fill(hsub, extTopology->firstHBRing(), extTopology->lastHBRing(), hg ); break;
67  case (HcalEndcap) : fill(hsub, extTopology->firstHERing(), extTopology->lastHERing(), hg ); break;
68  case (HcalForward) : fill(hsub, extTopology->firstHFRing(), extTopology->lastHFRing(), hg ); break;
69  case (HcalOuter) : fill(hsub, extTopology->firstHORing(), extTopology->lastHORing(), hg ); break;
70  default: break;
71  }
72  return hg;
73 }
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 76 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().

77 {
78  ReturnType hg( new HcalGeometry( extTopology ) ) ;
79 
80  if( hg->cornersMgr() == 0 ) hg->allocateCorners( HcalDetId::kSizeForDenseIndexing ) ;
81  if( hg->parMgr() == 0 ) hg->allocatePar( 500, 5 ) ;
82 
87  return hg;
88 }
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
void HcalHardcodeGeometryLoader::makeCell ( const HcalDetId detId,
ReturnType  geom 
) const
private

Definition at line 130 of file HcalHardcodeGeometryLoader.cc.

References 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, CaloSubdetectorGeometry::newCell(), HcalTopology::nPhiBins(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), phi, point, alignCSCRings::r, funct::sin(), HcalDetId::subdet(), funct::tan(), theBarrelRadius, theHB15aThickness, theHB15bThickness, theHB16aThickness, theHB16bThickness, theHBHEEtaBounds, theHBThickness, theHEZPos, theHFEtaBounds, theHFThickness, theHFZPos, theHOThickness, theOuterRadius, theta(), theta_from_eta(), vdt::x, detailsBasic3DVector::y, detailsBasic3DVector::z, PV3DBase< T, PVType, FrameType >::z(), and HcalDetId::zside().

Referenced by fill().

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