CMS 3D CMS Logo

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
 
DetId denseId2detId (uint32_t denseId) const override
 
int detectorType () const
 
virtual uint32_t detId2denseGeomId (const DetId &id) const
 
uint32_t detId2denseId (const DetId &id) const override
 Dense indexing. More...
 
std::vector< DetIddown (const DetId &id) const override
 
std::vector< DetIdeast (const DetId &id) const override
 
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
 
DetId goEast (const DetId &id) const override
 move the Topology east (positive ix) More...
 
DetId goNorth (const DetId &id) const override
 move the Topology north (increment iy) More...
 
DetId goSouth (const DetId &id) const override
 move the Topology south (decrement iy) More...
 
DetId goWest (const DetId &id) const override
 move the Topology west (negative ix) More...
 
std::vector< DetIdnorth (const DetId &id) const override
 
int numberCells () const
 
DetId offsetBy (const DetId startId, int nrStepsX, int nrStepsY) const
 
std::vector< DetIdsouth (const DetId &id) const override
 
ForwardSubdetector subDetector () const
 
DetId switchZSide (const DetId startId) const
 
unsigned int totalGeomModules () const
 
unsigned int totalModules () const
 
std::vector< DetIdup (const DetId &id) const override
 
bool valid (const DetId &id) const override
 Is this a valid cell id. More...
 
bool validHashIndex (uint32_t ix) const
 
std::vector< DetIdwest (const DetId &id) const override
 
 ~FastTimeTopology () override
 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 11 of file FastTimeTopology.h.

Constructor & Destructor Documentation

◆ FastTimeTopology()

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

create a new Topology

Definition at line 6 of file FastTimeTopology.cc.

7  : hdcons_(hdcons), subdet_(sub), type_(type) {
10  kHGhalf_ = nEtaZ_ * nPhi_;
11  kHGeomHalf_ = 1;
12  kSizeForDenseIndexing = (unsigned int)(2 * kHGhalf_);
13 #ifdef EDM_ML_DEBUG
14  std::cout << "FastTimeTopology initialized for subDetetcor " << subdet_ << " Type " << type_ << " with " << nEtaZ_
15  << " cells along Z|Eta and " << nPhi_ << " cells along phi: total channels " << kSizeForDenseIndexing << ":"
16  << (2 * kHGeomHalf_) << std::endl;
17 #endif
18 }

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

◆ ~FastTimeTopology()

FastTimeTopology::~FastTimeTopology ( )
inlineoverride

virtual destructor

Definition at line 17 of file FastTimeTopology.h.

17 {}

Member Function Documentation

◆ changeXY()

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

move the nagivator along x, y

Definition at line 97 of file FastTimeTopology.cc.

97  {
99  int iEtaZ = id_.iEtaZ + nrStepsX;
100  int iPhi = id_.iPhi + nrStepsY;
101  if (iPhi < 1)
102  iPhi += nPhi_;
103  else if (iPhi > nPhi_)
104  iPhi -= nPhi_;
105  if (id_.iType == 1 && iEtaZ < 0) {
106  iEtaZ = -iEtaZ;
107  id_.zside = -id_.zside;
108  }
109  id_.iPhi = iPhi;
110  id_.iEtaZ = iEtaZ;
111  DetId nextPoint = encode(id_);
112  if (valid(nextPoint))
113  return nextPoint;
114  else
115  return DetId(0);
116 }

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

Referenced by offsetBy().

◆ dddConstants()

const FastTimeDDDConstants& FastTimeTopology::dddConstants ( ) const
inline

◆ decode()

FastTimeTopology::DecodedDetId FastTimeTopology::decode ( const DetId id) const

Definition at line 81 of file FastTimeTopology.cc.

81  {
83  FastTimeDetId id(startId);
84  id_.iPhi = id.iphi();
85  id_.iEtaZ = id.ieta();
86  id_.iType = id.type();
87  id_.zside = id.zside();
88  id_.subdet = id.subdetId();
89  return id_;
90 }

References triggerObjects_cff::id, FastTimeTopology::DecodedDetId::iEtaZ, FastTimeTopology::DecodedDetId::iPhi, FastTimeTopology::DecodedDetId::iType, FastTimeTopology::DecodedDetId::subdet, and FastTimeTopology::DecodedDetId::zside.

