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

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

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

References gather_cfg::cout.

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

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

References gather_cfg::cout.

◆ exclude() [1/4]

void CastorTopology::exclude ( const HcalCastorDetId id)

Exlucde a cell

Definition at line 45 of file CastorTopology.cc.

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 }

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

Referenced by exclude().

◆ exclude() [2/4]

void CastorTopology::exclude ( int  zside)

Exclude a side

Definition at line 52 of file CastorTopology.cc.

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 }

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

◆ exclude() [3/4]

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.

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 }

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

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

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 }

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

◆ firstCell()

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

Definition at line 257 of file CastorTopology.cc.

257  {
258  int firstCell = 0;
259  switch (section) {
260  case (HcalCastorDetId::EM):
262  break;
263  case (HcalCastorDetId::HAD):
265  break;
267  firstCell = 0;
268  break;
269  }
270  return firstCell;
271 }

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

Referenced by CastorHardcodeGeometryLoader::fill().

◆ firstEMModule()

int CastorTopology::firstEMModule ( ) const
inlineprivate

Definition at line 69 of file CastorTopology.h.

69 { return firstEMModule_; }

References firstEMModule_.

◆ firstHADModule()

int CastorTopology::firstHADModule ( ) const
inlineprivate

Definition at line 70 of file CastorTopology.h.

70 { return firstHADModule_; }

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

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 }

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

◆ incSector()

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.

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 }

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

◆ isExcluded()

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

Definition at line 21 of file CastorTopology.cc.

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 }

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

Referenced by valid().

◆ lastCell()

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

Definition at line 273 of file CastorTopology.cc.

273  {
274  int lastCell = 0;
275  switch (section) {
276  case (HcalCastorDetId::EM):
278  break;
279  case (HcalCastorDetId::HAD):
281  break;
283  lastCell = 0;
284  break;
285  }
286  return lastCell;
287 }

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

Referenced by CastorHardcodeGeometryLoader::fill().

◆ lastEMModule()

int CastorTopology::lastEMModule ( ) const
inlineprivate

Definition at line 71 of file CastorTopology.h.

71 { return lastEMModule_; }

References lastEMModule_.

◆ lastHADModule()

int CastorTopology::lastHADModule ( ) const
inlineprivate

Definition at line 72 of file CastorTopology.h.

72 { return lastHADModule_; }

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

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 }

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

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

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

References gather_cfg::cout.

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

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

References gather_cfg::cout.

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

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

References gather_cfg::cout.

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

19 { return (validRaw(id) && !isExcluded(id)); }

References isExcluded(), and validRaw().

Referenced by CastorHardcodeGeometryLoader::fill().

◆ validRaw()

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

Is this a valid cell id?

Definition at line 137 of file CastorTopology.cc.

137  {
138  return HcalCastorDetId::validDetId(id.section(), id.zside() > 0, id.sector(), id.module());
139 }

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

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

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

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

References gather_cfg::cout.

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().

CastorTopology::exclude
void exclude(const HcalCastorDetId &id)
Definition: CastorTopology.cc:45
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HcalCastorDetId::validDetId
static bool validDetId(Section iSection, bool posEta, int iSector, int iMod)
Definition: HcalCastorDetId.cc:69
CastorTopology::lastCell
int lastCell(HcalCastorDetId::Section section) const
Definition: CastorTopology.cc:273
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
gather_cfg.cout
cout
Definition: gather_cfg.py:144
CastorTopology::isExcluded
bool isExcluded(const HcalCastorDetId &id) const
Definition: CastorTopology.cc:21
CastorTopology::excludeZP_
bool excludeZP_
Definition: CastorTopology.h:63
HcalCastorDetId::Unknown
Definition: HcalCastorDetId.h:25
CastorTopology::excludeHAD_
bool excludeHAD_
Definition: CastorTopology.h:63
CastorTopology::lastHADModule_
int lastHADModule_
Definition: CastorTopology.h:65
HcalCastorDetId::section
Section section() const
get the section
Definition: HcalCastorDetId.cc:49
CastorTopology::firstHADModule_
int firstHADModule_
Definition: CastorTopology.h:65
HcalCastorDetId
Definition: HcalCastorDetId.h:23
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
CastorTopology::lastEMModule_
int lastEMModule_
Definition: CastorTopology.h:65
HcalCastorDetId::module
int module() const
get the module (1-2 for EM, 1-12 for HAD)
Definition: HcalCastorDetId.h:58
CaloSubdetectorTopology::ncells
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)
Definition: CaloSubdetectorTopology.h:30
HcalCastorDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalCastorDetId.h:50
MODULE_EM_MAX
static const int MODULE_EM_MAX
Definition: CastorTopology.cc:6
HcalCastorDetId::sector
int sector() const
get the sector (1-16)
Definition: HcalCastorDetId.h:62
CastorTopology::excludeZN_
bool excludeZN_
Definition: CastorTopology.h:63
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CastorTopology::validRaw
virtual bool validRaw(const HcalCastorDetId &id) const
Definition: CastorTopology.cc:137
CastorTopology::excludeEM_
bool excludeEM_
Definition: CastorTopology.h:63
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
CastorTopology::firstEMModule_
int firstEMModule_
Definition: CastorTopology.h:65
CastorTopology::exclusionList_
std::vector< HcalCastorDetId > exclusionList_
Definition: CastorTopology.h:61
hgcalPlots.section
section
Definition: hgcalPlots.py:2670
MODULE_HAD_MAX
static const int MODULE_HAD_MAX
Definition: CastorTopology.cc:7
HcalCastorDetId::HAD
Definition: HcalCastorDetId.h:25
CastorTopology::firstCell
int firstCell(HcalCastorDetId::Section section) const
Definition: CastorTopology.cc:257
HcalCastorDetId::EM
Definition: HcalCastorDetId.h:25