CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFRecHitProducerHO Class Reference

Producer for particle flow rechits (PFRecHit) in HO. More...

#include <PFRecHitProducerHO.h>

Inheritance diagram for PFRecHitProducerHO:
PFRecHitProducer edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 PFRecHitProducerHO (const edm::ParameterSet &)
 
 ~PFRecHitProducerHO ()
 
- Public Member Functions inherited from PFRecHitProducer
virtual void beginRun (edm::Run &run, const edm::EventSetup &es)
 
virtual void endRun ()
 
 PFRecHitProducer (const edm::ParameterSet &)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~PFRecHitProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

reco::PFRecHitcreateHORecHit (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 More...
 
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 More...
 
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 More...
 
std::vector< std::vector< DetId > > neighboursHO_
 for each HO barrel rechit, keep track of the neighbours More...
 
double thresholdR0_
 
double thresholdR1_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Types inherited from PFRecHitProducer
typedef std::map< unsigned,
unsigned >::const_iterator 
IDH
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 
- Protected Attributes inherited from PFRecHitProducer
const HcalPFCorrsmyPFCorr
 
const EcalChannelStatustheEcalChStatus
 
const HcalChannelQualitytheHcalChStatus
 
const CaloTowerConstituentsMaptheTowerConstituentsMap
 
double thresh_Barrel_
 rechits with E < threshold will not give rise to a PFRecHit More...
 
double thresh_Endcap_
 
bool verbose_
 verbose ? More...
 

Detailed Description

Producer for particle flow rechits (PFRecHit) in HO.

Author
Gobinda Majumder
Date
November 2011

Definition at line 35 of file PFRecHitProducerHO.h.

Constructor & Destructor Documentation

PFRecHitProducerHO::PFRecHitProducerHO ( const edm::ParameterSet iConfig)
explicit

Definition at line 43 of file PFRecHitProducerHO.cc.

References edm::ParameterSet::getParameter(), HOMaxAllowedSev_, inputTagHORecHits_, and neighbourmapcalculated_.

44  : PFRecHitProducer(iConfig) {
45 
46  // access to the collections of rechits
48  iConfig.getParameter<InputTag>("recHitsHO");
49 
50  HOMaxAllowedSev_ = iConfig.getParameter<int>("HOMaxAllowedSev");
52 }
T getParameter(std::string const &) const
PFRecHitProducer(const edm::ParameterSet &)
edm::InputTag inputTagHORecHits_
bool neighbourmapcalculated_
set to true in hoNeighbArray
PFRecHitProducerHO::~PFRecHitProducerHO ( )

Definition at line 56 of file PFRecHitProducerHO.cc.

56 {}

Member Function Documentation

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(), x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by createRecHits().

175  {
176 
178  math::XYZVector axis;
179 
180  const CaloCellGeometry *thisCell
181  = geom->getGeometry(detid);
182 
183  // find rechit geometry
184  if(!thisCell) {
185  LogError("PFRecHitProducerHO")
186  <<"warning detid "<<detid.rawId()
187  <<" not found in geometry"<<endl;
188  return 0;
189  }
190 
191  double sclel0l1r=0.946; //384.8/406.6
192 
193  if (abs(thisCell->getPosition().z())>130) {
194  position.SetCoordinates ( sclel0l1r*thisCell->getPosition().x(),
195  sclel0l1r*thisCell->getPosition().y(),
196  sclel0l1r*thisCell->getPosition().z() );
197 
198  } else {
199  position.SetCoordinates ( thisCell->getPosition().x(),
200  thisCell->getPosition().y(),
201  thisCell->getPosition().z() );
202  }
203 
204  // the axis vector is the difference
205 
206  // const TruncatedPyramid* pyr
207  // = dynamic_cast< const TruncatedPyramid* > (thisCell);
208  // if( pyr ) {
209  // axis.SetCoordinates( pyr->getPosition(1).x(),
210  // pyr->getPosition(1).y(),
211  // pyr->getPosition(1).z() );
212 
213  // math::XYZVector axis0( pyr->getPosition(0).x(),
214  // pyr->getPosition(0).y(),
215  // pyr->getPosition(0).z() );
216 
217  // axis -= axis0;
218  // }
219  // else return 0;
220 
221  axis = math::XYZVector(0,0,0);
222 
223  // if( !geomfound ) {
224  // LogError("PFRecHitProducerHO")<<"cannor find geometry for detid "
225  // <<detid.rawId()<<" in layer "<<layer<<endl;
226  // return 0; // geometry not found, skip rechit
227  // }
228 
229 
230  reco::PFRecHit *rh
231  = new reco::PFRecHit( detid.rawId(), layer,
232  energy,
233  position.x(), position.y(), position.z(),
234  axis.x(), axis.y(), axis.z() );
235 
236  const CaloCellGeometry::CornersVec& corners = thisCell->getCorners();
237  assert( corners.size() == 8 );
238 
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() );
244 
245  } else {
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() );
250  }
251 
252  return rh;
253 }
void setSECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:226
void setNECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:231
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
double double double z
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
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
Definition: DetId.h:45
void setSWCorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:221
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
T z() const
Definition: PV3DBase.h:63
void setNWCorner(double posx, double posy, double posz)
search for pointers to neighbours, using neighbours&#39; DetId.
Definition: PFRecHit.cc:216
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:61
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell&#39;s volume.
void PFRecHitProducerHO::createRecHits ( std::vector< reco::PFRecHit > &  rechits,
std::vector< reco::PFRecHit > &  rechitsCleaned,
edm::Event ,
const edm::EventSetup  
)
privatevirtual

