CMS 3D CMS Logo

CastorGeometry.cc
Go to the documentation of this file.
5 #include "CastorGeometryData.h"
6 #include <algorithm>
7 
11 
13  theTopology( new CastorTopology ),
14  lastReqDet_(DetId::Detector(0)),
15  lastReqSubdet_(0),
16  m_ownsTopology ( true ),
17  m_cellVec ( k_NumberOfCellsForCorners )
18 {}
19 
21  theTopology(topology),
23  lastReqSubdet_(0),
26 {}
27 
28 
30 {
31  if( m_ownsTopology ) delete theTopology ;
32 }
33 
34 DetId
36 {
37  DetId returnId ( 0 ) ;
38  const std::vector<DetId>& detIds ( getValidDetIds() ) ;
39  for(auto detId : detIds)
40  {
41  const CaloCellGeometry* cell ( getGeometry( detId ) ) ;
42  if( nullptr != cell &&
43  cell->inside( r ) )
44  {
45  returnId = detId ;
46  break ;
47  }
48  }
49  return returnId ;
50 }
51 
52 
53 
54 unsigned int
56 {
57  const CaloGenericDetId gid ( id ) ;
58 
59  assert( gid.isCastor() ) ;
60 
61  return 0 ;
62 }
63 
64 unsigned int
66 {
67  return (unsigned int)DetId::Calo - 1 ;
68 }
69 
70 void
72  const CCGFloat* pv ,
73  unsigned int /*i*/,
74  Pt3D& ref )
75 {
76  IdealCastorTrapezoid::localCorners( lc, pv, ref ) ;
77 }
78 
79 void
81  const GlobalPoint& /*f2*/ ,
82  const GlobalPoint& /*f3*/ ,
83  const CCGFloat* parm ,
84  const DetId& detId )
85 {
86  const CaloGenericDetId cgid ( detId ) ;
87 
88  assert( cgid.isCastor() ) ;
89 
90  const unsigned int di ( cgid.denseIndex() ) ;
91 
92  m_cellVec[ di ] = IdealCastorTrapezoid( f1, cornersMgr(), parm ) ;
93  addValidID( detId ) ;
94 }
95 
96 const CaloCellGeometry*
98 {
99  const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
100  return ( m_cellVec.size() < index ||
101  nullptr == cell->param() ? nullptr : cell ) ;
102 }
CaloTopology const * topology(0)
DetId getClosestCell(const GlobalPoint &r) const override
bool isCastor() const
static unsigned int alignmentTransformIndexLocal(const DetId &id)
DetId::Detector lastReqDet_
std::vector< Pt3D > Pt3DVec
CaloCellGeometry::CCGFloat CCGFloat
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const CastorTopology * theTopology
const CCGFloat * param() const
def pv(vc)
Definition: MetAnalyzer.py:6
~CastorGeometry() override
CaloCellGeometry::CCGFloat CCGFloat
const CaloCellGeometry * cellGeomPtr(uint32_t index) const override
uint32_t denseIndex() const
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: DetId.h:18
bool inside(const GlobalPoint &point) const
Returns true if the specified point is inside this cell.
void addValidID(const DetId &id)
CaloCellGeometry::CornersMgr * cornersMgr()
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
CaloCellGeometry::Pt3D Pt3D
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)