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
HcalDDDGeometryLoader Class Reference

#include <HcalDDDGeometryLoader.h>

Public Types

typedef CaloSubdetectorGeometryReturnType
 

Public Member Functions

 HcalDDDGeometryLoader (const DDCompactView &cpv)
 
ReturnType load (DetId::Detector, int)
 
ReturnType load ()
 Load all of HCAL. More...
 
virtual ~HcalDDDGeometryLoader ()
 

Private Member Functions

void fill (HcalSubdetector, HcalDDDGeometry *, CaloSubdetectorGeometry *)
 
 HcalDDDGeometryLoader ()
 
CaloCellGeometrymakeCell (const HcalDetId &, HcalCellType, double, double, CaloSubdetectorGeometry *geom) const
 

Private Attributes

HcalNumberingFromDDDnumberingFromDDD
 

Detailed Description

Note
The Geometry as loaded from DDD
Date:
2008/08/27 15:57:15
Revision:
1.4
Author
S. Banerjee

Definition at line 22 of file HcalDDDGeometryLoader.h.

Member Typedef Documentation

Definition at line 29 of file HcalDDDGeometryLoader.h.

Constructor & Destructor Documentation

HcalDDDGeometryLoader::HcalDDDGeometryLoader ( const DDCompactView cpv)
explicit

Definition at line 13 of file HcalDDDGeometryLoader.cc.

References mergeVDriftHistosByStation::name, and numberingFromDDD.

13  {
14  std::string name = "HcalHits";
15  numberingFromDDD = new HcalNumberingFromDDD(name, cpv);
16 }
HcalNumberingFromDDD * numberingFromDDD
HcalDDDGeometryLoader::~HcalDDDGeometryLoader ( )
virtual

Definition at line 18 of file HcalDDDGeometryLoader.cc.

References numberingFromDDD.

18  {
19  delete numberingFromDDD;
20 }
HcalNumberingFromDDD * numberingFromDDD
HcalDDDGeometryLoader::HcalDDDGeometryLoader ( )
private

Member Function Documentation

void HcalDDDGeometryLoader::fill ( HcalSubdetector  subdet,
HcalDDDGeometry geometryDDD,
CaloSubdetectorGeometry geom 
)
private

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

Definition at line 68 of file HcalDDDGeometryLoader.cc.

References CaloSubdetectorGeometry::addCell(), HcalNumberingFromDDD::HcalCellTypes(), i, HcalDDDGeometry::insertCell(), gen::k, LogDebug, M_PI, makeCell(), numberingFromDDD, convertSQLiteXML::ok, and phi.

Referenced by load().

70  {
71 
72  // start by making the new HcalDetIds
73  std::vector<HcalCellType> hcalCells = numberingFromDDD->HcalCellTypes(subdet);
74  geometryDDD->insertCell(hcalCells);
75 #ifdef DebugLog
76  LogDebug("HCalGeom") << "HcalDDDGeometryLoader::fill gets "
77  << hcalCells.size() << " cells for subdetector "
78  << subdet;
79 #endif
80  // Make the new HcalDetIds and the cells
81 
82  double deg = M_PI/180.;
83  std::vector<HcalDetId> hcalIds;
84  for (unsigned int i=0; i<hcalCells.size(); i++) {
85  int etaRing = hcalCells[i].etaBin();
86  int depthBin = hcalCells[i].depthSegment();
87  int phiInc = 4/hcalCells[i].nPhiModule();
88  unsigned int iphi = 1;
89  if (hcalCells[i].unitPhi() == 4) iphi = 3;
90  double dphi = (hcalCells[i].phiBinWidth())*deg;
91  double phi =-(hcalCells[i].phiOffset())*deg + 0.5*dphi;
92  std::vector<int>missPlus = hcalCells[i].missingPhiPlus();
93  std::vector<int>missMinus = hcalCells[i].missingPhiMinus();
94 #ifdef DebugLog
95  LogDebug("HCalGeom") << "HcalDDDGeometryLoader: Subdet " << subdet
96  << " eta " << etaRing << " depth " << depthBin
97  << " modules " << hcalCells[i].nPhiModule() << " "
98  << phiInc << " phi " << phi/deg << " " << dphi/deg
99  << " Missing " << missPlus.size() << "/"
100  << missMinus.size();
101 #endif
102  for (int k = 0; k < hcalCells[i].nPhiBins(); k++) {
103  bool ok = true;
104  for (unsigned int kk = 0; kk < missPlus.size(); kk++)
105  if (iphi == (unsigned int)(missPlus[kk])) ok = false;
106  if (ok) {
107 #ifdef DebugLog
108  LogDebug("HCalGeom") << "HcalDDDGeometryLoader::fill Cell " << i
109  << " eta " << etaRing << " phi " << iphi << "("
110  << phi/deg << ", " << dphi/deg << ") depth "
111  << depthBin;
112 #endif
113  HcalDetId id(subdet, etaRing, iphi, depthBin);
114  hcalIds.push_back(id);
115  geom->addCell( id, makeCell(id,hcalCells[i],phi,dphi,geom) );
116  }
117  if (hcalCells[i].nHalves() > 1) {
118  ok = true;
119  for (unsigned int kk = 0; kk < missMinus.size(); kk++)
120  if (iphi == (unsigned int)(missMinus[kk])) ok = false;
121  if (ok) {
122 #ifdef DebugLog
123  LogDebug("HCalGeom") << "HcalDDDGeometryLoader::fill Cell " << i
124  << " eta " << -etaRing << " phi " << iphi <<" ("
125  << phi/deg << ", " << dphi/deg << ") depth "
126  << depthBin;
127 #endif
128  HcalDetId id(subdet, -etaRing, iphi, depthBin);
129  hcalIds.push_back(id);
130  geom->addCell( id, makeCell(id,hcalCells[i],phi,dphi,geom) );
131  }
132  }
133  iphi += phiInc;
134  phi += dphi;
135  }
136  }
137 
138  edm::LogInfo("HCalGeom") << "Number of HCAL DetIds made for " << subdet
139  << " is " << hcalIds.size();
140 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry * makeCell(const HcalDetId &, HcalCellType, double, double, CaloSubdetectorGeometry *geom) const
std::vector< HcalCellType > HcalCellTypes() const
void addCell(const DetId &id, CaloCellGeometry *ccg)
Add a cell to the geometry.
int insertCell(std::vector< HcalCellType > const &)
HcalNumberingFromDDD * numberingFromDDD
int k[5][pyjets_maxn]
#define M_PI
Definition: BFit3D.cc:3
Definition: DDAxes.h:10
HcalDDDGeometryLoader::ReturnType HcalDDDGeometryLoader::load ( DetId::Detector  det,
int  subdet 
)

Definition at line 24 of file HcalDDDGeometryLoader.cc.

References CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), prof2calltree::count, fill(), relativeConstraints::geom, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, numberingFromDDD, HcalNumberingFromDDD::numberOfCells(), and CaloSubdetectorGeometry::parMgr().