translate the standard rechits ( or calotowers) them to PFRecHits, which are stored in the rechits vector

Implements PFRecHitProducer.

Definition at line 59 of file PFRecHitProducerHO.cc.

References abs, createHORecHit(), CaloRecHit::detid(), cond::rpcobgas::detid, CaloRecHit::energy(), relval_parameters_module::energy, edm::hlt::Exception, findRecHitNeighboursHO(), CaloRecHit::flags(), newFWLiteAna::found, edm::EventSetup::get(), edm::Event::getByLabel(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), DetId::Hcal, PFLayer::HCAL_BARREL2, HcalOuter, HOMaxAllowedSev_, hoNeighbArray(), i, HcalDetId::ieta(), inputTagHORecHits_, edm::HandleBase::isValid(), neighbourmapcalculated_, edm::ESHandle< class >::product(), DetId::rawId(), reco::PFRecHit::setRescale(), DetId::subdetId(), PFRecHitProducer::theHcalChStatus, PFRecHitProducer::thresh_Barrel_, PFRecHitProducer::thresh_Endcap_, CaloRecHit::time(), and cond::rpcobgas::time.

62  {
63 
64 
65 
66  // this map is necessary to find the rechit neighbours efficiently
67  //C but I should think about using Florian's hashed index to do this.
68  //C in which case the map might not be necessary anymore
69  //
70  // the key of this map is detId.
71  // the value is the index in the rechits vector
72  map<unsigned, unsigned > idSortedRecHits;
73  // typedef map<unsigned, unsigned >::iterator IDH;
74 
76  iSetup.get<CaloGeometryRecord>().get(geoHandle);
77 
78  // get the HO geometry
79  const CaloSubdetectorGeometry *hcalBarrelGeometry =
80  geoHandle->getSubdetectorGeometry(DetId::Hcal, HcalOuter);
81 
82  // get the HO topology
83  HcalTopology hcalBarrelTopology; // (geoHandle);
84 
86  hoNeighbArray( *hcalBarrelGeometry,
87  hcalBarrelTopology);
88 
89  // Get Hcal Severity Level Computer, so that the severity of each rechit flag/status may be determined
90  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
91  iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
92  const HcalSeverityLevelComputer* hcalSevLvlComputer = hcalSevLvlComputerHndl.product();
93 
94 
95  // get the HO rechits
96 
98 
99 
100  bool found = iEvent.getByLabel(inputTagHORecHits_,
101  rhcHandle);
102 
103  if(!found) {
104 
105  ostringstream err;
106  err<<"could not find rechits "<<inputTagHORecHits_;
107  LogError("PFRecHitProducerHO")<<err.str()<<endl;
108 
109  throw cms::Exception( "MissingProduct", err.str());
110  }
111  else {
112  assert( rhcHandle.isValid() );
113 
114  // process HO rechits
115  for(unsigned i=0; i<rhcHandle->size(); i++) {
116 
117  const HORecHit& erh = (*rhcHandle)[i];
118  const HcalDetId& detid = (HcalDetId)erh.detid();
119 
120  double energy = erh.energy();
121  // uint32_t flag = erh.recoFlag();
122  double time = erh.time();
123 
125 
126  if (esd != 3) continue;
127 
128  int hoeta=detid.ieta();
129  if ( (abs(hoeta)<=4 && energy < thresh_Barrel_) ||
130  (abs(hoeta)> 4 && energy < thresh_Endcap_) ) continue;
131 
132 
133  // Get Channel Quality information for the given detID
134  const HcalChannelStatus* theStatus = theHcalChStatus->getValues(detid);
135  unsigned theStatusValue = theStatus->getValue();
136  // Now get severity of problems for the given detID, based on the rechit flag word and the channel quality status value
137  int hitSeverity=hcalSevLvlComputer->getSeverityLevel(detid, erh.flags(),theStatusValue);
138 
139  // Skip hits whose problems are more severe than max accept level. In the future, allow for cleaning of such hits?
140  // Note: As of April 2012, by default, all HO hits in rings +/-1, +/-2 should be identified as either "remove from calotowers" or "remove from rechit collections" in the channel quality database, and thus should be rejected by this conditional statement.
141  if (hitSeverity>HOMaxAllowedSev_)
142  {
143  //std::cout <<"Rejecting HO hit HO("<<hoeta<<", "<<detid.iphi()<<", "<<detid.depth()<<std::endl;
144  continue;
145  }
146 
147 
148 
149  reco::PFRecHit *pfrh = createHORecHit(detid, energy,
150  PFLayer::HCAL_BARREL2, // HO,
151  hcalBarrelGeometry);
152 
153  if( !pfrh ) continue; // problem with this rechit. skip it
154 
155  pfrh->setRescale(time);
156 
157  rechits.push_back( *pfrh );
158  delete pfrh;
159  idSortedRecHits.insert( make_pair(detid.rawId(), rechits.size()-1 ) );
160  }
161  }
162 
163  // do navigation
164  for(unsigned i=0; i<rechits.size(); i++ ) {
165  findRecHitNeighboursHO( rechits[i], idSortedRecHits );
166  }
167 
168 }
int i
Definition: DBlmapReader.cc:9
reco::PFRecHit * createHORecHit(const DetId &detid, double energy, PFLayer::Layer layer, const CaloSubdetectorGeometry *geom)
const DetId & detid() const
Definition: CaloRecHit.h:22
void hoNeighbArray(const CaloSubdetectorGeometry &barrelGeom, const CaloSubdetectorTopology &barrelTopo)
#define abs(x)
Definition: mlp_lapack.h:159
float time() const
Definition: CaloRecHit.h:21
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int iEvent
Definition: GenABIO.cc:243
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
float energy() const
Definition: CaloRecHit.h:19
uint32_t flags() const
Definition: CaloRecHit.h:23
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
HcalSubdetector
Definition: HcalAssistant.h:32
void setRescale(double factor)
Definition: PFRecHit.h:74
bool isValid() const
Definition: HandleBase.h:76
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
edm::InputTag inputTagHORecHits_
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
Definition: ESHandle.h:62
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
double thresh_Barrel_
rechits with E &lt; threshold will not give rise to a PFRecHit
uint32_t getValue() const
const Item * getValues(DetId fId) const
bool neighbourmapcalculated_
set to true in hoNeighbArray
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().

