CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloTopology.cc
Go to the documentation of this file.
3 
5 
7 
8 int CaloTopology::makeIndex(DetId::Detector det, int subdet) const { return (int(det) << 4) | (subdet & 0xF); }
9 
11  int subdet,
12  std::unique_ptr<const CaloSubdetectorTopology> geom) {
13  int index = makeIndex(det, subdet);
15 }
16 
18  auto i = theTopologies_.find(makeIndex(id.det(), id.subdetId()));
19  return (i == theTopologies_.end()) ? (nullptr) : (i->second.get());
20 }
21 
23  auto i = theTopologies_.find(makeIndex(det, subdet));
24  return (i == theTopologies_.end()) ? (nullptr) : (i->second.get());
25 }
26 
27 static const std::vector<DetId> emptyDetIdVector;
28 
29 std::vector<DetId> CaloTopology::east(const DetId& id) const {
30  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
31  return (topology == nullptr) ? (emptyDetIdVector) : (topology->east(id));
32 }
33 
34 std::vector<DetId> CaloTopology::west(const DetId& id) const {
35  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
36  return (topology == nullptr) ? (emptyDetIdVector) : (topology->west(id));
37 }
38 
39 std::vector<DetId> CaloTopology::north(const DetId& id) const {
40  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
41  return (topology == nullptr) ? (emptyDetIdVector) : (topology->north(id));
42 }
43 
44 std::vector<DetId> CaloTopology::south(const DetId& id) const {
45  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
46  return (topology == nullptr) ? (emptyDetIdVector) : (topology->south(id));
47 }
48 
49 std::vector<DetId> CaloTopology::up(const DetId& id) const {
50  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
51  return (topology == nullptr) ? (emptyDetIdVector) : (topology->up(id));
52 }
53 
54 std::vector<DetId> CaloTopology::down(const DetId& id) const {
55  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
56  return (topology == nullptr) ? (emptyDetIdVector) : (topology->down(id));
57 }
58 
59 std::vector<DetId> CaloTopology::getNeighbours(const DetId& id, const CaloDirection& dir) const {
60  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
61  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getNeighbours(id, dir));
62 }
63 
64 std::vector<DetId> CaloTopology::getWindow(const DetId& id, const int& northSouthSize, const int& eastWestSize) const {
65  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
66  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getWindow(id, northSouthSize, eastWestSize));
67 }
68 
69 std::vector<DetId> CaloTopology::getAllNeighbours(const DetId& id) const {
70  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
71  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getAllNeighbours(id));
72 }
73 
74 bool CaloTopology::valid(const DetId& id) const {
76  return (geom == nullptr) ? (false) : (geom->valid(id));
77 }
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
virtual std::vector< DetId > getAllNeighbours(const DetId &id) const
virtual std::vector< DetId > west(const DetId &id) const =0
std::vector< DetId > down(const DetId &id) const
Get the neighbors of the given cell in down direction (inward)
Definition: CaloTopology.cc:54
std::vector< DetId > getAllNeighbours(const DetId &id) const
Get all the neighbors of the given cell.
Definition: CaloTopology.cc:69
std::vector< DetId > up(const DetId &id) const
Get the neighbors of the given cell in up direction (outward)
Definition: CaloTopology.cc:49
TopMap theTopologies_
Definition: CaloTopology.h:55
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:64
int makeIndex(DetId::Detector det, int subdet) const
Definition: CaloTopology.cc:8
def move
Definition: eostools.py:511
std::vector< DetId > east(const DetId &id) const
Get the neighbors of the given cell in east direction.
Definition: CaloTopology.cc:29
std::vector< DetId > north(const DetId &id) const
Get the neighbors of the given cell in north direction.
Definition: CaloTopology.cc:39
virtual std::vector< DetId > north(const DetId &id) const =0
Definition: DetId.h:17
virtual std::vector< DetId > up(const DetId &id) const =0
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
bool valid(const DetId &id) const
Is this a valid cell id?
Definition: CaloTopology.cc:74
virtual bool valid(const DetId &) const
is this detid present in the Topology?
std::vector< DetId > west(const DetId &id) const
Get the neighbors of the given cell in west direction.
Definition: CaloTopology.cc:34
Detector
Definition: DetId.h:24
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
static const std::vector< DetId > emptyDetIdVector
Definition: CaloTopology.cc:27
void setSubdetTopology(DetId::Detector det, int subdet, std::unique_ptr< const CaloSubdetectorTopology > geom)
Register a subdetector Topology.
Definition: CaloTopology.cc:10
virtual std::vector< DetId > south(const DetId &id) const =0
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
Get the neighbors of the given cell given direction.
Definition: CaloTopology.cc:59
virtual std::vector< DetId > east(const DetId &id) const =0
std::vector< DetId > south(const DetId &id) const
Get the neighbors of the given cell in south direction.
Definition: CaloTopology.cc:44
virtual std::vector< DetId > down(const DetId &id) const =0