#include <CaloSubdetectorTopology.h>
Classes | |
struct | CellInfo |
Public Member Functions | |
CaloSubdetectorTopology () | |
standard constructor | |
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 std::vector< DetId > | north (const DetId &id) const =0 |
virtual std::vector< DetId > | south (const DetId &id) const =0 |
virtual std::vector< DetId > | up (const DetId &id) const =0 |
virtual bool | valid (const DetId &id) 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 75 of file CaloSubdetectorTopology.h.
CaloSubdetectorTopology::CaloSubdetectorTopology | ( | ) | [inline] |
virtual CaloSubdetectorTopology::~CaloSubdetectorTopology | ( | ) | [inline, virtual] |
Get the neighbors of the given cell in down direction (inward)
Implemented in CaloTowerTopology, EcalBarrelHardcodedTopology, EcalBarrelTopology, EcalEndcapHardcodedTopology, EcalEndcapTopology, EcalPreshowerTopology, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by CaloNavigator< EBDetId >::down(), and CaloTopology::down().
Get the neighbors of the given cell in east direction
Implemented in CaloTowerTopology, EcalBarrelHardcodedTopology, EcalBarrelTopology, EcalEndcapHardcodedTopology, EcalEndcapTopology, EcalPreshowerTopology, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by CaloTopology::east(), CaloNavigator< EBDetId >::east(), PFRecHitProducerHCAL::findRecHitNeighboursCT(), and getNeighbours().
virtual std::vector<DetId> CaloSubdetectorTopology::getAllNeighbours | ( | const DetId & | id | ) | const [inline, virtual] |
Get all the neighbors of the given cell
Definition at line 69 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 95 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 39 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(), and PFRecHitProducerECAL::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(), HLTPi0RecHitsFilter::filter(), HLTEcalResonanceFilter::filter(), getAllNeighbours(), BetaCalculatorECAL::getDetailedTrackLengthInXtals(), CaloTopology::getWindow(), EgammaHLTNxNClusterProducer::makeNxNClusters(), EcalDeadChannelRecoveryAlgos::MakeNxNMatrice(), PiZeroAnalyzer::makePizero(), 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; }
Get the neighbors of the given cell in north direction
Implemented in CaloTowerTopology, EcalBarrelHardcodedTopology, EcalBarrelTopology, EcalEndcapHardcodedTopology, EcalEndcapTopology, EcalPreshowerTopology, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by PFRecHitProducerHCAL::findRecHitNeighboursCT(), getNeighbours(), PFRecHitProducerHCAL::getNorth(), CaloTopology::north(), and CaloNavigator< EBDetId >::north().
Get the neighbors of the given cell in south direction
Implemented in CaloTowerTopology, EcalBarrelHardcodedTopology, EcalBarrelTopology, EcalEndcapHardcodedTopology, EcalEndcapTopology, EcalPreshowerTopology, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by PFRecHitProducerHCAL::findRecHitNeighboursCT(), getNeighbours(), PFRecHitProducerHCAL::getSouth(), CaloTopology::south(), and CaloNavigator< EBDetId >::south().
Get the neighbors of the given cell in up direction (outward)
Implemented in CaloTowerTopology, EcalBarrelHardcodedTopology, EcalBarrelTopology, EcalEndcapHardcodedTopology, EcalEndcapTopology, EcalPreshowerTopology, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by CaloNavigator< EBDetId >::up(), and CaloTopology::up().
virtual bool CaloSubdetectorTopology::valid | ( | const DetId & | id | ) | const [inline, virtual] |
is this detid present in the Topology?
Reimplemented in CaloTowerTopology.
Definition at line 25 of file CaloSubdetectorTopology.h.
Referenced by CaloTopology::valid().
{ return false; };
Get the neighbors of the given cell in west direction
Implemented in CaloTowerTopology, EcalBarrelHardcodedTopology, EcalBarrelTopology, EcalEndcapHardcodedTopology, EcalEndcapTopology, EcalPreshowerTopology, HcalTopology, CastorTopology, and ZdcTopology.
Referenced by PFRecHitProducerHCAL::findRecHitNeighboursCT(), getNeighbours(), CaloNavigator< EBDetId >::west(), and CaloTopology::west().