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
 
bool isBH_
 

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.

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 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 71 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().

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

25  {
26 
27  HcalSubdetector hsub = static_cast<HcalSubdetector>(subdet);
28 
29 
30  HcalDDDGeometry* gDDD ( new HcalDDDGeometry(topo) );
31  ReturnType geom ( gDDD );
32 
33  if ( geom->cornersMgr() == 0 ) {
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() == 0 ) geom->allocatePar( 500, 3 ) ;
44 
45  fill (hsub, gDDD, geom );
46  return geom ;
47 }
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 50 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().

50  {
51 
52  HcalDDDGeometry* gDDD ( new HcalDDDGeometry(topo) );
53  ReturnType geom ( gDDD );
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, gDDD, geom);
65  fill(HcalEndcap, gDDD, geom);
66  fill(HcalForward, gDDD, geom);
67  fill(HcalOuter, gDDD, geom);
68  return geom ;
69 }
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 146 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(), isBH_, 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().

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

bool HcalDDDGeometryLoader::isBH_
private

Definition at line 47 of file HcalDDDGeometryLoader.h.

Referenced by HcalDDDGeometryLoader(), and makeCell().