73 vector<reco::PFRecHit>& rechitsCleaned,
85 map<unsigned, unsigned > idSortedRecHits;
97 assert( ecalBarrelGeometry );
108 assert( ecalEndcapGeometry );
119 ecalEndcapTopology );
134 LogError(
"PFRecHitProducerECAL")<<err.str()<<endl;
142 for(
unsigned i=0;
i<rhcHandle->size();
i++) {
151 if (esd != 1)
continue;
166 if( !pfrhCleaned )
continue;
168 rechitsCleaned.push_back( *pfrhCleaned );
178 if( !pfrh )
continue;
181 rechits.push_back( *pfrh );
183 idSortedRecHits.insert( make_pair(detid.
rawId(), rechits.size()-1 ) );
198 LogError(
"PFRecHitProducerECAL")<<err.str()<<endl;
205 for(
unsigned i=0;
i<rhcHandle->size();
i++) {
213 if (esd != 2)
continue;
225 if( !pfrh )
continue;
228 rechits.push_back( *pfrh );
230 idSortedRecHits.insert( make_pair(detid.
rawId(), rechits.size()-1 ) );
236 for(
unsigned i=0;
i<rechits.size();
i++ ) {
266 <<
"warning detid "<<detid.
rawId()
267 <<
" not found in geometry"<<endl;
303 position.x(), position.y(), position.z(),
304 axis.x(), axis.y(), axis.z() );
308 assert( corners.size() == 8 );
310 rh->
setNECorner( corners[0].
x(), corners[0].
y(), corners[0].
z() );
311 rh->
setSECorner( corners[1].
x(), corners[1].
y(), corners[1].
z() );
312 rh->
setSWCorner( corners[2].
x(), corners[2].
y(), corners[2].
z() );
313 rh->
setNWCorner( corners[3].
x(), corners[3].
y(), corners[3].
z() );
334 <<
"warning detid "<<detid.
rawId()
335 <<
" not found in geometry"<<endl;
370 const map<unsigned,unsigned >& sortedHits ) {
384 IDH i = sortedHits.find( north.rawId() );
385 if(i != sortedHits.end() )
388 i = sortedHits.find( northeast.
rawId() );
389 if(i != sortedHits.end() )
392 i = sortedHits.find( south.
rawId() );
393 if(i != sortedHits.end() )
396 i = sortedHits.find( southwest.
rawId() );
397 if(i != sortedHits.end() )
400 i = sortedHits.find( east.
rawId() );
401 if(i != sortedHits.end() )
404 i = sortedHits.find( southeast.
rawId() );
405 if(i != sortedHits.end() )
408 i = sortedHits.find( west.
rawId() );
409 if(i != sortedHits.end() )
412 i = sortedHits.find( northwest.
rawId() );
413 if(i != sortedHits.end() )
438 const unsigned nbarrel = 62000;
446 unsigned size=vec.size();
447 for(
unsigned ic=0; ic<
size; ++ic)
450 std::vector<DetId> neighbours(barrelTopo.
getWindow(vec[ic],3,3));
452 unsigned nneighbours=neighbours.size();
455 if(hashedindex>=nbarrel)
457 LogDebug(
"CaloGeometryTools") <<
" Array overflow " << std::endl;
469 for(
unsigned in=0;
in<nneighbours;++
in)
472 if(neighbours[
in]!=vec[ic])
481 DetId central(vec[ic]);
483 for(
unsigned idir=0;idir<8;++idir)
485 DetId testid=central;
487 barrelTopo, endcapTopo,
488 barrelGeom, endcapGeom);
505 const unsigned nendcap=19960;
508 for(
unsigned ic=0; ic<
size; ++ic)
511 std::vector<DetId> neighbours(endcapTopo.
getWindow(vecee[ic],3,3));
512 unsigned nneighbours=neighbours.size();
516 if(hashedindex>=nendcap)
518 LogDebug(
"CaloGeometryTools") <<
" Array overflow " << std::endl;
524 for(
unsigned in=0;
in<nneighbours;++
in)
527 if(neighbours[
in]!=vecee[ic])
535 DetId central(vecee[ic]);
537 for(
unsigned idir=0;idir<8;++idir)
539 DetId testid=central;
541 barrelTopo, endcapTopo,
542 barrelGeom, endcapGeom);
564 std::vector<DetId> neighbours;
573 if(neighbours.size()>0 && !neighbours[0].null()) {
574 cell = neighbours[0];
582 const int ietaAbs ( ebDetId.
ietaAbs() ) ;
591 cell = *(ol.begin() );
604 if(neighbours.size()>0 && !neighbours[0].null()) {
605 cell = neighbours[0];
620 cell = *(ol.begin() );
650 else if(dir==
SOUTH) {
655 result =
stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
659 result =
stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
669 return stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
672 result =
stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
683 return stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
686 result =
stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
697 return stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
700 result =
stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
711 return stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
716 return stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
730 DetId originalcell = cell;
731 if(dir==
NONE || cell==
DetId(0))
return false;
736 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)
const OrderedListOfEEDetId * getClosestEndcapCells(EBDetId id) const
int hashedIndex() const
get a compact index for arrays
void ecalNeighbArray(const EcalBarrelGeometry &barrelGeom, const CaloSubdetectorTopology &barrelTopo, const EcalEndcapGeometry &endcapGeom, const CaloSubdetectorTopology &endcapTopo)
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
void add8Neighbour(unsigned index)
void setNECorner(double posx, double posy, double posz)
edm::InputTag inputTagEcalRecHitsEE_
const DetId & detid() const
unsigned detId() const
rechit detId
edm::InputTag inputTagEcalRecHitsEB_
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)
bool crossBarrelEndcapBorder_
if true, navigation will cross the barrel-endcap border
const GlobalPoint getPosition(float depth) const
uint32_t recoFlag() const
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Base producer for particle flow rechits (PFRecHit)
PFRecHitProducerECAL(const edm::ParameterSet &)
bool stdmove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom) const
int iPhiOuterRing() const
bool stdsimplemove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom) const
const OrderedListOfEBDetId * getClosestBarrelCells(EEDetId id) const
bool findEcalRecHitGeometry(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 setRescale(double factor)
std::vector< std::vector< DetId > > neighboursEB_
for each ecal barrel rechit, keep track of the neighbours
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
reco::PFRecHit * createEcalRecHit(const DetId &detid, double energy, PFLayer::Layer layer, const CaloSubdetectorGeometry *geom)
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
static const int MAX_IETA
void findRecHitNeighboursECAL(reco::PFRecHit &rh, const std::map< unsigned, unsigned > &sortedHits)
find rechit neighbours, using the hashed index
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
std::vector< std::vector< DetId > > neighboursEE_
for each ecal endcap rechit, keep track of the neighbours
void createRecHits(std::vector< reco::PFRecHit > &rechits, std::vector< reco::PFRecHit > &rechitsCleaned, edm::Event &, const edm::EventSetup &)
std::map< unsigned, unsigned >::const_iterator IDH
DetId move(DetId cell, const CaloDirection &dir) const
double thresh_Barrel_
rechits with E < threshold will not give rise to a PFRecHit
bool neighbourmapcalculated_
set to true in ecalNeighbArray
CaloDirection
Codes the local directions in the cell lattice.
const GlobalPoint & getPosition() const
int ietaAbs() const
get the absolute value of the crystal ieta
tuple size
Write out results.
virtual const CornersVec & getCorners() const =0