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 ()
 
void makeCell (const HcalDetId &, HcalCellType, double, double, CaloSubdetectorGeometry *geom) const
 

Private Attributes

HcalNumberingFromDDDnumberingFromDDD
 

Detailed Description

Note
The Geometry as loaded from DDD
Date:
2011/06/04 19:07:17
Revision:
1.6
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 15 of file HcalDDDGeometryLoader.cc.

References mergeVDriftHistosByStation::name, and numberingFromDDD.

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

Definition at line 20 of file HcalDDDGeometryLoader.cc.

References numberingFromDDD.

20  {
21  delete numberingFromDDD;
22 }
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 70 of file HcalDDDGeometryLoader.cc.

References HcalNumberingFromDDD::HcalCellTypes(), i, errorMatrix2Lands_multiChannel::id, HcalDDDGeometry::insertCell(), gen::k, GetRecoTauVFromDQM_MC_cff::kk, LogDebug, M_PI, makeCell(), numberingFromDDD, convertSQLiteXML::ok, and phi.

Referenced by load().

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

26  {
27 
28  HcalSubdetector hsub = static_cast<HcalSubdetector>(subdet);
29  HcalDDDGeometry* gDDD ( new HcalDDDGeometry );
30  ReturnType geom ( gDDD );
31 
32  if ( geom->cornersMgr() == 0 ) {
33  const unsigned int count (numberingFromDDD->numberOfCells(HcalBarrel ) +
37  geom->allocateCorners( count ) ;
38  }
39 
40  // if( geom->cornersMgr() == 0 ) geom->allocateCorners( 2592 ) ;
41 
42  if ( geom->parMgr() == 0 ) geom->allocatePar( 500, 3 ) ;
43 
44  fill (hsub, gDDD, geom );
45  return geom ;
46 }
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 49 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().

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

Definition at line 145 of file HcalDDDGeometryLoader.cc.

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

Referenced by fill().

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