CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private 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< std::shared_ptr< const CaloCellGeometry > > 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...
 
std::shared_ptr< 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
 
bool present (const DetId &id) const override
 is this detid present in the geometry? More...
 
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 ~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)
 
std::shared_ptr< const CaloCellGeometrycellGeomPtr (uint32_t index) const override
 
unsigned int getClosestCellIndex (const GlobalPoint &r) const
 
const CaloCellGeometrygetGeometryRawPtr (uint32_t index) const override
 
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 Member Functions

std::shared_ptr< const CaloCellGeometrycellGeomPtr (uint32_t index, const GlobalPoint &p) 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 27 of file HGCalGeometry.h.

Member Typedef Documentation

Definition at line 40 of file HGCalGeometry.h.

Definition at line 33 of file HGCalGeometry.h.

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

Definition at line 31 of file HGCalGeometry.h.

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

Definition at line 38 of file HGCalGeometry.h.

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

Definition at line 37 of file HGCalGeometry.h.

Definition at line 41 of file HGCalGeometry.h.

Definition at line 34 of file HGCalGeometry.h.

Definition at line 35 of file HGCalGeometry.h.

Member Enumeration Documentation

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 43 of file HGCalGeometry.h.

anonymous enum
Enumerator
k_NumberOfShapes 

Definition at line 44 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
Definition: HGCalTopology.h:98
std::vector< DetId > m_validIds
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
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 289 of file HGCalGeometry.cc.

Referenced by topology().

289  {
290  edm::LogError("HGCalGeom") << "HGCalGeometry::addValidID is not implemented";
291 }
std::string HGCalGeometry::cellElement ( ) const

Definition at line 231 of file HGCalGeometry.cc.

References HGCEE, HGCHEB, HGCHEF, and m_subdet.

Referenced by producerTag().

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 267 of file HGCalGeometry.cc.

References m_cellVec, and m_validGeomIds.

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

267  {
268  if ((index >= m_cellVec.size()) || (m_validGeomIds[index].rawId() == 0))
269  return nullptr;
270  static const auto do_not_delete = [](const void*){};
271  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec[index],do_not_delete);
272  if (nullptr == cell->param()) return nullptr;
273  return cell;
274 }
std::vector< DetId > m_validGeomIds
CellVec m_cellVec
std::shared_ptr< const CaloCellGeometry > HGCalGeometry::cellGeomPtr ( uint32_t  index,
const GlobalPoint p 
) const
private

Definition at line 276 of file HGCalGeometry.cc.

References cellGeomPtr(), m_cellVec, and m_validGeomIds.

276  {
277  if ((index >= m_cellVec.size()) || (m_validGeomIds[index].rawId() == 0))
278  return nullptr;
279  if (pos == GlobalPoint()) return cellGeomPtr(index);
280  auto cell = std::make_shared<FlatTrd>(m_cellVec[index]);
281  cell->setPosition(pos);
282 #ifdef EDM_ML_DEBUG
283 //std::cout << "cellGeomPtr " << newcell << ":" << cell << std::endl;
284 #endif
285  if (nullptr == cell->param()) return nullptr;
286  return cell;
287 }
std::vector< DetId > m_validGeomIds
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
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 226 of file HGCalGeometry.cc.

Referenced by getValidGeomDetIds().

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 195 of file HGCalGeometry.cc.

References HGCalDDDConstants::assignCell(), gather_cfg::cout, HGCalTopology::dddConstants(), HGCalTopology::decode(), HGCalTopology::encode(), getClosestCellIndex(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, HGCalTopology::DecodedDetId::iCell, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, DTRecHitClients_cfi::local, m_cellVec, m_validGeomIds, 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().

195  {
196  unsigned int cellIndex = getClosestCellIndex(r);
197  if (cellIndex < m_cellVec.size()) {
199  HepGeom::Point3D<float> local;
200  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Hexagon) ||
201  (topology().dddConstants().geomMode() == HGCalGeometryMode::HexagonFull)) {
202  if (r.z() > 0) local = HepGeom::Point3D<float>(r.x(),r.y(),0);
203  else local = HepGeom::Point3D<float>(-r.x(),r.y(),0);
204  std::pair<int,int> kxy =
205  topology().dddConstants().assignCell(local.x(),local.y(),id_.iLay,
206  id_.iSubSec,true);
207  id_.iCell = kxy.second;
208  id_.iSec = kxy.first;
209  id_.iSubSec = topology().dddConstants().waferTypeT(kxy.first);
210  if (id_.iSubSec != 1) id_.iSubSec = -1;
211 #ifdef EDM_ML_DEBUG
212  std::cout << "getClosestCell: local " << local << " Id " << id_.zside
213  << ":" << id_.iLay << ":" << id_.iSec << ":" << id_.iSubSec
214  << ":" << id_.iCell << std::endl;
215 #endif
216 
217  //check if returned cell is valid
218  if (id_.iCell>=0) return topology().encode(id_);
219  }
220  }
221 
222  //if not valid or out of bounds return a null DetId
223  return DetId();
224 }
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:99
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 294 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().