Referenced by HcalDDDGeometryEP::produceAligned(), and HcalDDDGeometryEP::produceIdeal().

24  {
25 
26  HcalSubdetector hsub = static_cast<HcalSubdetector>(subdet);
27  HcalDDDGeometry* gDDD ( new HcalDDDGeometry );
28  ReturnType geom ( gDDD );
29 
30  if ( geom->cornersMgr() == 0 ) {
31  const unsigned int count (numberingFromDDD->numberOfCells(HcalBarrel ) +
35  geom->allocateCorners( count ) ;
36  }
37 
38  // if( geom->cornersMgr() == 0 ) geom->allocateCorners( 2592 ) ;
39 
40  if ( geom->parMgr() == 0 ) geom->allocatePar( 500, 3 ) ;
41 
42  fill (hsub, gDDD, geom );
43  return geom ;
44 }
void fill(HcalSubdetector, HcalDDDGeometry *, CaloSubdetectorGeometry *)
unsigned int numberOfCells(HcalSubdetector) const
HcalSubdetector
Definition: HcalAssistant.h:32
HcalNumberingFromDDD * numberingFromDDD
CaloSubdetectorGeometry * ReturnType
HcalDDDGeometryLoader::ReturnType HcalDDDGeometryLoader::load ( )

Load all of HCAL.

Definition at line 47 of file HcalDDDGeometryLoader.cc.

References CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), prof2calltree::count, fill(), relativeConstraints::geom, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, numberingFromDDD, HcalNumberingFromDDD::numberOfCells(), and CaloSubdetectorGeometry::parMgr().

47  {
48 
49  HcalDDDGeometry* gDDD ( new HcalDDDGeometry );
50  ReturnType geom ( gDDD );
51 
52  if( geom->cornersMgr() == 0 ) {
53  const unsigned int count (numberingFromDDD->numberOfCells(HcalBarrel ) +
57  geom->allocateCorners( count ) ;
58  }
59  if( geom->parMgr() == 0 ) geom->allocatePar( 500, 3 ) ;
60 
61  fill(HcalBarrel, gDDD, geom);
62  fill(HcalEndcap, gDDD, geom);
63  fill(HcalForward, gDDD, geom);
64  fill(HcalOuter, gDDD, geom);
65  return geom ;
66 }
void fill(HcalSubdetector, HcalDDDGeometry *, CaloSubdetectorGeometry *)
unsigned int numberOfCells(HcalSubdetector) const
HcalNumberingFromDDD * numberingFromDDD
CaloSubdetectorGeometry * ReturnType
CaloCellGeometry * HcalDDDGeometryLoader::makeCell ( const HcalDetId detId,
HcalCellType  hcalCell,
double  phi,
double  dphi,
CaloSubdetectorGeometry geom 
) const
private

Definition at line 143 of file HcalDDDGeometryLoader.cc.

References abs, CaloSubdetectorGeometry::cornersMgr(), funct::cos(), HcalCellType::depthMax(), HcalCellType::depthMin(), HcalCellType::depthType(), eta(), HcalCellType::etaMax(), HcalCellType::etaMin(), funct::exp(), CaloCellGeometry::getParmPtr(), HcalCellType::halfSize(), HcalBarrel, HcalForward, HcalOuter, LogDebug, CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), point, csvReporter::r, funct::sin(), HcalDetId::subdet(), funct::tan(), theta(), x, detailsBasic3DVector::y, detailsBasic3DVector::z, and HcalDetId::zside().

