#include <CaloSubdetectorTopology.h>
Classes | |
struct | CellInfo |
Public Member Functions | |
CaloSubdetectorTopology () | |
standard constructor | |
virtual DetId | denseId2detId (unsigned int) const |
return a linear packed id | |
virtual bool | denseIdConsistent (int topoVer) const |
return whether this topology is consistent with the numbering in the given topology | |
virtual unsigned int | detId2denseId (const DetId &) const |
return a linear packed id | |
virtual std::vector< DetId > | down (const DetId &id) const =0 |
virtual std::vector< DetId > | east (const DetId &id) const =0 |
virtual std::vector< DetId > | getAllNeighbours (const DetId &id) const |
virtual std::vector< DetId > | getNeighbours (const DetId &id, const CaloDirection &dir) const |
virtual std::vector< DetId > | getWindow (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) | |
virtual std::vector< DetId > | north (const DetId &id) const =0 |
virtual std::vector< DetId > | south (const DetId &id) const =0 |
virtual int | topoVersion () const |
return a version which identifies the given topology | |
virtual std::vector< DetId > | up (const DetId &id) const =0 |
virtual bool | valid (const DetId &) const |
is this detid present in the Topology? | |
virtual std::vector< DetId > | west (const DetId &id) const =0 |
virtual | ~CaloSubdetectorTopology () |
virtual destructor | |
Protected Types | |
typedef std::pair< int, int > | Coordinate |
Protected Member Functions | |
Coordinate | getNeighbourIndex (const Coordinate &coord, const CaloDirection &dir) const |
typedef std::pair<int,int> CaloSubdetectorTopology::Coordinate [protected] |
Definition at line 118 of file CaloSubdetectorTopology.h.
CaloSubdetectorTopology::CaloSubdetectorTopology | ( | ) | [inline] |
virtual CaloSubdetectorTopology::~CaloSubdetectorTopology | ( | ) | [inline, virtual] |
virtual DetId CaloSubdetectorTopology::denseId2detId | ( | unsigned int | ) | const [inline, virtual] |
return a linear packed id
Reimplemented in HcalTopology.
Definition at line 32 of file CaloSubdetectorTopology.h.
{ return DetId(0); }
virtual bool CaloSubdetectorTopology::denseIdConsistent | ( | int | topoVer | ) | const [inline, virtual] |
return whether this topology is consistent with the numbering in the given topology
Definition at line 38 of file CaloSubdetectorTopology.h.
References topoVersion().
Referenced by HcalCondObjectContainerBase::setTopo().
{ return topoVer==topoVersion(); }
virtual unsigned int CaloSubdetectorTopology::detId2denseId | ( | const DetId & | ) | const [inline, virtual] |
return a linear packed id
Reimplemented in HcalTopology.
Definition at line 30 of file CaloSubdetectorTopology.h.
{ return 0; }
Get the neighbors of the given cell in down direction (inward)
Implemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by CaloTopology::down(), and goDown().
Get the neighbors of the given cell in east direction
Implemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by CaloTopology::east(), PFRecHitProducerHCAL::findRecHitNeighboursCT(), getNeighbours(), and goEast().
virtual std::vector<DetId> CaloSubdetectorTopology::getAllNeighbours | ( | const DetId & | id | ) | const [inline, virtual] |
Get all the neighbors of the given cell
Definition at line 112 of file CaloSubdetectorTopology.h.
References getWindow().
Referenced by CaloTopology::getAllNeighbours().
{ return getWindow(id,3,3); }
Coordinate CaloSubdetectorTopology::getNeighbourIndex | ( | const Coordinate & | coord, |
const CaloDirection & | dir | ||
) | const [inline, protected] |
Definition at line 138 of file CaloSubdetectorTopology.h.
References EAST, Exception, NORTH, SOUTH, and WEST.
Referenced by getWindow().
{ switch (dir) { case NORTH: return Coordinate(coord.first,coord.second + 1); case SOUTH: return Coordinate(coord.first,coord.second - 1); case EAST: return Coordinate(coord.first + 1,coord.second); case WEST: return Coordinate(coord.first - 1,coord.second); default: throw cms::Exception("getWindowError") << "Unsopported direction"; } }
virtual std::vector<DetId> CaloSubdetectorTopology::getNeighbours | ( | const DetId & | id, |
const CaloDirection & | dir | ||
) | const [inline, virtual] |
Get the neighbors of the given cell given direction
Definition at line 82 of file CaloSubdetectorTopology.h.
References EAST, east(), Exception, NONE, NORTH, north(), SOUTH, south(), west(), and WEST.
Referenced by CaloTopology::getNeighbours(), getWindow(), CaloGeometryHelper::simplemove(), spr::simpleMove(), PFRecHitProducerECAL::stdsimplemove(), and PFRecHitProducerHO::stdsimplemove().
{ std::vector<DetId> aNullVector; switch(dir) { case NONE: return aNullVector; break; case SOUTH: return south(id); break; case NORTH: return north(id); break; case EAST: return east(id); break; case WEST: return west(id); break; default: throw cms::Exception("getNeighboursError") << "Unsopported direction"; } return aNullVector; }
std::vector< DetId > CaloSubdetectorTopology::getWindow | ( | const DetId & | id, |
const int & | northSouthSize, | ||
const int & | eastWestSize | ||
) | const [virtual] |
Get the neighbors of the given cell in a window of given size
Definition at line 4 of file CaloSubdetectorTopology.cc.
References EAST, Exception, getNeighbourIndex(), getNeighbours(), i, NORTH, SOUTH, and WEST.
Referenced by HLTAlCaMonPi0::analyze(), HLTAlCa::analyze(), DQMSourcePi0::analyze(), CaloGeometryHelper::buildNeighbourArray(), HLTEcalResonanceFilter::calcShowerShape(), PFRecHitProducerECAL::ecalNeighbArray(), HLTEcalResonanceFilter::filter(), getAllNeighbours(), BetaCalculatorECAL::getDetailedTrackLengthInXtals(), CaloTopology::getWindow(), PFRecHitProducerHO::hoNeighbArray(), EgammaHLTNxNClusterProducer::makeNxNClusters(), EcalDeadChannelRecoveryAlgos::MakeNxNMatrice(), PiZeroAnalyzer::makePizero(), pat::PATElectronProducer::produce(), HighPtTrackEcalDetIdProducer::produce(), InterestingTrackEcalDetIdProducer::produce(), InterestingDetIdCollectionProducer::produce(), InterestingEcalDetIdProducer::produce(), and SingleEleCalibSelector::select().
{ std::vector<DetId> cellsInWindow; // check pivot if (id.null()) return cellsInWindow; // DetId myTmpId(id); std::vector<std::pair<Coordinate,DetId> > fringe; fringe.push_back(std::pair<Coordinate,DetId>(Coordinate(0,0),myTmpId)); int halfWestEast = eastWestSize/2 ; int halfNorthSouth = northSouthSize/2 ; std::vector<CellInfo> visited_cells; visited_cells.resize(northSouthSize * eastWestSize); while (fringe.size() > 0) { std::pair<Coordinate,DetId> cur = fringe.back(); fringe.pop_back(); // check all four neighbours const CaloDirection directions[4] = { NORTH, SOUTH, EAST, WEST }; for (unsigned dirnum = 0; dirnum < 4; ++dirnum) { Coordinate neighbour = getNeighbourIndex(cur.first,directions[dirnum]); //If outside the window range if ( neighbour.first < -halfWestEast || neighbour.first > halfWestEast || neighbour.second < -halfNorthSouth || neighbour.second > halfNorthSouth ) continue; //Found integer index in the matrix unsigned int_index = neighbour.first + halfWestEast + eastWestSize * (neighbour.second + halfNorthSouth ); assert(int_index < visited_cells.size()); // check whether we have seen this neighbour already if (visited_cells[int_index].visited) // we have seen this one already continue; // a new cell, get the DetId of the neighbour, mark it // as visited and add it to the fringe visited_cells[int_index].visited = true; std::vector<DetId> neighbourCells = getNeighbours(cur.second,directions[dirnum]); if ( neighbourCells.size() == 1 ) visited_cells[int_index].cell = neighbourCells[0]; else if ( neighbourCells.size() == 0 ) visited_cells[int_index].cell = DetId(0); else throw cms::Exception("getWindowError") << "Not supported subdetector for getWindow method"; if (!visited_cells[int_index].cell.null()) fringe.push_back(std::pair<Coordinate,DetId>(neighbour,visited_cells[int_index].cell)); } // loop over all possible directions } // while some cells are left on the fringe for (unsigned int i=0; i<visited_cells.size(); i++) if (!visited_cells[i].cell.null()) cellsInWindow.push_back(visited_cells[i].cell); return cellsInWindow; }
Reimplemented in GCC11_FINAL< T, TOPO >.
Definition at line 75 of file CaloSubdetectorTopology.h.
References down().
Referenced by GCC11_FINAL< T, TOPO >::down().
Reimplemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, and GCC11_FINAL< T, TOPO >.
Definition at line 55 of file CaloSubdetectorTopology.h.
References east().
Referenced by GCC11_FINAL< T, TOPO >::east().
Reimplemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, and GCC11_FINAL< T, TOPO >.
Definition at line 63 of file CaloSubdetectorTopology.h.
References north().
Referenced by GCC11_FINAL< T, TOPO >::north().
Reimplemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, and GCC11_FINAL< T, TOPO >.
Definition at line 67 of file CaloSubdetectorTopology.h.
References south().
Referenced by GCC11_FINAL< T, TOPO >::south().
Reimplemented in GCC11_FINAL< T, TOPO >.
Definition at line 71 of file CaloSubdetectorTopology.h.
References up().
Referenced by GCC11_FINAL< T, TOPO >::up().
Reimplemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, and GCC11_FINAL< T, TOPO >.
Definition at line 59 of file CaloSubdetectorTopology.h.
References west().
Referenced by GCC11_FINAL< T, TOPO >::west().
virtual unsigned int CaloSubdetectorTopology::ncells | ( | ) | const [inline, virtual] |
return a count of valid cells (for dense indexing use)
Reimplemented in HcalTopology.
Definition at line 34 of file CaloSubdetectorTopology.h.
Referenced by CastorTopology::ncells(), and ZdcTopology::ncells().
{ return 1; }
Get the neighbors of the given cell in north direction
Implemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by PFRecHitProducerHCAL::findRecHitNeighboursCT(), getNeighbours(), PFRecHitProducerHCAL::getNorth(), PFHCALDualTimeRecHitProducer::getNorth(), goNorth(), and CaloTopology::north().
Get the neighbors of the given cell in south direction
Implemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by PFRecHitProducerHCAL::findRecHitNeighboursCT(), getNeighbours(), PFRecHitProducerHCAL::getSouth(), PFHCALDualTimeRecHitProducer::getSouth(), goSouth(), and CaloTopology::south().
virtual int CaloSubdetectorTopology::topoVersion | ( | ) | const [inline, virtual] |
return a version which identifies the given topology
Reimplemented in HcalTopology.
Definition at line 36 of file CaloSubdetectorTopology.h.
Referenced by denseIdConsistent().
{ return 0; }
Get the neighbors of the given cell in up direction (outward)
Implemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by goUp(), and CaloTopology::up().
virtual bool CaloSubdetectorTopology::valid | ( | const DetId & | ) | const [inline, virtual] |
is this detid present in the Topology?
Reimplemented in GCC11_FINAL< T, TOPO >, and HcalTopology.
Definition at line 28 of file CaloSubdetectorTopology.h.
Referenced by CaloTopology::valid().
{ return false; };
Get the neighbors of the given cell in west direction
Implemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by PFRecHitProducerHCAL::findRecHitNeighboursCT(), getNeighbours(), goWest(), and CaloTopology::west().