CMS 3D CMS Logo

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

◆ TopMap

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

Definition at line 21 of file CaloTopology.h.

Constructor & Destructor Documentation

◆ CaloTopology()

CaloTopology::CaloTopology ( )

Definition at line 4 of file CaloTopology.cc.

4 {}

◆ ~CaloTopology()

CaloTopology::~CaloTopology ( )
default

Member Function Documentation

◆ down()

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.

54  {
55  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
56  return (topology == nullptr) ? (emptyDetIdVector) : (topology->down(id));
57 }

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

◆ east()

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.

29  {
30  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
31  return (topology == nullptr) ? (emptyDetIdVector) : (topology->east(id));
32 }

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

◆ getAllNeighbours()

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.

69  {
70  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
71  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getAllNeighbours(id));
72 }

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

◆ getNeighbours()

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.

59  {
60  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
61  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getNeighbours(id, dir));
62 }

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

◆ getSubdetectorTopology() [1/2]

const CaloSubdetectorTopology * CaloTopology::getSubdetectorTopology ( const DetId id) const

◆ getSubdetectorTopology() [2/2]

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.

22  {
23  auto i = theTopologies_.find(makeIndex(det, subdet));
24  return (i == theTopologies_.end()) ? (nullptr) : (i->second.get());
25 }

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

◆ getWindow()

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.

64  {
65  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
66  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getWindow(id, northSouthSize, eastWestSize));
67 }

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

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

◆ makeIndex()

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

Definition at line 8 of file CaloTopology.cc.

8 { return (int(det) << 4) | (subdet & 0xF); }

Referenced by getSubdetectorTopology(), and setSubdetTopology().

◆ north()

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.

39  {
40  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
41  return (topology == nullptr) ? (emptyDetIdVector) : (topology->north(id));
42 }

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

◆ setSubdetTopology()

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.

12  {
13  int index = makeIndex(det, subdet);
15 }

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

◆ south()

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.

44  {
45  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
46  return (topology == nullptr) ? (emptyDetIdVector) : (topology->south(id));
47 }

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

◆ up()

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.

49  {
50  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
51  return (topology == nullptr) ? (emptyDetIdVector) : (topology->up(id));
52 }

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

◆ valid()

bool CaloTopology::valid ( const DetId id) const

Is this a valid cell id?

Definition at line 74 of file CaloTopology.cc.

74  {
76  return (geom == nullptr) ? (false) : (geom->valid(id));
77 }

References relativeConstraints::geom, and getSubdetectorTopology().

◆ west()

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.

34  {
35  const CaloSubdetectorTopology* topology = getSubdetectorTopology(id);
36  return (topology == nullptr) ? (emptyDetIdVector) : (topology->west(id));
37 }

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

Member Data Documentation

◆ theTopologies_

TopMap CaloTopology::theTopologies_
private

Definition at line 55 of file CaloTopology.h.

Referenced by getSubdetectorTopology(), and setSubdetTopology().

mps_fire.i
i
Definition: mps_fire.py:428
CaloSubdetectorTopology::east
virtual std::vector< DetId > east(const DetId &id) const =0
CaloTopology::makeIndex
int makeIndex(DetId::Detector det, int subdet) const
Definition: CaloTopology.cc:8
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
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::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
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
CaloSubdetectorTopology::getWindow
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Definition: CaloSubdetectorTopology.cc:4
eostools.move
def move(src, dest)
Definition: eostools.py:511
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
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