CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CastorTopology Class Reference

#include <CastorTopology.h>

Inheritance diagram for CastorTopology:
CaloSubdetectorTopology

Public Member Functions

 CastorTopology ()
 
std::vector< DetIddown (const DetId &id) const override
 
std::vector< DetIdeast (const DetId &id) const override
 
void exclude (const HcalCastorDetId &id)
 
void exclude (int zside)
 
void exclude (int zside, HcalCastorDetId::Section section)
 
int exclude (int zside, HcalCastorDetId::Section section1, int isec1, int imod1, HcalCastorDetId::Section section2, int isec2, int imod2)
 
int firstCell (HcalCastorDetId::Section section) const
 
virtual std::vector< DetIdincModule (const DetId &id) const
 
virtual std::vector< DetIdincSector (const DetId &id) const
 
int lastCell (HcalCastorDetId::Section section) const
 
int ncells (HcalCastorDetId::Section section) const
 
std::vector< DetIdnorth (const DetId &id) const override
 
std::vector< DetIdsouth (const DetId &id) const override
 
std::vector< DetIdup (const DetId &id) const override
 
virtual bool valid (const HcalCastorDetId &id) const
 
virtual bool validRaw (const HcalCastorDetId &id) const
 
std::vector< DetIdwest (const DetId &id) const override
 
- 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 goEast (const DetId &id) const
 
virtual DetId goNorth (const DetId &id) const
 
virtual DetId goSouth (const DetId &id) const
 
virtual DetId goUp (const DetId &id) const
 