Referenced by changeXY(), detId2denseGeomId(), detId2denseId(), FastTimeGeometry::newCell(), switchZSide(), and valid().

◆ denseId2detId()

DetId FastTimeTopology::denseId2detId ( uint32_t  denseId) const
override

Definition at line 26 of file FastTimeTopology.cc.

26  {
27  if (validHashIndex(hi)) {
29  id_.iType = type_;
30  id_.zside = ((int)(hi) < kHGhalf_ ? -1 : 1);
31  int di = ((int)(hi) % kHGhalf_);
32  int iPhi = (di % nPhi_);
33  id_.iPhi = iPhi + 1;
34  id_.iEtaZ = (((di - iPhi) / nPhi_) + 1);
35  return encode(id_);
36  } else {
37  return DetId(0);
38  }
39 }

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

◆ detectorType()

int FastTimeTopology::detectorType ( ) const
inline

Definition at line 97 of file FastTimeTopology.h.

97 { return type_; }

References type_.

Referenced by FastTimeGeometryLoader::build().

◆ detId2denseGeomId()

uint32_t FastTimeTopology::detId2denseGeomId ( const DetId id) const
virtual

Definition at line 41 of file FastTimeTopology.cc.

41  {
43  uint32_t idx = (uint32_t)((id_.zside > 0) ? kHGeomHalf_ : 0);
44  return idx;
45 }

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

Referenced by FastTimeGeometry::indexFor().

◆ detId2denseId()

uint32_t FastTimeTopology::detId2denseId ( const DetId id) const
overridevirtual

Dense indexing.

Reimplemented from CaloSubdetectorTopology.

Definition at line 20 of file FastTimeTopology.cc.

20  {
22  uint32_t idx = (uint32_t)(((id_.zside > 0) ? kHGhalf_ : 0) + ((id_.iEtaZ - 1) * nPhi_ + id_.iPhi - 1));
23  return idx;
24 }

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

◆ down()

std::vector<DetId> FastTimeTopology::down ( const DetId id) const
inlineoverridevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 64 of file FastTimeTopology.h.

64  {
65  std::vector<DetId> vNeighborsDetId;
66  return vNeighborsDetId;
67  }

◆ east()

std::vector<DetId> FastTimeTopology::east ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 41 of file FastTimeTopology.h.

41  {
42  DetId nextId = goEast(id);
43  std::vector<DetId> vNeighborsDetId;
44  if (!(nextId == DetId(0)))
45  vNeighborsDetId.emplace_back(nextId);
46  return vNeighborsDetId;
47  }

References goEast().

◆ encode()

DetId FastTimeTopology::encode ( const DecodedDetId id_) const

◆ geomDenseId2decId()

FastTimeTopology::DecodedDetId FastTimeTopology::geomDenseId2decId ( const uint32_t &  hi) const

Definition at line 73 of file FastTimeTopology.cc.

73  {
75  if (hi < totalGeomModules()) {
76  id_.zside = ((int)(hi) < kHGeomHalf_ ? -1 : 1);
77  }
78  return id_;
79 }

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

◆ goEast()

DetId FastTimeTopology::goEast ( const DetId id) const
inlineoverridevirtual

move the Topology east (positive ix)

Reimplemented from CaloSubdetectorTopology.

Definition at line 40 of file FastTimeTopology.h.

40 { return offsetBy(id, +1, 0); }

References offsetBy().

Referenced by east().

◆ goNorth()

DetId FastTimeTopology::goNorth ( const DetId id) const
inlineoverridevirtual

move the Topology north (increment iy)

Reimplemented from CaloSubdetectorTopology.

Definition at line 20 of file FastTimeTopology.h.

20 { return offsetBy(id, 0, +1); }

References offsetBy().

Referenced by north().

◆ goSouth()

DetId FastTimeTopology::goSouth ( const DetId id) const
inlineoverridevirtual

move the Topology south (decrement iy)

Reimplemented from CaloSubdetectorTopology.

Definition at line 30 of file FastTimeTopology.h.

30 { return offsetBy(id, 0, -1); }

References offsetBy().

Referenced by south().

◆ goWest()

DetId FastTimeTopology::goWest ( const DetId id) const
inlineoverridevirtual

move the Topology west (negative ix)