294  {
295 
296  float phip = r.phi();
297  float zp = r.z();
298  unsigned int cellIndex = m_cellVec.size();
299  float dzmin(9999), dphimin(9999), dphi10(0.175);
300  for (unsigned int k=0; k<m_cellVec.size(); ++k) {
301  float dphi = phip-m_cellVec[k].phiPos();
302  while (dphi > M_PI) dphi -= 2*M_PI;
303  while (dphi <= -M_PI) dphi += 2*M_PI;
304  if (fabs(dphi) < dphi10) {
305  float dz = fabs(zp - m_cellVec[k].getPosition().z());
306  if (dz < (dzmin+0.001)) {
307  dzmin = dz;
308  if (fabs(dphi) < (dphimin+0.01)) {
309  cellIndex = k;
310  dphimin = fabs(dphi);
311  } else {
312  if (cellIndex >= m_cellVec.size()) cellIndex = k;
313  }
314  }
315  }
316  }
317 #ifdef EDM_ML_DEBUG
318  std::cout << "getClosestCellIndex::Input " << zp << ":" << phip << " Index "
319  << cellIndex;
320  if (cellIndex < m_cellVec.size())
321  std::cout << " Cell z " << m_cellVec[cellIndex].getPosition().z() << ":"
322  << dzmin << " phi " << m_cellVec[cellIndex].phiPos() << ":"
323  << dphimin;
324  std::cout << std::endl;
325 
326 #endif
327  return cellIndex;
328 }
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 169 of file HGCalGeometry.cc.

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

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

169  {
170 
171  HGCalGeometry::CornersVec co (8, GlobalPoint(0,0,0));
172  unsigned int cellIndex = indexFor(id);
173  if (cellIndex < m_cellVec.size()) {
175  std::pair<float,float> xy;
176  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Hexagon) ||
177  (topology().dddConstants().geomMode() == HGCalGeometryMode::HexagonFull)) {
178  xy = topology().dddConstants().locateCellHex(id_.iCell,id_.iSec,true);
179  } else {
180  xy = std::pair<float,float>(0,0);
181  }
182  float dz = m_cellVec[cellIndex].param()[0];
183  float dx = 0.5*m_cellVec[cellIndex].param()[11];
184  static const int signx[] = {-1,-1,1,1,-1,-1,1,1};
185  static const int signy[] = {-1,1,1,-1,-1,1,1,-1};
186  static const int signz[] = {-1,-1,-1,-1,1,1,1,1};
187  for (unsigned int i = 0; i != 8; ++i) {
188  const HepGeom::Point3D<float> lcoord(xy.first+signx[i]*dx,xy.second+signy[i]*dx,signz[i]*dz);
189  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
190  }
191  }
192  return co;
193 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:38
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
DecodedDetId decode(const DetId &id) const
const HGCalDDDConstants & dddConstants() const
unsigned int indexFor(const DetId &id) const override
CellVec m_cellVec
std::shared_ptr< 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 117 of file HGCalGeometry.cc.

