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

Private Attributes

HcalTopologydummyTopology_
 
const HcalDDDRecConstantshcalConstants
 

Detailed Description

Note
The Geometry as loaded from DDD
Author
S. Banerjee

Definition at line 20 of file HcalDDDGeometryLoader.h.

Member Typedef Documentation

Definition at line 27 of file HcalDDDGeometryLoader.h.

Constructor & Destructor Documentation

HcalDDDGeometryLoader::HcalDDDGeometryLoader ( const HcalDDDRecConstants hcons)
explicit

Definition at line 16 of file HcalDDDGeometryLoader.cc.

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

Definition at line 19 of file HcalDDDGeometryLoader.cc.

19  {
20 }
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 69 of file HcalDDDGeometryLoader.cc.

References HcalDDDRecConstants::HcalCellTypes(), hcalConstants, i, HcalDDDGeometry::insertCell(), relval_2017::k, GetRecoTauVFromDQM_MC_cff::kk, LogDebug, M_PI, makeCell(), convertSQLiteXML::ok, and phi.

Referenced by load().

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

Definition at line 23 of file HcalDDDGeometryLoader.cc.

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

Referenced by HcalDDDGeometryEP::produceIdeal().

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

Load all of HCAL.

Definition at line 48 of file HcalDDDGeometryLoader.cc.

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

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

Definition at line 144 of file HcalDDDGeometryLoader.cc.

References funct::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, AnalysisDataFormats_SUSYBSMObjects::hp, GeomDetEnumerators::isBarrel(), LogDebug, CaloSubdetectorGeometry::newCell(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), point, alignCSCRings::r, diffTwoXMLs::r1, diffTwoXMLs::r2, jetcorrextractor::sign(), funct::sin(), HcalDetId::subdet(), funct::tan(), theta(), x, y, z, and HcalDetId::zside().

Referenced by fill().

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

const HcalDDDRecConstants* HcalDDDGeometryLoader::hcalConstants
private

Definition at line 44 of file HcalDDDGeometryLoader.h.

Referenced by fill(), and load().