CMS 3D CMS Logo

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 HcalDDDRecConstants *hcons)
 
ReturnType load (const HcalTopology &topo, DetId::Detector, int)
 
ReturnType load (const HcalTopology &topo)
 Load all of HCAL. More...
 
virtual ~HcalDDDGeometryLoader ()
 

Private Member Functions

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

Private Attributes

HcalTopologydummyTopology_
 
const HcalDDDRecConstantshcalConstants
 
bool isBH_
 

Detailed Description

Note
The Geometry as loaded from DDD
Author
S. Banerjee

Definition at line 21 of file HcalDDDGeometryLoader.h.

Member Typedef Documentation

Definition at line 28 of file HcalDDDGeometryLoader.h.

Constructor & Destructor Documentation

HcalDDDGeometryLoader::HcalDDDGeometryLoader ( const HcalDDDRecConstants hcons)
explicit

Definition at line 16 of file HcalDDDGeometryLoader.cc.

References hcalConstants, HcalDDDRecConstants::isBH(), and isBH_.

17  : hcalConstants(hcons) {
19 }
const HcalDDDRecConstants * hcalConstants
HcalDDDGeometryLoader::~HcalDDDGeometryLoader ( )
virtual

Definition at line 21 of file HcalDDDGeometryLoader.cc.

21  {
22 }
HcalDDDGeometryLoader::HcalDDDGeometryLoader ( )
private

Member Function Documentation

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

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

Definition at line 73 of file HcalDDDGeometryLoader.cc.

References gather_cfg::cout, plotBeamSpotDB::first, HcalDDDRecConstants::HcalCellTypes(), hcalConstants, mps_fire::i, hcalTTPDigis_cfi::id, HcalDDDGeometry::increaseReserve(), HcalDDDGeometry::insertCell(), gen::k, makeCell(), and edm::second().

Referenced by load().

74  {
75 
76  // start by making the new HcalDetIds
77  std::vector<HcalCellType> hcalCells = hcalConstants->HcalCellTypes(subdet);
78  geom->insertCell(hcalCells);
79 #ifdef EDM_ML_DEBUG
80  std::cout << "HcalDDDGeometryLoader::fill gets " << hcalCells.size()
81  << " cells for subdetector " << subdet << std::endl;
82 #endif
83  // Make the new HcalDetIds and the cells
84 
85  std::vector<HcalDetId> hcalIds;
86  for (unsigned int i=0; i<hcalCells.size(); i++) {
87  int etaRing = hcalCells[i].etaBin();
88  int iside = hcalCells[i].zside();
89  int depthBin = hcalCells[i].depthSegment();
90  double dphi = hcalCells[i].phiBinWidth();
91  std::vector<std::pair<int,double> > phis = hcalCells[i].phis();
92 #ifdef EDM_ML_DEBUG
93  std::cout << "HcalDDDGeometryLoader: Subdet " << subdet << " side "
94  << iside << " eta " << etaRing << " depth " << depthBin
95  << " with " << phis.size() << "modules:" << std::endl;
96 #endif
97  geom->increaseReserve(phis.size());
98  for (unsigned int k = 0; k < phis.size(); k++) {
99 #ifdef EDM_ML_DEBUG
100  std::cout << "HcalDDDGeometryLoader::fill Cell " << i << " eta "
101  << iside*etaRing << " phi " << phis[k].first << "("
102  << phis[k].second/CLHEP::deg << ", " << dphi/CLHEP::deg
103  << ") depth " << depthBin << std::endl;
104 #endif
105  HcalDetId id(subdet, iside*etaRing, phis[k].first, depthBin);
106  hcalIds.push_back(id);
107  makeCell(id,hcalCells[i],phis[k].second,dphi,geom) ;
108  }
109  }
110 
111  edm::LogInfo("HCalGeom") << "Number of HCAL DetIds made for " << subdet
112  << " is " << hcalIds.size();
113 }
U second(std::pair< T, U > const &p)
int insertCell(std::vector< HcalCellType > const &)
void increaseReserve(unsigned int extra)
std::vector< HcalCellType > HcalCellTypes(HcalSubdetector) const
int k[5][pyjets_maxn]
void makeCell(const HcalDetId &, const HcalCellType &, double, double, HcalDDDGeometry *geom) const
const HcalDDDRecConstants * hcalConstants
HcalDDDGeometryLoader::ReturnType HcalDDDGeometryLoader::load ( const HcalTopology topo,
DetId::Detector  det,
int  subdet 
)

