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.

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

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

References gather_cfg::cout.

220 {
221  std::cout << "CastorTopology::down() not yet implemented" << std::endl;
222  std::vector<DetId> vNeighborsDetId;
223  return vNeighborsDetId;
224 }
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 187 of file CastorTopology.cc.

References gather_cfg::cout.

188 {
189  std::cout << "CastorTopology::east() not yet implemented" << std::endl;
190  std::vector<DetId> vNeighborsDetId;
191  return vNeighborsDetId;
192 }
void CastorTopology::exclude ( const HcalCastorDetId id)

Exlucde a cell

Definition at line 47 of file CastorTopology.cc.

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

Referenced by exclude().

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

Exclude a side

Definition at line 55 of file CastorTopology.cc.

References excludeZN_, and excludeZP_.

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

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

Definition at line 63 of file CastorTopology.cc.

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

63  {
64  switch(zside){
65  case( 1): excludeZP_ = true; break;
66  case(-1): excludeZN_ = true; break;
67  default: break;
68  }
69  switch (section) {
70  case(HcalCastorDetId::EM) : excludeEM_ = true; break;
71  case(HcalCastorDetId::HAD) : excludeHAD_ = true; break;
72  default: break;
73  }
74 }
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 76 of file CastorTopology.cc.

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

77  {
78  bool exed = false;
79  switch(zside){
80  case( 1): exed = excludeZP_; break;
81  case(-1): exed = excludeZN_; break;
82  default: exed = false;
83  }
84  if (exed) return 0;
85 
86 
87 /* NOTE not so sure about the exclusion */
88  if (section1 == HcalCastorDetId::EM && section2 == HcalCastorDetId::EM) {
89  exed = excludeEM_; }
90  else if (section1 == HcalCastorDetId::HAD && section2 == HcalCastorDetId::HAD) {
91  exed = excludeHAD_; }
92  else { exed = false; };
93 
94  if (exed) return 0;
95 
96  bool isPositive = false;
97  if(zside == 1)isPositive = true;
98 
99  int n = 0;
100  for (int isec = isec1; isec < isec2; isec++){
101  for (int imod = imod1; imod < imod2; imod++) {
102  HcalCastorDetId id(section1, isPositive, isec, imod);
103  if(validRaw(id))exclude(id);
104  n++;
105  }
106  }
107  return n;
108 }
virtual bool validRaw(const HcalCastorDetId &id) const
void exclude(const HcalCastorDetId &id)
int CastorTopology::firstCell ( HcalCastorDetId::Section  section) const

Definition at line 236 of file CastorTopology.cc.

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

Referenced by CastorHardcodeGeometryLoader::fill().

236  {
237  int firstCell = 0;
238  switch (section) {
239  case(HcalCastorDetId::EM) : firstCell = firstEMModule_ ; break;
240  case(HcalCastorDetId::HAD) : firstCell = firstHADModule_; break;
241  case(HcalCastorDetId::Unknown) : firstCell = 0; break;
242  }
243  return firstCell;
244 }
int firstCell(HcalCastorDetId::Section section) const
int CastorTopology::firstEMModule ( ) const
inlineprivate

Definition at line 65 of file CastorTopology.h.

References firstEMModule_.

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

Definition at line 66 of file CastorTopology.h.

References firstHADModule_.

66 {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 147 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().

147  {
148  std::vector<DetId> vNeighborsDetId;
149  HcalCastorDetId castorId = HcalCastorDetId(id);
150  HcalCastorDetId castorDetId;
151  if(validRaw(castorId) && castorId.section()== HcalCastorDetId::EM){
152  bool isPositive = false;
153  if(castorId.zside()==1)isPositive = true;
154  if(castorId.module()==1){
155  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()+1);
156  vNeighborsDetId.emplace_back(castorDetId.rawId());
157  return vNeighborsDetId;
158  }
159  if(castorId.module()== MODULE_EM_MAX){
160  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()-1);
161  vNeighborsDetId.emplace_back(castorDetId.rawId());
162  return vNeighborsDetId;
163  }
164  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()-1);
165  vNeighborsDetId.emplace_back(castorDetId.rawId());
166  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()+1);
167  vNeighborsDetId.emplace_back(castorDetId.rawId());
168  }
169  if(validRaw(castorId) && castorId.section()== HcalCastorDetId::HAD){
170  bool isPositive = false;
171  if(castorId.zside()==1)isPositive = true;
172  if(castorId.module()==1){
173  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()+1);
174  vNeighborsDetId.emplace_back(castorDetId.rawId());
175  return vNeighborsDetId;
176  }
177  if(castorId.module()== MODULE_HAD_MAX){
178  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()-1);
179  vNeighborsDetId.emplace_back(castorDetId.rawId());
180  return vNeighborsDetId;
181  }
182  }
183  return vNeighborsDetId;
184 }
int sector() const
get the sector (1-16)
static const int MODULE_EM_MAX
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
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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 118 of file CastorTopology.cc.

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

