Producer for particle flow rechits (PFRecHit) in HO. More...
#include <PFRecHitProducerHO.h>
Public Member Functions | |
PFRecHitProducerHO (const edm::ParameterSet &) | |
~PFRecHitProducerHO () | |
Private Member Functions | |
reco::PFRecHit * | createHORecHit (const DetId &detid, double energy, PFLayer::Layer layer, const CaloSubdetectorGeometry *geom) |
void | createRecHits (std::vector< reco::PFRecHit > &rechits, std::vector< reco::PFRecHit > &rechitsCleaned, edm::Event &, const edm::EventSetup &) |
bool | findHORecHitGeometry (const DetId &detid, const CaloSubdetectorGeometry *geom, math::XYZVector &position, math::XYZVector &axis) |
find the position and the axis of the cell for a given rechit | |
void | findRecHitNeighbours (reco::PFRecHit &rh, const std::map< unsigned, unsigned > &sortedHits, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom) |
void | findRecHitNeighboursHO (reco::PFRecHit &rh, const std::map< unsigned, unsigned > &sortedHits) |
find rechit neighbours, using the hashed index | |
void | hoNeighbArray (const CaloSubdetectorGeometry &barrelGeom, const CaloSubdetectorTopology &barrelTopo) |
DetId | move (DetId cell, const CaloDirection &dir) const |
bool | stdmove (DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom) const |
bool | stdsimplemove (DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom) const |
Private Attributes | |
int | HOMaxAllowedSev_ |
edm::InputTag | inputTagHORecHits_ |
bool | neighbourmapcalculated_ |
set to true in hoNeighbArray | |
std::vector< std::vector< DetId > > | neighboursHO_ |
for each HO barrel rechit, keep track of the neighbours | |
double | thresholdR0_ |
double | thresholdR1_ |
Producer for particle flow rechits (PFRecHit) in HO.
Definition at line 35 of file PFRecHitProducerHO.h.
PFRecHitProducerHO::PFRecHitProducerHO | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 43 of file PFRecHitProducerHO.cc.
References edm::ParameterSet::getParameter(), HOMaxAllowedSev_, inputTagHORecHits_, and neighbourmapcalculated_.
: PFRecHitProducer(iConfig) { // access to the collections of rechits inputTagHORecHits_ = iConfig.getParameter<InputTag>("recHitsHO"); HOMaxAllowedSev_ = iConfig.getParameter<int>("HOMaxAllowedSev"); neighbourmapcalculated_ = false; }
PFRecHitProducerHO::~PFRecHitProducerHO | ( | ) |
Definition at line 56 of file PFRecHitProducerHO.cc.
{}
reco::PFRecHit * PFRecHitProducerHO::createHORecHit | ( | const DetId & | detid, |
double | energy, | ||
PFLayer::Layer | layer, | ||
const CaloSubdetectorGeometry * | geom | ||
) | [private] |
Definition at line 172 of file PFRecHitProducerHO.cc.
References abs, relval_parameters_module::energy, CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), position, DetId::rawId(), reco::PFRecHit::setNECorner(), reco::PFRecHit::setNWCorner(), reco::PFRecHit::setSECorner(), reco::PFRecHit::setSWCorner(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::z(), and z.
{ math::XYZVector position; math::XYZVector axis; const CaloCellGeometry *thisCell = geom->getGeometry(detid); // find rechit geometry if(!thisCell) { LogError("PFRecHitProducerHO") <<"warning detid "<<detid.rawId() <<" not found in geometry"<<endl; return 0; } double sclel0l1r=0.946; //384.8/406.6 if (abs(thisCell->getPosition().z())>130) { position.SetCoordinates ( sclel0l1r*thisCell->getPosition().x(), sclel0l1r*thisCell->getPosition().y(), sclel0l1r*thisCell->getPosition().z() ); } else { position.SetCoordinates ( thisCell->getPosition().x(), thisCell->getPosition().y(), thisCell->getPosition().z() ); } // the axis vector is the difference // const TruncatedPyramid* pyr // = dynamic_cast< const TruncatedPyramid* > (thisCell); // if( pyr ) { // axis.SetCoordinates( pyr->getPosition(1).x(), // pyr->getPosition(1).y(), // pyr->getPosition(1).z() ); // math::XYZVector axis0( pyr->getPosition(0).x(), // pyr->getPosition(0).y(), // pyr->getPosition(0).z() ); // axis -= axis0; // } // else return 0; axis = math::XYZVector(0,0,0); // if( !geomfound ) { // LogError("PFRecHitProducerHO")<<"cannor find geometry for detid " // <<detid.rawId()<<" in layer "<<layer<<endl; // return 0; // geometry not found, skip rechit // } reco::PFRecHit *rh = new reco::PFRecHit( detid.rawId(), layer, energy, position.x(), position.y(), position.z(), axis.x(), axis.y(), axis.z() ); const CaloCellGeometry::CornersVec& corners = thisCell->getCorners(); assert( corners.size() == 8 ); if (abs(corners[0].z())>130.0) { rh->setNECorner( sclel0l1r*corners[0].x(), sclel0l1r*corners[0].y(), sclel0l1r*corners[0].z() ); rh->setSECorner( sclel0l1r*corners[1].x(), sclel0l1r*corners[1].y(), sclel0l1r*corners[1].z() ); rh->setSWCorner( sclel0l1r*corners[2].x(), sclel0l1r*corners[2].y(), sclel0l1r*corners[2].z() ); rh->setNWCorner( sclel0l1r*corners[3].x(), sclel0l1r*corners[3].y(), sclel0l1r*corners[3].z() ); } else { rh->setNECorner( corners[0].x(), corners[0].y(), corners[0].z() ); rh->setSECorner( corners[1].x(), corners[1].y(), corners[1].z() ); rh->setSWCorner( corners[2].x(), corners[2].y(), corners[2].z() ); rh->setNWCorner( corners[3].x(), corners[3].y(), corners[3].z() ); } return rh; }
void PFRecHitProducerHO::createRecHits | ( | std::vector< reco::PFRecHit > & | rechits, |
std::vector< reco::PFRecHit > & | rechitsCleaned, | ||
edm::Event & | , | ||
const edm::EventSetup & | |||
) | [private, virtual] |
translate the standard rechits ( or calotowers) them to PFRecHits, which are stored in the rechits vector
Implements PFRecHitProducer.
bool PFRecHitProducerHO::findHORecHitGeometry | ( | const DetId & | detid, |
const CaloSubdetectorGeometry * | geom, | ||
math::XYZVector & | position, | ||
math::XYZVector & | axis | ||
) | [private] |
find the position and the axis of the cell for a given rechit
Definition at line 257 of file PFRecHitProducerHO.cc.
References CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), DetId::rawId(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ const CaloCellGeometry *thisCell = geom->getGeometry(detid); // find rechit geometry if(!thisCell) { LogError("PFRecHitProducerHO") <<"warning detid "<<detid.rawId() <<" not found in geometry"<<endl; return false; } position.SetCoordinates ( thisCell->getPosition().x(), thisCell->getPosition().y(), thisCell->getPosition().z() ); // the axis vector is the difference // const TruncatedPyramid* pyr // = dynamic_cast< const TruncatedPyramid* > (thisCell); // if( pyr ) { // axis.SetCoordinates( pyr->getPosition(1).x(), // pyr->getPosition(1).y(), // pyr->getPosition(1).z() ); // math::XYZVector axis0( pyr->getPosition(0).x(), // pyr->getPosition(0).y(), // pyr->getPosition(0).z() ); // axis -= axis0; // return true; // } axis = math::XYZVector(0,0,0); return true; // else return false; }
void PFRecHitProducerHO::findRecHitNeighbours | ( | reco::PFRecHit & | rh, |
const std::map< unsigned, unsigned > & | sortedHits, | ||
const CaloSubdetectorTopology & | barrelTopo, | ||
const CaloSubdetectorGeometry & | barrelGeom | ||
) | [private] |
void PFRecHitProducerHO::findRecHitNeighboursHO | ( | reco::PFRecHit & | rh, |
const std::map< unsigned, unsigned > & | sortedHits | ||
) | [private] |
find rechit neighbours, using the hashed index
Definition at line 308 of file PFRecHitProducerHO.cc.
References reco::PFRecHit::add4Neighbour(), reco::PFRecHit::add8Neighbour(), reco::PFRecHit::detId(), east, EAST, i, north, NORTH, NORTHEAST, NORTHWEST, DetId::rawId(), SOUTH, south, SOUTHEAST, SOUTHWEST, west, and WEST.
{ DetId center( rh.detId() ); DetId north = move( center, NORTH ); DetId northeast = move( center, NORTHEAST ); DetId northwest = move( center, NORTHWEST ); DetId south = move( center, SOUTH ); DetId southeast = move( center, SOUTHEAST ); DetId southwest = move( center, SOUTHWEST ); DetId east = move( center, EAST ); DetId west = move( center, WEST ); IDH i = sortedHits.find( north.rawId() ); if(i != sortedHits.end() ) rh.add4Neighbour( i->second ); i = sortedHits.find( northeast.rawId() ); if(i != sortedHits.end() ) rh.add8Neighbour( i->second ); i = sortedHits.find( south.rawId() ); if(i != sortedHits.end() ) rh.add4Neighbour( i->second ); i = sortedHits.find( southwest.rawId() ); if(i != sortedHits.end() ) rh.add8Neighbour( i->second ); i = sortedHits.find( east.rawId() ); if(i != sortedHits.end() ) rh.add4Neighbour( i->second ); i = sortedHits.find( southeast.rawId() ); if(i != sortedHits.end() ) rh.add8Neighbour( i->second ); i = sortedHits.find( west.rawId() ); if(i != sortedHits.end() ) rh.add4Neighbour( i->second ); i = sortedHits.find( northwest.rawId() ); if(i != sortedHits.end() ) rh.add8Neighbour( i->second ); }
void PFRecHitProducerHO::hoNeighbArray | ( | const CaloSubdetectorGeometry & | barrelGeom, |
const CaloSubdetectorTopology & | barrelTopo | ||
) | [private] |
fill the vectors neighboursEB_ and neighboursEE_ which keep track of the neighbours of each rechit. to be called at the beginning of the run
Definition at line 359 of file PFRecHitProducerHO.cc.
References EAST, CaloSubdetectorGeometry::getValidDetIds(), CaloSubdetectorTopology::getWindow(), HcalDetId::hashed_index(), DetId::Hcal, HcalOuter, recoMuon::in, LogDebug, neighbourmapcalculated_, neighboursHO_, NORTH, NORTHEAST, NORTHWEST, findQualityFiles::size, SOUTH, SOUTHEAST, SOUTHWEST, ntuplemaker::status, stdmove(), and WEST.
{ static const CaloDirection orderedDir[8]={SOUTHWEST, SOUTH, SOUTHEAST, WEST, EAST, NORTHWEST, NORTH, NORTHEAST}; const unsigned nbarrel = 2160; //62000; // Barrel first. The hashed index runs from 0 to 2199 61199 neighboursHO_.resize(nbarrel); //std::cout << " Building the array of neighbours (barrel) " ; const std::vector<DetId>& vec(barrelGeom.getValidDetIds(DetId::Hcal, HcalOuter)); unsigned size=vec.size(); for(unsigned ic=0; ic<size; ++ic) { // We get the 9 cells in a square. std::vector<DetId> neighbours(barrelTopo.getWindow(vec[ic],3,3)); unsigned nneighbours=neighbours.size(); unsigned hashedindex=HcalDetId(vec[ic]).hashed_index()-5184; //2*( kHBhalf + kHEhalf ) // std::cout << " Cell " << ic<<" "<<vec[ic].rawId()<<" "<<HcalDetId(vec[ic]) <<" "<<hashedindex<<" "<<nneighbours<< std::endl; if(hashedindex>=nbarrel) { LogDebug("CaloGeometryTools") << " Array overflow " << std::endl; } // If there are 9 cells, it is easy, and this order is know: // 6 7 8 // 3 4 5 // 0 1 2 (0 = SOUTHWEST) if(nneighbours==9) { neighboursHO_[hashedindex].reserve(8); for(unsigned in=0;in<nneighbours;++in) { // remove the centre // cout<<"ic "<<ic<<" "<<in<<" "<<neighbours[in].rawId()<<" "<<vec[ic].rawId()<<" "<<hashedindex<<endl; if(neighbours[in]!=vec[ic]) { neighboursHO_[hashedindex].push_back(neighbours[in]); // std::cout << " Neighbour " << ic<<" "<<size<<" "<<in << " " <<hashedindex<<" "<< HcalDetId(neighbours[in]) << std::endl; } } } else { DetId central(vec[ic]); neighboursHO_[hashedindex].resize(8,DetId(0)); for(unsigned idir=0;idir<8;++idir) { DetId testid=central; bool status=stdmove(testid,orderedDir[idir], barrelTopo, barrelGeom); if(status) neighboursHO_[hashedindex][idir]=testid; } } } // std::cout << " done " << size <<std::endl; neighbourmapcalculated_ = true; }
DetId PFRecHitProducerHO::move | ( | DetId | cell, |
const CaloDirection & | dir | ||
) | const [private] |
Definition at line 556 of file PFRecHitProducerHO.cc.
References dir, HcalDetId::hashed_index(), neighbourmapcalculated_, neighboursHO_, NONE, and query::result.
{ DetId originalcell = cell; if(dir==NONE || cell==DetId(0)) return false; // Conversion CaloDirection and index in the table // CaloDirection :NONE,SOUTH,SOUTHEAST,SOUTHWEST,EAST,WEST, NORTHEAST,NORTHWEST,NORTH // Table : SOUTHWEST,SOUTH,SOUTHEAST,WEST,EAST,NORTHWEST,NORTH, NORTHEAST static const int calodirections[9]={-1,1,2,0,4,3,7,5,6}; assert(neighbourmapcalculated_); DetId result = neighboursHO_[HcalDetId(originalcell).hashed_index()-5184][calodirections[dir]]; return result; }
bool PFRecHitProducerHO::stdmove | ( | DetId & | cell, |
const CaloDirection & | dir, | ||
const CaloSubdetectorTopology & | barrelTopo, | ||
const CaloSubdetectorGeometry & | barrelGeom | ||
) | const [private] |
Definition at line 467 of file PFRecHitProducerHO.cc.
References EAST, NORTH, NORTHEAST, NORTHWEST, query::result, SOUTH, SOUTHEAST, SOUTHWEST, stdsimplemove(), and WEST.
Referenced by hoNeighbArray().
{ bool result; if(dir==NORTH) { result = stdsimplemove(cell,NORTH, barrelTopo, barrelGeom); return result; } else if(dir==SOUTH) { result = stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom); return result; } else if(dir==EAST) { result = stdsimplemove(cell,EAST, barrelTopo, barrelGeom); return result; } else if(dir==WEST) { result = stdsimplemove(cell,WEST, barrelTopo, barrelGeom); return result; } // One has to try both paths else if(dir==NORTHEAST) { result = stdsimplemove(cell,NORTH, barrelTopo, barrelGeom); if(result) return stdsimplemove(cell,EAST, barrelTopo, barrelGeom); else { result = stdsimplemove(cell,EAST, barrelTopo, barrelGeom); if(result) return stdsimplemove(cell,NORTH, barrelTopo, barrelGeom); else return false; } } else if(dir==NORTHWEST) { result = stdsimplemove(cell,NORTH, barrelTopo, barrelGeom ); if(result) return stdsimplemove(cell,WEST, barrelTopo, barrelGeom ); else { result = stdsimplemove(cell,WEST, barrelTopo, barrelGeom ); if(result) return stdsimplemove(cell,NORTH, barrelTopo, barrelGeom ); else return false; } } else if(dir == SOUTHEAST) { result = stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom ); if(result) return stdsimplemove(cell,EAST, barrelTopo, barrelGeom ); else { result = stdsimplemove(cell,EAST, barrelTopo, barrelGeom ); if(result) return stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom ); else return false; } } else if(dir == SOUTHWEST) { result = stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom ); if(result) return stdsimplemove(cell,WEST, barrelTopo, barrelGeom ); else { result = stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom ); if(result) return stdsimplemove(cell,WEST, barrelTopo, barrelGeom ); else return false; } } cell = DetId(0); return false; }
bool PFRecHitProducerHO::stdsimplemove | ( | DetId & | cell, |
const CaloDirection & | dir, | ||
const CaloSubdetectorTopology & | barrelTopo, | ||
const CaloSubdetectorGeometry & | barrelGeom | ||
) | const [private] |
Definition at line 434 of file PFRecHitProducerHO.cc.
References CaloSubdetectorTopology::getNeighbours(), HcalOuter, and DetId::subdetId().
Referenced by stdmove().
{ std::vector<DetId> neighbours; // BARREL CASE if(cell.subdetId()==HcalOuter) { HcalDetId hoDetId = cell; neighbours = barrelTopo.getNeighbours(hoDetId,dir); // first try to move according to the standard navigation if(neighbours.size()>0 && !neighbours[0].null()) { cell = neighbours[0]; return true; } // failed. } // everything failed cell = DetId(0); return false; }
int PFRecHitProducerHO::HOMaxAllowedSev_ [private] |
Definition at line 114 of file PFRecHitProducerHO.h.
Referenced by PFRecHitProducerHO().
Definition at line 105 of file PFRecHitProducerHO.h.
Referenced by PFRecHitProducerHO().
bool PFRecHitProducerHO::neighbourmapcalculated_ [private] |
set to true in hoNeighbArray
Definition at line 99 of file PFRecHitProducerHO.h.
Referenced by hoNeighbArray(), move(), and PFRecHitProducerHO().
std::vector<std::vector<DetId> > PFRecHitProducerHO::neighboursHO_ [private] |
for each HO barrel rechit, keep track of the neighbours
Definition at line 96 of file PFRecHitProducerHO.h.
Referenced by hoNeighbArray(), and move().
double PFRecHitProducerHO::thresholdR0_ [private] |
Definition at line 108 of file PFRecHitProducerHO.h.
double PFRecHitProducerHO::thresholdR1_ [private] |
Definition at line 111 of file PFRecHitProducerHO.h.