test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
FastTimeTopology Class Reference

#include <FastTimeTopology.h>

Inheritance diagram for FastTimeTopology:
CaloSubdetectorTopology

Classes

struct  DecodedDetId
 

Public Member Functions

const FastTimeDDDConstantsdddConstants () const
 
DecodedDetId decode (const DetId &id) const
 
virtual DetId denseId2detId (uint32_t denseId) const
 
int detectorType () const
 
virtual uint32_t detId2denseGeomId (const DetId &id) const
 
virtual uint32_t detId2denseId (const DetId &id) const
 Dense indexing. More...
 
virtual std::vector< DetIddown (const DetId &id) const
 
virtual std::vector< DetIdeast (const DetId &id) const
 
DetId encode (const DecodedDetId &id_) const
 
 FastTimeTopology (const FastTimeDDDConstants &hdcons, ForwardSubdetector subdet, int type)
 create a new Topology More...
 
DecodedDetId geomDenseId2decId (const uint32_t &hi) const
 
virtual DetId goEast (const DetId &id) const
 move the Topology east (positive ix) More...
 
virtual DetId goNorth (const DetId &id) const
 move the Topology north (increment iy) More...
 
virtual DetId goSouth (const DetId &id) const
 move the Topology south (decrement iy) More...
 
virtual DetId goWest (const DetId &id) const
 move the Topology west (negative ix) More...
 
virtual std::vector< DetIdnorth (const DetId &id) const
 
int numberCells () const
 
DetId offsetBy (const DetId startId, int nrStepsX, int nrStepsY) const
 
virtual std::vector< DetIdsouth (const DetId &id) const
 
ForwardSubdetector subDetector () const
 
DetId switchZSide (const DetId startId) const
 
unsigned int totalGeomModules () const
 
unsigned int totalModules () const
 
virtual std::vector< DetIdup (const DetId &id) const
 
virtual bool valid (const DetId &id) const
 Is this a valid cell id. More...
 
bool validHashIndex (uint32_t ix) const
 
virtual std::vector< DetIdwest (const DetId &id) const
 
virtual ~FastTimeTopology ()
 virtual destructor More...
 
