CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
virtual std::vector< DetIddown (const DetId &id) const
 
virtual std::vector< DetIdeast (const DetId &id) const
 
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
 
virtual std::vector< DetIdnorth (const DetId &id) const
 
virtual std::vector< DetIdsouth (const DetId &id) const
 
virtual std::vector< DetIdup (const DetId &id) const
 
virtual bool valid (const HcalCastorDetId &id) const
 
virtual bool validRaw (const HcalCastorDetId &id) const
 
virtual std::vector< DetIdwest (const DetId &id) const
 
- 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
virtual

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

Implements CaloSubdetectorTopology.

Definition at line 226 of file CastorTopology.cc.

References gather_cfg::cout.

227 {
228  std::cout << "CastorTopology::down() not yet implemented" << std::endl;
229  std::vector<DetId> vNeighborsDetId;
230  return vNeighborsDetId;
231 }
tuple cout
Definition: gather_cfg.py:121
std::vector< DetId > CastorTopology::east ( const DetId id) const
virtual

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 194 of file CastorTopology.cc.

References gather_cfg::cout.

195 {
196  std::cout << "CastorTopology::east() not yet implemented" << std::endl;
197  std::vector<DetId> vNeighborsDetId;
198  return vNeighborsDetId;
199 }
tuple cout
Definition: gather_cfg.py:121
void CastorTopology::exclude ( const HcalCastorDetId id)

Exlucde a cell

Definition at line 54 of file CastorTopology.cc.

References exclusionList_, and i.

Referenced by exclude().

54  {
55  std::vector<HcalCastorDetId>::iterator
56  i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
57  if (i==exclusionList_.end() || *i!=id) {
58  exclusionList_.insert(i,id);
59  }
60 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalCastorDetId > exclusionList_
void CastorTopology::exclude ( int  zside)

Exclude a side

Definition at line 62 of file CastorTopology.cc.

References excludeZN_, and excludeZP_.

62  {
63  switch(zside){
64  case( 1): excludeZP_ = true; break;
65  case(-1): excludeZN_ = true; break;
66  default: break;
67  }
68 }
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 70 of file CastorTopology.cc.

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

70  {
71  switch(zside){
72  case( 1): excludeZP_ = true; break;
73  case(-1): excludeZN_ = true; break;
74  default: break;
75  }
76  switch (section) {
77  case(HcalCastorDetId::EM) : excludeEM_ = true; break;
78  case(HcalCastorDetId::HAD) : excludeHAD_ = true; break;
79  default: break;
80  }
81 }
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 83 of file CastorTopology.cc.

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

84  {
85  bool exed = false;
86  switch(zside){
87  case( 1): exed = excludeZP_; break;
88  case(-1): exed = excludeZN_; break;
89  default: exed = false;
90  }
91  if (exed) return 0;
92 
93 
94 /* NOTE not so sure about the exclusion */
95  if (section1 == HcalCastorDetId::EM && section2 == HcalCastorDetId::EM) {
96  exed = excludeEM_; }
97  else if (section1 == HcalCastorDetId::HAD && section2 == HcalCastorDetId::HAD) {
98  exed = excludeHAD_; }
99  else { exed = false; };
100 
101  if (exed) return 0;
102 
103  bool isPositive = false;
104  if(zside == 1)isPositive = true;
105 
106  int n = 0;
107  for (int isec = isec1; isec < isec2; isec++){
108  for (int imod = imod1; imod < imod2; imod++) {
109  HcalCastorDetId id(section1, isPositive, isec, imod);
110  if(validRaw(id))exclude(id);
111  n++;
112  }
113  }
114  return n;
115 }
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 243 of file CastorTopology.cc.

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

Referenced by CastorHardcodeGeometryLoader::fill().

243  {
244  int firstCell = 0;
245  switch (section) {
246  case(HcalCastorDetId::EM) : firstCell = firstEMModule_ ; break;
247  case(HcalCastorDetId::HAD) : firstCell = firstHADModule_; break;
248  case(HcalCastorDetId::Unknown) : firstCell = 0; break;
249  }
250  return firstCell;
251 }
int firstCell(HcalCastorDetId::Section section) const
int CastorTopology::firstEMModule ( ) const
inlineprivate

Definition at line 63 of file CastorTopology.h.

References firstEMModule_.

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

Definition at line 64 of file CastorTopology.h.

References firstHADModule_.

64 {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 154 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().

154  {
155  std::vector<DetId> vNeighborsDetId;
156  HcalCastorDetId castorId = HcalCastorDetId(id);
157  HcalCastorDetId castorDetId;
158  if(validRaw(castorId) && castorId.section()== HcalCastorDetId::EM){
159  bool isPositive = false;
160  if(castorId.zside()==1)isPositive = true;
161  if(castorId.module()==1){
162  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()+1);
163  vNeighborsDetId.push_back(castorDetId.rawId());
164  return vNeighborsDetId;
165  }
166  if(castorId.module()== MODULE_EM_MAX){
167  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()-1);
168  vNeighborsDetId.push_back(castorDetId.rawId());
169  return vNeighborsDetId;
170  }
171  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()-1);
172  vNeighborsDetId.push_back(castorDetId.rawId());
173  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()+1);
174  vNeighborsDetId.push_back(castorDetId.rawId());
175  }
176  if(validRaw(castorId) && castorId.section()== HcalCastorDetId::HAD){
177  bool isPositive = false;
178  if(castorId.zside()==1)isPositive = true;
179  if(castorId.module()==1){
180  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()+1);
181  vNeighborsDetId.push_back(castorDetId.rawId());
182  return vNeighborsDetId;
183  }
184  if(castorId.module()== MODULE_HAD_MAX){
185  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector(), castorId.module()-1);
186  vNeighborsDetId.push_back(castorDetId.rawId());
187  return vNeighborsDetId;
188  }
189  }
190  return vNeighborsDetId;
191 }
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 125 of file CastorTopology.cc.

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

