CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalBarrelTopology Class Referencefinal

#include <EcalBarrelTopology.h>

Inheritance diagram for EcalBarrelTopology:
CaloSubdetectorTopology

Public Member Functions

std::vector< DetIddown (const DetId &) const override
 
std::vector< DetIdeast (const DetId &id) const override
 
 EcalBarrelTopology ()
 create a new Topology More...
 
 EcalBarrelTopology (edm::ESHandle< CaloGeometry > theGeom)
 create a new Topology from geometry More...
 
DetId goEast (const DetId &id) const override
 move the Topology east (negative ieta) More...
 
DetId goNorth (const DetId &id) const override
 move the Topology north (increment iphi) More...
 
DetId goSouth (const DetId &id) const override
 move the Topology south (decrement iphi) More...
 
DetId goWest (const DetId &id) const override
 move the Topology west (positive ieta) More...
 
std::vector< DetIdnorth (const DetId &id) const override
 
std::vector< DetIdsouth (const DetId &id) const override
 
std::vector< DetIdup (const DetId &) const override
 
std::vector< DetIdwest (const DetId &id) const override
 
 ~EcalBarrelTopology () override
 virtual destructor More...
 
- Public Member Functions inherited from CaloSubdetectorTopology
 CaloSubdetectorTopology ()
 standard constructor More...
 
virtual DetId denseId2detId (unsigned int) const
 return a linear packed id More...
 
virtual bool denseIdConsistent (int topoVer) const
 return whether this topology is consistent with the numbering in the given topology More...
 
virtual unsigned int detId2denseId (const DetId &) const
 return a linear packed id More...
 
virtual std::vector< DetIdgetAllNeighbours (const DetId &id) const
 
virtual std::vector< DetIdgetNeighbours (const DetId &id, const CaloDirection &dir) const
 
virtual std::vector< DetIdgetWindow (const DetId &id, const int &northSouthSize, const int &eastWestSize) const
 
virtual DetId goDown (const DetId &id) const
 
virtual DetId goUp (const DetId &id) const
 
virtual unsigned int ncells () const
 return a count of valid cells (for dense indexing use) More...
 
virtual int topoVersion () const
 return a version which identifies the given topology More...
 
virtual bool valid (const DetId &) const
 is this detid present in the Topology? More...
 
virtual ~CaloSubdetectorTopology ()
 virtual destructor More...
 

Private Member Functions

EBDetId decrementIeta (const EBDetId &) const
 move the nagivator to smaller ieta (more negative z) (stops at end of barrel and returns null) More...
 
EBDetId decrementIphi (const EBDetId &) const
 move the nagivator to smaller iphi (wraps around the barrel) More...
 
EBDetId incrementIeta (const EBDetId &) const
 move the nagivator to larger ieta (more positive z) (stops at end of barrel and returns null) More...
 
EBDetId incrementIphi (const EBDetId &) const
 move the nagivator to larger iphi (wraps around the barrel) More...
 

Private Attributes

const CaloSubdetectorGeometrytheGeom_
 

Additional Inherited Members

- Protected Types inherited from CaloSubdetectorTopology
typedef std::pair< int, int > Coordinate
 
- Protected Member Functions inherited from CaloSubdetectorTopology
Coordinate getNeighbourIndex (const Coordinate &coord, const CaloDirection &dir) const
 

Detailed Description

Definition at line 13 of file EcalBarrelTopology.h.

Constructor & Destructor Documentation

EcalBarrelTopology::EcalBarrelTopology ( )
inline

create a new Topology

Definition at line 18 of file EcalBarrelTopology.h.

18 : theGeom_(nullptr) {};
const CaloSubdetectorGeometry * theGeom_
EcalBarrelTopology::~EcalBarrelTopology ( )
inlineoverride

virtual destructor

Definition at line 21 of file EcalBarrelTopology.h.

21 { }
EcalBarrelTopology::EcalBarrelTopology ( edm::ESHandle< CaloGeometry theGeom)
inline

create a new Topology from geometry

Definition at line 24 of file EcalBarrelTopology.h.

References DetId::Ecal, EcalBarrel, CaloGeometry::getSubdetectorGeometry(), and theGeom_.

24  {
26  }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
const CaloSubdetectorGeometry * theGeom_

Member Function Documentation

EBDetId EcalBarrelTopology::decrementIeta ( const EBDetId id) const
private

move the nagivator to smaller ieta (more negative z) (stops at end of barrel and returns null)

Definition at line 29 of file EcalBarrelTopology.cc.

References CaloSubdetectorGeometry::present(), theGeom_, and EBDetId::validDetId().

Referenced by down(), and goEast().