- 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 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 goUp (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 ~CaloSubdetectorTopology ()
 virtual destructor More...
 

Private Member Functions

DetId changeXY (const DetId &id, int nrStepsX, int nrStepsY) const
 move the nagivator along x, y More...
 

Private Attributes

const FastTimeDDDConstantshdcons_
 
int kHGeomHalf_
 
int kHGhalf_
 
unsigned int kSizeForDenseIndexing
 
int nEtaZ_
 
int nPhi_
 
ForwardSubdetector subdet_
 
int type_
 

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

Definition at line 13 of file FastTimeTopology.h.

Constructor & Destructor Documentation

FastTimeTopology::FastTimeTopology ( const FastTimeDDDConstants hdcons,
ForwardSubdetector  subdet,
int  type 
)

create a new Topology

Definition at line 6 of file FastTimeTopology.cc.

References gather_cfg::cout, hdcons_, kHGeomHalf_, kHGhalf_, kSizeForDenseIndexing, nEtaZ_, nPhi_, FastTimeDDDConstants::numberEtaZ(), FastTimeDDDConstants::numberPhi(), subdet_, and type_.

8  : hdcons_(hdcons), subdet_(sub),
9  type_(type) {
13  kHGeomHalf_ = 1;
14  kSizeForDenseIndexing = (unsigned int)(2*kHGhalf_);
15 #ifdef EDM_ML_DEBUG
16  std::cout << "FastTimeTopology initialized for subDetetcor " << subdet_
17  << " Type " << type_ << " with " << nEtaZ_
18  << " cells along Z|Eta and " << nPhi_
19  << " cells along phi: total channels " << kSizeForDenseIndexing
20  << ":" << (2*kHGeomHalf_) << std::endl;
21 #endif
22 }
type
Definition: HCALResponse.h:21
ForwardSubdetector subdet_
int numberEtaZ(int type) const
int numberPhi(int type) const
unsigned int kSizeForDenseIndexing
const FastTimeDDDConstants & hdcons_
tuple cout
Definition: gather_cfg.py:145
virtual FastTimeTopology::~FastTimeTopology ( )
inlinevirtual

virtual destructor

Definition at line 21 of file FastTimeTopology.h.

21 { }

Member Function Documentation

DetId FastTimeTopology::changeXY ( const DetId id,
int  nrStepsX,
int  nrStepsY 
) const
private

move the nagivator along x, y

Definition at line 110 of file FastTimeTopology.cc.

References decode(), encode(), FastTimeTopology::DecodedDetId::iEtaZ, FastTimeTopology::DecodedDetId::iPhi, FastTimeTopology::DecodedDetId::iType, nPhi_, valid(), and FastTimeTopology::DecodedDetId::zside.

Referenced by offsetBy().

111  {
112 
114  int iEtaZ = id_.iEtaZ + nrStepsX;
115  int iPhi = id_.iPhi + nrStepsY;
116  if (iPhi < 1) iPhi += nPhi_;
117  else if (iPhi > nPhi_) iPhi -= nPhi_;
118  if (id_.iType == 1 && iEtaZ < 0) {
119  iEtaZ = -iEtaZ;
120  id_.zside = -id_.zside;
121  }
122  id_.iPhi = iPhi;
123  id_.iEtaZ = iEtaZ;
124  DetId nextPoint = encode(id_);
125  if (valid(nextPoint)) return nextPoint;
126  else return DetId(0);
127 }
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
virtual bool valid(const DetId &id) const
Is this a valid cell id.
DetId encode(const DecodedDetId &id_) const
const FastTimeDDDConstants& FastTimeTopology::dddConstants ( ) const
inline
FastTimeTopology::DecodedDetId FastTimeTopology::decode ( const DetId id) const
DetId FastTimeTopology::denseId2detId ( uint32_t  denseId) const
virtual

Definition at line 32 of file FastTimeTopology.cc.

References encode(), FastTimeTopology::DecodedDetId::iEtaZ, FastTimeTopology::DecodedDetId::iPhi, FastTimeTopology::DecodedDetId::iType, kHGhalf_, nPhi_, type_, validHashIndex(), and FastTimeTopology::DecodedDetId::zside.

32  {
33 
34  if (validHashIndex(hi)) {
36  id_.iType = type_;
37  id_.zside = ((int)(hi)<kHGhalf_ ? -1 : 1);
38  int di = ((int)(hi)%kHGhalf_);
39  int iPhi = (di%nPhi_);
40  id_.iPhi = iPhi+1;
41  id_.iEtaZ = (((di-iPhi)/nPhi_)+1);
42  return encode(id_);
43  } else {
44  return DetId(0);
45  }
46 }
Definition: DetId.h:18
DetId encode(const DecodedDetId &id_) const
bool validHashIndex(uint32_t ix) const
int FastTimeTopology::detectorType ( ) const
inline

Definition at line 109 of file FastTimeTopology.h.

References type_.

Referenced by FastTimeGeometryLoader::build().

109 { return type_;}
uint32_t FastTimeTopology::detId2denseGeomId ( const DetId id) const
virtual

Definition at line 48 of file FastTimeTopology.cc.

References decode(), kHGeomHalf_, and FastTimeTopology::DecodedDetId::zside.

Referenced by FastTimeGeometry::indexFor().

48  {
49 
51  uint32_t idx = (uint32_t)((id_.zside > 0) ? kHGeomHalf_ : 0);
52  return idx;
53 }
DecodedDetId decode(const DetId &id) const
uint32_t FastTimeTopology::detId2denseId ( const DetId id) const
virtual

Dense indexing.

Reimplemented from CaloSubdetectorTopology.

Definition at line 24 of file FastTimeTopology.cc.

References decode(), FastTimeTopology::DecodedDetId::iEtaZ, FastTimeTopology::DecodedDetId::iPhi, kHGhalf_, nPhi_, and FastTimeTopology::DecodedDetId::zside.

24  {
25 
27  uint32_t idx = (uint32_t)(((id_.zside > 0) ? kHGhalf_ : 0) +
28  ((id_.iEtaZ-1)*nPhi_+id_.iPhi-1));
29  return idx;
30 }
DecodedDetId decode(const DetId &id) const
virtual std::vector<DetId> FastTimeTopology::down ( const DetId id) const
inlinevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 76 of file FastTimeTopology.h.

76  {
77  std::vector<DetId> vNeighborsDetId;
78  return vNeighborsDetId;
79  }
virtual std::vector<DetId> FastTimeTopology::east ( const DetId id) const
inlinevirtual

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 51 of file FastTimeTopology.h.

References goEast().

51  {
52  DetId nextId=goEast(id);
53  std::vector<DetId> vNeighborsDetId;
54  if (! (nextId==DetId(0)))
55  vNeighborsDetId.push_back(nextId);
56  return vNeighborsDetId;
57  }
virtual DetId goEast(const DetId &id) const
move the Topology east (positive ix)
Definition: DetId.h:18
DetId FastTimeTopology::encode ( const DecodedDetId id_) const

Definition at line 104 of file FastTimeTopology.cc.

References FastTimeTopology::DecodedDetId::iEtaZ, FastTimeTopology::DecodedDetId::iPhi, FastTimeTopology::DecodedDetId::iType, and FastTimeTopology::DecodedDetId::zside.

Referenced by changeXY(), denseId2detId(), FastTimeGeometry::newCell(), and switchZSide().

104  {
105 
106  DetId id = FastTimeDetId(id_.iType,id_.iEtaZ,id_.iPhi,id_.zside);
107  return id;
108 }
Definition: DetId.h:18
FastTimeTopology::DecodedDetId FastTimeTopology::geomDenseId2decId ( const uint32_t &  hi) const

Definition at line 83 of file FastTimeTopology.cc.

References kHGeomHalf_, totalGeomModules(), and FastTimeTopology::DecodedDetId::zside.

83  {
84 
86  if (hi < totalGeomModules()) {
87  id_.zside = ((int)(hi)<kHGeomHalf_ ? -1 : 1);
88  }
89  return id_;
90 }
unsigned int totalGeomModules() const
virtual DetId FastTimeTopology::goEast ( const DetId id) const
inlinevirtual

move the Topology east (positive ix)

Reimplemented from CaloSubdetectorTopology.

Definition at line 48 of file FastTimeTopology.h.

References offsetBy().

Referenced by east().

48  {
49  return offsetBy(id,+1,0);
50  }
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
virtual DetId FastTimeTopology::goNorth ( const DetId id) const
inlinevirtual

move the Topology north (increment iy)

Reimplemented from CaloSubdetectorTopology.

Definition at line 24 of file FastTimeTopology.h.

References offsetBy().

Referenced by north().

24  {
25  return offsetBy(id,0,+1);
26  }
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
virtual DetId FastTimeTopology::goSouth ( const DetId id) const
inlinevirtual

move the Topology south (decrement iy)

Reimplemented from CaloSubdetectorTopology.

Definition at line 36 of file FastTimeTopology.h.

References offsetBy().

Referenced by south().

36  {
37  return offsetBy(id,0,-1);
38  }
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
virtual DetId FastTimeTopology::goWest ( const DetId id) const
inlinevirtual

move the Topology west (negative ix)

Reimplemented from CaloSubdetectorTopology.

Definition at line 60 of file FastTimeTopology.h.

References offsetBy().

Referenced by west().

60  {
61  return offsetBy(id,-1,0);
62  }
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
virtual std::vector<DetId> FastTimeTopology::north ( const DetId id) const
inlinevirtual

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 27 of file FastTimeTopology.h.

References goNorth().

27  {
28  DetId nextId= goNorth(id);
29  std::vector<DetId> vNeighborsDetId;
30  if (! (nextId==DetId(0)))
31  vNeighborsDetId.push_back(nextId);
32  return vNeighborsDetId;
33  }
virtual DetId goNorth(const DetId &id) const
move the Topology north (increment iy)
Definition: DetId.h:18
int FastTimeTopology::numberCells ( ) const
inline

Definition at line 92 of file FastTimeTopology.h.

References kHGeomHalf_.

92 {return kHGeomHalf_;}
DetId FastTimeTopology::offsetBy ( const DetId  startId,
int  nrStepsX,
int  nrStepsY 
) const

Definition at line 62 of file FastTimeTopology.cc.

References changeXY(), DetId::det(), DetId::Forward, subdet_, DetId::subdetId(), and valid().

Referenced by goEast(), goNorth(), goSouth(), and goWest().

63  {
64 
65  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)){
66  DetId id = changeXY(startId,nrStepsX,nrStepsY);
67  if (valid(id)) return id;
68  }
69  return DetId(0);
70 }
ForwardSubdetector subdet_
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
virtual bool valid(const DetId &id) const
Is this a valid cell id.
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
virtual std::vector<DetId> FastTimeTopology::south ( const DetId id) const
inlinevirtual

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 39 of file FastTimeTopology.h.