Referenced by fill().

147  {
148 
149  // the two eta boundaries of the cell
150  double eta1 = hcalCell.etaMin();
151  double eta2 = hcalCell.etaMax();
152  HcalSubdetector subdet = detId.subdet();
153  double eta = 0.5*(eta1+eta2) * detId.zside();
154  double deta = (eta2-eta1);
155  double theta = 2.0*atan(exp(-eta));
156 
157  // barrel vs forward
158  bool rzType = hcalCell.depthType();
159  bool isBarrel = (subdet == HcalBarrel || subdet == HcalOuter);
160 
161  double z, r, thickness;
162 #ifdef DebugLog
163  double r0, r1, r2;
164 #endif
165  if (rzType) {
166  r = hcalCell.depthMin();
167  if (isBarrel) {
168  z = r * sinh(eta); // sinh(eta) == 1/tan(theta)
169  thickness = (hcalCell.depthMax() - r) * cosh(eta); // cosh(eta) == 1/sin(theta)
170 #ifdef DebugLog
171  r1 = r;
172  r2 = hcalCell.depthMax();
173  r0 = 0.5*(r1+r2);
174 #endif
175  } else {
176  z = r * sinh(eta2);
177  thickness = 2. * hcalCell.halfSize();
178  r = z/sinh(std::abs(eta));
179 #ifdef DebugLog
180  r0 = z/sinh(std::abs(eta));
181  r1 = z/sinh(std::abs(eta)+0.5*deta);
182  r2 = z/sinh(std::abs(eta)-0.5*deta);
183 #endif
184  }
185 #ifdef DebugLog
186  LogDebug("HCalGeom") << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
187  << " eta = " << eta << " theta = " << theta
188  << " r = " << r << " thickness = " << thickness
189  << " r0-r2 (" << r0 << ":" << r1 << ":" << r2 << ")";
190 #endif
191  } else {
192  z = hcalCell.depthMin();
193  thickness = hcalCell.depthMax() - z;
194  z *= detId.zside(); // get the sign right.
195  r = z * tan(theta);
196  thickness /= std::abs(cos(theta));
197 #ifdef DebugLog
198  r0 = z/sinh(std::abs(eta));
199  r1 = z/sinh(std::abs(eta)+0.5*deta);
200  r2 = z/sinh(std::abs(eta)-0.5*deta);
201  LogDebug("HCalGeom") << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
202  << " eta = " << eta << " theta = " << theta
203  << " z = " << z << " r = " << r << " thickness = "
204  << thickness << " r0-r2 (" << r0 << ":" << r1 << ":"
205  << r2 << ")";
206 #endif
207  }
208 
209  double x = r * cos(phi);
210  double y = r * sin(phi);
211  GlobalPoint point(x,y,z);
212 
213 #ifdef DebugLog
214  LogDebug("HCalGeom") << "HcalDDDGeometryLoader::makeCell for " << detId
215  << " Point " << point << " deta = " << deta
216  << " dphi = " << dphi << " thickness = " << thickness
217  << " isBarrel = " << isBarrel << " " << rzType;
218 #endif
219 
220  if (subdet==HcalForward) {
221  std::vector<double> hf ;
222  hf.reserve(3) ;
223  hf.push_back(deta/2.) ;
224  hf.push_back(dphi/2.) ;
225  hf.push_back(thickness/2.) ;
226  return new calogeom::IdealZPrism(point,
227  geom->cornersMgr(),
229  geom->parMgr(),
230  geom->parVecVec() ) );
231  } else {
232  const double sign ( isBarrel ? 1 : -1 ) ;
233  std::vector<double> hh ;
234  hh.reserve(3) ;
235  hh.push_back(deta/2.) ;
236  hh.push_back(dphi/2.) ;
237  hh.push_back(sign*thickness/2.) ;
239  geom->cornersMgr(),
241  geom->parMgr(),
242  geom->parVecVec() ) );
243  }
244 }
#define LogDebug(id)
double depthMax() const
Definition: HcalCellType.h:75
double depthMin() const
Definition: HcalCellType.h:74
bool depthType() const
Definition: HcalCellType.h:76
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
#define abs(x)
Definition: mlp_lapack.h:159
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
T eta() const
double double double z
double halfSize() const
Definition: HcalCellType.h:77
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
double etaMax() const
cell edge, always positive &amp; greater than etaMin
Definition: HcalCellType.h:70
CaloCellGeometry::CornersMgr * cornersMgr()
double etaMin() const
lower cell edge. Always positive
Definition: HcalCellType.h:67
static const double * getParmPtr(const std::vector< double > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition: DDAxes.h:10
*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

HcalNumberingFromDDD* HcalDDDGeometryLoader::numberingFromDDD
private

Definition at line 46 of file HcalDDDGeometryLoader.h.

Referenced by fill(), HcalDDDGeometryLoader(), load(), and ~HcalDDDGeometryLoader().