29  {
30 
31  if (!(theGeom_->present(id)))
32  return EBDetId(0);
33 
34  EBDetId nextPoint;
35  if (id.ieta()==1)
36  {
37  if (EBDetId::validDetId(-1,id.iphi()))
38  nextPoint=EBDetId(-1,id.iphi());
39  else
40  return EBDetId(0);
41  }
42  else
43  {
44  if (EBDetId::validDetId(id.ieta()-1,id.iphi()))
45  nextPoint=EBDetId(id.ieta()-1,id.iphi());
46  else
47  return EBDetId(0);
48  }
49 
50  if (theGeom_->present(nextPoint))
51  return nextPoint;
52  else
53  return EBDetId(0);
54 }
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
virtual bool present(const DetId &id) const
is this detid present in the geometry?
const CaloSubdetectorGeometry * theGeom_
EBDetId EcalBarrelTopology::decrementIphi ( const EBDetId id) const
private

move the nagivator to smaller iphi (wraps around the barrel)

Definition at line 85 of file EcalBarrelTopology.cc.

References EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, CaloSubdetectorGeometry::present(), theGeom_, and EBDetId::validDetId().

Referenced by down(), and goSouth().

85  {
86  if (!(theGeom_->present(id)))
87  return EBDetId(0);
88 
89  EBDetId nextPoint;
90 
91  if (id.iphi()==EBDetId::MIN_IPHI)
92  {
94  nextPoint=EBDetId(id.ieta(),EBDetId::MAX_IPHI);
95  else
96  return EBDetId(0);
97  }
98  else
99  {
100  if (EBDetId::validDetId(id.ieta(),id.iphi()-1))
101  nextPoint=EBDetId(id.ieta(),id.iphi()-1);
102  else
103  return EBDetId(0);
104  }
105 
106  if (theGeom_->present(nextPoint))
107  return nextPoint;
108  else
109  return EBDetId(0);
110 }
static const int MIN_IPHI
Definition: EBDetId.h:142
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
virtual bool present(const DetId &id) const
is this detid present in the geometry?
const CaloSubdetectorGeometry * theGeom_
static const int MAX_IPHI
Definition: EBDetId.h:144
std::vector<DetId> EcalBarrelTopology::down ( const DetId id) const
inlineoverridevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 88 of file EcalBarrelTopology.h.

References gather_cfg::cout, decrementIeta(), decrementIphi(), incrementIeta(), and incrementIphi().

89  {
90  std::cout << "EcalBarrelTopology::down() not yet implemented" << std::endl;
91  std::vector<DetId> vNeighborsDetId;
92  return vNeighborsDetId;
93  }
std::vector<DetId> EcalBarrelTopology::east ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 58 of file EcalBarrelTopology.h.

References goEast(), and DetId::rawId().