118  {
119  std::vector<DetId> vNeighborsDetId;
120  HcalCastorDetId castorId = HcalCastorDetId(id);
121  HcalCastorDetId castorDetId;
122  if(validRaw(castorId)) {
123  bool isPositive = false;
124  if(castorId.zside()==1)isPositive = true;
125  if(castorId.sector()==1) {
126  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()+1,
127 castorId.module());
128  vNeighborsDetId.emplace_back(castorDetId.rawId());
129  return vNeighborsDetId;
130  }
131  if(castorId.sector()== 16){
132  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()-1,
133 castorId.module());
134  vNeighborsDetId.emplace_back(castorDetId.rawId());
135  return vNeighborsDetId;
136  }
137  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()-1,
138 castorId.module());
139  vNeighborsDetId.emplace_back(castorDetId.rawId());
140  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()+1,
141 castorId.module());
142  vNeighborsDetId.emplace_back(castorDetId.rawId());
143  }
144  return vNeighborsDetId;
145 }
int sector() const
get the sector (1-16)
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
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int zside() const
get the z-side of the cell (1/-1)
bool CastorTopology::isExcluded ( const HcalCastorDetId id) const
private

Definition at line 28 of file CastorTopology.cc.

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

Referenced by valid().

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

Definition at line 246 of file CastorTopology.cc.

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

Referenced by CastorHardcodeGeometryLoader::fill().

246  {
247  int lastCell = 0;
248  switch (section) {
249  case(HcalCastorDetId::EM) : lastCell = lastEMModule_; break;
250  case(HcalCastorDetId::HAD) : lastCell = lastHADModule_; break;
251  case(HcalCastorDetId::Unknown) : lastCell = 0; break;
252  }
253  return lastCell;
254 }
int lastCell(HcalCastorDetId::Section section) const
int CastorTopology::lastEMModule ( ) const
inlineprivate

Definition at line 67 of file CastorTopology.h.

References lastEMModule_.

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

Definition at line 68 of file CastorTopology.h.

References lastHADModule_.

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

Definition at line 226 of file CastorTopology.cc.

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

226  {
227  int ncells = 0;
228  switch (section) {
229  case(HcalCastorDetId::EM) : ncells = MODULE_EM_MAX*16; break;
230  case(HcalCastorDetId::HAD) : ncells = MODULE_HAD_MAX*16; break;
231  case(HcalCastorDetId::Unknown) : ncells =0; break;
232  }
233  return ncells;
234 }
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 201 of file CastorTopology.cc.

References gather_cfg::cout.

202 {
203  std::cout << "CastorTopology::north() not yet implemented" << std::endl;
204  std::vector<DetId> vNeighborsDetId;
205  return vNeighborsDetId;
206 }
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 207 of file CastorTopology.cc.

References gather_cfg::cout.

208 {
209  std::cout << "CastorTopology::south() not yet implemented" << std::endl;
210  std::vector<DetId> vNeighborsDetId;
211  return vNeighborsDetId;
212 }
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 213 of file CastorTopology.cc.

References gather_cfg::cout.

214 {
215  std::cout << "CastorTopology::up() not yet implemented" << std::endl;
216  std::vector<DetId> vNeighborsDetId;
217  return vNeighborsDetId;
218 }
bool CastorTopology::valid ( const HcalCastorDetId id) const
virtual

Definition at line 22 of file CastorTopology.cc.

References isExcluded(), and validRaw().

Referenced by CastorHardcodeGeometryLoader::fill().

23 {
24  return ( validRaw( id ) &&
25  !isExcluded( id ) ) ;
26 }
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 110 of file CastorTopology.cc.

References python.rootplot.argparse::module, vertexPlots::section, HcalCastorDetId::validDetId(), and HcalDigiParam_cfi::zside.

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

111 {
113  id.zside()>0,
114  id.sector(),
115  id.module() ) ;
116 }
static bool validDetId(Section iSection, bool posEta, int iSector, int iMod)
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 194 of file CastorTopology.cc.

References gather_cfg::cout.

195 {
196  std::cout << "CastorTopology::west() not yet implemented" << std::endl;
197  std::vector<DetId> vNeighborsDetId;
198  return vNeighborsDetId;
199 }

Member Data Documentation

bool CastorTopology::excludeEM_
private

Definition at line 59 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

bool CastorTopology::excludeHAD_
private

Definition at line 59 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

bool CastorTopology::excludeZN_
private

Definition at line 59 of file CastorTopology.h.

Referenced by exclude().

bool CastorTopology::excludeZP_
private

Definition at line 59 of file CastorTopology.h.

Referenced by exclude().

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

Definition at line 57 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

int CastorTopology::firstEMModule_
private

Definition at line 61 of file CastorTopology.h.

Referenced by firstCell(), and firstEMModule().

int CastorTopology::firstHADModule_
private

Definition at line 61 of file CastorTopology.h.

Referenced by firstCell(), and firstHADModule().

int CastorTopology::lastEMModule_
private

Definition at line 61 of file CastorTopology.h.

Referenced by lastCell(), and lastEMModule().

int CastorTopology::lastHADModule_
private

Definition at line 61 of file CastorTopology.h.

Referenced by lastCell(), and lastHADModule().