CMS 3D CMS Logo

CaloTopology.cc
Go to the documentation of this file.
3 
4 
6 }
7 
9 
10 
11 int CaloTopology::makeIndex(DetId::Detector det, int subdet) const {
12  return (int(det)<<4) | (subdet&0xF);
13 }
14 
15 void CaloTopology::setSubdetTopology(DetId::Detector det, int subdet, std::unique_ptr<const CaloSubdetectorTopology> geom) {
16  int index=makeIndex(det,subdet);
18 }
19 
21  auto i=theTopologies_.find(makeIndex(id.det(),id.subdetId()));
22  return (i==theTopologies_.end())?(nullptr):(i->second.get());
23 }
24 
26  auto i=theTopologies_.find(makeIndex(det,subdet));
27  return (i==theTopologies_.end())?(nullptr):(i->second.get());
28 }
29 
30 static const std::vector<DetId> emptyDetIdVector;
31 
32 std::vector<DetId> CaloTopology::east(const DetId& id) const {
34  return (topology==nullptr) ? (emptyDetIdVector):(topology->east(id));
35 }
36 
37 std::vector<DetId> CaloTopology::west(const DetId& id) const {
39  return (topology==nullptr) ? (emptyDetIdVector):(topology->west(id));
40 }
41 
42 std::vector<DetId> CaloTopology::north(const DetId& id) const {
44  return (topology==nullptr) ? (emptyDetIdVector):(topology->north(id));
45 }
46 
47 std::vector<DetId> CaloTopology::south(const DetId& id) const {
49  return (topology==nullptr) ? (emptyDetIdVector):(topology->south(id));
50 }
51 
52 std::vector<DetId> CaloTopology::up(const DetId& id) const {
54  return (topology==nullptr) ? (emptyDetIdVector):(topology->up(id));
55 }
56 
57 std::vector<DetId> CaloTopology::down(const DetId& id) const {
59  return (topology==nullptr) ? (emptyDetIdVector):(topology->down(id));
60 }
61 
62 std::vector<DetId> CaloTopology::getNeighbours(const DetId& id,const CaloDirection& dir) const {
64  return (topology==nullptr) ? (emptyDetIdVector):(topology->getNeighbours(id,dir));
65 }
66 
67 std::vector<DetId> CaloTopology::getWindow(const DetId& id, const int& northSouthSize, const int& eastWestSize) const {
69  return (topology==nullptr) ? (emptyDetIdVector):(topology->getWindow(id,northSouthSize, eastWestSize));
70 }
71 
72 std::vector<DetId> CaloTopology::getAllNeighbours(const DetId& id) const {
74  return (topology==nullptr) ? (emptyDetIdVector):(topology->getAllNeighbours(id));
75 }
76 
77 bool CaloTopology::valid(const DetId& id) const {
79  return (geom==nullptr)?(false):(geom->valid(id));
80 }
81 
virtual std::vector< DetId > up(const DetId &id) const =0
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
virtual std::vector< DetId > getAllNeighbours(const DetId &id) const
CaloTopology const * topology(0)
virtual std::vector< DetId > north(const DetId &id) const =0
virtual std::vector< DetId > east(const DetId &id) const =0
virtual std::vector< DetId > down(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:57
std::vector< DetId > getAllNeighbours(const DetId &id) const
Get all the neighbors of the given cell.
Definition: CaloTopology.cc:72
std::vector< DetId > up(const DetId &id) const
Get the neighbors of the given cell in up direction (outward)
Definition: CaloTopology.cc:52
TopMap theTopologies_
Definition: CaloTopology.h:56
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:67
int makeIndex(DetId::Detector det, int subdet) const
Definition: CaloTopology.cc:11
std::vector< DetId > east(const DetId &id) const
Get the neighbors of the given cell in east direction.
Definition: CaloTopology.cc:32
std::vector< DetId > north(const DetId &id) const
Get the neighbors of the given cell in north direction.
Definition: CaloTopology.cc:42
Definition: DetId.h:18
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:77
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:37
virtual std::vector< DetId > west(const DetId &id) const =0
Detector
Definition: DetId.h:26
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:20
static const std::vector< DetId > emptyDetIdVector
Definition: CaloTopology.cc:30
void setSubdetTopology(DetId::Detector det, int subdet, std::unique_ptr< const CaloSubdetectorTopology > geom)
Register a subdetector Topology.
Definition: CaloTopology.cc:15
dbl *** dir
Definition: mlp_gen.cc:35
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:62
def move(src, dest)
Definition: eostools.py:511
virtual std::vector< DetId > south(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:47