virtual DetId goWest (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

int firstEMModule () const
 
int firstHADModule () const
 
bool isExcluded (const HcalCastorDetId &id) const
 
int lastEMModule () const
 
int lastHADModule () const
 

Private Attributes

bool excludeEM_
 
bool excludeHAD_
 
bool excludeZN_
 
bool excludeZP_
 
std::vector< HcalCastorDetIdexclusionList_
 
int firstEMModule_
 
int firstHADModule_
 
int lastEMModule_
 
int lastHADModule_
 

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

Author
P. Katsas - UoA

Definition at line 13 of file CastorTopology.h.

Constructor & Destructor Documentation

CastorTopology::CastorTopology ( )

Definition at line 9 of file CastorTopology.cc.

10  : excludeEM_(false),
11  excludeHAD_(false),
12  excludeZP_(false),
13  excludeZN_(false),
14  firstEMModule_(1),
15  lastEMModule_(2),
16  firstHADModule_(3),
17  lastHADModule_(14) {}

Member Function Documentation

std::vector< DetId > CastorTopology::down ( const DetId id) const
overridevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 235 of file CastorTopology.cc.

References gather_cfg::cout.

235  {
236  std::cout << "CastorTopology::down() not yet implemented" << std::endl;
237  std::vector<DetId> vNeighborsDetId;
238  return vNeighborsDetId;
239 }
std::vector< DetId > CastorTopology::east ( const DetId id) const
overridevirtual

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 208 of file CastorTopology.cc.

References gather_cfg::cout.

208  {
209  std::cout << "CastorTopology::east() not yet implemented" << std::endl;
210  std::vector<DetId> vNeighborsDetId;
211  return vNeighborsDetId;
212 }
void CastorTopology::exclude ( const HcalCastorDetId id)

Exlucde a cell

Definition at line 45 of file CastorTopology.cc.

References exclusionList_, mps_fire::i, and triggerObjects_cff::id.

Referenced by exclude().

45  {
46  std::vector<HcalCastorDetId>::iterator i = std::lower_bound(exclusionList_.begin(), exclusionList_.end(), id);
47  if (i == exclusionList_.end() || *i != id) {
48  exclusionList_.insert(i, id);
49  }
50 }
std::vector< HcalCastorDetId > exclusionList_
void CastorTopology::exclude ( int  zside)

Exclude a side

Definition at line 52 of file CastorTopology.cc.

References excludeZN_, and excludeZP_.

52  {
53  switch (zside) {
54  case (1):
55  excludeZP_ = true;
56  break;
57  case (-1):
58  excludeZN_ = true;
59  break;
60  default:
61  break;
62  }
63 }
int zside(DetId const &)
void CastorTopology::exclude ( int  zside,
HcalCastorDetId::Section  section 
)

Exclude a section, in either side (+1 positive, -1 negative)

Definition at line 65 of file CastorTopology.cc.

References HcalCastorDetId::EM, excludeEM_, excludeHAD_, excludeZN_, excludeZP_, and HcalCastorDetId::HAD.

65  {
66  switch (zside) {
67  case (1):
68  excludeZP_ = true;
69  break;
70  case (-1):
71  excludeZN_ = true;
72  break;
73  default:
74  break;
75  }
76  switch (section) {
77  case (HcalCastorDetId::EM):
78  excludeEM_ = true;
79  break;
80  case (HcalCastorDetId::HAD):
81  excludeHAD_ = true;
82  break;
83  default:
84  break;
85  }
86 }
int zside(DetId const &)
int CastorTopology::exclude ( int  zside,
HcalCastorDetId::Section  section1,
int  isec1,
int  imod1,
HcalCastorDetId::Section  section2,
int  isec2,
int  imod2 
)

Exclude a range of channels (deph) for a given subdetector

Definition at line 88 of file CastorTopology.cc.

References HcalCastorDetId::EM, exclude(), excludeEM_, excludeHAD_, excludeZN_, excludeZP_, HcalCastorDetId::HAD, triggerObjects_cff::id, dqmiodumpmetadata::n, and validRaw().

94  {
95  bool exed = false;
96  switch (zside) {
97  case (1):
98  exed = excludeZP_;
99  break;
100  case (-1):
101  exed = excludeZN_;
102  break;
103  default:
104  exed = false;
105  }
106  if (exed)
107  return 0;
108 
109  /* NOTE not so sure about the exclusion */
110  if (section1 == HcalCastorDetId::EM && section2 == HcalCastorDetId::EM) {
111  exed = excludeEM_;
112  } else if (section1 == HcalCastorDetId::HAD && section2 == HcalCastorDetId::HAD) {
113  exed = excludeHAD_;
114  } else {
115  exed = false;
116  };
117 
118  if (exed)
119  return 0;
120 
121  bool isPositive = false;
122  if (zside == 1)
123  isPositive = true;
124 
125  int n = 0;
126  for (int isec = isec1; isec < isec2; isec++) {
127  for (int imod = imod1; imod < imod2; imod++) {
128  HcalCastorDetId id(section1, isPositive, isec, imod);
129  if (validRaw(id))
130  exclude(id);
131  n++;
132  }
133  }
134  return n;
135 }
virtual bool validRaw(const HcalCastorDetId &id) const
int zside(DetId const &)
void exclude(const HcalCastorDetId &id)
int CastorTopology::firstCell ( HcalCastorDetId::Section  section) const

Definition at line 257 of file CastorTopology.cc.

References HcalCastorDetId::EM, firstEMModule_, firstHADModule_, HcalCastorDetId::HAD, and HcalCastorDetId::Unknown.

Referenced by CastorHardcodeGeometryLoader::fill().

257  {
258  int firstCell = 0;
259  switch (section) {
260  case (HcalCastorDetId::EM):
261  firstCell = firstEMModule_;
262  break;
263  case (HcalCastorDetId::HAD):
264  firstCell = firstHADModule_;
265  break;
267  firstCell = 0;
268  break;
269  }
270  return firstCell;
271 }
int firstCell(HcalCastorDetId::Section section) const
int CastorTopology::firstEMModule ( ) const
inlineprivate

Definition at line 69 of file CastorTopology.h.

References firstEMModule_.

69 { return firstEMModule_; }
int CastorTopology::firstHADModule ( ) const
inlineprivate

Definition at line 70 of file CastorTopology.h.

References firstHADModule_.

70 { return firstHADModule_; }
std::vector< DetId > CastorTopology::incModule ( const DetId id) const
virtual

Get the neigbors of the given cell with higher module

Definition at line 167 of file CastorTopology.cc.

References HcalCastorDetId::EM, HcalCastorDetId::HAD, HcalCastorDetId::module(), MODULE_EM_MAX, MODULE_HAD_MAX, DetId::rawId(), HcalCastorDetId::section(), HcalCastorDetId::sector(), validRaw(), and HcalCastorDetId::zside().

167  {
168  std::vector<DetId> vNeighborsDetId;
169  HcalCastorDetId castorId = HcalCastorDetId(id);
170  HcalCastorDetId castorDetId;
171  if (validRaw(castorId) && castorId.section() == HcalCastorDetId::EM) {
172  bool isPositive = false;
173  if (castorId.zside() == 1)
174  isPositive = true;
175  if (castorId.module() == 1) {
176  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module() + 1);
177  vNeighborsDetId.emplace_back(castorDetId.rawId());
178  return vNeighborsDetId;
179  }
180  if (castorId.module() == MODULE_EM_MAX) {
181  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module() - 1);
182  vNeighborsDetId.emplace_back(castorDetId.rawId());
183  return vNeighborsDetId;
184  }
185  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module() - 1);
186  vNeighborsDetId.emplace_back(castorDetId.rawId());
187  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module() + 1);
188  vNeighborsDetId.emplace_back(castorDetId.rawId());
189  }
190  if (validRaw(castorId) && castorId.section() == HcalCastorDetId::HAD) {
191  bool isPositive = false;
192  if (castorId.zside() == 1)
193  isPositive = true;
194  if (castorId.module() == 1) {
195  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module() + 1);
196  vNeighborsDetId.emplace_back(castorDetId.rawId());
197  return vNeighborsDetId;
198  }
199  if (castorId.module() == MODULE_HAD_MAX) {
200  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module() - 1);
201  vNeighborsDetId.emplace_back(castorDetId.rawId());
202  return vNeighborsDetId;
203  }
204  }
205  return vNeighborsDetId;
206 }
int sector() const
get the sector (1-16)
static const int MODULE_EM_MAX
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int module() const
get the module (1-2 for EM, 1-12 for HAD)
virtual bool validRaw(const HcalCastorDetId &id) const
Section section() const
get the section
static const int MODULE_HAD_MAX
int zside() const
get the z-side of the cell (1/-1)
std::vector< DetId > CastorTopology::incSector ( const DetId id) const
virtual

