CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorGeometry.cc
Go to the documentation of this file.
5 #include "CastorGeometryData.h"
6 #include <algorithm>
7 
9  theTopology( new CastorTopology ),
10  lastReqDet_(DetId::Detector(0)),
11  lastReqSubdet_(0),
12  m_ownsTopology ( true )
13 {
14 }
15 
17  theTopology(topology),
18  lastReqDet_(DetId::Detector(0)),
19  lastReqSubdet_(0),
20  m_ownsTopology ( false )
21 {
22 }
23 
24 
26 {
27  if( m_ownsTopology ) delete theTopology ;
28 }
29 
30 const std::vector<DetId>&
32  int subdet ) const
33 {
34  const std::vector<DetId>& baseIds ( CaloSubdetectorGeometry::getValidDetIds() ) ;
35  if( det == DetId::Detector( 0 ) &&
36  subdet == 0 )
37  {
38  return baseIds ;
39  }
40 
41  if( lastReqDet_ != det ||
42  lastReqSubdet_ != subdet )
43  {
44  lastReqDet_ = det ;
45  lastReqSubdet_ = subdet ;
46  m_validIds.clear();
47  m_validIds.reserve( baseIds.size() ) ;
48  }
49 
50  if( m_validIds.empty() )
51  {
52  for( unsigned int i ( 0 ) ; i != baseIds.size() ; ++i )
53  {
54  const DetId id ( baseIds[i] );
55  if( id.det() == det &&
56  id.subdetId() == subdet )
57  {
58  m_validIds.push_back( id ) ;
59  }
60  }
61  std::sort(m_validIds.begin(),m_validIds.end());
62  }
63  return m_validIds;
64 }
65 
66 /* NOTE only draft implementation at the moment
67  what about dead volumes?
68 */
69 
70 DetId
72 {
73  DetId returnId ( 0 ) ;
74  const std::vector<DetId>& detIds ( getValidDetIds() ) ;
75  for( std::vector<DetId>::const_iterator it ( detIds.begin() ) ;
76  it != detIds.end(); ++it )
77  {
78  const CaloCellGeometry& cell ( *getGeometry( *it ) ) ;
79  if( cell.inside( r ) )
80  {
81  returnId = *it ;
82  break ;
83  }
84  }
85  return returnId ;
86 }
87 
88 
89 
90 unsigned int
92 {
93  const CaloGenericDetId gid ( id ) ;
94 
95  assert( gid.isCastor() ) ;
96 
97  return 0 ;
98 }
99 
100 unsigned int
102 {
103  return (unsigned int)DetId::Calo - 1 ;
104 }
105 
106 std::vector<HepGeom::Point3D<double> >
108  unsigned int i,
109  HepGeom::Point3D<double> & ref )
110 {
111  return ( calogeom::IdealCastorTrapezoid::localCorners( pv, ref ) ) ;
112 }
113 
116  const GlobalPoint& f2 ,
117  const GlobalPoint& f3 ,
119  const double* parm ,
120  const DetId& detId )
121 {
122  const CaloGenericDetId cgid ( detId ) ;
123 
124  assert( cgid.isCastor() ) ;
125 
126  return ( new calogeom::IdealCastorTrapezoid( f1, mgr, parm ) ) ;
127 }
int i
Definition: DBlmapReader.cc:9
static std::vector< HepGeom::Point3D< double > > localCorners(const double *pv, HepGeom::Point3D< double > &ref)
virtual ~CastorGeometry()
bool isCastor() const
static unsigned int alignmentTransformIndexLocal(const DetId &id)
DetId::Detector lastReqDet_
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
static std::vector< HepGeom::Point3D< double > > localCorners(const double *pv, unsigned int i, HepGeom::Point3D< double > &ref)
Definition: DetId.h:20
bool inside(const GlobalPoint &point) const
Detector
Definition: DetId.h:26
Definition: EZMgrFL.h:8
static CaloCellGeometry * newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, CaloCellGeometry::CornersMgr *mgr, const double *parm, const DetId &detId)
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
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)
std::vector< DetId > m_validIds
virtual DetId getClosestCell(const GlobalPoint &r) const