References cellGeomPtr(), HGCalDetId::geometryCell(), getPosition(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, and topology().

Referenced by dbString().

117  {
118  if (id == DetId()) return nullptr; // nothing to get
119  DetId geoId;
120  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Hexagon) ||
121  (topology().dddConstants().geomMode() == HGCalGeometryMode::HexagonFull)) {
122  geoId = (DetId)(HGCalDetId(id).geometryCell());
123  } else {
124  return nullptr;
125  }
126  const uint32_t cellIndex (topology().detId2denseGeomId(geoId));
127  const GlobalPoint pos = (id != geoId) ? getPosition(id) : GlobalPoint();
128  return cellGeomPtr (cellIndex, pos);
129 
130 }
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
Definition: DetId.h:18
const CaloCellGeometry * HGCalGeometry::getGeometryRawPtr ( uint32_t  index) const
overrideprotectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 260 of file HGCalGeometry.cc.

References m_cellVec, and CaloCellGeometry::param().

Referenced by present(), and topology().

260  {
261  // Modify the RawPtr class
262  const CaloCellGeometry* cell(&m_cellVec[index]);
263  return (m_cellVec.size() < index ||
264  nullptr == cell->param() ? nullptr : cell);
265 }
CellVec m_cellVec
GlobalPoint HGCalGeometry::getPosition ( const DetId id) const

Definition at line 145 of file HGCalGeometry.cc.

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

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

145  {
146 
147  unsigned int cellIndex = indexFor(id);
148  GlobalPoint glob;
149  if (cellIndex < m_cellVec.size()) {
151  std::pair<float,float> xy;
152  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Hexagon) ||
153  (topology().dddConstants().geomMode() == HGCalGeometryMode::HexagonFull)) {
154  xy = topology().dddConstants().locateCellHex(id_.iCell,id_.iSec,true);
155  } else {
156  xy = std::pair<float,float>(0,0);
157  }
158  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
159  glob = m_cellVec[cellIndex].getPosition(lcoord);
160 #ifdef EDM_ML_DEBUG
161  std::cout << "getPosition:: index " << cellIndex << " Local " << lcoord.x()
162  << ":" << lcoord.y() << " ID " << id_.iCell << ":" << id_.iLay
163  << " Global " << glob << std::endl;
164 #endif
165  }
166  return glob;
167 }
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
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 344 of file HGCalGeometry.cc.

References HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, cellGeomPtr(), HGCalParameters::hgtrap::cellSize, HGCalTopology::dddConstants(), HGCalParameters::hgtrap::dz, HGCalDDDConstants::getModule(), HGCalDDDConstants::getTrForm(), HGCalDDDConstants::getTrFormN(), runTauDisplay::gp, HGCalParameters::hgtrap::h, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, mps_fire::i, k_NumberOfParametersPerShape, k_NumberOfShapes, HGCalParameters::hgtrform::lay, HGCalDetId::layer(), m_validGeomIds, CaloSubdetectorGeometry::numberOfParametersPerShape(), CaloSubdetectorGeometry::numberOfShapes(), CaloSubdetectorGeometry::numberOfTransformParms(), findQualityFiles::rr, HGCalDDDConstants::sectors(), HGCalParameters::hgtrap::tl, topology(), HGCalTopology::totalGeomModules(), groupFilesInBlocks::tt, and HGCalDDDConstants::waferInLayer().

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