Reimplemented from CaloSubdetectorTopology.

Definition at line 50 of file FastTimeTopology.h.

50 { return offsetBy(id, -1, 0); }

References offsetBy().

Referenced by west().

◆ north()

std::vector<DetId> FastTimeTopology::north ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 21 of file FastTimeTopology.h.

21  {
22  DetId nextId = goNorth(id);
23  std::vector<DetId> vNeighborsDetId;
24  if (!(nextId == DetId(0)))
25  vNeighborsDetId.emplace_back(nextId);
26  return vNeighborsDetId;
27  }

References goNorth().

◆ numberCells()

int FastTimeTopology::numberCells ( ) const
inline

Definition at line 80 of file FastTimeTopology.h.

80 { return kHGeomHalf_; }

References kHGeomHalf_.

◆ offsetBy()

DetId FastTimeTopology::offsetBy ( const DetId  startId,
int  nrStepsX,
int  nrStepsY 
) const

Definition at line 53 of file FastTimeTopology.cc.

53  {
54  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)) {
55  DetId id = changeXY(startId, nrStepsX, nrStepsY);
56  if (valid(id))
57  return id;
58  }
59  return DetId(0);
60 }

References changeXY(), DetId::det(), DetId::Forward, triggerObjects_cff::id, createfilelist::int, subdet_, DetId::subdetId(), and valid().

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

◆ south()

std::vector<DetId> FastTimeTopology::south ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 31 of file FastTimeTopology.h.

31  {
32  DetId nextId = goSouth(id);
33  std::vector<DetId> vNeighborsDetId;
34  if (!(nextId == DetId(0)))
35  vNeighborsDetId.emplace_back(nextId);
36  return vNeighborsDetId;
37  }

References goSouth().

◆ subDetector()

ForwardSubdetector FastTimeTopology::subDetector ( ) const
inline

Definition at line 96 of file FastTimeTopology.h.

96 { return subdet_; }

References subdet_.

Referenced by FastTimeGeometryLoader::build().

◆ switchZSide()

DetId FastTimeTopology::switchZSide ( const DetId  startId) const

Definition at line 62 of file FastTimeTopology.cc.

62  {
63  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)) {
65  id_.zside = -id_.zside;
66  DetId id = encode(id_);
67  if (valid(id))
68  return id;
69  }
70  return DetId(0);
71 }

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

◆ totalGeomModules()

unsigned int FastTimeTopology::totalGeomModules ( ) const
inline

◆ totalModules()

unsigned int FastTimeTopology::totalModules ( ) const
inline

Definition at line 78 of file FastTimeTopology.h.

78 { return kSizeForDenseIndexing; }

References kSizeForDenseIndexing.

◆ up()

std::vector<DetId> FastTimeTopology::up ( const DetId id) const
inlineoverridevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 59 of file FastTimeTopology.h.

59  {
60  std::vector<DetId> vNeighborsDetId;
61  return vNeighborsDetId;
62  }

◆ valid()

bool FastTimeTopology::valid ( const DetId id) const
overridevirtual

◆ validHashIndex()

bool FastTimeTopology::validHashIndex ( uint32_t  ix) const
inline

Definition at line 76 of file FastTimeTopology.h.

76 { return (ix < kSizeForDenseIndexing); }

References kSizeForDenseIndexing.

Referenced by denseId2detId().

◆ west()

std::vector<DetId> FastTimeTopology::west ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 51 of file FastTimeTopology.h.

51  {
52  DetId nextId = goWest(id);
53  std::vector<DetId> vNeighborsDetId;
54  if (!(nextId == DetId(0)))
55  vNeighborsDetId.emplace_back(nextId);
56  return vNeighborsDetId;
57  }

References goWest().

Member Data Documentation

◆ hdcons_

const FastTimeDDDConstants& FastTimeTopology::hdcons_
private

Definition at line 103 of file FastTimeTopology.h.

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

◆ kHGeomHalf_

int FastTimeTopology::kHGeomHalf_
private

◆ kHGhalf_

int FastTimeTopology::kHGhalf_
private

Definition at line 105 of file FastTimeTopology.h.

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

◆ kSizeForDenseIndexing

unsigned int FastTimeTopology::kSizeForDenseIndexing
private

Definition at line 106 of file FastTimeTopology.h.

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