260  {
261 
262 
263  const CaloCellGeometry *thisCell
264  = geom->getGeometry(detid);
265 
266  // find rechit geometry
267  if(!thisCell) {
268  LogError("PFRecHitProducerHO")
269  <<"warning detid "<<detid.rawId()
270  <<" not found in geometry"<<endl;
271  return false;
272  }
273 
274  position.SetCoordinates ( thisCell->getPosition().x(),
275  thisCell->getPosition().y(),
276  thisCell->getPosition().z() );
277 
278 
279 
280  // the axis vector is the difference
281  // const TruncatedPyramid* pyr
282  // = dynamic_cast< const TruncatedPyramid* > (thisCell);
283  // if( pyr ) {
284  // axis.SetCoordinates( pyr->getPosition(1).x(),
285  // pyr->getPosition(1).y(),
286  // pyr->getPosition(1).z() );
287 
288  // math::XYZVector axis0( pyr->getPosition(0).x(),
289  // pyr->getPosition(0).y(),
290  // pyr->getPosition(0).z() );
291 
292  // axis -= axis0;
293 
294 
295  // return true;
296  // }
297 
298  axis = math::XYZVector(0,0,0);
299  return true;
300 
301  // else return false;
302 }
T y() const
Definition: PV3DBase.h:62
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
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
Definition: DetId.h:45
T z() const
Definition: PV3DBase.h:63
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
T x() const
Definition: PV3DBase.h:61
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.

