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
 
virtual unsigned int ncells () const
 return a count of valid cells (for dense indexing use) More...
 
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 DetId &) const
 
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::CastorTopology ( )

Definition at line 10 of file CastorTopology.cc.

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

Member Function Documentation

◆ down()

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 236 of file CastorTopology.cc.

236  {
237  edm::LogVerbatim("ForwardGeom") << "CastorTopology::down() not yet implemented";
238  std::vector<DetId> vNeighborsDetId;
239  return vNeighborsDetId;
240 }
Log< level::Info, true > LogVerbatim

◆ east()

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 209 of file CastorTopology.cc.

209  {
210  edm::LogVerbatim("ForwardGeom") << "CastorTopology::east() not yet implemented";
211  std::vector<DetId> vNeighborsDetId;
212  return vNeighborsDetId;
213 }
Log< level::Info, true > LogVerbatim

◆ exclude() [1/4]

void CastorTopology::exclude ( const HcalCastorDetId id)

Exlucde a cell

Definition at line 46 of file CastorTopology.cc.

References exclusionList_, mps_fire::i, EcalPhiSymFlatTableProducers_cfi::id, and pfDeepBoostedJetPreprocessParams_cfi::lower_bound.

Referenced by exclude().

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

◆ exclude() [2/4]

void CastorTopology::exclude ( int  zside)

Exclude a side

Definition at line 53 of file CastorTopology.cc.

References excludeZN_, excludeZP_, and ecaldqm::zside().

53  {
54  switch (zside) {
55  case (1):
56  excludeZP_ = true;
57  break;
58  case (-1):
59  excludeZN_ = true;
60  break;
61  default:
62  break;
63  }
64 }
int zside(DetId const &)

◆ exclude() [3/4]

void CastorTopology::exclude ( int  zside,
HcalCastorDetId::Section  section 
)

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

Definition at line 66 of file CastorTopology.cc.

References HcalCastorDetId::EM, excludeEM_, excludeHAD_, excludeZN_, excludeZP_, HcalCastorDetId::HAD, hgcalPlots::section, and ecaldqm::zside().

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

◆ exclude() [4/4]

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 89 of file CastorTopology.cc.

References HcalCastorDetId::EM, exclude(), excludeEM_, excludeHAD_, excludeZN_, excludeZP_, HcalCastorDetId::HAD, EcalPhiSymFlatTableProducers_cfi::id, l1ctLayer1_patternWriters_cff::isec, create_idmaps::n, validRaw(), and ecaldqm::zside().

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

◆ firstCell()

int CastorTopology::firstCell ( HcalCastorDetId::Section  section) const

Definition at line 258 of file CastorTopology.cc.

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

Referenced by CastorHardcodeGeometryLoader::fill().

258  {
259  int firstCell = 0;
260  switch (section) {
261  case (HcalCastorDetId::EM):
263  break;
264  case (HcalCastorDetId::HAD):
266  break;
268  firstCell = 0;
269  break;
270  }
271  return firstCell;
272 }
int firstCell(HcalCastorDetId::Section section) const

◆ firstEMModule()

int CastorTopology::firstEMModule ( ) const
inlineprivate

Definition at line 69 of file CastorTopology.h.

References firstEMModule_.

69 { return firstEMModule_; }

◆ firstHADModule()

int CastorTopology::firstHADModule ( ) const
inlineprivate

Definition at line 70 of file CastorTopology.h.

References firstHADModule_.

70 { return firstHADModule_; }

◆ incModule()

std::vector< DetId > CastorTopology::incModule ( const DetId id) const
virtual

Get the neigbors of the given cell with higher module

Definition at line 168 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().

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

◆ incSector()

std::vector< DetId > CastorTopology::incSector ( const DetId id) const
virtual

Get the neighbors of the given cell with higher #sector

Definition at line 142 of file CastorTopology.cc.

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

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

◆ isExcluded()

bool CastorTopology::isExcluded ( const HcalCastorDetId id) const
private

Definition at line 22 of file CastorTopology.cc.

References HcalCastorDetId::EM, excludeEM_, excludeHAD_, exclusionList_, HcalCastorDetId::HAD, mps_fire::i, EcalPhiSymFlatTableProducers_cfi::id, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, and hgcalPlots::section.

Referenced by valid().

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

◆ lastCell()

int CastorTopology::lastCell ( HcalCastorDetId::Section  section) const

Definition at line 274 of file CastorTopology.cc.

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

Referenced by CastorHardcodeGeometryLoader::fill().

274  {
275  int lastCell = 0;
276  switch (section) {
277  case (HcalCastorDetId::EM):
279  break;
280  case (HcalCastorDetId::HAD):
282  break;
284  lastCell = 0;
285  break;
286  }
287  return lastCell;
288 }
int lastCell(HcalCastorDetId::Section section) const

◆ lastEMModule()