References goSouth().

39  {
40  DetId nextId= goSouth(id);
41  std::vector<DetId> vNeighborsDetId;
42  if (! (nextId==DetId(0)))
43  vNeighborsDetId.push_back(nextId);
44  return vNeighborsDetId;
45  }
virtual DetId goSouth(const DetId &id) const
move the Topology south (decrement iy)
Definition: DetId.h:18
ForwardSubdetector FastTimeTopology::subDetector ( ) const
inline

Definition at line 108 of file FastTimeTopology.h.

References subdet_.

Referenced by FastTimeGeometryLoader::build().

108 { return subdet_;}
ForwardSubdetector subdet_
DetId FastTimeTopology::switchZSide ( const DetId  startId) const

Definition at line 72 of file FastTimeTopology.cc.

References decode(), DetId::det(), encode(), DetId::Forward, subdet_, DetId::subdetId(), valid(), and FastTimeTopology::DecodedDetId::zside.

72  {
73 
74  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)){
76  id_.zside =-id_.zside;
77  DetId id = encode(id_);
78  if (valid(id)) return id;
79  }
80  return DetId(0);
81 }
DecodedDetId decode(const DetId &id) const
ForwardSubdetector subdet_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
virtual bool valid(const DetId &id) const
Is this a valid cell id.
DetId encode(const DecodedDetId &id_) const
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
unsigned int FastTimeTopology::totalGeomModules ( ) const
inline
unsigned int FastTimeTopology::totalModules ( ) const
inline