Referenced by createRecHits().

309  {
310 
311  DetId center( rh.detId() );
312 
313 
314  DetId north = move( center, NORTH );
315  DetId northeast = move( center, NORTHEAST );
316  DetId northwest = move( center, NORTHWEST );
317  DetId south = move( center, SOUTH );
318  DetId southeast = move( center, SOUTHEAST );
319  DetId southwest = move( center, SOUTHWEST );
320  DetId east = move( center, EAST );
321  DetId west = move( center, WEST );
322 
323  IDH i = sortedHits.find( north.rawId() );
324  if(i != sortedHits.end() )
325  rh.add4Neighbour( i->second );
326 
327  i = sortedHits.find( northeast.rawId() );
328  if(i != sortedHits.end() )
329  rh.add8Neighbour( i->second );
330 
331  i = sortedHits.find( south.rawId() );
332  if(i != sortedHits.end() )
333  rh.add4Neighbour( i->second );
334 
335  i = sortedHits.find( southwest.rawId() );
336  if(i != sortedHits.end() )
337  rh.add8Neighbour( i->second );
338 
339  i = sortedHits.find( east.rawId() );
340  if(i != sortedHits.end() )
341  rh.add4Neighbour( i->second );
342 
343  i = sortedHits.find( southeast.rawId() );
344  if(i != sortedHits.end() )
345  rh.add8Neighbour( i->second );
346 
347  i = sortedHits.find( west.rawId() );
348  if(i != sortedHits.end() )
349  rh.add4Neighbour( i->second );
350 
351  i = sortedHits.find( northwest.rawId() );
352  if(i != sortedHits.end() )
353  rh.add8Neighbour( i->second );
354 }
void add4Neighbour(unsigned index)
Definition: PFRecHit.cc:176
int i
Definition: DBlmapReader.cc:9
void add8Neighbour(unsigned index)
Definition: PFRecHit.cc:181
unsigned detId() const
rechit detId
Definition: PFRecHit.h:99
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
Definition: DetId.h:20
DetId move(DetId cell, const CaloDirection &dir) const
std::map< unsigned, unsigned >::const_iterator IDH
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.

Referenced by createRecHits().