347  {
348 
349  unsigned int numberOfCells = topology().totalGeomModules(); // total Geom Modules both sides
352 
353  trVector.reserve( numberOfCells * numberOfTransformParms());
354  iVector.reserve( numberOfCells );
355  dimVector.reserve( numberOfShapes * numberOfParametersPerShape );
356  dinsVector.reserve( numberOfCells );
357 
358  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Hexagon) ||
359  (topology().dddConstants().geomMode() == HGCalGeometryMode::HexagonFull)) {
360  for (unsigned itr=0; itr<topology().dddConstants().getTrFormN(); ++itr) {
362  int layer = mytr.lay;
363  for (int wafer=0; wafer<topology().dddConstants().sectors(); ++wafer) {
364  if (topology().dddConstants().waferInLayer(wafer,layer,true)) {
365  HGCalParameters::hgtrap vol = topology().dddConstants().getModule(wafer, true, true);
367  params[0] = vol.dz;
368  params[1] = params[2] = 0;
369  params[3] = params[7] = vol.h;
370  params[4] = params[8] = vol.bl;
371  params[5] = params[9] = vol.tl;
372  params[6] = params[10]= vol.alpha;
373  params[11]= vol.cellSize;
374  dimVector.insert( dimVector.end(), params.begin(), params.end());
375  }
376  }
377  }
378  }
379 
380  for (unsigned int i( 0 ); i < numberOfCells; ++i) {
381  DetId detId = m_validGeomIds[i];
382  int layer = HGCalDetId(detId).layer();
383  dinsVector.emplace_back( topology().detId2denseGeomId( detId ));
384  iVector.emplace_back( layer );
385 
386  Tr3D tr;
387  auto ptr = cellGeomPtr( i );
388  if ( nullptr != ptr ) {
389  ptr->getTransform( tr, ( Pt3DVec* ) nullptr );
390 
391  if( Tr3D() == tr ) { // there is no rotation
392  const GlobalPoint& gp( ptr->getPosition());
393  tr = HepGeom::Translate3D( gp.x(), gp.y(), gp.z());
394  }
395 
396  const CLHEP::Hep3Vector tt( tr.getTranslation());
397  trVector.emplace_back( tt.x());
398  trVector.emplace_back( tt.y());
399  trVector.emplace_back( tt.z());
400  if (6 == numberOfTransformParms()) {
401  const CLHEP::HepRotation rr( tr.getRotation());
402  const ROOT::Math::Transform3D rtr( rr.xx(), rr.xy(), rr.xz(), tt.x(),
403  rr.yx(), rr.yy(), rr.yz(), tt.y(),
404  rr.zx(), rr.zy(), rr.zz(), tt.z());
406  rtr.GetRotation( ea );
407  trVector.emplace_back( ea.Phi());
408  trVector.emplace_back( ea.Theta());
409  trVector.emplace_back( ea.Psi());
410  }
411  }
412  }
413 }
std::vector< DetId > m_validGeomIds
virtual unsigned int numberOfParametersPerShape() const
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
HGCalParameters::hgtrform getTrForm(unsigned int k) const
std::vector< float > ParmVec
CaloCellGeometry::Tr3D Tr3D
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:98
unsigned int getTrFormN() const
virtual unsigned int numberOfShapes() const
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
int sectors() const
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
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
int layer() const
get the layer #
Definition: HGCalDetId.h:48
bool waferInLayer(int wafer, int lay, bool reco) 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 79 of file HGCalGeometry.h.

References CaloSubdetectorGeometry::m_validIds.

