CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
CaloTopology Class Reference

#include <CaloTopology.h>

Public Types

typedef std::map< int,
std::unique_ptr< const
CaloSubdetectorTopology > > 
TopMap
 

Public Member Functions

 CaloTopology ()
 
std::vector< DetIddown (const DetId &id) const
 Get the neighbors of the given cell in down direction (inward) More...
 
std::vector< DetIdeast (const DetId &id) const
 Get the neighbors of the given cell in east direction. More...
 
std::vector< DetIdgetAllNeighbours (const DetId &id) const
 Get all the neighbors of the given cell. More...
 
std::vector< DetIdgetNeighbours (const DetId &id, const CaloDirection &dir) const
 Get the neighbors of the given cell given direction. More...
 
const CaloSubdetectorTopologygetSubdetectorTopology (const DetId &id) const
 access the subdetector Topology for the given subdetector directly More...
 
const CaloSubdetectorTopologygetSubdetectorTopology (DetId::Detector det, int subdet) const
 access the subdetector Topology for the given subdetector directly More...
 
std::vector< DetIdgetWindow (const DetId &id, const int &northSouthSize, const int &eastWestSize) const
 Get the neighbors of the given cell in a window of given size. More...
 
std::vector< DetIdnorth (const DetId &id) const
 Get the neighbors of the given cell in north direction. More...
 
void setSubdetTopology (DetId::Detector det, int subdet, std::unique_ptr< const CaloSubdetectorTopology > geom)
 Register a subdetector Topology. More...
 
std::vector< DetIdsouth (const DetId &id) const
 Get the neighbors of the given cell in south direction. More...
 
std::vector< DetIdup (const DetId &id) const
 Get the neighbors of the given cell in up direction (outward) More...
 
bool valid (const DetId &id) const
 Is this a valid cell id? More...
 
std::vector< DetIdwest (const DetId &id) const
 Get the neighbors of the given cell in west direction. More...
 
 ~CaloTopology ()
 

Private Member Functions

int makeIndex (DetId::Detector det, int subdet) const
 

Private Attributes

TopMap theTopologies_
 

Detailed Description

Revision:
1.4
Author
J. Mans and P. Meridiani

Definition at line 19 of file CaloTopology.h.

Member Typedef Documentation

typedef std::map<int, std::unique_ptr<const CaloSubdetectorTopology> > CaloTopology::TopMap

Definition at line 21 of file CaloTopology.h.

Constructor & Destructor Documentation

CaloTopology::CaloTopology ( )

Definition at line 4 of file CaloTopology.cc.

4 {}
CaloTopology::~CaloTopology ( )
default

Member Function Documentation

std::vector< DetId > CaloTopology::down ( const DetId id) const

Get the neighbors of the given cell in down direction (inward)

Definition at line 54 of file CaloTopology.cc.

References CaloSubdetectorTopology::down(), emptyDetIdVector, and getSubdetectorTopology().

54  {
55  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
56  return (topology == nullptr) ? (emptyDetIdVector) : (topology->down(id));
57 }
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
virtual std::vector< DetId > down(const DetId &id) const =0
std::vector< DetId > CaloTopology::east ( const DetId id) const

Get the neighbors of the given cell in east direction.

Definition at line 29 of file CaloTopology.cc.

References CaloSubdetectorTopology::east(), emptyDetIdVector, and getSubdetectorTopology().

29  {
30  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
31  return (topology == nullptr) ? (emptyDetIdVector) : (topology->east(id));
32 }
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
virtual std::vector< DetId > east(const DetId &id) const =0
std::vector< DetId > CaloTopology::getAllNeighbours ( const DetId id) const

Get all the neighbors of the given cell.

Definition at line 69 of file CaloTopology.cc.

References emptyDetIdVector, CaloSubdetectorTopology::getAllNeighbours(), and getSubdetectorTopology().

69  {
70  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
71  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getAllNeighbours(id));
72 }
virtual std::vector< DetId > getAllNeighbours(const DetId &id) const
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
std::vector< DetId > CaloTopology::getNeighbours ( const DetId id,
const CaloDirection dir 
) const

Get the neighbors of the given cell given direction.

Definition at line 59 of file CaloTopology.cc.

References emptyDetIdVector, CaloSubdetectorTopology::getNeighbours(), and getSubdetectorTopology().

