CMS 3D CMS Logo

CaloSubdetectorGeometry.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_CALOGEOMETRY_CALOSUBDETECTORGEOMETRY_H
2 #define GEOMETRY_CALOGEOMETRY_CALOSUBDETECTORGEOMETRY_H 1
3 
4 #include <algorithm>
5 #include <memory>
6 #include <vector>
7 #include <set>
8 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
9 #include <atomic>
10 #endif
17 
26 public:
27  typedef std::vector<std::shared_ptr<const CaloCellGeometry> > CellSet;
29 
30  typedef std::set<DetId> DetIdSet;
31 
35 
36  typedef std::vector<CCGFloat> TrVec;
37  typedef std::vector<unsigned int> IVec;
38  typedef std::vector<CCGFloat> DimVec;
39 
42 
44 
46  virtual ~CaloSubdetectorGeometry();
47 
51 
52  virtual void newCell(const GlobalPoint& f1,
53  const GlobalPoint& f2,
54  const GlobalPoint& f3,
55  const CCGFloat* parm,
56  const DetId& detId) = 0;
57 
59  virtual bool present(const DetId& id) const;
60 
62  virtual CellMayOwnPtr getGeometry(const DetId& id) const;
63 
68  virtual const std::vector<DetId>& getValidDetIds(DetId::Detector det = DetId::Detector(0), int subdet = 0) const;
69 
70  // Get closest cell, etc...
71  virtual DetId getClosestCell(const GlobalPoint& r) const;
72 
79  virtual DetIdSet getCells(const GlobalPoint& r, double dR) const;
80  virtual CellSet getCellSet(const GlobalPoint& r, double dR) const;
81 
82  CCGFloat deltaPhi(const DetId& detId) const;
83 
84  CCGFloat deltaEta(const DetId& detId) const;
85 
87 
89 
90  void allocatePar(ParVec::size_type n, unsigned int m);
91 
92  ParMgr* parMgr() { return m_parMgr; }
93  const ParMgr* parMgrConst() const { return m_parMgr; }
94 
96  const ParVecVec& parVecVec() const { return m_parVecVec; }
97 
98  virtual unsigned int numberOfShapes() const { return 1; }
99  virtual unsigned int numberOfParametersPerShape() const { return 1; }
100  virtual unsigned int numberOfTransformParms() const { return 6; }
101 
102  virtual void fillDefaultNamedParameters() const { return; }
103 
104  virtual void getSummary(TrVec& trVector, IVec& iVector, DimVec& dimVector, IVec& dinsVector) const;
105 
106  virtual void initializeParms() { return; }
107 
108  virtual bool valid(const DetId& id) const {
109  return (std::find(m_validIds.begin(), m_validIds.end(), id) != m_validIds.end());
110  }
111 
112 protected:
113  virtual unsigned int indexFor(const DetId& id) const;
114  virtual unsigned int sizeForDenseIndex(const DetId& id) const;
115 
116  virtual CellPtr getGeometryRawPtr(uint32_t index) const = 0;
117  virtual CellPtr cellGeomPtr(uint32_t index) const;
118 
120 
121  static CCGFloat deltaR(const GlobalPoint& p1, const GlobalPoint& p2) { return reco::deltaR(p1, p2); }
122 
123  void addValidID(const DetId& id);
124 
125  std::vector<DetId> m_validIds;
126 
127 private:
129 
131 
133 
134 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
135  mutable std::atomic<std::vector<CCGFloat>*> m_deltaPhi;
136  mutable std::atomic<std::vector<CCGFloat>*> m_deltaEta;
137 #else
138  mutable std::vector<CCGFloat>* m_deltaPhi;
139  mutable std::vector<CCGFloat>* m_deltaEta;
140 #endif
141 };
142 
143 #endif
virtual CellMayOwnPtr getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
CaloCellGeometry::CornersMgr * m_cmgr
std::vector< CCGFloat > DimVec
std::vector< ParVec > ParVecVec
CaloSubdetectorGeometry & operator=(const CaloSubdetectorGeometry &)=delete
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)=0
virtual unsigned int numberOfTransformParms() const
MgrType::size_type size_type
Definition: EZArrayFL.h:27
std::vector< unsigned int > IVec
virtual CellPtr getGeometryRawPtr(uint32_t index) const =0
std::vector< CCGFloat > TrVec
virtual unsigned int numberOfShapes() const
const ParVecVec & parVecVec() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
CaloCellGeometry::CCGFloat CCGFloat
void allocatePar(ParVec::size_type n, unsigned int m)
CCGFloat deltaPhi(const DetId &detId) const
std::vector< std::shared_ptr< const CaloCellGeometry > > CellSet
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
std::vector< DetId > m_validIds
std::atomic< std::vector< CCGFloat > * > m_deltaPhi
virtual bool present(const DetId &id) const
is this detid present in the geometry?
virtual bool valid(const DetId &id) const
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)
CaloCellGeometry::ParVec ParVec
virtual DetId getClosestCell(const GlobalPoint &r) const
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
Definition: DetId.h:17
void addValidID(const DetId &id)
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
CaloCellGeometry::CornersMgr * cornersMgr()
Detector
Definition: DetId.h:24
CaloCellGeometry::ParVecVec ParVecVec
Definition: EZMgrFL.h:8
virtual unsigned int indexFor(const DetId &id) const
CaloCellGeometry::ParMgr ParMgr
static CCGFloat deltaR(const GlobalPoint &p1, const GlobalPoint &p2)
virtual ~CaloSubdetectorGeometry()
The base class DOES assume that it owns the CaloCellGeometry objects.
virtual CellSet getCellSet(const GlobalPoint &r, double dR) const
virtual CellPtr cellGeomPtr(uint32_t index) const
virtual void fillDefaultNamedParameters() const
CCGFloat deltaEta(const DetId &detId) const
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
std::atomic< std::vector< CCGFloat > * > m_deltaEta
const ParMgr * parMgrConst() const
virtual unsigned int numberOfParametersPerShape() const
virtual unsigned int sizeForDenseIndex(const DetId &id) const