◆ nEtaZ_

int FastTimeTopology::nEtaZ_
private

Definition at line 105 of file FastTimeTopology.h.

Referenced by FastTimeTopology().

◆ nPhi_

int FastTimeTopology::nPhi_
private

Definition at line 105 of file FastTimeTopology.h.

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

◆ subdet_

ForwardSubdetector FastTimeTopology::subdet_
private

Definition at line 104 of file FastTimeTopology.h.

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

◆ type_

int FastTimeTopology::type_
private
FastTimeTopology::validHashIndex
bool validHashIndex(uint32_t ix) const
Definition: FastTimeTopology.h:76
FastTimeTopology::DecodedDetId::iPhi
int iPhi
Definition: FastTimeTopology.h:89
FastTimeTopology::offsetBy
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
Definition: FastTimeTopology.cc:53
FastTimeTopology::nPhi_
int nPhi_
Definition: FastTimeTopology.h:105
FastTimeTopology::DecodedDetId::subdet
int subdet
Definition: FastTimeTopology.h:89
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
gather_cfg.cout
cout
Definition: gather_cfg.py:144
FastTimeTopology::goNorth
DetId goNorth(const DetId &id) const override
move the Topology north (increment iy)
Definition: FastTimeTopology.h:20
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
DetId
Definition: DetId.h:17
FastTimeTopology::decode
DecodedDetId decode(const DetId &id) const
Definition: FastTimeTopology.cc:81
FastTimeTopology::kHGhalf_
int kHGhalf_
Definition: FastTimeTopology.h:105
FastTimeTopology::kHGeomHalf_
int kHGeomHalf_
Definition: FastTimeTopology.h:105
FastTimeTopology::goWest
DetId goWest(const DetId &id) const override
move the Topology west (negative ix)
Definition: FastTimeTopology.h:50
FastTimeTopology::DecodedDetId::zside
int zside
Definition: FastTimeTopology.h:89
FastTimeTopology::valid
bool valid(const DetId &id) const override
Is this a valid cell id.
Definition: FastTimeTopology.cc:47
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
FastTimeTopology::totalGeomModules
unsigned int totalGeomModules() const
Definition: FastTimeTopology.h:79
FastTimeTopology::subdet_
ForwardSubdetector subdet_
Definition: FastTimeTopology.h:104
FastTimeTopology::goEast
DetId goEast(const DetId &id) const override
move the Topology east (positive ix)
Definition: FastTimeTopology.h:40
FastTimeDDDConstants::numberPhi
int numberPhi(int type) const
Definition: FastTimeDDDConstants.cc:184
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
createfilelist.int
int
Definition: createfilelist.py:10
FastTimeDDDConstants::numberEtaZ
int numberEtaZ(int type) const
Definition: FastTimeDDDConstants.cc:174
FastTimeTopology::goSouth
DetId goSouth(const DetId &id) const override
move the Topology south (decrement iy)
Definition: FastTimeTopology.h:30
FastTimeTopology::DecodedDetId
Definition: FastTimeTopology.h:87
FastTimeTopology::kSizeForDenseIndexing
unsigned int kSizeForDenseIndexing
Definition: FastTimeTopology.h:106
FastTimeTopology::nEtaZ_
int nEtaZ_
Definition: FastTimeTopology.h:105
FastTimeTopology::DecodedDetId::iEtaZ
int iEtaZ
Definition: FastTimeTopology.h:89
hi
Definition: EPCuts.h:4
FastTimeTopology::encode
DetId encode(const DecodedDetId &id_) const
Definition: FastTimeTopology.cc:92
FastTimeTopology::changeXY
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
Definition: FastTimeTopology.cc:97
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
FastTimeDetId
Definition: FastTimeDetId.h:8
FastTimeDDDConstants::isValidXY
bool isValidXY(int type, int izeta, int iphi) const
Definition: FastTimeDDDConstants.cc:164
FastTimeTopology::hdcons_
const FastTimeDDDConstants & hdcons_
Definition: FastTimeTopology.h:103
DetId::Forward
Definition: DetId.h:30
FastTimeTopology::DecodedDetId::iType
int iType
Definition: FastTimeTopology.h:89
FastTimeTopology::type_
int type_
Definition: FastTimeTopology.h:105
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116