CMS 3D CMS Logo

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