Get the neighbors of the given cell with higher #sector

Definition at line 141 of file CastorTopology.cc.

References HcalCastorDetId::module(), DetId::rawId(), HcalCastorDetId::section(), HcalCastorDetId::sector(), validRaw(), and HcalCastorDetId::zside().

141  {
142  std::vector<DetId> vNeighborsDetId;
143  HcalCastorDetId castorId = HcalCastorDetId(id);
144  HcalCastorDetId castorDetId;
145  if (validRaw(castorId)) {
146  bool isPositive = false;
147  if (castorId.zside() == 1)
148  isPositive = true;
149  if (castorId.sector() == 1) {
150  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector() + 1, castorId.module());
151  vNeighborsDetId.emplace_back(castorDetId.rawId());
152  return vNeighborsDetId;
153  }
154  if (castorId.sector() == 16) {
155  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector() - 1, castorId.module());
156  vNeighborsDetId.emplace_back(castorDetId.rawId());
157  return vNeighborsDetId;
158  }
159  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector() - 1, castorId.module());
160  vNeighborsDetId.emplace_back(castorDetId.rawId());
161  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector() + 1, castorId.module());
162  vNeighborsDetId.emplace_back(castorDetId.rawId());
163  }
164  return vNeighborsDetId;
165 }
int sector() const
get the sector (1-16)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int module() const
get the module (1-2 for EM, 1-12 for HAD)
virtual bool validRaw(const HcalCastorDetId &id) const
Section section() const
get the section
int zside() const
get the z-side of the cell (1/-1)
bool CastorTopology::isExcluded ( const HcalCastorDetId id) const
private

Definition at line 21 of file CastorTopology.cc.

References HcalCastorDetId::EM, excludeEM_, excludeHAD_, exclusionList_, HcalCastorDetId::HAD, mps_fire::i, triggerObjects_cff::id, and trackingPlots::section.

Referenced by valid().

21  {
22  bool exed = false;
23 
24  // check for section exclutions
25  switch (id.section()) {
26  case (HcalCastorDetId::EM):
27  exed = excludeEM_;
28  break;
29  case (HcalCastorDetId::HAD):
30  exed = excludeHAD_;
31  break;
32  default:
33  exed = false;
34  }
35 
36  // check the entire list
37  if (!exed && !exclusionList_.empty()) {
38  std::vector<HcalCastorDetId>::const_iterator i = std::lower_bound(exclusionList_.begin(), exclusionList_.end(), id);
39  if (i != exclusionList_.end() && *i == id)
40  exed = true;
41  }
42  return exed;
43 }
std::vector< HcalCastorDetId > exclusionList_
int CastorTopology::lastCell ( HcalCastorDetId::Section  section) const

Definition at line 273 of file CastorTopology.cc.

References HcalCastorDetId::EM, HcalCastorDetId::HAD, lastEMModule_, lastHADModule_, and HcalCastorDetId::Unknown.

Referenced by CastorHardcodeGeometryLoader::fill().

273  {
274  int lastCell = 0;
275  switch (section) {
276  case (HcalCastorDetId::EM):
277  lastCell = lastEMModule_;
278  break;
279  case (HcalCastorDetId::HAD):
280  lastCell = lastHADModule_;
281  break;
283  lastCell = 0;
284  break;
285  }
286  return lastCell;
287 }
int lastCell(HcalCastorDetId::Section section) const
int CastorTopology::lastEMModule ( ) const
inlineprivate

