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)
 
 HcalDDDGeometryLoader ()=delete
 
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 *)
 
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)
18 {
20 }
const HcalDDDRecConstants * hcalConstants_
HcalDDDGeometryLoader::~HcalDDDGeometryLoader ( )
virtual

Definition at line 22 of file HcalDDDGeometryLoader.cc.

22  {
23 }
HcalDDDGeometryLoader::HcalDDDGeometryLoader ( )
delete

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 74 of file HcalDDDGeometryLoader.cc.

References gather_cfg::cout, HcalDDDRecConstants::HcalCellTypes(), hcalConstants_, mps_fire::i, triggerObjects_cff::id, HcalDDDGeometry::increaseReserve(), HcalDDDGeometry::insertCell(), gen::k, makeCell(), and phi.

Referenced by load().

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

Definition at line 26 of file HcalDDDGeometryLoader.cc.

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

Referenced by HcalDDDGeometryEP::produceIdeal().

26  {
27 
28  HcalSubdetector hsub = static_cast<HcalSubdetector>(subdet);
29 
30 
31  HcalDDDGeometry* geom ( new HcalDDDGeometry(topo) );
32 
33  if ( geom->cornersMgr() == nullptr ) {
34  const unsigned int count (hcalConstants_->numberOfCells(HcalBarrel ) +
38  geom->allocateCorners( count ) ;
39  }
40 
41  // if( geom->cornersMgr() == 0 ) geom->allocateCorners( 2592 ) ;
42 
43  if ( geom->parMgr() == nullptr ) geom->allocatePar( 500, 3 ) ;
44 
45  fill (hsub, geom );
46  //fast insertion of valid ids requires sort at end
47  geom->sortValidIds();
48  return geom ;
49 }
#define nullptr
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 52 of file HcalDDDGeometryLoader.cc.

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

52  {
53 
54  HcalDDDGeometry* geom ( new HcalDDDGeometry(topo) );
55 
56  if( geom->cornersMgr() == nullptr ) {
57  const unsigned int count (hcalConstants_->numberOfCells(HcalBarrel ) +
61  geom->allocateCorners( count ) ;
62  }
63  if( geom->parMgr() == nullptr ) geom->allocatePar( 500, 3 ) ;
64 
65  fill(HcalBarrel, geom);
66  fill(HcalEndcap, geom);
69  //fast insertion of valid ids requires sort at end
70  geom->sortValidIds();
71  return geom ;
72 }
#define nullptr
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 116 of file HcalDDDGeometryLoader.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, HcalCellType::depthMax(), HcalCellType::depthMin(), HcalCellType::depthType(), PVValHelper::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().

119  {
120 
121  // the two eta boundaries of the cell
122  double eta1 = hcalCell.etaMin();
123  double eta2 = hcalCell.etaMax();
124  HcalSubdetector subdet = detId.subdet();
125  double eta = 0.5*(eta1+eta2) * detId.zside();
126  double deta = (eta2-eta1);
127  double theta = 2.0*atan(exp(-eta));
128 
129  // barrel vs forward
130  bool rzType = hcalCell.depthType();
131  bool isBarrel = (subdet == HcalBarrel || subdet == HcalOuter);
132 
133  double z, r, thickness;
134 #ifdef EDM_ML_DEBUG
135  double r0, r1, r2;
136 #endif
137  if (rzType) {
138  r = hcalCell.depthMin();
139  if (isBarrel) {
140  z = r * sinh(eta); // sinh(eta) == 1/tan(theta)
141  thickness = (hcalCell.depthMax() - r) * cosh(eta); // cosh(eta) == 1/sin(theta)
142 #ifdef EDM_ML_DEBUG
143  r1 = r;
144  r2 = hcalCell.depthMax();
145  r0 = 0.5*(r1+r2);
146 #endif
147  } else {
148  z = r * sinh(eta2);
149  thickness = 2. * hcalCell.halfSize();
150  r = z/sinh(std::abs(eta));
151 #ifdef EDM_ML_DEBUG
152  r0 = z/sinh(std::abs(eta));
153  r1 = z/sinh(std::abs(eta)+0.5*deta);
154  r2 = z/sinh(std::abs(eta)-0.5*deta);
155 #endif
156  }
157 #ifdef EDM_ML_DEBUG
158  std::cout << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
159  << " eta = " << eta << " theta = " << theta << " r = " << r
160  << " thickness = " << thickness << " r0-r2 (" << r0 << ":"
161  << r1 << ":" << r2 << ")" << std::endl;
162 #endif
163  } else {
164  z = hcalCell.depthMin();
165  thickness = hcalCell.depthMax() - z;
166  if (isBH_) z += (0.5*thickness);
167  z *= detId.zside(); // get the sign right.
168  r = z * tan(theta);
169  thickness /= std::abs(cos(theta));
170 #ifdef EDM_ML_DEBUG
171  r0 = z/sinh(std::abs(eta));
172  r1 = z/sinh(std::abs(eta)+0.5*deta);
173  r2 = z/sinh(std::abs(eta)-0.5*deta);
174  std::cout << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
175  << " eta = " << eta << " theta = " << theta << " z = " << z
176  << " r = " << r << " thickness = " << thickness << " r0-r2 ("
177  << r0 << ":" << r1 << ":" << r2 << ")" << std::endl;
178 #endif
179  }
180 
181  double x = r * cos(phi);
182  double y = r * sin(phi);
183  GlobalPoint point(x,y,z);
184 
185 #ifdef EDM_ML_DEBUG
186  std::cout << "HcalDDDGeometryLoader::makeCell for " << detId << " Point "
187  << point << " deta = " << deta << " dphi = " << dphi
188  << " thickness = " << thickness << " isBarrel = " << isBarrel
189  << " " << rzType << std::endl;
190 #endif
191 
192  std::vector<CCGFloat> hp ;
193  hp.reserve(3) ;
194 
195  if (subdet==HcalForward) {
196  hp.emplace_back(deta/2.) ;
197  hp.emplace_back(dphi/2.) ;
198  hp.emplace_back(thickness/2.) ;
199  } else {
200  const double sign ( isBarrel ? 1 : -1 ) ;
201  hp.emplace_back(deta/2.) ;
202  hp.emplace_back(dphi/2.) ;
203  hp.emplace_back(sign*thickness/2.) ;
204  }
205  geom->newCellFast( point, point, point,
207  geom->parMgr(),
208  geom->parVecVec() ),
209  detId ) ;
210 }
double depthMax() const
Definition: HcalCellType.h:79
double depthMin() const
Definition: HcalCellType.h:78
bool depthType() const
Definition: HcalCellType.h:80
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:114
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:81
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:71
double etaMin() const
lower cell edge. Always positive
Definition: HcalCellType.h:68
*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().