1 #ifndef RecoParticleFlow_PFClusterProducer_PFECALHashNavigator_h
2 #define RecoParticleFlow_PFClusterProducer_PFECALHashNavigator_h
109 const EcalEndcapGeometry& endcapGeom,
114 const unsigned nbarrel = 62000;
120 const std::vector<DetId>& vec(barrelGeom.getValidDetIds(
DetId::Ecal,
122 unsigned size=vec.size();
123 for(
unsigned ic=0; ic<
size; ++ic)
126 std::vector<DetId> neighbours(barrelTopo.
getWindow(vec[ic],3,3));
128 unsigned nneighbours=neighbours.size();
131 if(hashedindex>=nbarrel)
133 LogDebug(
"CaloGeometryTools") <<
" Array overflow " << std::endl;
145 for(
unsigned in=0;
in<nneighbours;++
in)
148 if(neighbours[
in]!=vec[ic])
157 DetId central(vec[ic]);
159 for(
unsigned idir=0;idir<8;++idir)
161 DetId testid=central;
163 barrelTopo, endcapTopo,
164 barrelGeom, endcapGeom);
181 const unsigned nendcap=19960;
184 for(
unsigned ic=0; ic<
size; ++ic)
187 std::vector<DetId> neighbours(endcapTopo.
getWindow(vecee[ic],3,3));
188 unsigned nneighbours=neighbours.size();
192 if(hashedindex>=nendcap)
194 LogDebug(
"CaloGeometryTools") <<
" Array overflow " << std::endl;
200 for(
unsigned in=0;
in<nneighbours;++
in)
203 if(neighbours[
in]!=vecee[ic])
211 DetId central(vecee[ic]);
213 for(
unsigned idir=0;idir<8;++idir)
215 DetId testid=central;
217 barrelTopo, endcapTopo,
218 barrelGeom, endcapGeom);
235 const EcalBarrelGeometry& barrelGeom,
236 const EcalEndcapGeometry& endcapGeom )
239 std::vector<DetId> neighbours;
248 if(neighbours.size()>0 && !neighbours[0].null()) {
249 cell = neighbours[0];
257 const int ietaAbs ( ebDetId.
ietaAbs() ) ;
262 const EcalBarrelGeometry::OrderedListOfEEDetId&
263 ol( * barrelGeom.getClosestEndcapCells( ebDetId ) ) ;
266 cell = *(ol.begin() );
279 if(neighbours.size()>0 && !neighbours[0].null()) {
280 cell = neighbours[0];
291 const EcalEndcapGeometry::OrderedListOfEBDetId&
292 ol( * endcapGeom.getClosestBarrelCells( eeDetId ) ) ;
295 cell = *(ol.begin() );
312 const EcalBarrelGeometry& barrelGeom,
313 const EcalEndcapGeometry& endcapGeom )
324 else if(dir==
SOUTH) {
329 result =
stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
333 result =
stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
343 return stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
346 result =
stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
357 return stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
360 result =
stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
371 return stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
374 result =
stdsimplemove(cell,
EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
385 return stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
390 return stdsimplemove(cell,
WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
404 DetId originalcell = cell;
405 if(dir==
NONE || cell==
DetId(0))
return false;
410 static const int calodirections[9]={-1,1,2,0,4,3,7,5,6};
void ecalNeighbArray(const EcalBarrelGeometry &barrelGeom, const CaloSubdetectorTopology &barrelTopo, const EcalEndcapGeometry &endcapGeom, const CaloSubdetectorTopology &endcapTopo)
T getParameter(std::string const &) const
std::vector< std::vector< DetId > > neighboursEB_
for each ecal barrel rechit, keep track of the neighbours
PFECALHashNavigator(const edm::ParameterSet &iConfig)
int hashedIndex() const
get a compact index for arrays
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
bool stdmove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom) const
unsigned detId() const
rechit detId
bool crossBarrelEndcapBorder_
if true, navigation will cross the barrel-endcap border
EcalBarrelTopology * barrelTopology_
std::vector< std::vector< DetId > > neighboursEE_
for each ecal endcap rechit, keep track of the neighbours
void associateNeighbour(const DetId &id, reco::PFRecHit &hit, std::auto_ptr< reco::PFRecHitCollection > &hits, edm::RefProd< reco::PFRecHitCollection > &refProd, short eta, short phi, short depth)
static const CaloDirection orderedDir[8]
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
int iPhiOuterRing() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
DetId move(DetId cell, const CaloDirection &dir) const
const EcalEndcapGeometry * endcapGeometry_
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
bool stdsimplemove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom) const
const EcalBarrelGeometry * barrelGeometry_
static const int MAX_IETA
EcalEndcapTopology * endcapTopology_
void associateNeighbours(reco::PFRecHit &rh, std::auto_ptr< reco::PFRecHitCollection > &hits, edm::RefProd< reco::PFRecHitCollection > &refprod)
CaloDirection
Codes the local directions in the cell lattice.
int ietaAbs() const
get the absolute value of the crystal ieta
bool neighbourmapcalculated_
set to true in ecalNeighbArray
void beginEvent(const edm::EventSetup &iSetup)
tuple size
Write out results.