CMS 3D CMS Logo

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 }
CaloDirection
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
mps_fire.i
i
Definition: mps_fire.py:428
CaloSubdetectorTopology::east
virtual std::vector< DetId > east(const DetId &id) const =0
CaloTopology::down
std::vector< DetId > down(const DetId &id) const
Get the neighbors of the given cell in down direction (inward)
Definition: CaloTopology.cc:54
CaloTopology::makeIndex
int makeIndex(DetId::Detector det, int subdet) const
Definition: CaloTopology.cc:8
CaloTopology::south
std::vector< DetId > south(const DetId &id) const
Get the neighbors of the given cell in south direction.
Definition: CaloTopology.cc:44
CaloTopology::getWindow
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
CaloSubdetectorTopology::getAllNeighbours
virtual std::vector< DetId > getAllNeighbours(const DetId &id) const
Definition: CaloSubdetectorTopology.h:105
CaloSubdetectorTopology::west
virtual std::vector< DetId > west(const DetId &id) const =0
CaloTopology::setSubdetTopology
void setSubdetTopology(DetId::Detector det, int subdet, std::unique_ptr< const CaloSubdetectorTopology > geom)
Register a subdetector Topology.
Definition: CaloTopology.cc:10
CaloTopology::north
std::vector< DetId > north(const DetId &id) const
Get the neighbors of the given cell in north direction.
Definition: CaloTopology.cc:39
CaloTopology::getNeighbours
std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
Get the neighbors of the given cell given direction.
Definition: CaloTopology.cc:59
CaloTopology::up
std::vector< DetId > up(const DetId &id) const
Get the neighbors of the given cell in up direction (outward)
Definition: CaloTopology.cc:49
DetId
Definition: DetId.h:17
CaloTopology::~CaloTopology
~CaloTopology()
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
CaloSubdetectorTopology::getNeighbours
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
Definition: CaloSubdetectorTopology.h:77
CaloTopology::east
std::vector< DetId > east(const DetId &id) const
Get the neighbors of the given cell in east direction.
Definition: CaloTopology.cc:29
CaloTopology::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
CaloTopology::getAllNeighbours
std::vector< DetId > getAllNeighbours(const DetId &id) const
Get all the neighbors of the given cell.
Definition: CaloTopology.cc:69
DetId::Detector
Detector
Definition: DetId.h:24
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
CaloSubdetectorTopology::south
virtual std::vector< DetId > south(const DetId &id) const =0
CaloSubdetectorTopology::north
virtual std::vector< DetId > north(const DetId &id) const =0
CaloTopology.h
CaloSubdetectorTopology::getWindow
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Definition: CaloSubdetectorTopology.cc:4
CaloSubdetectorTopology.h
CaloTopology::CaloTopology
CaloTopology()
Definition: CaloTopology.cc:4
eostools.move
def move(src, dest)
Definition: eostools.py:511
CaloTopology::valid
bool valid(const DetId &id) const
Is this a valid cell id?
Definition: CaloTopology.cc:74
CaloSubdetectorTopology::up
virtual std::vector< DetId > up(const DetId &id) const =0
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
CaloTopology::theTopologies_
TopMap theTopologies_
Definition: CaloTopology.h:55
CaloTopology::west
std::vector< DetId > west(const DetId &id) const
Get the neighbors of the given cell in west direction.
Definition: CaloTopology.cc:34
CaloSubdetectorTopology::down
virtual std::vector< DetId > down(const DetId &id) const =0
emptyDetIdVector
static const std::vector< DetId > emptyDetIdVector
Definition: CaloTopology.cc:27
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23