61 vector<reco::PFRecHit>& rechitsCleaned,
73 map<unsigned, unsigned > idSortedRecHits;
109 LogError(
"PFRecHitProducerHO")<<err.str()<<endl;
117 for(
unsigned i=0;
i<rhcHandle->size();
i++) {
128 if (esd != 3)
continue;
130 int hoeta=detid.
ieta();
137 unsigned theStatusValue = theStatus->
getValue();
155 if( !pfrh )
continue;
159 rechits.push_back( *pfrh );
161 idSortedRecHits.insert( make_pair(detid.
rawId(), rechits.size()-1 ) );
166 for(
unsigned i=0;
i<rechits.size();
i++ ) {
188 <<
"warning detid "<<detid.
rawId()
189 <<
" not found in geometry"<<endl;
193 double sclel0l1r=0.946;
196 position.SetCoordinates ( sclel0l1r*thisCell->
getPosition().
x(),
235 position.x(), position.y(), position.z(),
236 axis.x(), axis.y(), axis.z() );
239 assert( corners.size() == 8 );
241 if (
abs(corners[0].
z())>130.0) {
242 rh->
setNECorner( sclel0l1r*corners[0].
x(), sclel0l1r*corners[0].
y(), sclel0l1r*corners[0].
z() );
243 rh->
setSECorner( sclel0l1r*corners[1].
x(), sclel0l1r*corners[1].
y(), sclel0l1r*corners[1].
z() );
244 rh->
setSWCorner( sclel0l1r*corners[2].
x(), sclel0l1r*corners[2].
y(), sclel0l1r*corners[2].
z() );
245 rh->
setNWCorner( sclel0l1r*corners[3].
x(), sclel0l1r*corners[3].
y(), sclel0l1r*corners[3].
z() );
248 rh->
setNECorner( corners[0].
x(), corners[0].
y(), corners[0].
z() );
249 rh->
setSECorner( corners[1].
x(), corners[1].
y(), corners[1].
z() );
250 rh->
setSWCorner( corners[2].
x(), corners[2].
y(), corners[2].
z() );
251 rh->
setNWCorner( corners[3].
x(), corners[3].
y(), corners[3].
z() );
271 <<
"warning detid "<<detid.
rawId()
272 <<
" not found in geometry"<<endl;
312 const map<unsigned,unsigned >& sortedHits ) {
326 IDH i = sortedHits.find( north.rawId() );
327 if(i != sortedHits.end() )
330 i = sortedHits.find( northeast.
rawId() );
331 if(i != sortedHits.end() )
334 i = sortedHits.find( south.
rawId() );
335 if(i != sortedHits.end() )
338 i = sortedHits.find( southwest.
rawId() );
339 if(i != sortedHits.end() )
342 i = sortedHits.find( east.
rawId() );
343 if(i != sortedHits.end() )
346 i = sortedHits.find( southeast.
rawId() );
347 if(i != sortedHits.end() )
350 i = sortedHits.find( west.
rawId() );
351 if(i != sortedHits.end() )
354 i = sortedHits.find( northwest.
rawId() );
355 if(i != sortedHits.end() )
375 const unsigned nbarrel = 2160;
383 unsigned size=vec.size();
384 for(
unsigned ic=0; ic<
size; ++ic)
387 std::vector<DetId> neighbours(barrelTopo.
getWindow(vec[ic],3,3));
388 unsigned nneighbours=neighbours.size();
392 if(hashedindex>=nbarrel)
394 LogDebug(
"CaloGeometryTools") <<
" Array overflow " << std::endl;
406 for(
unsigned in=0;
in<nneighbours;++
in)
410 if(neighbours[
in]!=vec[ic])
419 DetId central(vec[ic]);
421 for(
unsigned idir=0;idir<8;++idir)
423 DetId testid=central;
425 barrelTopo, barrelGeom);
443 std::vector<DetId> neighbours;
452 if(neighbours.size()>0 && !neighbours[0].null()) {
453 cell = neighbours[0];
484 else if(dir==
SOUTH) {
563 DetId originalcell = cell;
564 if(dir==
NONE || cell==
DetId(0))
return false;
569 static const int calodirections[9]={-1,1,2,0,4,3,7,5,6};
void setSECorner(double posx, double posy, double posz)
T getParameter(std::string const &) const
void add4Neighbour(unsigned index)
reco::PFRecHit * createHORecHit(const DetId &detid, double energy, PFLayer::Layer layer, const CaloSubdetectorGeometry *geom)
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
void add8Neighbour(unsigned index)
unsigned int getHOSize() const
void setNECorner(double posx, double posy, double posz)
std::vector< std::vector< DetId > > neighboursHO_
for each HO barrel rechit, keep track of the neighbours
const DetId & detid() const
unsigned detId() const
rechit detId
bool stdsimplemove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom) const
const Item * getValues(DetId fId, bool throwOnFail=true) const
static int position[TOTALCHAMBERS][3]
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
uint32_t rawId() const
get the raw id
void setSWCorner(double posx, double posy, double posz)
DetId move(DetId cell, const HcalTopology &barrelTopo, const CaloDirection &dir) const
void createRecHits(std::vector< reco::PFRecHit > &rechits, std::vector< reco::PFRecHit > &rechitsCleaned, edm::Event &, const edm::EventSetup &)
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Base producer for particle flow rechits (PFRecHit)
void hoNeighbArray(const CaloSubdetectorGeometry &barrelGeom, const HcalTopology &barrelTopo)
int ieta() const
get the cell ieta
void findRecHitNeighboursHO(reco::PFRecHit &rh, const HcalTopology &topo, const std::map< unsigned, unsigned > &sortedHits)
find rechit neighbours, using the hashed index
void setRescale(double factor)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void setNWCorner(double posx, double posy, double posz)
search for pointers to neighbours, using neighbours' DetId.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::InputTag inputTagHORecHits_
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
const HcalChannelQuality * theHcalChStatus
T const * product() const
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
std::map< unsigned, unsigned >::const_iterator IDH
unsigned int detId2denseIdHO(const DetId &id) const
return a linear packed id from HO
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
double thresh_Barrel_
rechits with E < threshold will not give rise to a PFRecHit
CaloDirection
Codes the local directions in the cell lattice.
uint32_t getValue() const
bool stdmove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom) const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
tuple size
Write out results.
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell's volume.
PFRecHitProducerHO(const edm::ParameterSet &)
bool neighbourmapcalculated_
set to true in hoNeighbArray