Definition at line 25 of file HcalDDDGeometryLoader.cc.

References CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), KineDebug3::count(), fill(), relativeConstraints::geom, HcalBarrel, hcalConstants, HcalEndcap, HcalForward, HcalOuter, HcalDDDRecConstants::numberOfCells(), CaloSubdetectorGeometry::parMgr(), and HcalDDDGeometry::sortValidIds().

Referenced by HcalDDDGeometryEP::produceIdeal().

25  {
26 
27  HcalSubdetector hsub = static_cast<HcalSubdetector>(subdet);
28 
29 
30  HcalDDDGeometry* geom ( new HcalDDDGeometry(topo) );
31 
32  if ( geom->cornersMgr() == 0 ) {
33  const unsigned int count (hcalConstants->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, geom );
45  //fast insertion of valid ids requires sort at end
46  geom->sortValidIds();
47  return geom ;
48 }
void fill(HcalSubdetector, HcalDDDGeometry *)
unsigned int numberOfCells(HcalSubdetector) const
HcalSubdetector
Definition: HcalAssistant.h:31
const HcalDDDRecConstants * hcalConstants
HcalDDDGeometryLoader::ReturnType HcalDDDGeometryLoader::load ( const HcalTopology topo)

Load all of HCAL.

Definition at line 51 of file HcalDDDGeometryLoader.cc.

References CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), KineDebug3::count(), fill(), relativeConstraints::geom, HcalBarrel, hcalConstants, HcalEndcap, HcalForward, HcalOuter, HcalDDDRecConstants::numberOfCells(), CaloSubdetectorGeometry::parMgr(), and HcalDDDGeometry::sortValidIds().

