CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
HGCalGeometry Class Referencefinal

#include <HGCalGeometry.h>

Inheritance diagram for HGCalGeometry:
CaloSubdetectorGeometry

Public Types

enum  { k_NumberOfParametersPerShape = 12 }
 
enum  { k_NumberOfShapes = 50 }
 
typedef HGCalGeometryRecord AlignedRecord
 
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< FlatTrdCellVec
 
typedef std::vector< GlobalPointCornersVec
 
typedef std::set< DetIdDetIdSet
 
typedef PHGCalRcd PGeometryRecord
 
typedef CaloCellGeometry::Pt3D Pt3D
 
typedef CaloCellGeometry::Pt3DVec Pt3DVec
 
- Public Types inherited from CaloSubdetectorGeometry
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< CaloCellGeometry const * > CellSet
 
typedef std::set< DetIdDetIdSet
 
typedef std::vector< CCGFloatDimVec
 
typedef std::vector< unsigned int > IVec
 
typedef CaloCellGeometry::ParMgr ParMgr
 
typedef CaloCellGeometry::ParVec ParVec
 
typedef CaloCellGeometry::ParVecVec ParVecVec
 
typedef std::vector< CCGFloatTrVec
 

Public Member Functions

std::string cellElement () const
 
virtual void fillNamedParams (DDFilteredView fv)
 
DetIdSet getCells (const GlobalPoint &r, double dR) const override
 Get a list of all cells within a dR of the given cell. More...
 
DetId getClosestCell (const GlobalPoint &r) const override
 
CornersVec getCorners (const DetId &id) const
 Returns the corner points of this cell's volume. More...
 
const CaloCellGeometrygetGeometry (const DetId &id) const override
 Get the cell geometry of a given detector id. Should return false if not found. More...
 
GlobalPoint getPosition (const DetId &id) const
 