361  {
362 
363  static const CaloDirection orderedDir[8]={SOUTHWEST,
364  SOUTH,
365  SOUTHEAST,
366  WEST,
367  EAST,
368  NORTHWEST,
369  NORTH,
370  NORTHEAST};
371 
372  const unsigned nbarrel = 2160; //62000;
373  // Barrel first. The hashed index runs from 0 to 2199 61199
374  neighboursHO_.resize(nbarrel);
375 
376  //std::cout << " Building the array of neighbours (barrel) " ;
377 
378  const std::vector<DetId>& vec(barrelGeom.getValidDetIds(DetId::Hcal,
379  HcalOuter));
380  unsigned size=vec.size();
381  for(unsigned ic=0; ic<size; ++ic)
382  {
383  // We get the 9 cells in a square.
384  std::vector<DetId> neighbours(barrelTopo.getWindow(vec[ic],3,3));
385  unsigned nneighbours=neighbours.size();
386 
387  unsigned hashedindex=HcalDetId(vec[ic]).hashed_index()-5184; //2*( kHBhalf + kHEhalf )
388  // std::cout << " Cell " << ic<<" "<<vec[ic].rawId()<<" "<<HcalDetId(vec[ic]) <<" "<<hashedindex<<" "<<nneighbours<< std::endl;
389  if(hashedindex>=nbarrel)
390  {
391  LogDebug("CaloGeometryTools") << " Array overflow " << std::endl;
392  }
393 
394 
395  // If there are 9 cells, it is easy, and this order is know:
396  // 6 7 8
397  // 3 4 5
398  // 0 1 2 (0 = SOUTHWEST)
399 
400  if(nneighbours==9)
401  {
402  neighboursHO_[hashedindex].reserve(8);
403  for(unsigned in=0;in<nneighbours;++in)
404  {
405  // remove the centre
406  // cout<<"ic "<<ic<<" "<<in<<" "<<neighbours[in].rawId()<<" "<<vec[ic].rawId()<<" "<<hashedindex<<endl;
407  if(neighbours[in]!=vec[ic])
408  {
409  neighboursHO_[hashedindex].push_back(neighbours[in]);
410  // std::cout << " Neighbour " << ic<<" "<<size<<" "<<in << " " <<hashedindex<<" "<< HcalDetId(neighbours[in]) << std::endl;
411  }
412  }
413  }
414  else
415  {
416  DetId central(vec[ic]);
417  neighboursHO_[hashedindex].resize(8,DetId(0));
418  for(unsigned idir=0;idir<8;++idir)
419  {
420  DetId testid=central;
421  bool status=stdmove(testid,orderedDir[idir],
422  barrelTopo, barrelGeom);
423  if(status) neighboursHO_[hashedindex][idir]=testid;
424  }
425 
426  }
427  }
428 
429  // std::cout << " done " << size <<std::endl;
431 }
#define LogDebug(id)
std::vector< std::vector< DetId > > neighboursHO_
for each HO barrel rechit, keep track of the neighbours
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)
Definition: DetId.h:20
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
tuple status
Definition: ntuplemaker.py:245
bool stdmove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom) const
tuple size
Write out results.
int hashed_index() const
Definition: HcalDetId.cc:119
bool neighbourmapcalculated_
set to true in hoNeighbArray
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.

Referenced by Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

558 {
559  DetId originalcell = cell;
560  if(dir==NONE || cell==DetId(0)) return false;
561 
562  // Conversion CaloDirection and index in the table
563  // CaloDirection :NONE,SOUTH,SOUTHEAST,SOUTHWEST,EAST,WEST, NORTHEAST,NORTHWEST,NORTH
564  // Table : SOUTHWEST,SOUTH,SOUTHEAST,WEST,EAST,NORTHWEST,NORTH, NORTHEAST
565  static const int calodirections[9]={-1,1,2,0,4,3,7,5,6};
566 
567  assert(neighbourmapcalculated_);
568 
569  DetId result = neighboursHO_[HcalDetId(originalcell).hashed_index()-5184][calodirections[dir]];
570  return result;
571 }
std::vector< std::vector< DetId > > neighboursHO_
for each HO barrel rechit, keep track of the neighbours
tuple result
Definition: query.py:137
Definition: DetId.h:20
dbl *** dir
Definition: mlp_gen.cc:35
int hashed_index() const
Definition: HcalDetId.cc:119
bool neighbourmapcalculated_
set to true in hoNeighbArray
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().

