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  {
56  return (topology == nullptr) ? (emptyDetIdVector) : (topology->down(id));
57 }

References down(), emptyDetIdVector, getSubdetectorTopology(), and ecaldqm::topology().

Referenced by down().

◆ 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  {
31  return (topology == nullptr) ? (emptyDetIdVector) : (topology->east(id));
32 }

References east(), emptyDetIdVector, getSubdetectorTopology(), and ecaldqm::topology().

Referenced by east(), and spr::newHCALIdEW().

◆ 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  {
71  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getAllNeighbours(id));
72 }

References emptyDetIdVector, getAllNeighbours(), getSubdetectorTopology(), and ecaldqm::topology().

Referenced by getAllNeighbours().

◆ 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  {
61  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getNeighbours(id, dir));
62 }

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

Referenced by getNeighbours().

◆ 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

◆ 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  {
41  return (topology == nullptr) ? (emptyDetIdVector) : (topology->north(id));
42 }

References emptyDetIdVector, getSubdetectorTopology(), north(), and ecaldqm::topology().

Referenced by spr::newHCALIdNS(), and 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  {
46  return (topology == nullptr) ? (emptyDetIdVector) : (topology->south(id));
47 }

References emptyDetIdVector, getSubdetectorTopology(), south(), and ecaldqm::topology().

Referenced by spr::newHCALIdNS(), and 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  {
51  return (topology == nullptr) ? (emptyDetIdVector) : (topology->up(id));
52 }

References emptyDetIdVector, getSubdetectorTopology(), ecaldqm::topology(), and up().

Referenced by spr::matrixHCALIdsDepth(), and 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().

Referenced by HcalLutAnalyzer::analyze(), and CaloMiscalibMapHcal::prefillMap().

◆ 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  {
36  return (topology == nullptr) ? (emptyDetIdVector) : (topology->west(id));
37 }

References emptyDetIdVector, getSubdetectorTopology(), ecaldqm::topology(), and west().

Referenced by spr::newHCALIdEW(), and 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
CaloTopology::down
std::vector< DetId > down(const DetId &id) const
Get the neighbors of the given cell in down direction (inward)
Definition: CaloTopology.cc:54
CaloTopology::makeIndex
int makeIndex(DetId::Detector det, int subdet) const
Definition: CaloTopology.cc:8
CaloTopology::south
std::vector< DetId > south(const DetId &id) const
Get the neighbors of the given cell in south direction.
Definition: CaloTopology.cc:44
CaloTopology::getWindow
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:64
CaloTopology::north
std::vector< DetId > north(const DetId &id) const
Get the neighbors of the given cell in north direction.
Definition: CaloTopology.cc:39
CaloTopology::getNeighbours
std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
Get the neighbors of the given cell given direction.
Definition: CaloTopology.cc:59
CaloTopology::up
std::vector< DetId > up(const DetId &id) const
Get the neighbors of the given cell in up direction (outward)
Definition: CaloTopology.cc:49
ecaldqm::topology
const CaloTopology * topology(nullptr)
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
CaloTopology::east
std::vector< DetId > east(const DetId &id) const
Get the neighbors of the given cell in east direction.
Definition: CaloTopology.cc:29
CaloTopology::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
CaloTopology::getAllNeighbours
std::vector< DetId > getAllNeighbours(const DetId &id) const
Get all the neighbors of the given cell.
Definition: CaloTopology.cc:69
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
eostools.move
def move(src, dest)
Definition: eostools.py:511
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
CaloTopology::theTopologies_
TopMap theTopologies_
Definition: CaloTopology.h:55
CaloTopology::west
std::vector< DetId > west(const DetId &id) const
Get the neighbors of the given cell in west direction.
Definition: CaloTopology.cc:34
emptyDetIdVector
static const std::vector< DetId > emptyDetIdVector
Definition: CaloTopology.cc:27
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23