51  {
52 
53  HcalDDDGeometry* geom ( new HcalDDDGeometry(topo) );
54 
55  if( geom->cornersMgr() == 0 ) {
56  const unsigned int count (hcalConstants->numberOfCells(HcalBarrel ) +
60  geom->allocateCorners( count ) ;
61  }
62  if( geom->parMgr() == 0 ) geom->allocatePar( 500, 3 ) ;
63 
64  fill(HcalBarrel, geom);
65  fill(HcalEndcap, geom);
68  //fast insertion of valid ids requires sort at end
69  geom->sortValidIds();
70  return geom ;
71 }
void fill(HcalSubdetector, HcalDDDGeometry *)
unsigned int numberOfCells(HcalSubdetector) const
const HcalDDDRecConstants * hcalConstants
void HcalDDDGeometryLoader::makeCell ( const HcalDetId detId,
const HcalCellType hcalCell,
double  phi,
double  dphi,
HcalDDDGeometry geom 
) const
private

Definition at line 115 of file HcalDDDGeometryLoader.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, HcalCellType::depthMax(), HcalCellType::depthMin(), HcalCellType::depthType(), stringResolutionProvider_cfi::eta, HcalCellType::etaMax(), HcalCellType::etaMin(), JetChargeProducer_cfi::exp, CaloCellGeometry::getParmPtr(), HcalCellType::halfSize(), HcalBarrel, HcalForward, HcalOuter, AnalysisDataFormats_SUSYBSMObjects::hp, gedGsfElectrons_cfi::isBarrel, isBH_, HcalDDDGeometry::newCellFast(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), point, alignCSCRings::r, diffTwoXMLs::r1, diffTwoXMLs::r2, Validation_hcalonly_cfi::sign, funct::sin(), HcalDetId::subdet(), funct::tan(), theta(), x, y, z, and HcalDetId::zside().

Referenced by fill().

118  {
119 
120  // the two eta boundaries of the cell
121  double eta1 = hcalCell.etaMin();
122  double eta2 = hcalCell.etaMax();
123  HcalSubdetector subdet = detId.subdet();
124  double eta = 0.5*(eta1+eta2) * detId.zside();
125  double deta = (eta2-eta1);
126  double theta = 2.0*atan(exp(-eta));
127 
128  // barrel vs forward
129  bool rzType = hcalCell.depthType();
130  bool isBarrel = (subdet == HcalBarrel || subdet == HcalOuter);
131 
132  double z, r, thickness;
133 #ifdef EDM_ML_DEBUG
134  double r0, r1, r2;
135 #endif
136  if (rzType) {
137  r = hcalCell.depthMin();
138  if (isBarrel) {
139  z = r * sinh(eta); // sinh(eta) == 1/tan(theta)
140  thickness = (hcalCell.depthMax() - r) * cosh(eta); // cosh(eta) == 1/sin(theta)
141 #ifdef EDM_ML_DEBUG
142  r1 = r;
143  r2 = hcalCell.depthMax();
144  r0 = 0.5*(r1+r2);
145 #endif
146  } else {
147  z = r * sinh(eta2);
148  thickness = 2. * hcalCell.halfSize();
149  r = z/sinh(std::abs(eta));
150 #ifdef EDM_ML_DEBUG
151  r0 = z/sinh(std::abs(eta));
152  r1 = z/sinh(std::abs(eta)+0.5*deta);
153  r2 = z/sinh(std::abs(eta)-0.5*deta);
154 #endif
155  }
156 #ifdef EDM_ML_DEBUG
157  std::cout << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
158  << " eta = " << eta << " theta = " << theta << " r = " << r
159  << " thickness = " << thickness << " r0-r2 (" << r0 << ":"
160  << r1 << ":" << r2 << ")" << std::endl;
161 #endif
162  } else {
163  z = hcalCell.depthMin();
164  thickness = hcalCell.depthMax() - z;
165  if (isBH_) z += (0.5*thickness);
166  z *= detId.zside(); // get the sign right.
167  r = z * tan(theta);
168  thickness /= std::abs(cos(theta));
169 #ifdef EDM_ML_DEBUG
170  r0 = z/sinh(std::abs(eta));
171  r1 = z/sinh(std::abs(eta)+0.5*deta);
172  r2 = z/sinh(std::abs(eta)-0.5*deta);
173  std::cout << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
174  << " eta = " << eta << " theta = " << theta << " z = " << z
175  << " r = " << r << " thickness = " << thickness << " r0-r2 ("
176  << r0 << ":" << r1 << ":" << r2 << ")" << std::endl;
177 #endif
178  }
179 
180  double x = r * cos(phi);
181  double y = r * sin(phi);
182  GlobalPoint point(x,y,z);
183 
184 #ifdef EDM_ML_DEBUG
185  std::cout << "HcalDDDGeometryLoader::makeCell for " << detId << " Point "
186  << point << " deta = " << deta << " dphi = " << dphi
187  << " thickness = " << thickness << " isBarrel = " << isBarrel
188  << " " << rzType << std::endl;
189 #endif
190 
191  std::vector<CCGFloat> hp ;
192  hp.reserve(3) ;
193 
194  if (subdet==HcalForward) {
195  hp.push_back(deta/2.) ;
196  hp.push_back(dphi/2.) ;
197  hp.push_back(thickness/2.) ;
198  } else {
199  const double sign ( isBarrel ? 1 : -1 ) ;
200  hp.push_back(deta/2.) ;
201  hp.push_back(dphi/2.) ;
202  hp.push_back(sign*thickness/2.) ;
203  }
204  geom->newCellFast( point, point, point,
206  geom->parMgr(),
207  geom->parVecVec() ),
208  detId ) ;
209 }
double depthMax() const
Definition: HcalCellType.h:77
double depthMin() const
Definition: HcalCellType.h:76
bool depthType() const
Definition: HcalCellType.h:78
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.cc:93
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
void newCellFast(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
double halfSize() const
Definition: HcalCellType.h:79
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
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:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
double etaMax() const
cell edge, always positive & greater than etaMin
Definition: HcalCellType.h:69
double etaMin() const
lower cell edge. Always positive
Definition: HcalCellType.h:66
*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

Member Data Documentation

HcalTopology* HcalDDDGeometryLoader::dummyTopology_
private

Definition at line 47 of file HcalDDDGeometryLoader.h.

const HcalDDDRecConstants* HcalDDDGeometryLoader::hcalConstants
private

Definition at line 45 of file HcalDDDGeometryLoader.h.

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

bool HcalDDDGeometryLoader::isBH_
private

Definition at line 48 of file HcalDDDGeometryLoader.h.

Referenced by HcalDDDGeometryLoader(), and makeCell().