79 { 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 238 of file HGCalGeometry.cc.

References gather_cfg::cout, TauDecayModes::dec, HGCalTopology::detId2denseGeomId(), HGCalDetId::geometryCell(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, m_cellVec, DetId::rawId(), and topology().

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

238  {
239  unsigned int cellIndex = m_cellVec.size();
240  if (id != DetId()) {
241  DetId geoId;
242  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Hexagon) ||
243  (topology().dddConstants().geomMode() == HGCalGeometryMode::HexagonFull)) {
244  geoId = (DetId)(HGCalDetId(id).geometryCell());
245  cellIndex = topology().detId2denseGeomId(geoId);
246 #ifdef EDM_ML_DEBUG
247  std::cout << "indexFor " << std::hex << id.rawId() << ":"
248  << geoId.rawId() << std::dec << " index " << cellIndex
249  << std::endl;
250 #endif
251  }
252  }
253  return cellIndex;
254 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
virtual uint32_t detId2denseGeomId(const DetId &id) const
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
Definition: DetId.h:18
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:162
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(), HGCalDetId::geometryCell(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, m_cellVec, m_halfType, m_validGeomIds, CaloSubdetectorGeometry::m_validIds, HGCalDDDConstants::numberCellsHexagon(), DetId::rawId(), HGCalGeometryMode::Square, 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::Hexagon) ||
61  (topology().dddConstants().geomMode() == HGCalGeometryMode::HexagonFull)) {
62  geomId = (DetId)(HGCalDetId(detId).geometryCell());
63  cells = topology().dddConstants().numberCellsHexagon(id.iSec);
64 #ifdef EDM_ML_DEBUG
65  std::cout << "NewCell " << HGCalDetId(detId) << " GEOM "
66  << HGCalDetId(geomId) << std::endl;
67 #endif
68  } else {
69  return;
70  }
71  const uint32_t cellIndex (topology().detId2denseGeomId(detId));
72 
73  m_cellVec.at( cellIndex ) = FlatTrd( cornersMgr(), f1, f2, f3, parm ) ;
74  m_validGeomIds.at( cellIndex ) = geomId ;
75 
76 #ifdef EDM_ML_DEBUG
77  std::cout << "Store for DetId " << std::hex << detId.rawId() << " GeomId "
78  << geomId.rawId() << std::dec << " Index " << cellIndex
79  << " cells " << cells << std::endl;
80  unsigned int nOld = m_validIds.size();
81 #endif
82  for (int cell = 0; cell < cells; ++cell) {
83  id.iCell = cell;
84  DetId idc = topology().encode(id);
85  if (topology().valid(idc)) {
86  m_validIds.emplace_back(idc);
87  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Square) &&
88  (!m_halfType)) {
89  id.iSubSec = -id.iSubSec;
90  m_validIds.emplace_back( topology().encode(id));
91  id.iSubSec = -id.iSubSec;
92  }
93  }
94  }
95 
96 #ifdef EDM_ML_DEBUG
97  std::cout << "HGCalGeometry::newCell-> [" << cellIndex << "]"
98  << " front:" << f1.x() << '/' << f1.y() << '/' << f1.z()
99  << " back:" << f2.x() << '/' << f2.y() << '/' << f2.z()
100  << " eta|phi " << m_cellVec[cellIndex].etaPos() << ":"
101  << m_cellVec[cellIndex].phiPos() << " id:";
102  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Hexagon) ||
103  (topology().dddConstants().geomMode() == HGCalGeometryMode::HexagonFull)) {
104  std::cout << HGCalDetId(detId);
105  } else {
106  std::cout << std::hex << detId.rawId() << std::dec;
107  }
108  unsigned int nNew = m_validIds.size();
109  std::cout << " with valid DetId from " << nOld << " to " << nNew
110  << std::endl;
111  std::cout << "Cell[" << cellIndex << "] " << std::hex << geomId.rawId()
112  << ":" << m_validGeomIds[cellIndex].rawId() << std::dec
113  << std::endl;
114 #endif
115 }
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:44
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
int numberCellsHexagon(int wafer) const
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:99
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
const HGCalDDDConstants & dddConstants() const
CaloCellGeometry::CornersMgr * cornersMgr()
def encode(args, files)
T x() const
Definition: PV3DBase.h:62
CellVec m_cellVec
bool HGCalGeometry::present ( const DetId id) const
overridevirtual

is this detid present in the geometry?

Reimplemented from CaloSubdetectorGeometry.

Definition at line 132 of file HGCalGeometry.cc.

References HGCalDetId::geometryCell(), getGeometryRawPtr(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, and topology().

Referenced by dbString().

132  {
133  if (id == DetId()) return false;
134  DetId geoId;
135  if ((topology().dddConstants().geomMode() == HGCalGeometryMode::Hexagon) ||
136  (topology().dddConstants().geomMode() == HGCalGeometryMode::HexagonFull)) {
137  geoId = (DetId)(HGCalDetId(id).geometryCell());
138  } else {
139  return false;
140  }
141  const uint32_t index (topology().detId2denseGeomId(geoId));
142  return (nullptr != getGeometryRawPtr(index)) ;
143 }
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
Definition: DetId.h:18
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
static std::string HGCalGeometry::producerTag ( )
inlinestatic

Definition at line 96 of file HGCalGeometry.h.

References cellElement(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

Definition at line 256 of file HGCalGeometry.cc.

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

Referenced by topology().

256  {
257  return topology().totalGeomModules();
258 }
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:98
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
void HGCalGeometry::sortDetIds ( void  )

Definition at line 339 of file HGCalGeometry.cc.

References CaloSubdetectorGeometry::m_validIds.

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

339  {
340  m_validIds.shrink_to_fit();
341  std::sort( m_validIds.begin(), m_validIds.end(), rawIdSort());
342 }
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 124 of file HGCalGeometry.h.

Referenced by newCell().

ForwardSubdetector HGCalGeometry::m_subdet
private

Definition at line 125 of file HGCalGeometry.h.

Referenced by cellElement().

const HGCalTopology& HGCalGeometry::m_topology
private

Definition at line 120 of file HGCalGeometry.h.

Referenced by topology().

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

Definition at line 123 of file HGCalGeometry.h.

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