59  {
60  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
61  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getNeighbours(id, dir));
62 }
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
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
const CaloSubdetectorTopology * CaloTopology::getSubdetectorTopology ( const DetId id) const
const CaloSubdetectorTopology * CaloTopology::getSubdetectorTopology ( DetId::Detector  det,
int  subdet 
) const

access the subdetector Topology for the given subdetector directly

Definition at line 22 of file CaloTopology.cc.

References mps_fire::i, makeIndex(), and theTopologies_.

22  {
23  auto i = theTopologies_.find(makeIndex(det, subdet));
24  return (i == theTopologies_.end()) ? (nullptr) : (i->second.get());
25 }
TopMap theTopologies_
Definition: CaloTopology.h:55
int makeIndex(DetId::Detector det, int subdet) const
Definition: CaloTopology.cc:8
std::vector< DetId > CaloTopology::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 at line 64 of file CaloTopology.cc.

References emptyDetIdVector, getSubdetectorTopology(), and CaloSubdetectorTopology::getWindow().

Referenced by AlCaECALRecHitReducer::AddMiniRecHitCollection(), EcalClusterSeverityLevelAlgo::closestProblematic(), and EcalClusterSeverityLevelAlgo::fractionAroundClosestProblematic().

64  {
65  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
66  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getWindow(id, northSouthSize, eastWestSize));
67 }
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
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
int CaloTopology::makeIndex ( DetId::Detector  det,
int  subdet 
) const
private

Definition at line 8 of file CaloTopology.cc.

Referenced by getSubdetectorTopology(), and setSubdetTopology().

8 { return (int(det) << 4) | (subdet & 0xF); }
std::vector< DetId > CaloTopology::north ( const DetId id) const

Get the neighbors of the given cell in north direction.

Definition at line 39 of file CaloTopology.cc.

References emptyDetIdVector, getSubdetectorTopology(), and CaloSubdetectorTopology::north().

39  {
40  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
41  return (topology == nullptr) ? (emptyDetIdVector) : (topology->north(id));
42 }
virtual std::vector< DetId > north(const DetId &id) const =0
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 CaloTopology::setSubdetTopology ( DetId::Detector  det,
int  subdet,
std::unique_ptr< const CaloSubdetectorTopology geom 
)

Register a subdetector Topology.

Definition at line 10 of file CaloTopology.cc.

References makeIndex(), eostools::move(), and theTopologies_.

12  {
13  int index = makeIndex(det, subdet);
15 }
TopMap theTopologies_
Definition: CaloTopology.h:55
int makeIndex(DetId::Detector det, int subdet) const
Definition: CaloTopology.cc:8
def move
Definition: eostools.py:511
std::vector< DetId > CaloTopology::south ( const DetId id) const

Get the neighbors of the given cell in south direction.

Definition at line 44 of file CaloTopology.cc.

References emptyDetIdVector, getSubdetectorTopology(), and CaloSubdetectorTopology::south().

44  {
45  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
46  return (topology == nullptr) ? (emptyDetIdVector) : (topology->south(id));
47 }
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
virtual std::vector< DetId > south(const DetId &id) const =0
std::vector< DetId > CaloTopology::up ( const DetId id) const

Get the neighbors of the given cell in up direction (outward)

Definition at line 49 of file CaloTopology.cc.

References emptyDetIdVector, getSubdetectorTopology(), and CaloSubdetectorTopology::up().

49  {
50  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
51  return (topology == nullptr) ? (emptyDetIdVector) : (topology->up(id));
52 }
virtual std::vector< DetId > up(const DetId &id) const =0
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
bool CaloTopology::valid ( const DetId id) const

Is this a valid cell id?

Definition at line 74 of file CaloTopology.cc.

References relativeConstraints::geom, getSubdetectorTopology(), and CaloSubdetectorTopology::valid().

74  {
76  return (geom == nullptr) ? (false) : (geom->valid(id));
77 }
virtual bool valid(const DetId &) const
is this detid present in the Topology?
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
std::vector< DetId > CaloTopology::west ( const DetId id) const

Get the neighbors of the given cell in west direction.

Definition at line 34 of file CaloTopology.cc.

References emptyDetIdVector, getSubdetectorTopology(), and CaloSubdetectorTopology::west().

34  {
35  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
36  return (topology == nullptr) ? (emptyDetIdVector) : (topology->west(id));
37 }
virtual std::vector< DetId > west(const DetId &id) const =0
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

Member Data Documentation

TopMap CaloTopology::theTopologies_
private

Definition at line 55 of file CaloTopology.h.

Referenced by getSubdetectorTopology(), and setSubdetTopology().