125  {
126  std::vector<DetId> vNeighborsDetId;
127  HcalCastorDetId castorId = HcalCastorDetId(id);
128  HcalCastorDetId castorDetId;
129  if(validRaw(castorId)) {
130  bool isPositive = false;
131  if(castorId.zside()==1)isPositive = true;
132  if(castorId.sector()==1) {
133  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()+1,
134 castorId.module());
135  vNeighborsDetId.push_back(castorDetId.rawId());
136  return vNeighborsDetId;
137  }
138  if(castorId.sector()== 16){
139  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()-1,
140 castorId.module());
141  vNeighborsDetId.push_back(castorDetId.rawId());
142  return vNeighborsDetId;
143  }
144  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()-1,
145 castorId.module());
146  vNeighborsDetId.push_back(castorDetId.rawId());
147  castorDetId = HcalCastorDetId(castorId.section(), isPositive, castorId.sector()+1,
148 castorId.module());
149  vNeighborsDetId.push_back(castorDetId.rawId());
150  }
151  return vNeighborsDetId;
152 }
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_, excludeZN_, excludeZP_, exclusionList_, HcalCastorDetId::HAD, i, and ecaldqm::zside().

Referenced by valid().

28  {
29  bool exed=false;
30 
31  //check the for side exclusions
32  switch(id.zside()){
33  case( 1): exed = excludeZP_; break;
34  case(-1): exed = excludeZN_; break;
35  default: exed = false;
36  }
37 
38  // check for section exclutions
39  switch (id.section()) {
40  case(HcalCastorDetId::EM) : exed = excludeEM_; break;
41  case(HcalCastorDetId::HAD) : exed = excludeHAD_; break;
42  default: exed = false;
43  }
44 
45  // check the entire list
46  if (!exed && !exclusionList_.empty()) {
47  std::vector<HcalCastorDetId>::const_iterator
48  i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
49  if (i!=exclusionList_.end() && *i==id) exed=true;
50  }
51  return exed;
52 }
int i
Definition: DBlmapReader.cc:9
int zside(DetId const &)
std::vector< HcalCastorDetId > exclusionList_
int CastorTopology::lastCell ( HcalCastorDetId::Section  section) const

Definition at line 253 of file CastorTopology.cc.

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

