CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTopology.cc
Go to the documentation of this file.
3 
4 
6 }
7 
9 {
10  for( TopMap::iterator i ( theTopologies_.begin() ) ;
11  i != theTopologies_.end() ; ++i )
12  {
13  delete i->second ;
14  }
15 }
16 
17 int CaloTopology::makeIndex(DetId::Detector det, int subdet) const {
18  return (int(det)<<4) | (subdet&0xF);
19 }
20 
22  int index=makeIndex(det,subdet);
24 }
25 
27  std::map<int, const CaloSubdetectorTopology*>::const_iterator i=theTopologies_.find(makeIndex(id.det(),id.subdetId()));
28  return (i==theTopologies_.end())?(0):(i->second);
29 }
30 
32  std::map<int, const CaloSubdetectorTopology*>::const_iterator i=theTopologies_.find(makeIndex(det,subdet));
33  return (i==theTopologies_.end())?(0):(i->second);
34 }
35 
36 static const std::vector<DetId> emptyDetIdVector;
37 
38 std::vector<DetId> CaloTopology::east(const DetId& id) const {
40  return (topology==0) ? (emptyDetIdVector):(topology->east(id));
41 }
42 
43 std::vector<DetId> CaloTopology::west(const DetId& id) const {
45  return (topology==0) ? (emptyDetIdVector):(topology->west(id));
46 }
47 
48 std::vector<DetId> CaloTopology::north(const DetId& id) const {
50  return (topology==0) ? (emptyDetIdVector):(topology->north(id));
51 }
52 
53 std::vector<DetId> CaloTopology::south(const DetId& id) const {
55  return (topology==0) ? (emptyDetIdVector):(topology->south(id));
56 }
57 
58 std::vector<DetId> CaloTopology::up(const DetId& id) const {
60  return (topology==0) ? (emptyDetIdVector):(topology->up(id));
61 }
62 
63 std::vector<DetId> CaloTopology::down(const DetId& id) const {
65  return (topology==0) ? (emptyDetIdVector):(topology->down(id));
66 }
67 
68 std::vector<DetId> CaloTopology::getNeighbours(const DetId& id,const CaloDirection& dir) const {
70  return (topology==0) ? (emptyDetIdVector):(topology->getNeighbours(id,dir));
71 }
72 
73 std::vector<DetId> CaloTopology::getWindow(const DetId& id, const int& northSouthSize, const int& eastWestSize) const {
75  return (topology==0) ? (emptyDetIdVector):(topology->getWindow(id,northSouthSize, eastWestSize));
76 }
77 
78 std::vector<DetId> CaloTopology::getAllNeighbours(const DetId& id) const {
80  return (topology==0) ? (emptyDetIdVector):(topology->getAllNeighbours(id));
81 }
82 
83 bool CaloTopology::valid(const DetId& id) const {
85  return (geom==0)?(false):(geom->valid(id));
86 }
87 
int i
Definition: DBlmapReader.cc:9
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:63
std::vector< DetId > getAllNeighbours(const DetId &id) const
Get all the neighbors of the given cell.
Definition: CaloTopology.cc:78
std::vector< DetId > up(const DetId &id) const
Get the neighbors of the given cell in up direction (outward)
Definition: CaloTopology.cc:58
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:73
int makeIndex(DetId::Detector det, int subdet) const
Definition: CaloTopology.cc:17
std::vector< DetId > east(const DetId &id) const
Get the neighbors of the given cell in east direction.
Definition: CaloTopology.cc:38
std::vector< DetId > north(const DetId &id) const
Get the neighbors of the given cell in north direction.
Definition: CaloTopology.cc:48
virtual std::vector< DetId > north(const DetId &id) const =0
void setSubdetTopology(DetId::Detector det, int subdet, const CaloSubdetectorTopology *geom)
Register a subdetector Topology.
Definition: CaloTopology.cc:21
Definition: DetId.h:18
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:83
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:43
Detector
Definition: DetId.h:24
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
static const std::vector< DetId > emptyDetIdVector
Definition: CaloTopology.cc:36
virtual std::vector< DetId > south(const DetId &id) const =0
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:68
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:53
virtual std::vector< DetId > down(const DetId &id) const =0