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  auto cell = getGeometry(detId);
41  if( nullptr != cell &&
42  cell->inside( r ) ) {
43  returnId = detId ;
44  break ;
45  }
46  }
47  return returnId ;
48 }
49 
50 
51 unsigned int
53 {
54  const CaloGenericDetId gid ( id ) ;
55 
56  assert( gid.isCastor() ) ;
57 
58  return 0 ;
59 }
60 
61 unsigned int
63 {
64  return (unsigned int)DetId::Calo - 1 ;
65 }
66 
67 void
69  const CCGFloat* pv ,
70  unsigned int /*i*/,
71  Pt3D& ref )
72 {
73  IdealCastorTrapezoid::localCorners( lc, pv, ref ) ;
74 }
75 
76 void
78  const GlobalPoint& /*f2*/ ,
79  const GlobalPoint& /*f3*/ ,
80  const CCGFloat* parm ,
81  const DetId& detId )
82 {
83  const CaloGenericDetId cgid ( detId ) ;
84 
85  assert( cgid.isCastor() ) ;
86 
87  const unsigned int di ( cgid.denseIndex() ) ;
88 
89  m_cellVec[ di ] = IdealCastorTrapezoid( f1, cornersMgr(), parm ) ;
90  addValidID( detId ) ;
91 }
92 
94  // Modify the RawPtr class
95  const CaloCellGeometry* cell(&m_cellVec[index]);
96  return (m_cellVec.size() < index ||
97  nullptr == cell->param() ? nullptr : cell);
98 }
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)
const CastorTopology * theTopology
const CCGFloat * param() const
def pv(vc)
Definition: MetAnalyzer.py:7
~CastorGeometry() override
CaloCellGeometry::CCGFloat CCGFloat
uint32_t denseIndex() const
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: DetId.h:18
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
void addValidID(const DetId &id)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
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)