Definition at line 90 of file FastTimeTopology.h.

References kSizeForDenseIndexing.

90 {return kSizeForDenseIndexing;}
unsigned int kSizeForDenseIndexing
virtual std::vector<DetId> FastTimeTopology::up ( const DetId id) const
inlinevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 71 of file FastTimeTopology.h.

71  {
72  std::vector<DetId> vNeighborsDetId;
73  return vNeighborsDetId;
74  }
bool FastTimeTopology::valid ( const DetId id) const
virtual

Is this a valid cell id.

Reimplemented from CaloSubdetectorTopology.

Definition at line 55 of file FastTimeTopology.cc.

References decode(), hdcons_, FastTimeTopology::DecodedDetId::iEtaZ, FastTimeTopology::DecodedDetId::iPhi, FastTimeDDDConstants::isValidXY(), and FastTimeTopology::DecodedDetId::iType.

Referenced by changeXY(), offsetBy(), and switchZSide().

55  {
56 
58  bool flag = hdcons_.isValidXY(id_.iType,id_.iEtaZ,id_.iPhi);
59  return flag;
60 }
DecodedDetId decode(const DetId &id) const
bool isValidXY(int type, int izeta, int iphi) const
const FastTimeDDDConstants & hdcons_
bool FastTimeTopology::validHashIndex ( uint32_t  ix) const
inline

Definition at line 88 of file FastTimeTopology.h.

References kSizeForDenseIndexing.

Referenced by denseId2detId().

88 {return (ix < kSizeForDenseIndexing);}
unsigned int kSizeForDenseIndexing
virtual std::vector<DetId> FastTimeTopology::west ( const DetId id) const
inlinevirtual

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 63 of file FastTimeTopology.h.

References goWest().

63  {
64  DetId nextId=goWest(id);
65  std::vector<DetId> vNeighborsDetId;
66  if (! (nextId==DetId(0)))
67  vNeighborsDetId.push_back(nextId);
68  return vNeighborsDetId;
69  }
Definition: DetId.h:18
virtual DetId goWest(const DetId &id) const
move the Topology west (negative ix)

Member Data Documentation

const FastTimeDDDConstants& FastTimeTopology::hdcons_
private

Definition at line 115 of file FastTimeTopology.h.

Referenced by dddConstants(), FastTimeTopology(), and valid().

int FastTimeTopology::kHGeomHalf_
private
int FastTimeTopology::kHGhalf_
private

Definition at line 117 of file FastTimeTopology.h.

Referenced by denseId2detId(), detId2denseId(), and FastTimeTopology().

unsigned int FastTimeTopology::kSizeForDenseIndexing
private

Definition at line 118 of file FastTimeTopology.h.

Referenced by FastTimeTopology(), totalModules(), and validHashIndex().

int FastTimeTopology::nEtaZ_
private

Definition at line 117 of file FastTimeTopology.h.

Referenced by FastTimeTopology().

int FastTimeTopology::nPhi_
private

Definition at line 117 of file FastTimeTopology.h.

Referenced by changeXY(), denseId2detId(), detId2denseId(), and FastTimeTopology().

ForwardSubdetector FastTimeTopology::subdet_
private

Definition at line 116 of file FastTimeTopology.h.

Referenced by FastTimeTopology(), offsetBy(), subDetector(), and switchZSide().

int FastTimeTopology::type_
private