60 vector<reco::PFRecHit>& rechitsCleaned,
72 map<unsigned, unsigned > idSortedRecHits;
107 LogError(
"PFRecHitProducerHO")<<err.str()<<endl;
115 for(
unsigned i=0;
i<rhcHandle->size();
i++) {
126 if (esd != 3)
continue;
128 int hoeta=detid.
ieta();
135 unsigned theStatusValue = theStatus->
getValue();
153 if( !pfrh )
continue;
157 rechits.push_back( *pfrh );
159 idSortedRecHits.insert( make_pair(detid.
rawId(), rechits.size()-1 ) );
164 for(
unsigned i=0;
i<rechits.size();
i++ ) {
186 <<
"warning detid "<<detid.
rawId()
187 <<
" not found in geometry"<<endl;
191 double sclel0l1r=0.946;
194 position.SetCoordinates ( sclel0l1r*thisCell->
getPosition().
x(),
233 position.x(), position.y(), position.z(),
234 axis.x(), axis.y(), axis.z() );
237 assert( corners.size() == 8 );
239 if (
abs(corners[0].
z())>130.0) {
240 rh->
setNECorner( sclel0l1r*corners[0].
x(), sclel0l1r*corners[0].
y(), sclel0l1r*corners[0].
z() );
241 rh->
setSECorner( sclel0l1r*corners[1].
x(), sclel0l1r*corners[1].
y(), sclel0l1r*corners[1].
z() );
242 rh->
setSWCorner( sclel0l1r*corners[2].
x(), sclel0l1r*corners[2].
y(), sclel0l1r*corners[2].
z() );
243 rh->
setNWCorner( sclel0l1r*corners[3].
x(), sclel0l1r*corners[3].
y(), sclel0l1r*corners[3].
z() );
246 rh->
setNECorner( corners[0].
x(), corners[0].
y(), corners[0].
z() );
247 rh->
setSECorner( corners[1].
x(), corners[1].
y(), corners[1].
z() );
248 rh->
setSWCorner( corners[2].
x(), corners[2].
y(), corners[2].
z() );
249 rh->
setNWCorner( corners[3].
x(), corners[3].
y(), corners[3].
z() );
269 <<
"warning detid "<<detid.
rawId()
270 <<
" not found in geometry"<<endl;
309 const map<unsigned,unsigned >& sortedHits ) {
323 IDH i = sortedHits.find( north.rawId() );
324 if(i != sortedHits.end() )
327 i = sortedHits.find( northeast.
rawId() );
328 if(i != sortedHits.end() )
331 i = sortedHits.find( south.
rawId() );
332 if(i != sortedHits.end() )
335 i = sortedHits.find( southwest.
rawId() );
336 if(i != sortedHits.end() )
339 i = sortedHits.find( east.
rawId() );
340 if(i != sortedHits.end() )
343 i = sortedHits.find( southeast.
rawId() );
344 if(i != sortedHits.end() )
347 i = sortedHits.find( west.
rawId() );
348 if(i != sortedHits.end() )
351 i = sortedHits.find( northwest.
rawId() );
352 if(i != sortedHits.end() )
372 const unsigned nbarrel = 2160;
380 unsigned size=vec.size();
381 for(
unsigned ic=0; ic<
size; ++ic)
384 std::vector<DetId> neighbours(barrelTopo.
getWindow(vec[ic],3,3));
385 unsigned nneighbours=neighbours.size();
389 if(hashedindex>=nbarrel)
391 LogDebug(
"CaloGeometryTools") <<
" Array overflow " << std::endl;
403 for(
unsigned in=0;
in<nneighbours;++
in)
407 if(neighbours[
in]!=vec[ic])
416 DetId central(vec[ic]);
418 for(
unsigned idir=0;idir<8;++idir)
420 DetId testid=central;
422 barrelTopo, barrelGeom);
440 std::vector<DetId> neighbours;
449 if(neighbours.size()>0 && !neighbours[0].null()) {
450 cell = neighbours[0];
481 else if(dir==
SOUTH) {
559 DetId originalcell = cell;
560 if(dir==
NONE || cell==
DetId(0))
return false;
565 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)
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
void hoNeighbArray(const CaloSubdetectorGeometry &barrelGeom, const CaloSubdetectorTopology &barrelTopo)
bool stdsimplemove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom) const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
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)
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)
int ieta() const
get the cell ieta
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
DetId move(DetId cell, const CaloDirection &dir) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
const HcalChannelQuality * theHcalChStatus
void findRecHitNeighboursHO(reco::PFRecHit &rh, const std::map< unsigned, unsigned > &sortedHits)
find rechit neighbours, using the hashed index
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
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 Item * getValues(DetId fId) const
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