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 (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_
 
HcalNumberingFromDDDnumberingFromDDD
 

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 DDCompactView cpv)
explicit
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 72 of file HcalDDDGeometryLoader.cc.

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

Referenced by load().

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

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

Definition at line 147 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().

151  {
152 
153  // the two eta boundaries of the cell
154  double eta1 = hcalCell.etaMin();
155  double eta2 = hcalCell.etaMax();
156  HcalSubdetector subdet = detId.subdet();
157  double eta = 0.5*(eta1+eta2) * detId.zside();
158  double deta = (eta2-eta1);
159  double theta = 2.0*atan(exp(-eta));
160 
161  // barrel vs forward
162  bool rzType = hcalCell.depthType();
163  bool isBarrel = (subdet == HcalBarrel || subdet == HcalOuter);
164 
165  double z, r, thickness;
166 #ifdef DebugLog
167  double r0, r1, r2;
168 #endif
169  if (rzType) {
170  r = hcalCell.depthMin();
171  if (isBarrel) {
172  z = r * sinh(eta); // sinh(eta) == 1/tan(theta)
173  thickness = (hcalCell.depthMax() - r) * cosh(eta); // cosh(eta) == 1/sin(theta)
174 #ifdef DebugLog
175  r1 = r;
176  r2 = hcalCell.depthMax();
177  r0 = 0.5*(r1+r2);
178 #endif
179  } else {
180  z = r * sinh(eta2);
181  thickness = 2. * hcalCell.halfSize();
182  r = z/sinh(std::abs(eta));
183 #ifdef DebugLog
184  r0 = z/sinh(std::abs(eta));
185  r1 = z/sinh(std::abs(eta)+0.5*deta);
186  r2 = z/sinh(std::abs(eta)-0.5*deta);
187 #endif
188  }
189 #ifdef DebugLog
190  LogDebug("HCalGeom") << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
191  << " eta = " << eta << " theta = " << theta
192  << " r = " << r << " thickness = " << thickness
193  << " r0-r2 (" << r0 << ":" << r1 << ":" << r2 << ")";
194 #endif
195  } else {
196  z = hcalCell.depthMin();
197  thickness = hcalCell.depthMax() - z;
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  {
229  hp.push_back(deta/2.) ;
230  hp.push_back(dphi/2.) ;
231  hp.push_back(thickness/2.) ;
232  }
233  else
234  {
235  const double sign ( isBarrel ? 1 : -1 ) ;
236  hp.push_back(deta/2.) ;
237  hp.push_back(dphi/2.) ;
238  hp.push_back(sign*thickness/2.) ;
239  }
240  geom->newCell( point, point, point,
242  geom->parMgr(),
243  geom->parVecVec() ),
244  detId ) ;
245 }
#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:45
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:47
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:77
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:70
double etaMin() const
lower cell edge. Always positive
Definition: HcalCellType.h:67
*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.

HcalNumberingFromDDD* HcalDDDGeometryLoader::numberingFromDDD
private

Definition at line 45 of file HcalDDDGeometryLoader.h.

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