Referenced by CastorHardcodeGeometryLoader::fill().

253  {
254  int lastCell = 0;
255  switch (section) {
256  case(HcalCastorDetId::EM) : lastCell = lastEMModule_; break;
257  case(HcalCastorDetId::HAD) : lastCell = lastHADModule_; break;
258  case(HcalCastorDetId::Unknown) : lastCell = 0; break;
259  }
260  return lastCell;
261 }
int lastCell(HcalCastorDetId::Section section) const
int CastorTopology::lastEMModule ( ) const
inlineprivate

Definition at line 65 of file CastorTopology.h.

References lastEMModule_.

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

Definition at line 66 of file CastorTopology.h.

References lastHADModule_.

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

Definition at line 233 of file CastorTopology.cc.

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

233  {
234  int ncells = 0;
235  switch (section) {
236  case(HcalCastorDetId::EM) : ncells = MODULE_EM_MAX*16; break;
237  case(HcalCastorDetId::HAD) : ncells = MODULE_HAD_MAX*16; break;
238  case(HcalCastorDetId::Unknown) : ncells =0; break;
239  }
240  return ncells;
241 }
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
virtual

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 208 of file CastorTopology.cc.

References gather_cfg::cout.

209 {
210  std::cout << "CastorTopology::north() not yet implemented" << std::endl;
211  std::vector<DetId> vNeighborsDetId;
212  return vNeighborsDetId;
213 }
tuple cout
Definition: gather_cfg.py:121
std::vector< DetId > CastorTopology::south ( const DetId id) const
virtual

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 214 of file CastorTopology.cc.

References gather_cfg::cout.

215 {
216  std::cout << "CastorTopology::south() not yet implemented" << std::endl;
217  std::vector<DetId> vNeighborsDetId;
218  return vNeighborsDetId;
219 }
tuple cout
Definition: gather_cfg.py:121
std::vector< DetId > CastorTopology::up ( const DetId id) const
virtual

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

Implements CaloSubdetectorTopology.

Definition at line 220 of file CastorTopology.cc.

References gather_cfg::cout.

221 {
222  std::cout << "CastorTopology::up() not yet implemented" << std::endl;
223  std::vector<DetId> vNeighborsDetId;
224  return vNeighborsDetId;
225 }
tuple cout
Definition: gather_cfg.py:121
bool CastorTopology::valid ( const HcalCastorDetId id) const
virtual

Is this a valid cell id?

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

References python.rootplot.argparse::module, HcalCastorDetId::validDetId(), and ecaldqm::zside().

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

118 {
119  return HcalCastorDetId::validDetId( id.section(),
120  id.zside()>0,
121  id.sector(),
122  id.module() ) ;
123 }
static bool validDetId(Section iSection, bool posEta, int iSector, int iMod)
int zside(DetId const &)
std::vector< DetId > CastorTopology::west ( const DetId id) const
virtual

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 201 of file CastorTopology.cc.

References gather_cfg::cout.

202 {
203  std::cout << "CastorTopology::west() not yet implemented" << std::endl;
204  std::vector<DetId> vNeighborsDetId;
205  return vNeighborsDetId;
206 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

bool CastorTopology::excludeEM_
private

Definition at line 57 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

bool CastorTopology::excludeHAD_
private

Definition at line 57 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

bool CastorTopology::excludeZN_
private

Definition at line 57 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

bool CastorTopology::excludeZP_
private

Definition at line 57 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

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

Definition at line 55 of file CastorTopology.h.

Referenced by exclude(), and isExcluded().

int CastorTopology::firstEMModule_
private

Definition at line 59 of file CastorTopology.h.

Referenced by firstCell(), and firstEMModule().

int CastorTopology::firstHADModule_
private

Definition at line 59 of file CastorTopology.h.

Referenced by firstCell(), and firstHADModule().

int CastorTopology::lastEMModule_
private

Definition at line 59 of file CastorTopology.h.

Referenced by lastCell(), and lastEMModule().

int CastorTopology::lastHADModule_
private

Definition at line 59 of file CastorTopology.h.

Referenced by lastCell(), and lastHADModule().