1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
#ifndef GEOMETRY_CALOGEOMETRY_CALOSUBDETECTORGEOMETRY_H
#define GEOMETRY_CALOGEOMETRY_CALOSUBDETECTORGEOMETRY_H 1
#include <algorithm>
#include <memory>
#include <vector>
#include <set>
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
#include <atomic>
#endif
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometryPtr.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometryMayOwnPtr.h"
#include "DataFormats/Math/interface/deltaR.h"
/** \class CaloSubdetectorGeometry
Base class for a geometry container for a specific calorimetry subdetector.
\author J. Mans - Minnesota
*/
class CaloSubdetectorGeometry {
public:
typedef std::vector<std::shared_ptr<const CaloCellGeometry> > CellSet;
typedef CaloCellGeometry::CCGFloat CCGFloat;
typedef std::set<DetId> DetIdSet;
typedef CaloCellGeometry::ParMgr ParMgr;
typedef CaloCellGeometry::ParVec ParVec;
typedef CaloCellGeometry::ParVecVec ParVecVec;
typedef std::vector<CCGFloat> TrVec;
typedef std::vector<unsigned int> IVec;
typedef std::vector<CCGFloat> DimVec;
using CellPtr = CaloCellGeometryPtr;
using CellMayOwnPtr = CaloCellGeometryMayOwnPtr;
CaloSubdetectorGeometry();
/// The base class DOES assume that it owns the CaloCellGeometry objects
virtual ~CaloSubdetectorGeometry();
/// avoid copies
CaloSubdetectorGeometry(const CaloSubdetectorGeometry&) = delete;
CaloSubdetectorGeometry& operator=(const CaloSubdetectorGeometry&) = delete;
virtual void newCell(const GlobalPoint& f1,
const GlobalPoint& f2,
const GlobalPoint& f3,
const CCGFloat* parm,
const DetId& detId) = 0;
/// is this detid present in the geometry?
virtual bool present(const DetId& id) const;
/// Get the cell geometry of a given detector id. Should return false if not found.
virtual CellMayOwnPtr getGeometry(const DetId& id) const;
/** \brief 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.
*/
virtual const std::vector<DetId>& getValidDetIds(DetId::Detector det = DetId::Detector(0), int subdet = 0) const;
// Get closest cell, etc...
virtual DetId getClosestCell(const GlobalPoint& r) const;
/** \brief 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.
*/
virtual DetIdSet getCells(const GlobalPoint& r, double dR) const;
virtual CellSet getCellSet(const GlobalPoint& r, double dR) const;
CCGFloat deltaPhi(const DetId& detId) const;
CCGFloat deltaEta(const DetId& detId) const;
void allocateCorners(CaloCellGeometry::CornersVec::size_type n);
CaloCellGeometry::CornersMgr* cornersMgr() { return m_cmgr; }
void allocatePar(ParVec::size_type n, unsigned int m);
ParMgr* parMgr() { return m_parMgr; }
const ParMgr* parMgrConst() const { return m_parMgr; }
ParVecVec& parVecVec() { return m_parVecVec; }
const ParVecVec& parVecVec() const { return m_parVecVec; }
virtual unsigned int numberOfShapes() const { return 1; }
virtual unsigned int numberOfParametersPerShape() const { return 1; }
virtual unsigned int numberOfTransformParms() const { return 6; }
virtual void fillDefaultNamedParameters() const { return; }
virtual void getSummary(TrVec& trVector, IVec& iVector, DimVec& dimVector, IVec& dinsVector) const;
virtual void initializeParms() { return; }
virtual bool valid(const DetId& id) const {
return (std::find(m_validIds.begin(), m_validIds.end(), id) != m_validIds.end());
}
protected:
virtual unsigned int indexFor(const DetId& id) const;
virtual unsigned int sizeForDenseIndex(const DetId& id) const;
virtual CellPtr getGeometryRawPtr(uint32_t index) const = 0;
virtual CellPtr cellGeomPtr(uint32_t index) const;
ParVecVec m_parVecVec;
static CCGFloat deltaR(const GlobalPoint& p1, const GlobalPoint& p2) { return reco::deltaR(p1, p2); }
void addValidID(const DetId& id);
std::vector<DetId> m_validIds;
private:
ParMgr* m_parMgr;
CaloCellGeometry::CornersMgr* m_cmgr;
bool m_sortedIds;
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
mutable std::atomic<std::vector<CCGFloat>*> m_deltaPhi;
mutable std::atomic<std::vector<CCGFloat>*> m_deltaEta;
#else
mutable std::vector<CCGFloat>* m_deltaPhi;
mutable std::vector<CCGFloat>* m_deltaEta;
#endif
};
#endif
|