Definition at line 71 of file CastorTopology.h.

References lastEMModule_.

71 { return lastEMModule_; }
int CastorTopology::lastHADModule ( ) const
inlineprivate

Definition at line 72 of file CastorTopology.h.

References lastHADModule_.

72 { return lastHADModule_; }
int CastorTopology::ncells ( HcalCastorDetId::Section  section) const

Definition at line 241 of file CastorTopology.cc.

References HcalCastorDetId::EM, HcalCastorDetId::HAD, MODULE_EM_MAX, MODULE_HAD_MAX, CaloSubdetectorTopology::ncells(), and HcalCastorDetId::Unknown.

241  {
242  int ncells = 0;
243  switch (section) {
244  case (HcalCastorDetId::EM):
245  ncells = MODULE_EM_MAX * 16;
246  break;
247  case (HcalCastorDetId::HAD):
248  ncells = MODULE_HAD_MAX * 16;
249  break;
251  ncells = 0;
252  break;
253  }
254  return ncells;
255 }
static const int MODULE_EM_MAX
static const int MODULE_HAD_MAX
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)
std::vector< DetId > CastorTopology::north ( const DetId id) const
overridevirtual

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 220 of file CastorTopology.cc.

References gather_cfg::cout.

220  {
221  std::cout << "CastorTopology::north() not yet implemented" << std::endl;
222  std::vector<DetId> vNeighborsDetId;
223  return vNeighborsDetId;
224 }
std::vector< DetId > CastorTopology::south ( const DetId id) const
overridevirtual

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 225 of file CastorTopology.cc.

References gather_cfg::cout.

225  {
226  std::cout << "CastorTopology::south() not yet implemented" << std::endl;
227  std::vector<DetId> vNeighborsDetId;
228  return vNeighborsDetId;
229 }
std::vector< DetId > CastorTopology::up ( const DetId id) const
overridevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 230 of file CastorTopology.cc.

References gather_cfg::cout.

230  {
231  std::cout << "CastorTopology::up() not yet implemented" << std::endl;
232  std::vector<DetId> vNeighborsDetId;
233  return vNeighborsDetId;
234 }
bool CastorTopology::valid ( const HcalCastorDetId id) const
virtual

Definition at line 19 of file CastorTopology.cc.

References isExcluded(), and validRaw().

Referenced by CastorHardcodeGeometryLoader::fill().

19 { return (validRaw(id) && !isExcluded(id)); }
virtual bool validRaw(const HcalCastorDetId &id) const
bool isExcluded(const HcalCastorDetId &id) const
bool CastorTopology::validRaw ( const HcalCastorDetId id) const
virtual

Is this a valid cell id?

Definition at line 137 of file CastorTopology.cc.

References trackingPlots::section, HcalCastorDetId::validDetId(), and ecaldqm::zside().

Referenced by exclude(), incModule(), incSector(), and valid().

137  {
138  return HcalCastorDetId::validDetId(id.section(), id.zside() > 0, id.sector(), id.module());
139 }
static bool validDetId(Section iSection, bool posEta, int iSector, int iMod)
int zside(DetId const &)
Definition: vlib.h:198
std::vector< DetId > CastorTopology::west ( const DetId id) const
overridevirtual

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 214 of file CastorTopology.cc.

References gather_cfg::cout.

214  {
215  std::cout << "CastorTopology::west() not yet implemented" << std::endl;
216  std::vector<DetId> vNeighborsDetId;
217  return vNeighborsDetId;
218 }

Member Data Documentation

bool CastorTopology::excludeEM_
private

Definition at line 63 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

bool CastorTopology::excludeHAD_
private

Definition at line 63 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

bool CastorTopology::excludeZN_
private

Definition at line 63 of file CastorTopology.h.

Referenced by exclude().

bool CastorTopology::excludeZP_
private

Definition at line 63 of file CastorTopology.h.

Referenced by exclude().

std::vector<HcalCastorDetId> CastorTopology::exclusionList_
private

Definition at line 61 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

int CastorTopology::firstEMModule_
private

Definition at line 65 of file CastorTopology.h.

Referenced by firstCell(), and firstEMModule().

int CastorTopology::firstHADModule_
private

Definition at line 65 of file CastorTopology.h.

Referenced by firstCell(), and firstHADModule().

int CastorTopology::lastEMModule_
private

Definition at line 65 of file CastorTopology.h.

Referenced by lastCell(), and lastEMModule().

int CastorTopology::lastHADModule_
private

Definition at line 65 of file CastorTopology.h.

Referenced by lastCell(), and lastHADModule().