472  {
473 
474 
475  bool result;
476 
477  if(dir==NORTH) {
478  result = stdsimplemove(cell,NORTH, barrelTopo, barrelGeom);
479  return result;
480  }
481  else if(dir==SOUTH) {
482  result = stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom);
483  return result;
484  }
485  else if(dir==EAST) {
486  result = stdsimplemove(cell,EAST, barrelTopo, barrelGeom);
487  return result;
488  }
489  else if(dir==WEST) {
490  result = stdsimplemove(cell,WEST, barrelTopo, barrelGeom);
491  return result;
492  }
493 
494 
495  // One has to try both paths
496  else if(dir==NORTHEAST)
497  {
498  result = stdsimplemove(cell,NORTH, barrelTopo, barrelGeom);
499  if(result)
500  return stdsimplemove(cell,EAST, barrelTopo, barrelGeom);
501  else
502  {
503  result = stdsimplemove(cell,EAST, barrelTopo, barrelGeom);
504  if(result)
505  return stdsimplemove(cell,NORTH, barrelTopo, barrelGeom);
506  else
507  return false;
508  }
509  }
510  else if(dir==NORTHWEST)
511  {
512  result = stdsimplemove(cell,NORTH, barrelTopo, barrelGeom );
513  if(result)
514  return stdsimplemove(cell,WEST, barrelTopo, barrelGeom );
515  else
516  {
517  result = stdsimplemove(cell,WEST, barrelTopo, barrelGeom );
518  if(result)
519  return stdsimplemove(cell,NORTH, barrelTopo, barrelGeom );
520  else
521  return false;
522  }
523  }
524  else if(dir == SOUTHEAST)
525  {
526  result = stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom );
527  if(result)
528  return stdsimplemove(cell,EAST, barrelTopo, barrelGeom );
529  else
530  {
531  result = stdsimplemove(cell,EAST, barrelTopo, barrelGeom );
532  if(result)
533  return stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom );
534  else
535  return false;
536  }
537  }
538  else if(dir == SOUTHWEST)
539  {
540  result = stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom );
541  if(result)
542  return stdsimplemove(cell,WEST, barrelTopo, barrelGeom );
543  else
544  {
545  result = stdsimplemove(cell,SOUTH, barrelTopo, barrelGeom );
546  if(result)
547  return stdsimplemove(cell,WEST, barrelTopo, barrelGeom );
548  else
549  return false;
550  }
551  }
552  cell = DetId(0);
553  return false;
554 }
bool stdsimplemove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom) const
tuple result
Definition: query.py:137
Definition: DetId.h:20
dbl *** dir
Definition: mlp_gen.cc:35
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().

438  {
439 
440  std::vector<DetId> neighbours;
441 
442  // BARREL CASE
443  if(cell.subdetId()==HcalOuter) {
444  HcalDetId hoDetId = cell;
445 
446  neighbours = barrelTopo.getNeighbours(hoDetId,dir);
447 
448  // first try to move according to the standard navigation
449  if(neighbours.size()>0 && !neighbours[0].null()) {
450  cell = neighbours[0];
451  return true;
452  }
453 
454  // failed.
455 
456 
457  }
458 
459  // everything failed
460  cell = DetId(0);
461  return false;
462 }
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
dbl *** dir
Definition: mlp_gen.cc:35

Member Data Documentation

int PFRecHitProducerHO::HOMaxAllowedSev_
private

Definition at line 114 of file PFRecHitProducerHO.h.

Referenced by createRecHits(), and PFRecHitProducerHO().

edm::InputTag PFRecHitProducerHO::inputTagHORecHits_
private

Definition at line 105 of file PFRecHitProducerHO.h.

Referenced by createRecHits(), and PFRecHitProducerHO().

bool PFRecHitProducerHO::neighbourmapcalculated_
private

set to true in hoNeighbArray

Definition at line 99 of file PFRecHitProducerHO.h.

Referenced by createRecHits(), 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.