59  {
60  EBDetId nextId=goEast(id);
61  std::vector<DetId> vNeighborsDetId;
62  if (! (nextId==EBDetId(0)))
63  vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
64  return vNeighborsDetId;
65  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DetId goEast(const DetId &id) const override
move the Topology east (negative ieta)
Definition: DetId.h:18
DetId EcalBarrelTopology::goEast ( const DetId id) const
inlineoverridevirtual

move the Topology east (negative ieta)

Reimplemented from CaloSubdetectorTopology.

Definition at line 55 of file EcalBarrelTopology.h.

References decrementIeta().

Referenced by east().

55  {
56  return decrementIeta(EBDetId(id));
57  }
EBDetId decrementIeta(const EBDetId &) const
move the nagivator to smaller ieta (more negative z) (stops at end of barrel and returns null) ...
DetId EcalBarrelTopology::goNorth ( const DetId id) const
inlineoverridevirtual

move the Topology north (increment iphi)

Reimplemented from CaloSubdetectorTopology.

Definition at line 29 of file EcalBarrelTopology.h.

References incrementIphi().

Referenced by north().

29  {
30  return incrementIphi(EBDetId(id));
31  }
EBDetId incrementIphi(const EBDetId &) const
move the nagivator to larger iphi (wraps around the barrel)
DetId EcalBarrelTopology::goSouth ( const DetId id) const
inlineoverridevirtual

move the Topology south (decrement iphi)

Reimplemented from CaloSubdetectorTopology.

Definition at line 42 of file EcalBarrelTopology.h.

References decrementIphi().

Referenced by south().

42  {
43  return decrementIphi(EBDetId(id));
44  }
EBDetId decrementIphi(const EBDetId &) const
move the nagivator to smaller iphi (wraps around the barrel)
DetId EcalBarrelTopology::goWest ( const DetId id) const
inlineoverridevirtual

move the Topology west (positive ieta)

Reimplemented from CaloSubdetectorTopology.

Definition at line 68 of file EcalBarrelTopology.h.

References incrementIeta().

Referenced by west().

68  {
69  return incrementIeta(EBDetId(id));
70  }
EBDetId incrementIeta(const EBDetId &) const
move the nagivator to larger ieta (more positive z) (stops at end of barrel and returns null) ...
EBDetId EcalBarrelTopology::incrementIeta ( const EBDetId id) const
private

move the nagivator to larger ieta (more positive z) (stops at end of barrel and returns null)

Definition at line 4 of file EcalBarrelTopology.cc.

References CaloSubdetectorGeometry::present(), theGeom_, and EBDetId::validDetId().

Referenced by down(), and goWest().

4  {
5  if (!(theGeom_->present(id)))
6  return EBDetId(0);
7 
8  EBDetId nextPoint;
9  if (id.ieta()==-1)
10  {
11  if (EBDetId::validDetId(1,id.iphi()))
12  nextPoint=EBDetId (1,id.iphi());
13  else
14  return EBDetId(0);
15  }
16  else
17  {
18  if (EBDetId::validDetId(id.ieta()+1,id.iphi()))
19  nextPoint=EBDetId(id.ieta()+1,id.iphi());
20  else
21  return EBDetId(0);
22  }
23  if (theGeom_->present(nextPoint))
24  return nextPoint;
25  else
26  return EBDetId(0);
27 }
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
virtual bool present(const DetId &id) const
is this detid present in the geometry?
const CaloSubdetectorGeometry * theGeom_
EBDetId EcalBarrelTopology::incrementIphi ( const EBDetId id) const
private

move the nagivator to larger iphi (wraps around the barrel)

Definition at line 57 of file EcalBarrelTopology.cc.

References EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, CaloSubdetectorGeometry::present(), theGeom_, and EBDetId::validDetId().

Referenced by down(), and goNorth().

57  {
58  if (!(theGeom_->present(id)))
59  return EBDetId(0);
60 
61  EBDetId nextPoint;
62 
63  if (id.iphi()==EBDetId::MAX_IPHI)
64  {
66  nextPoint=EBDetId(id.ieta(),EBDetId::MIN_IPHI);
67  else
68  return EBDetId(0);
69  }
70  else
71  {
72  if (EBDetId::validDetId(id.ieta(),id.iphi()+1))
73  nextPoint=EBDetId(id.ieta(),id.iphi()+1);
74  else
75  return EBDetId(0);
76  }
77 
78  if (theGeom_->present(nextPoint))
79  return nextPoint;
80  else
81  return EBDetId(0);
82 }
static const int MIN_IPHI
Definition: EBDetId.h:142
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
virtual bool present(const DetId &id) const
is this detid present in the geometry?
const CaloSubdetectorGeometry * theGeom_
static const int MAX_IPHI
Definition: EBDetId.h:144
std::vector<DetId> EcalBarrelTopology::north ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 32 of file EcalBarrelTopology.h.

References goNorth(), and DetId::rawId().

33  {
34  EBDetId nextId=goNorth(id);
35  std::vector<DetId> vNeighborsDetId;
36  if (! (nextId==EBDetId(0)))
37  vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
38  return vNeighborsDetId;
39  }
DetId goNorth(const DetId &id) const override
move the Topology north (increment iphi)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Definition: DetId.h:18
std::vector<DetId> EcalBarrelTopology::south ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 45 of file EcalBarrelTopology.h.

References goSouth(), and DetId::rawId().

46  {
47  EBDetId nextId=goSouth(id);
48  std::vector<DetId> vNeighborsDetId;
49  if (! (nextId==EBDetId(0)))
50  vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
51  return vNeighborsDetId;
52  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DetId goSouth(const DetId &id) const override
move the Topology south (decrement iphi)
Definition: DetId.h:18
std::vector<DetId> EcalBarrelTopology::up ( const DetId id) const
inlineoverridevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 81 of file EcalBarrelTopology.h.

References gather_cfg::cout.

82  {
83  std::cout << "EcalBarrelTopology::up() not yet implemented" << std::endl;
84  std::vector<DetId> vNeighborsDetId;
85  return vNeighborsDetId;
86  }
std::vector<DetId> EcalBarrelTopology::west ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 71 of file EcalBarrelTopology.h.

References goWest(), and DetId::rawId().

72  {
73  EBDetId nextId=goWest(id);
74  std::vector<DetId> vNeighborsDetId;
75  if (! (nextId==EBDetId(0)))
76  vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
77  return vNeighborsDetId;
78  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DetId goWest(const DetId &id) const override
move the Topology west (positive ieta)
Definition: DetId.h:18

Member Data Documentation

const CaloSubdetectorGeometry* EcalBarrelTopology::theGeom_
private