int CastorTopology::lastEMModule ( ) const
inlineprivate

Definition at line 71 of file CastorTopology.h.

References lastEMModule_.

71 { return lastEMModule_; }

◆ lastHADModule()

int CastorTopology::lastHADModule ( ) const
inlineprivate

Definition at line 72 of file CastorTopology.h.

References lastHADModule_.

72 { return lastHADModule_; }

◆ ncells() [1/2]

virtual unsigned int CaloSubdetectorTopology::ncells
inline

return a count of valid cells (for dense indexing use)

Definition at line 30 of file CaloSubdetectorTopology.h.

30 { return 1; }

◆ ncells() [2/2]

int CastorTopology::ncells ( HcalCastorDetId::Section  section) const

Definition at line 242 of file CastorTopology.cc.

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

242  {
243  int ncells = 0;
244  switch (section) {
245  case (HcalCastorDetId::EM):
246  ncells = MODULE_EM_MAX * 16;
247  break;
248  case (HcalCastorDetId::HAD):
249  ncells = MODULE_HAD_MAX * 16;
250  break;
252  ncells = 0;
253  break;
254  }
255  return ncells;
256 }
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)

◆ north()

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 221 of file CastorTopology.cc.

221  {
222  edm::LogVerbatim("ForwardGeom") << "CastorTopology::north() not yet implemented";
223  std::vector<DetId> vNeighborsDetId;
224  return vNeighborsDetId;
225 }
Log< level::Info, true > LogVerbatim

◆ south()

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 226 of file CastorTopology.cc.

226  {
227  edm::LogVerbatim("ForwardGeom") << "CastorTopology::south() not yet implemented";
228  std::vector<DetId> vNeighborsDetId;
229  return vNeighborsDetId;
230 }
Log< level::Info, true > LogVerbatim

◆ up()

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 231 of file CastorTopology.cc.

231  {
232  edm::LogVerbatim("ForwardGeom") << "CastorTopology::up() not yet implemented";
233  std::vector<DetId> vNeighborsDetId;
234  return vNeighborsDetId;
235 }
Log< level::Info, true > LogVerbatim

◆ valid() [1/2]

virtual bool CaloSubdetectorTopology::valid
inline

Is this a valid cell id?

Definition at line 24 of file CaloSubdetectorTopology.h.

24 { return false; };

◆ valid() [2/2]

bool CastorTopology::valid ( const HcalCastorDetId id) const
virtual

Definition at line 20 of file CastorTopology.cc.

References isExcluded(), and validRaw().

Referenced by CastorHardcodeGeometryLoader::fill().

20 { return (validRaw(id) && !isExcluded(id)); }
bool isExcluded(const HcalCastorDetId &id) const
virtual bool validRaw(const HcalCastorDetId &id) const

◆ validRaw()

bool CastorTopology::validRaw ( const HcalCastorDetId id) const
virtual

Is this a valid cell id?

Definition at line 138 of file CastorTopology.cc.

References callgraph::module, hgcalPlots::section, nano_mu_digi_cff::sector, HcalCastorDetId::validDetId(), and ecaldqm::zside().

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

138  {
139  return HcalCastorDetId::validDetId(id.section(), id.zside() > 0, id.sector(), id.module());
140 }
static bool validDetId(Section iSection, bool posEta, int iSector, int iMod)
int zside(DetId const &)

◆ west()

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 215 of file CastorTopology.cc.

215  {
216  edm::LogVerbatim("ForwardGeom") << "CastorTopology::west() not yet implemented";
217  std::vector<DetId> vNeighborsDetId;
218  return vNeighborsDetId;
219 }
Log< level::Info, true > LogVerbatim

Member Data Documentation

◆ excludeEM_

bool CastorTopology::excludeEM_
private

Definition at line 63 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

◆ excludeHAD_

bool CastorTopology::excludeHAD_
private

Definition at line 63 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

◆ excludeZN_

bool CastorTopology::excludeZN_
private

Definition at line 63 of file CastorTopology.h.

Referenced by exclude().

◆ excludeZP_

bool CastorTopology::excludeZP_
private

Definition at line 63 of file CastorTopology.h.

Referenced by exclude().

◆ exclusionList_

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

Definition at line 61 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

◆ firstEMModule_

int CastorTopology::firstEMModule_
private

Definition at line 65 of file CastorTopology.h.

Referenced by firstCell(), and firstEMModule().

◆ firstHADModule_

int CastorTopology::firstHADModule_
private

Definition at line 65 of file CastorTopology.h.

Referenced by firstCell(), and firstHADModule().

◆ lastEMModule_

int CastorTopology::lastEMModule_
private

Definition at line 65 of file CastorTopology.h.

Referenced by lastCell(), and lastEMModule().

◆ lastHADModule_

int CastorTopology::lastHADModule_
private

Definition at line 65 of file CastorTopology.h.

Referenced by lastCell(), and lastHADModule().