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.

References emptyDetIdVector, getSubdetectorTopology(), and HLT_2024v13_cff::topology.

54  {
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

◆ 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.

References emptyDetIdVector, getSubdetectorTopology(), and HLT_2024v13_cff::topology.

29  {
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

◆ 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.

References emptyDetIdVector, getSubdetectorTopology(), and HLT_2024v13_cff::topology.

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

◆ 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.

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

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

◆ 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.

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

◆ 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.

References emptyDetIdVector, getSubdetectorTopology(), and HLT_2024v13_cff::topology.

Referenced by AlCaECALRecHitReducer::AddMiniRecHitCollection().

64  {
66  return (topology == nullptr) ? (emptyDetIdVector) : (topology->getWindow(id, northSouthSize, eastWestSize));
67 }
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

◆ makeIndex()

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); }

◆ 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.

References emptyDetIdVector, getSubdetectorTopology(), and HLT_2024v13_cff::topology.

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

◆ 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.

References relativeConstraints::geom, 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(src, dest)
Definition: eostools.py:511

◆ 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.

References emptyDetIdVector, getSubdetectorTopology(), and HLT_2024v13_cff::topology.

44  {
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

◆ 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.

References emptyDetIdVector, getSubdetectorTopology(), and HLT_2024v13_cff::topology.

49  {
51  return (topology == nullptr) ? (emptyDetIdVector) : (topology->up(id));
52 }
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

◆ valid()

bool CaloTopology::valid ( const DetId id) const

Is this a valid cell id?

Definition at line 74 of file CaloTopology.cc.

References relativeConstraints::geom, and getSubdetectorTopology().

74  {
76  return (geom == nullptr) ? (false) : (geom->valid(id));
77 }
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17

◆ 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.

References emptyDetIdVector, getSubdetectorTopology(), and HLT_2024v13_cff::topology.

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

◆ theTopologies_

TopMap CaloTopology::theTopologies_
private

Definition at line 55 of file CaloTopology.h.

Referenced by getSubdetectorTopology(), and setSubdetTopology().