void getSummary (CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
 
const std::vector< DetId > & getValidDetIds (DetId::Detector det=DetId::Detector(0), int subdet=0) const override
 Get a list of valid detector ids (for the given subdetector) More...
 
const std::vector< DetId > & getValidGeomDetIds (void) const
 
 HGCalGeometry (const HGCalTopology &topology)
 
void initializeParms () override
 
void localCorners (Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
 
void newCell (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
 
void sortDetIds ()
 
const HGCalTopologytopology () const
 
 ~HGCalGeometry () override
 
- Public Member Functions inherited from CaloSubdetectorGeometry
void allocateCorners (CaloCellGeometry::CornersVec::size_type n)
 
void allocatePar (ParVec::size_type n, unsigned int m)
 
 CaloSubdetectorGeometry ()
 
 CaloSubdetectorGeometry (const CaloSubdetectorGeometry &)=delete
 avoid copies More...
 
CaloCellGeometry::CornersMgrcornersMgr ()
 
CCGFloat deltaEta (const DetId &detId) const
 
CCGFloat deltaPhi (const DetId &detId) const
 
virtual void fillDefaultNamedParameters () const
 
virtual CellSet getCellSet (const GlobalPoint &r, double dR) const
 
virtual unsigned int numberOfParametersPerShape () const
 
virtual unsigned int numberOfShapes () const
 
virtual unsigned int numberOfTransformParms () const
 
CaloSubdetectorGeometryoperator= (const CaloSubdetectorGeometry &)=delete
 
ParMgrparMgr ()
 
const ParMgrparMgrConst () const
 
ParVecVecparVecVec ()
 
const ParVecVecparVecVec () const
 
virtual bool present (const DetId &id) const
 is this detid present in the geometry? More...
 
virtual ~CaloSubdetectorGeometry ()
 The base class DOES assume that it owns the CaloCellGeometry objects. More...
 

Static Public Member Functions

static std::string dbString ()
 
static std::string producerTag ()
 

Protected Member Functions

void addValidID (const DetId &id)
 
const CaloCellGeometrycellGeomPtr (uint32_t index) const override
 
unsigned int getClosestCellIndex (const GlobalPoint &r) const
 
unsigned int indexFor (const DetId &id) const override
 
unsigned int sizeForDenseIndex () const
 
- Protected Member Functions inherited from CaloSubdetectorGeometry
void addValidID (const DetId &id)
 
virtual unsigned int sizeForDenseIndex (const DetId &id) const
 

Private Attributes

CellVec m_cellVec
 
bool m_halfType
 
ForwardSubdetector m_subdet
 
const HGCalTopologym_topology
 
std::vector< DetIdm_validGeomIds
 

Additional Inherited Members

- Static Protected Member Functions inherited from CaloSubdetectorGeometry
static CCGFloat deltaR (const GlobalPoint &p1, const GlobalPoint &p2)
 
- Protected Attributes inherited from CaloSubdetectorGeometry
ParVecVec m_parVecVec
 
std::vector< DetIdm_validIds
 

Detailed Description

Definition at line 26 of file HGCalGeometry.h.

Member Typedef Documentation

Definition at line 39 of file HGCalGeometry.h.

Definition at line 32 of file HGCalGeometry.h.

typedef std::vector<FlatTrd> HGCalGeometry::CellVec

Definition at line 30 of file HGCalGeometry.h.

typedef std::vector<GlobalPoint> HGCalGeometry::CornersVec

Definition at line 37 of file HGCalGeometry.h.

typedef std::set<DetId> HGCalGeometry::DetIdSet

Definition at line 36 of file HGCalGeometry.h.

Definition at line 40 of file HGCalGeometry.h.

Definition at line 33 of file HGCalGeometry.h.

Definition at line 34 of file HGCalGeometry.h.

Member Enumeration Documentation

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 42 of file HGCalGeometry.h.

anonymous enum
Enumerator
k_NumberOfShapes 

Definition at line 43 of file HGCalGeometry.h.

Constructor & Destructor Documentation

HGCalGeometry::HGCalGeometry ( const HGCalTopology topology)

Definition at line 23 of file HGCalGeometry.cc.

References gather_cfg::cout, CaloSubdetectorGeometry::m_validIds, topology(), and HGCalTopology::totalGeomModules().

Referenced by dbString().

24  : m_topology( topology_ ),
25  m_cellVec( topology_.totalGeomModules()),
26  m_validGeomIds( topology_.totalGeomModules()),
27  m_halfType( topology_.detectorType()),
28  m_subdet( topology_.subDetector()) {
29 
30  m_validIds.reserve( topology().totalModules());
31 #ifdef EDM_ML_DEBUG
32  std::cout << "Expected total # of Geometry Modules "
33  << topology().totalGeomModules() << std::endl;
34 #endif
35 }
std::vector< DetId > m_validGeomIds
const HGCalTopology & m_topology
unsigned int totalGeomModules() const
std::vector< DetId > m_validIds
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
ForwardSubdetector m_subdet
CellVec m_cellVec
HGCalGeometry::~HGCalGeometry ( )
override

Definition at line 37 of file HGCalGeometry.cc.

Referenced by dbString().

37 { }

Member Function Documentation

void HGCalGeometry::addValidID ( const DetId id)
protected

Definition at line 274 of file HGCalGeometry.cc.

Referenced by topology().

274  {
275  edm::LogError("HGCalGeom") << "HGCalGeometry::addValidID is not implemented";
276 }
std::string HGCalGeometry::cellElement ( ) const

Definition at line 232 of file HGCalGeometry.cc.

References HGCEE, HGCHEB, HGCHEF, and m_subdet.

Referenced by producerTag().

232  {
233  if (m_subdet == HGCEE) return "HGCalEE";
234  else if (m_subdet == HGCHEF) return "HGCalHEFront";
235  else if (m_subdet == HGCHEB) return "HGCalHEBack";
236  else return "Unknown";
237 }
ForwardSubdetector m_subdet
const CaloCellGeometry * HGCalGeometry::cellGeomPtr ( uint32_t  index) const
overrideprotectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 263 of file HGCalGeometry.cc.

References m_cellVec, m_validGeomIds, and CaloCellGeometry::param().

Referenced by getGeometry(), getSummary(), and topology().

263  {
264  if ((index >= m_cellVec.size()) || (m_validGeomIds[index].rawId() == 0))
265  return nullptr;
266  const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
267 #ifdef EDM_ML_DEBUG
268  // std::cout << "cellGeomPtr " << m_cellVec[index];
269 #endif
270  if (nullptr == cell->param()) return nullptr;
271  return cell;
272 }
std::vector< DetId > m_validGeomIds
CellVec m_cellVec
static std::string HGCalGeometry::dbString ( )
inlinestatic
void HGCalGeometry::fillNamedParams ( DDFilteredView  fv)
virtual

Definition at line 39 of file HGCalGeometry.cc.

Referenced by getValidGeomDetIds().

39 {}
HGCalGeometry::DetIdSet HGCalGeometry::getCells ( const GlobalPoint r,
double  dR 
) const
overridevirtual

Get a list of all cells within a dR of the given cell.

The default implementation makes a loop over all cell geometries. Cleverer implementations are suggested to use rough conversions between eta/phi and ieta/iphi and test on the boundaries.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 228 of file HGCalGeometry.cc.

Referenced by getValidGeomDetIds().

228  {
230  return dss;
231 }
std::set< DetId > DetIdSet
Definition: HGCalGeometry.h:36
DetId HGCalGeometry::getClosestCell ( const GlobalPoint r) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 192 of file HGCalGeometry.cc.

References HGCalDDDConstants::assignCell(), gather_cfg::cout, HGCalTopology::dddConstants(), HGCalTopology::decode(), HGCalTopology::encode(), HGCalDDDConstants::geomMode(), getClosestCellIndex(), HGCalTopology::DecodedDetId::iCell, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, DTRecHitQuality_cfi::local, m_cellVec, m_validGeomIds, HGCalGeometryMode::Square, topology(), HGCalDDDConstants::waferTypeT(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and HGCalTopology::DecodedDetId::zside.

Referenced by getValidGeomDetIds().

192  {
193  unsigned int cellIndex = getClosestCellIndex(r);
194  if (cellIndex < m_cellVec.size()) {
196  HepGeom::Point3D<float> local;
197  if (topology().dddConstants().geomMode() == HGCalGeometryMode::Square) {
198  local = m_cellVec[cellIndex].getLocal(r);
199  } else {
200  if (r.z() > 0) local = HepGeom::Point3D<float>(r.x(),r.y(),0);
201  else local = HepGeom::Point3D<float>(-r.x(),r.y(),0);
202  }
203  std::pair<int,int> kxy =
204  topology().dddConstants().assignCell(local.x(),local.y(),id_.iLay,
205  id_.iSubSec,true);
206  id_.iCell = kxy.second;
208  id_.iSubSec = kxy.first;
209  } else {
210  id_.iSec = kxy.first;
211  id_.iSubSec = topology().dddConstants().waferTypeT(kxy.first);
212  if (id_.iSubSec != 1) id_.iSubSec = -1;
213  }
214 #ifdef EDM_ML_DEBUG
215  std::cout << "getClosestCell: local " << local << " Id " << id_.zside
216  << ":" << id_.iLay << ":" << id_.iSec << ":" << id_.iSubSec
217  << ":" << id_.iCell << std::endl;
218 #endif
219 
220  //check if returned cell is valid
221  if (id_.iCell>=0) return topology().encode(id_);
222  }
223 
224  //if not valid or out of bounds return a null DetId
225  return DetId();
226 }
std::vector< DetId > m_validGeomIds
unsigned int getClosestCellIndex(const GlobalPoint &r) const
T y() const
Definition: PV3DBase.h:63
DetId encode(const DecodedDetId &id_) const
T z() const
Definition: PV3DBase.h:64
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
HGCalGeometryMode::GeometryMode geomMode() const
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
const HGCalDDDConstants & dddConstants() const
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
T x() const
Definition: PV3DBase.h:62
int waferTypeT(int wafer) const
CellVec m_cellVec
unsigned int HGCalGeometry::getClosestCellIndex ( const GlobalPoint r) const
protected

Definition at line 279 of file HGCalGeometry.cc.

References a, b, gather_cfg::cout, PVValHelper::dz, getPosition(), gen::k, m_cellVec, M_PI, PV3DBase< T, PVType, FrameType >::phi(), DetId::rawId(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by getClosestCell(), and topology().

279  {
280 
281  float phip = r.phi();
282  float zp = r.z();
283  unsigned int cellIndex = m_cellVec.size();
284  float dzmin(9999), dphimin(9999), dphi10(0.175);
285  for (unsigned int k=0; k<m_cellVec.size(); ++k) {
286  float dphi = phip-m_cellVec[k].phiPos();
287  while (dphi > M_PI) dphi -= 2*M_PI;
288  while (dphi <= -M_PI) dphi += 2*M_PI;
289  if (fabs(dphi) < dphi10) {
290  float dz = fabs(zp - m_cellVec[k].getPosition().z());
291  if (dz < (dzmin+0.001)) {
292  dzmin = dz;
293  if (fabs(dphi) < (dphimin+0.01)) {
294  cellIndex = k;
295  dphimin = fabs(dphi);
296  } else {
297  if (cellIndex >= m_cellVec.size()) cellIndex = k;
298  }
299  }
300  }
301  }
302 #ifdef EDM_ML_DEBUG
303  std::cout << "getClosestCellIndex::Input " << zp << ":" << phip << " Index "
304  << cellIndex;
305  if (cellIndex < m_cellVec.size())
306  std::cout << " Cell z " << m_cellVec[cellIndex].getPosition().z() << ":"
307  << dzmin << " phi " << m_cellVec[cellIndex].phiPos() << ":"
308  << dphimin;
309  std::cout << std::endl;
310 
311 #endif
312  return cellIndex;
313 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint getPosition(const DetId &id) const
T z() const
Definition: PV3DBase.h:64
#define M_PI
int k[5][pyjets_maxn]
CellVec m_cellVec
HGCalGeometry::CornersVec HGCalGeometry::getCorners ( const DetId id) const

Returns the corner points of this cell's volume.

Definition at line 167 of file HGCalGeometry.cc.

References HGCalTopology::dddConstants(), HGCalTopology::decode(), PVValHelper::dx, PVValHelper::dz, mps_fire::i, HGCalTopology::DecodedDetId::iCell, HGCalTopology::DecodedDetId::iLay, indexFor(), HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellHex(), m_cellVec, HGCalGeometryMode::Square, topology(), and geometryCSVtoXML::xy.

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), and dbString().

167  {
168 
169  HGCalGeometry::CornersVec co (8, GlobalPoint(0,0,0));
170  unsigned int cellIndex = indexFor(id);
171  if (cellIndex < m_cellVec.size()) {
173  std::pair<float,float> xy;
174  if (topology().dddConstants().geomMode() == HGCalGeometryMode::Square) {
175  xy = topology().dddConstants().locateCell(id_.iCell,id_.iLay,id_.iSubSec,true);
176  } else {
177  xy = topology().dddConstants().locateCellHex(id_.iCell,id_.iSec,true);
178  }
179  float dz = m_cellVec[cellIndex].param()[0];
180  float dx = 0.5*m_cellVec[cellIndex].param()[11];
181  static const int signx[] = {-1,-1,1,1,-1,-1,1,1};
182  static const int signy[] = {-1,1,1,-1,-1,1,1,-1};
183  static const int signz[] = {-1,-1,-1,-1,1,1,1,1};
184  for (unsigned int i = 0; i != 8; ++i) {
185  const HepGeom::Point3D<float> lcoord(xy.first+signx[i]*dx,xy.second+signy[i]*dx,signz[i]*dz);
186  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
187  }
188  }
189  return co;
190 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:37
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
DecodedDetId decode(const DetId &id) const
const HGCalDDDConstants & dddConstants() const
unsigned int indexFor(const DetId &id) const override
CellVec m_cellVec
const CaloCellGeometry * HGCalGeometry::getGeometry ( const DetId id) const
overridevirtual

Get the cell geometry of a given detector id. Should return false if not found.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 120 of file HGCalGeometry.cc.

References cellGeomPtr(), HGCEEDetId::geometryCell(), HGCHEDetId::geometryCell(), HGCalDetId::geometryCell(), HGCEE, HGCalGeometryMode::Square, and topology().

Referenced by dbString().

120  {
121  if (id == DetId()) return nullptr; // nothing to get
122  DetId geoId;
123  if (topology().dddConstants().geomMode() == HGCalGeometryMode::Square) {
124  geoId = (id.subdetId() == HGCEE ?
125  (DetId)(HGCEEDetId(id).geometryCell()) :
126  (DetId)(HGCHEDetId(id).geometryCell()));
127  } else {
128  geoId = (DetId)(HGCalDetId(id).geometryCell());
129  }
130  const uint32_t cellIndex (topology().detId2denseGeomId(geoId));
131  /*
132  if (cellIndex < m_cellVec.size()) {
133  HGCalTopology::DecodedDetId id_ = topology().decode(id);
134  std::pair<float,float> xy = topology().dddConstants().locateCell(id_iCell,id_iLay,id_.iSubSec,true);
135  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
136  std::auto_ptr<FlatTrd> cellGeom(new FlatTrd(m_cellVec[cellIndex],lcoord));
137  return cellGeom.release();
138  }
139  */
140  return cellGeomPtr (cellIndex);
141 
142 }
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
HGCHEDetId geometryCell() const
Definition: HGCHEDetId.cc:46
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
Definition: DetId.h:18
HGCEEDetId geometryCell() const
Definition: HGCEEDetId.h:34
const CaloCellGeometry * cellGeomPtr(uint32_t index) const override
GlobalPoint HGCalGeometry::getPosition ( const DetId id) const

Definition at line 144 of file HGCalGeometry.cc.

References gather_cfg::cout, HGCalTopology::dddConstants(), HGCalTopology::decode(), HGCalTopology::DecodedDetId::iCell, HGCalTopology::DecodedDetId::iLay, indexFor(), HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellHex(), m_cellVec, HGCalGeometryMode::Square, topology(), and geometryCSVtoXML::xy.

Referenced by HGCalTBAnalyzer::analyzeDigi(), HGCalTBAnalyzer::analyzeRecHits(), HGCalTriggerGeometryHexImp1::buildTriggerCellsAndModules(), dbString(), HGCalTriggerNtupleHGCDigis::fill(), getClosestCellIndex(), HGCalTriggerGeometryHexImp2::getModulePosition(), HGCalTriggerGeometryHexLayerBasedImp1::getModulePosition(), hgcal::RecHitTools::getPosition(), HGCalTriggerGeometryHexImp2::getTriggerCellPosition(), HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellPosition(), and HGCalTriggerGeometryImp1::initialize().

144  {
145 
146  unsigned int cellIndex = indexFor(id);
147  GlobalPoint glob;
148  if (cellIndex < m_cellVec.size()) {
150  std::pair<float,float> xy;
151  if (topology().dddConstants().geomMode() == HGCalGeometryMode::Square) {
152  xy = topology().dddConstants().locateCell(id_.iCell,id_.iLay,id_.iSubSec,true);
153  } else {
154  xy = topology().dddConstants().locateCellHex(id_.iCell,id_.iSec,true);
155  }
156  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
157  glob = m_cellVec[cellIndex].getPosition(lcoord);
158 #ifdef EDM_ML_DEBUG
159  std::cout << "getPosition:: index " << cellIndex << " Local " << lcoord.x()
160  << ":" << lcoord.y() << " ID " << id_.iCell << ":" << id_.iLay
161  << " Global " << glob << std::endl;
162 #endif
163  }
164  return glob;
165 }
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
DecodedDetId decode(const DetId &id) const
const HGCalDDDConstants & dddConstants() const
unsigned int indexFor(const DetId &id) const override
CellVec m_cellVec
void HGCalGeometry::getSummary ( CaloSubdetectorGeometry::TrVec trVector,
CaloSubdetectorGeometry::IVec iVector,
CaloSubdetectorGeometry::DimVec dimVector,
CaloSubdetectorGeometry::IVec dinsVector 
) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 329 of file HGCalGeometry.cc.

References HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, cellGeomPtr(), HGCalParameters::hgtrap::cellSize, HGCalTopology::dddConstants(), HGCalParameters::hgtrap::dz, HGCalDDDConstants::getModule(), CaloCellGeometry::getPosition(), CaloCellGeometry::getTransform(), HGCalDDDConstants::getTrForm(), HGCalDDDConstants::getTrFormN(), runTauDisplay::gp, HGCalParameters::hgtrap::h, HGCEE, mps_fire::i, gen::k, k_NumberOfParametersPerShape, k_NumberOfShapes, HGCalParameters::hgtrform::lay, HGCEEDetId::layer(), HGCHEDetId::layer(), m_validGeomIds, CaloSubdetectorGeometry::numberOfParametersPerShape(), CaloSubdetectorGeometry::numberOfShapes(), CaloSubdetectorGeometry::numberOfTransformParms(), findQualityFiles::rr, HGCalDDDConstants::sectors(), HGCalGeometryMode::Square, DetId::subdetId(), HGCalParameters::hgtrap::tl, topology(), HGCalTopology::totalGeomModules(), groupFilesInBlocks::tt, HGCalDDDConstants::volumes(), and HGCalDDDConstants::waferInLayer().

Referenced by dbString(), and CaloGeometryDBEP< T, U >::produceAligned().

332  {
333 
334  unsigned int numberOfCells = topology().totalGeomModules(); // total Geom Modules both sides
337 
338  trVector.reserve( numberOfCells * numberOfTransformParms());
339  iVector.reserve( numberOfCells );
340  dimVector.reserve( numberOfShapes * numberOfParametersPerShape );
341  dinsVector.reserve( numberOfCells );
342 
343  if (topology().geomMode() == HGCalGeometryMode::Square) {
344  for (unsigned int k=0; k <topology().dddConstants().volumes(); ++k) {
347  params[0] = vol.dz;
348  params[1] = params[2] = 0;
349  params[3] = params[7] = vol.h;
350  params[4] = params[8] = vol.bl;
351  params[5] = params[9] = vol.tl;
352  params[6] = params[10]= vol.alpha;
353  params[11]= vol.cellSize;
354  dimVector.insert( dimVector.end(), params.begin(), params.end());
355  }
356  } else {
357  for (unsigned itr=0; itr<topology().dddConstants().getTrFormN(); ++itr) {
359  int layer = mytr.lay;
360  for (int wafer=0; wafer<topology().dddConstants().sectors(); ++wafer) {
361  if (topology().dddConstants().waferInLayer(wafer,layer,true)) {
362  HGCalParameters::hgtrap vol = topology().dddConstants().getModule(wafer, true, true);
364  params[0] = vol.dz;
365  params[1] = params[2] = 0;
366  params[3] = params[7] = vol.h;
367  params[4] = params[8] = vol.bl;
368  params[5] = params[9] = vol.tl;
369  params[6] = params[10]= vol.alpha;
370  params[11]= vol.cellSize;
371  dimVector.insert( dimVector.end(), params.begin(), params.end());
372  }
373  }
374  }
375  }
376 
377  for (unsigned int i( 0 ); i < numberOfCells; ++i) {
378  DetId detId = m_validGeomIds[i];
379  int layer = ((detId.subdetId() == ForwardSubdetector::HGCEE) ?
380  (HGCEEDetId(detId).layer()) :
381  (HGCHEDetId(detId).layer()));
382  dinsVector.emplace_back( topology().detId2denseGeomId( detId ));
383  iVector.emplace_back( layer );
384 
385  Tr3D tr;
386  const CaloCellGeometry* ptr( cellGeomPtr( i ));
387  if ( nullptr != ptr ) {
388  ptr->getTransform( tr, ( Pt3DVec* ) nullptr );
389 
390  if( Tr3D() == tr ) { // there is no rotation
391  const GlobalPoint& gp( ptr->getPosition());
392  tr = HepGeom::Translate3D( gp.x(), gp.y(), gp.z());
393  }
394 
395  const CLHEP::Hep3Vector tt( tr.getTranslation());
396  trVector.emplace_back( tt.x());
397  trVector.emplace_back( tt.y());
398  trVector.emplace_back( tt.z());
399  if (6 == numberOfTransformParms()) {
400  const CLHEP::HepRotation rr( tr.getRotation());
401  const ROOT::Math::Transform3D rtr( rr.xx(), rr.xy(), rr.xz(), tt.x(),
402  rr.yx(), rr.yy(), rr.yz(), tt.y(),
403  rr.zx(), rr.zy(), rr.zz(), tt.z());
405  rtr.GetRotation( ea );
406  trVector.emplace_back( ea.Phi());
407  trVector.emplace_back( ea.Theta());
408  trVector.emplace_back( ea.Psi());
409  }
410  }
411  }
412 }
std::vector< DetId > m_validGeomIds
virtual unsigned int numberOfParametersPerShape() const
HGCalParameters::hgtrform getTrForm(unsigned int k) const
std::vector< float > ParmVec
int layer() const
get the layer #
Definition: HGCHEDetId.h:50
CaloCellGeometry::Tr3D Tr3D
unsigned int totalGeomModules() const
unsigned int getTrFormN() const
virtual unsigned int numberOfShapes() const
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
int sectors() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
int k[5][pyjets_maxn]
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
int layer() const
get the layer #
Definition: HGCEEDetId.h:49
const HGCalDDDConstants & dddConstants() const
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
virtual unsigned int numberOfTransformParms() const
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
const CaloCellGeometry * cellGeomPtr(uint32_t index) const override
bool waferInLayer(int wafer, int lay, bool reco) const
unsigned int volumes() const
const std::vector<DetId>& HGCalGeometry::getValidDetIds ( DetId::Detector  det = DetId::Detector(0),
int  subdet = 0 
) const
inlineoverridevirtual

Get a list of valid detector ids (for the given subdetector)

Note
The implementation in this class is relevant for SubdetectorGeometries which handle only a single subdetector at a time. It does not look at the det and subdet arguments.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 76 of file HGCalGeometry.h.

References CaloSubdetectorGeometry::m_validIds.

76 { return m_validIds; }
std::vector< DetId > m_validIds
const std::vector<DetId>& HGCalGeometry::getValidGeomDetIds ( void  ) const
inline
unsigned int HGCalGeometry::indexFor ( const DetId id) const
overrideprotectedvirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 239 of file HGCalGeometry.cc.

References gather_cfg::cout, TauDecayModes::dec, HGCalTopology::detId2denseGeomId(), HGCEEDetId::geometryCell(), HGCHEDetId::geometryCell(), HGCalDetId::geometryCell(), HGCEE, m_cellVec, DetId::rawId(), HGCalGeometryMode::Square, and topology().

Referenced by getCorners(), getPosition(), and topology().

239  {
240  unsigned int cellIndex = m_cellVec.size();
241  if (id != DetId()) {
242  DetId geoId;
243  if (topology().dddConstants().geomMode() == HGCalGeometryMode::Square) {
244  geoId = (id.subdetId() == HGCEE ?
245  (DetId)(HGCEEDetId(id).geometryCell()) :
246  (DetId)(HGCHEDetId(id).geometryCell()));
247  } else {
248  geoId = (DetId)(HGCalDetId(id).geometryCell());
249  }
250  cellIndex = topology().detId2denseGeomId(geoId);
251 #ifdef EDM_ML_DEBUG
252  std::cout << "indexFor " << std::hex << id.rawId() << ":" << geoId.rawId()
253  << std::dec << " index " << cellIndex << std::endl;
254 #endif
255  }
256  return cellIndex;
257 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
virtual uint32_t detId2denseGeomId(const DetId &id) const
HGCHEDetId geometryCell() const
Definition: HGCHEDetId.cc:46
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
Definition: DetId.h:18
HGCEEDetId geometryCell() const
Definition: HGCEEDetId.h:34
CellVec m_cellVec
void HGCalGeometry::initializeParms ( )
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 41 of file HGCalGeometry.cc.

Referenced by getValidGeomDetIds().

41  {
42 }
void HGCalGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)

Definition at line 44 of file HGCalGeometry.cc.

References FlatTrd::localCorners().

Referenced by dbString().

47  {
48  FlatTrd::localCorners( lc, pv, ref ) ;
49 }
def pv(vc)
Definition: MetAnalyzer.py:6
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatTrd.cc:163
void HGCalGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
overridevirtual

Implements CaloSubdetectorGeometry.

Definition at line 51 of file HGCalGeometry.cc.

References CaloSubdetectorGeometry::cornersMgr(), gather_cfg::cout, HGCalTopology::dddConstants(), TauDecayModes::dec, HGCalTopology::decode(), alcaDQMUpload::encode(), HGCalTopology::encode(), HGCEEDetId::geometryCell(), HGCHEDetId::geometryCell(), HGCalDetId::geometryCell(), HGCEE, m_cellVec, m_halfType, m_subdet, m_validGeomIds, CaloSubdetectorGeometry::m_validIds, HGCalDDDConstants::maxCells(), HGCalDDDConstants::numberCellsHexagon(), DetId::rawId(), HGCalGeometryMode::Square, DetId::subdetId(), topology(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by HGCalGeometryLoader::buildGeom(), and dbString().

55  {
56 
57  DetId geomId;
58  int cells;
60  if (topology().dddConstants().geomMode() == HGCalGeometryMode::Square) {
61  geomId = (detId.subdetId() == HGCEE ?
62  (DetId)(HGCEEDetId(detId).geometryCell()) :
63  (DetId)(HGCHEDetId(detId).geometryCell()));
64  cells = topology().dddConstants().maxCells(id.iLay,true);
65  } else {
66  geomId = (DetId)(HGCalDetId(detId).geometryCell());
67  cells = topology().dddConstants().numberCellsHexagon(id.iSec);
68 #ifdef EDM_ML_DEBUG
69  std::cout << "NewCell " << HGCalDetId(detId) << " GEOM "
70  << HGCalDetId(geomId) << std::endl;
71 #endif
72  }
73  const uint32_t cellIndex (topology().detId2denseGeomId(detId));
74 
75  m_cellVec.at( cellIndex ) = FlatTrd( cornersMgr(), f1, f2, f3, parm ) ;
76  m_validGeomIds.at( cellIndex ) = geomId ;
77 
78 #ifdef EDM_ML_DEBUG
79  std::cout << "Store for DetId " << std::hex << detId.rawId() << " GeomId "
80  << geomId.rawId() << std::dec << " Index " << cellIndex
81  << " cells " << cells << std::endl;
82  unsigned int nOld = m_validIds.size();
83 #endif
84  for (int cell = 0; cell < cells; ++cell) {
85  id.iCell = cell;
86  DetId idc = topology().encode(id);
87  if (topology().valid(idc)) {
88  m_validIds.emplace_back(idc);
89  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Square) &&
90  (!m_halfType)) {
91  id.iSubSec = -id.iSubSec;
92  m_validIds.emplace_back( topology().encode(id));
93  id.iSubSec = -id.iSubSec;
94  }
95  }
96  }
97 
98 #ifdef EDM_ML_DEBUG
99  std::cout << "HGCalGeometry::newCell-> [" << cellIndex << "]"
100  << " front:" << f1.x() << '/' << f1.y() << '/' << f1.z()
101  << " back:" << f2.x() << '/' << f2.y() << '/' << f2.z()
102  << " eta|phi " << m_cellVec[cellIndex].etaPos() << ":"
103  << m_cellVec[cellIndex].phiPos() << " id:";
104  if (topology().dddConstants().geomMode() != HGCalGeometryMode::Square) {
105  std::cout << HGCalDetId(detId);
106  } else if (m_subdet == HGCEE) {
107  std::cout << HGCEEDetId(detId);
108  } else {
109  std::cout << HGCHEDetId(detId);
110  }
111  unsigned int nNew = m_validIds.size();
112  std::cout << " with valid DetId from " << nOld << " to " << nNew
113  << std::endl;
114  std::cout << "Cell[" << cellIndex << "] " << std::hex << geomId.rawId()
115  << ":" << m_validGeomIds[cellIndex].rawId() << std::dec
116  << std::endl;
117 #endif
118 }
std::vector< DetId > m_validGeomIds
A base class to handle the particular shape of HGCal volumes.
Definition: FlatTrd.h:19
T y() const
Definition: PV3DBase.h:63
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
int numberCellsHexagon(int wafer) const
HGCHEDetId geometryCell() const
Definition: HGCHEDetId.cc:46
DetId encode(const DecodedDetId &id_) const
std::vector< DetId > m_validIds
T z() const
Definition: PV3DBase.h:64
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
ForwardSubdetector m_subdet
const HGCalDDDConstants & dddConstants() const
HGCEEDetId geometryCell() const
Definition: HGCEEDetId.h:34
CaloCellGeometry::CornersMgr * cornersMgr()
def encode(args, files)
int maxCells(bool reco) const
T x() const
Definition: PV3DBase.h:62
CellVec m_cellVec
static std::string HGCalGeometry::producerTag ( )
inlinestatic

Definition at line 93 of file HGCalGeometry.h.

References cellElement(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PCaloGeometryBuilder::beginRun(), and CaloGeometryBuilder::produceAligned().

93 { return "HGCal" ; }
unsigned int HGCalGeometry::sizeForDenseIndex ( ) const
protected

Definition at line 259 of file HGCalGeometry.cc.

References topology(), and HGCalTopology::totalGeomModules().

Referenced by topology().

259  {
260  return topology().totalGeomModules();
261 }
unsigned int totalGeomModules() const
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
void HGCalGeometry::sortDetIds ( void  )

Definition at line 324 of file HGCalGeometry.cc.

References CaloSubdetectorGeometry::m_validIds.

Referenced by HGCalGeometryLoader::build(), and topology().

324  {
325  m_validIds.shrink_to_fit();
326  std::sort( m_validIds.begin(), m_validIds.end(), rawIdSort());
327 }
std::vector< DetId > m_validIds
const HGCalTopology& HGCalGeometry::topology ( ) const
inline

Member Data Documentation

CellVec HGCalGeometry::m_cellVec
private
bool HGCalGeometry::m_halfType
private

Definition at line 115 of file HGCalGeometry.h.

Referenced by newCell().

ForwardSubdetector HGCalGeometry::m_subdet
private

Definition at line 116 of file HGCalGeometry.h.

Referenced by cellElement(), and newCell().

const HGCalTopology& HGCalGeometry::m_topology
private

Definition at line 111 of file HGCalGeometry.h.

Referenced by topology().

std::vector<DetId> HGCalGeometry::m_validGeomIds
private

Definition at line 114 of file HGCalGeometry.h.

Referenced by cellGeomPtr(), getClosestCell(), getSummary(), getValidGeomDetIds(), and newCell().