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
PFRecHitProducerECAL Class Reference

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

#include <PFRecHitProducerECAL.h>

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

Public Member Functions

 PFRecHitProducerECAL (const edm::ParameterSet &)
 
 ~PFRecHitProducerECAL ()
 
- 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::PFRecHitcreateEcalRecHit (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 &)
 
void ecalNeighbArray (const EcalBarrelGeometry &barrelGeom, const CaloSubdetectorTopology &barrelTopo, const EcalEndcapGeometry &endcapGeom, const CaloSubdetectorTopology &endcapTopo)
 
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 More...
 
void findRecHitNeighboursECAL (reco::PFRecHit &rh, const std::map< unsigned, unsigned > &sortedHits)
 find rechit neighbours, using the hashed index More...
 
DetId move (DetId cell, const CaloDirection &dir) const
 
bool stdmove (DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom) const
 
bool stdsimplemove (DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom) const
 

Private Attributes

bool crossBarrelEndcapBorder_
 if true, navigation will cross the barrel-endcap border More...
 
edm::InputTag inputTagEcalRecHitsEB_
 
edm::InputTag inputTagEcalRecHitsEE_
 
bool neighbourmapcalculated_
 set to true in ecalNeighbArray More...
 
std::vector< std::vector< DetId > > neighboursEB_
 for each ecal barrel rechit, keep track of the neighbours More...
 
std::vector< std::vector< DetId > > neighboursEE_
 for each ecal endcap rechit, keep track of the neighbours More...
 
double threshCleaning_
 
bool timingCleaning_
 

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)
 
- 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 ECAL.

Author
Colin Bernet
Date
february 2008

Definition at line 41 of file PFRecHitProducerECAL.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file PFRecHitProducerECAL.cc.

References crossBarrelEndcapBorder_, edm::ParameterSet::getParameter(), inputTagEcalRecHitsEB_, inputTagEcalRecHitsEE_, neighbourmapcalculated_, threshCleaning_, and timingCleaning_.

37  : PFRecHitProducer(iConfig) {
38 
39  // access to the collections of rechits
40 
41 
43  iConfig.getParameter<InputTag>("ecalRecHitsEB");
44 
46  iConfig.getParameter<InputTag>("ecalRecHitsEE");
47 
48 
50  iConfig.getParameter<bool>("crossBarrelEndcapBorder");
51 
53  iConfig.getParameter<bool>("timing_Cleaning");
54 
56  iConfig.getParameter<double>("thresh_Cleaning");
57 
58 
60 }
T getParameter(std::string const &) const
edm::InputTag inputTagEcalRecHitsEE_
PFRecHitProducer(const edm::ParameterSet &)
edm::InputTag inputTagEcalRecHitsEB_
bool crossBarrelEndcapBorder_
if true, navigation will cross the barrel-endcap border
bool neighbourmapcalculated_
set to true in ecalNeighbArray
PFRecHitProducerECAL::~PFRecHitProducerECAL ( )

Definition at line 64 of file PFRecHitProducerECAL.cc.

64 {}

Member Function Documentation

reco::PFRecHit * PFRecHitProducerECAL::createEcalRecHit ( const DetId detid,
double  energy,
PFLayer::Layer  layer,
const CaloSubdetectorGeometry geom 
)
private

Definition at line 252 of file PFRecHitProducerECAL.cc.

References relval_parameters_module::energy, CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), TruncatedPyramid::getPosition(), position, DetId::rawId(), reco::PFRecHit::setNECorner(), reco::PFRecHit::setNWCorner(), reco::PFRecHit::setSECorner(), reco::PFRecHit::setSWCorner(), PV3DBase< T, PVType, FrameType >::x(), ExpressReco_HICollisions_FallBack::x, PV3DBase< T, PVType, FrameType >::y(), ExpressReco_HICollisions_FallBack::y, z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by createRecHits().

255  {
256 
258  math::XYZVector axis;
259 
260  const CaloCellGeometry *thisCell
261  = geom->getGeometry(detid);
262 
263  // find rechit geometry
264  if(!thisCell) {
265  LogError("PFRecHitProducerECAL")
266  <<"warning detid "<<detid.rawId()
267  <<" not found in geometry"<<endl;
268  return 0;
269  }
270 
271  position.SetCoordinates ( thisCell->getPosition().x(),
272  thisCell->getPosition().y(),
273  thisCell->getPosition().z() );
274 
275 
276 
277  // the axis vector is the difference
278  const TruncatedPyramid* pyr
279  = dynamic_cast< const TruncatedPyramid* > (thisCell);
280  if( pyr ) {
281  axis.SetCoordinates( pyr->getPosition(1).x(),
282  pyr->getPosition(1).y(),
283  pyr->getPosition(1).z() );
284 
285  math::XYZVector axis0( pyr->getPosition(0).x(),
286  pyr->getPosition(0).y(),
287  pyr->getPosition(0).z() );
288 
289  axis -= axis0;
290  }
291  else return 0;
292 
293 // if( !geomfound ) {
294 // LogError("PFRecHitProducerECAL")<<"cannor find geometry for detid "
295 // <<detid.rawId()<<" in layer "<<layer<<endl;
296 // return 0; // geometry not found, skip rechit
297 // }
298 
299 
300  reco::PFRecHit *rh
301  = new reco::PFRecHit( detid.rawId(), layer,
302  energy,
303  position.x(), position.y(), position.z(),
304  axis.x(), axis.y(), axis.z() );
305 
306 
307  const CaloCellGeometry::CornersVec& corners = thisCell->getCorners();
308  assert( corners.size() == 8 );
309 
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() );
314 
315  return rh;
316 }
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:57
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
const GlobalPoint getPosition(float depth) const
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
Definition: DDAxes.h:10
T z() const
Definition: PV3DBase.h:58
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
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
const GlobalPoint & getPosition() const
T x() const
Definition: PV3DBase.h:56
virtual const CornersVec & getCorners() const =0
void PFRecHitProducerECAL::createRecHits ( std::vector< reco::PFRecHit > &  rechits,
std::vector< reco::PFRecHit > &  rechitsCleaned,
edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

gets ecal barrel and endcap rechits, translate them to PFRecHits, which are stored in the rechits vector

Implements PFRecHitProducer.

Definition at line 72 of file PFRecHitProducerECAL.cc.

References createEcalRecHit(), CaloRecHit::detid(), cond::rpcobgas::detid, DetId::Ecal, PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, EcalBarrel, EcalEndcap, ecalNeighbArray(), CaloRecHit::energy(), relval_parameters_module::energy, edm::hlt::Exception, findRecHitNeighboursECAL(), newFWLiteAna::found, edm::EventSetup::get(), edm::Event::getByLabel(), i, inputTagEcalRecHitsEB_, inputTagEcalRecHitsEE_, edm::HandleBase::isValid(), EcalRecHit::kOutOfTime, EcalRecHit::kTowerRecovered, neighbourmapcalculated_, DetId::rawId(), EcalRecHit::recoFlag(), reco::PFRecHit::setRescale(), DetId::subdetId(), PFRecHitProducer::thresh_Barrel_, PFRecHitProducer::thresh_Endcap_, threshCleaning_, CaloRecHit::time(), cond::rpcobgas::time, and timingCleaning_.

75  {
76 
77 
78 
79  // this map is necessary to find the rechit neighbours efficiently
80  //C but I should think about using Florian's hashed index to do this.
81  //C in which case the map might not be necessary anymore
82  //
83  // the key of this map is detId.
84  // the value is the index in the rechits vector
85  map<unsigned, unsigned > idSortedRecHits;
86 // typedef map<unsigned, unsigned >::iterator IDH;
87 
89  iSetup.get<CaloGeometryRecord>().get(geoHandle);
90 
91  // get the ecalBarrel geometry
92  const CaloSubdetectorGeometry *ebtmp =
93  geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
94 
95  const EcalBarrelGeometry* ecalBarrelGeometry =
96  dynamic_cast< const EcalBarrelGeometry* > (ebtmp);
97  assert( ecalBarrelGeometry );
98 
99  // get the ecalBarrel topology
100  EcalBarrelTopology ecalBarrelTopology(geoHandle);
101 
102  // get the endcap geometry
103  const CaloSubdetectorGeometry *eetmp =
104  geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
105 
106  const EcalEndcapGeometry* ecalEndcapGeometry =
107  dynamic_cast< const EcalEndcapGeometry* > (eetmp);
108  assert( ecalEndcapGeometry );
109 
110 
111  // get the endcap topology
112  EcalEndcapTopology ecalEndcapTopology(geoHandle);
113 
114 
116  ecalNeighbArray( *ecalBarrelGeometry,
117  ecalBarrelTopology,
118  *ecalEndcapGeometry,
119  ecalEndcapTopology );
120 
121 
122  // get the ecalBarrel rechits
123 
125 
126 
127  bool found = iEvent.getByLabel(inputTagEcalRecHitsEB_,
128  rhcHandle);
129 
130  if(!found) {
131 
132  ostringstream err;
133  err<<"could not find rechits "<<inputTagEcalRecHitsEB_;
134  LogError("PFRecHitProducerECAL")<<err.str()<<endl;
135 
136  throw cms::Exception( "MissingProduct", err.str());
137  }
138  else {
139  assert( rhcHandle.isValid() );
140 
141  // process ecal ecalBarrel rechits
142  for(unsigned i=0; i<rhcHandle->size(); i++) {
143 
144  const EcalRecHit& erh = (*rhcHandle)[i];
145  const DetId& detid = erh.detid();
146  double energy = erh.energy();
147  uint32_t flag = erh.recoFlag();
148  double time = erh.time();
149 
151  if (esd != 1) continue;
152 
153  if(energy < thresh_Barrel_ ) continue;
154 
155  // Check and skip the TT recovered rechits
156  if ( flag == EcalRecHit::kTowerRecovered ) {
157  // std::cout << "Rechit was recovered with energy " << energy << std::endl;
158  continue;
159  }
160 
161  // Just clean ECAL Barrel rechits out of time by more than 5 sigma.
162  if ( timingCleaning_ && energy > threshCleaning_ && flag == EcalRecHit::kOutOfTime ) {
163  reco::PFRecHit *pfrhCleaned = createEcalRecHit(detid, energy,
165  ecalBarrelGeometry);
166  if( !pfrhCleaned ) continue; // problem with this rechit. skip it
167  pfrhCleaned->setRescale(time);
168  rechitsCleaned.push_back( *pfrhCleaned );
169  delete pfrhCleaned;
170  continue;
171  }
172 
173 
174  reco::PFRecHit *pfrh = createEcalRecHit(detid, energy,
176  ecalBarrelGeometry);
177 
178  if( !pfrh ) continue; // problem with this rechit. skip it
179  pfrh->setRescale(time);
180 
181  rechits.push_back( *pfrh );
182  delete pfrh;
183  idSortedRecHits.insert( make_pair(detid.rawId(), rechits.size()-1 ) );
184  }
185  }
186 
187 
188 
189  //C proceed as for the barrel
190  // process ecal endcap rechits
191 
192  found = iEvent.getByLabel(inputTagEcalRecHitsEE_,
193  rhcHandle);
194 
195  if(!found) {
196  ostringstream err;
197  err<<"could not find rechits "<<inputTagEcalRecHitsEE_;
198  LogError("PFRecHitProducerECAL")<<err.str()<<endl;
199 
200  throw cms::Exception( "MissingProduct", err.str());
201  }
202  else {
203  assert( rhcHandle.isValid() );
204 
205  for(unsigned i=0; i<rhcHandle->size(); i++) {
206 
207  const EcalRecHit& erh = (*rhcHandle)[i];
208  const DetId& detid = erh.detid();
209  double energy = erh.energy();
210  uint32_t flag = erh.recoFlag();
211  double time = erh.time();
213  if (esd != 2) continue;
214  if(energy < thresh_Endcap_ ) continue;
215 
216  // Check and skip the TT recovered rechits
217  if ( flag == EcalRecHit::kTowerRecovered ) {
218  // std::cout << "Rechit was recovered with energy " << energy << std::endl;
219  continue;
220  }
221 
222  reco::PFRecHit *pfrh = createEcalRecHit(detid, energy,
224  ecalEndcapGeometry);
225  if( !pfrh ) continue; // problem with this rechit. skip it
226  pfrh->setRescale(time);
227 
228  rechits.push_back( *pfrh );
229  delete pfrh;
230  idSortedRecHits.insert( make_pair(detid.rawId(), rechits.size()-1 ) );
231  }
232  }
233 
234 
235  // do navigation
236  for(unsigned i=0; i<rechits.size(); i++ ) {
237 
238 // findRecHitNeighbours( rechits[i], idSortedRecHits,
239 // ecalBarrelTopology,
240 // *ecalBarrelGeometry,
241 // ecalEndcapTopology,
242 // *ecalEndcapGeometry);
243  findRecHitNeighboursECAL( rechits[i], idSortedRecHits );
244 
245  }
246 }
int i
Definition: DBlmapReader.cc:9
void ecalNeighbArray(const EcalBarrelGeometry &barrelGeom, const CaloSubdetectorTopology &barrelTopo, const EcalEndcapGeometry &endcapGeom, const CaloSubdetectorTopology &endcapTopo)
long int flag
Definition: mlp_lapack.h:47
edm::InputTag inputTagEcalRecHitsEE_
const DetId & detid() const
Definition: CaloRecHit.h:21
float time() const
Definition: CaloRecHit.h:20
edm::InputTag inputTagEcalRecHitsEB_
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
uint32_t recoFlag() const
Definition: EcalRecHit.h:78
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
float energy() const
Definition: CaloRecHit.h:19
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
Definition: DetId.h:20
reco::PFRecHit * createEcalRecHit(const DetId &detid, double energy, PFLayer::Layer layer, const CaloSubdetectorGeometry *geom)
const T & get() const
Definition: EventSetup.h:55
void findRecHitNeighboursECAL(reco::PFRecHit &rh, const std::map< unsigned, unsigned > &sortedHits)
find rechit neighbours, using the hashed index
double thresh_Barrel_
rechits with E &lt; threshold will not give rise to a PFRecHit
bool neighbourmapcalculated_
set to true in ecalNeighbArray
EcalSubdetector
void PFRecHitProducerECAL::ecalNeighbArray ( const EcalBarrelGeometry barrelGeom,
const CaloSubdetectorTopology barrelTopo,
const EcalEndcapGeometry endcapGeom,
const CaloSubdetectorTopology endcapTopo 
)
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 422 of file PFRecHitProducerECAL.cc.

References EAST, DetId::Ecal, EcalBarrel, EcalEndcap, CaloSubdetectorGeometry::getValidDetIds(), CaloSubdetectorTopology::getWindow(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), recoMuon::in, LogDebug, neighbourmapcalculated_, neighboursEB_, neighboursEE_, NORTH, NORTHEAST, NORTHWEST, findQualityFiles::size, SOUTH, SOUTHEAST, SOUTHWEST, ntuplemaker::status, stdmove(), and WEST.

Referenced by createRecHits().

426  {
427 
428 
429  static const CaloDirection orderedDir[8]={SOUTHWEST,
430  SOUTH,
431  SOUTHEAST,
432  WEST,
433  EAST,
434  NORTHWEST,
435  NORTH,
436  NORTHEAST};
437 
438  const unsigned nbarrel = 62000;
439  // Barrel first. The hashed index runs from 0 to 61199
440  neighboursEB_.resize(nbarrel);
441 
442  //std::cout << " Building the array of neighbours (barrel) " ;
443 
444  const std::vector<DetId>& vec(barrelGeom.getValidDetIds(DetId::Ecal,
445  EcalBarrel));
446  unsigned size=vec.size();
447  for(unsigned ic=0; ic<size; ++ic)
448  {
449  // We get the 9 cells in a square.
450  std::vector<DetId> neighbours(barrelTopo.getWindow(vec[ic],3,3));
451  // std::cout << " Cell " << EBDetId(vec[ic]) << std::endl;
452  unsigned nneighbours=neighbours.size();
453 
454  unsigned hashedindex=EBDetId(vec[ic]).hashedIndex();
455  if(hashedindex>=nbarrel)
456  {
457  LogDebug("CaloGeometryTools") << " Array overflow " << std::endl;
458  }
459 
460 
461  // If there are 9 cells, it is easy, and this order is know:
462 // 6 7 8
463 // 3 4 5
464 // 0 1 2 (0 = SOUTHWEST)
465 
466  if(nneighbours==9)
467  {
468  neighboursEB_[hashedindex].reserve(8);
469  for(unsigned in=0;in<nneighbours;++in)
470  {
471  // remove the centre
472  if(neighbours[in]!=vec[ic])
473  {
474  neighboursEB_[hashedindex].push_back(neighbours[in]);
475  // std::cout << " Neighbour " << in << " " << EBDetId(neighbours[in]) << std::endl;
476  }
477  }
478  }
479  else
480  {
481  DetId central(vec[ic]);
482  neighboursEB_[hashedindex].resize(8,DetId(0));
483  for(unsigned idir=0;idir<8;++idir)
484  {
485  DetId testid=central;
486  bool status=stdmove(testid,orderedDir[idir],
487  barrelTopo, endcapTopo,
488  barrelGeom, endcapGeom);
489  if(status) neighboursEB_[hashedindex][idir]=testid;
490  }
491 
492  }
493  }
494 
495  // Moved to the endcap
496 
497  // std::cout << " done " << size << std::endl;
498  // std::cout << " Building the array of neighbours (endcap) " ;
499 
500 // vec.clear();
501  const std::vector<DetId>& vecee=endcapGeom.getValidDetIds(DetId::Ecal,EcalEndcap);
502  size=vecee.size();
503  // There are some holes in the hashedIndex for the EE. Hence the array is bigger than the number
504  // of crystals
505  const unsigned nendcap=19960;
506 
507  neighboursEE_.resize(nendcap);
508  for(unsigned ic=0; ic<size; ++ic)
509  {
510  // We get the 9 cells in a square.
511  std::vector<DetId> neighbours(endcapTopo.getWindow(vecee[ic],3,3));
512  unsigned nneighbours=neighbours.size();
513  // remove the centre
514  unsigned hashedindex=EEDetId(vecee[ic]).hashedIndex();
515 
516  if(hashedindex>=nendcap)
517  {
518  LogDebug("CaloGeometryTools") << " Array overflow " << std::endl;
519  }
520 
521  if(nneighbours==9)
522  {
523  neighboursEE_[hashedindex].reserve(8);
524  for(unsigned in=0;in<nneighbours;++in)
525  {
526  // remove the centre
527  if(neighbours[in]!=vecee[ic])
528  {
529  neighboursEE_[hashedindex].push_back(neighbours[in]);
530  }
531  }
532  }
533  else
534  {
535  DetId central(vecee[ic]);
536  neighboursEE_[hashedindex].resize(8,DetId(0));
537  for(unsigned idir=0;idir<8;++idir)
538  {
539  DetId testid=central;
540  bool status=stdmove(testid,orderedDir[idir],
541  barrelTopo, endcapTopo,
542  barrelGeom, endcapGeom);
543 
544  if(status) neighboursEE_[hashedindex][idir]=testid;
545  }
546 
547  }
548  }
549  // std::cout << " done " << size <<std::endl;
551 }
#define LogDebug(id)
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:73
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)
bool stdmove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom) const
std::vector< std::vector< DetId > > neighboursEB_
for each ecal barrel rechit, keep track of the neighbours
Definition: DetId.h:20
int hashedIndex() const
Definition: EEDetId.h:177
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
std::vector< std::vector< DetId > > neighboursEE_
for each ecal endcap rechit, keep track of the neighbours
bool neighbourmapcalculated_
set to true in ecalNeighbArray
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
tuple status
Definition: ntuplemaker.py:245
tuple size
Write out results.
bool PFRecHitProducerECAL::findEcalRecHitGeometry ( 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 322 of file PFRecHitProducerECAL.cc.

References CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), TruncatedPyramid::getPosition(), DetId::rawId(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

325  {
326 
327 
328  const CaloCellGeometry *thisCell
329  = geom->getGeometry(detid);
330 
331  // find rechit geometry
332  if(!thisCell) {
333  LogError("PFRecHitProducerECAL")
334  <<"warning detid "<<detid.rawId()
335  <<" not found in geometry"<<endl;
336  return false;
337  }
338 
339  position.SetCoordinates ( thisCell->getPosition().x(),
340  thisCell->getPosition().y(),
341  thisCell->getPosition().z() );
342 
343 
344 
345  // the axis vector is the difference
346  const TruncatedPyramid* pyr
347  = dynamic_cast< const TruncatedPyramid* > (thisCell);
348  if( pyr ) {
349  axis.SetCoordinates( pyr->getPosition(1).x(),
350  pyr->getPosition(1).y(),
351  pyr->getPosition(1).z() );
352 
353  math::XYZVector axis0( pyr->getPosition(0).x(),
354  pyr->getPosition(0).y(),
355  pyr->getPosition(0).z() );
356 
357  axis -= axis0;
358 
359 
360  return true;
361  }
362  else return false;
363 }
T y() const
Definition: PV3DBase.h:57
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
const GlobalPoint getPosition(float depth) const
T z() const
Definition: PV3DBase.h:58
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
const GlobalPoint & getPosition() const
T x() const
Definition: PV3DBase.h:56
void PFRecHitProducerECAL::findRecHitNeighboursECAL ( reco::PFRecHit rh,
const std::map< unsigned, unsigned > &  sortedHits 
)
private

find rechit neighbours, using the hashed index

Definition at line 369 of file PFRecHitProducerECAL.cc.

References reco::PFRecHit::add4Neighbour(), reco::PFRecHit::add8Neighbour(), reco::PFRecHit::detId(), EAST, i, NORTH, NORTHEAST, NORTHWEST, DetId::rawId(), SOUTH, SOUTHEAST, SOUTHWEST, and WEST.

Referenced by createRecHits().

370  {
371 
372  DetId center( rh.detId() );
373 
374 
375  DetId north = move( center, NORTH );
376  DetId northeast = move( center, NORTHEAST );
377  DetId northwest = move( center, NORTHWEST );
378  DetId south = move( center, SOUTH );
379  DetId southeast = move( center, SOUTHEAST );
380  DetId southwest = move( center, SOUTHWEST );
381  DetId east = move( center, EAST );
382  DetId west = move( center, WEST );
383 
384  IDH i = sortedHits.find( north.rawId() );
385  if(i != sortedHits.end() )
386  rh.add4Neighbour( i->second );
387 
388  i = sortedHits.find( northeast.rawId() );
389  if(i != sortedHits.end() )
390  rh.add8Neighbour( i->second );
391 
392  i = sortedHits.find( south.rawId() );
393  if(i != sortedHits.end() )
394  rh.add4Neighbour( i->second );
395 
396  i = sortedHits.find( southwest.rawId() );
397  if(i != sortedHits.end() )
398  rh.add8Neighbour( i->second );
399 
400  i = sortedHits.find( east.rawId() );
401  if(i != sortedHits.end() )
402  rh.add4Neighbour( i->second );
403 
404  i = sortedHits.find( southeast.rawId() );
405  if(i != sortedHits.end() )
406  rh.add8Neighbour( i->second );
407 
408  i = sortedHits.find( west.rawId() );
409  if(i != sortedHits.end() )
410  rh.add4Neighbour( i->second );
411 
412  i = sortedHits.find( northwest.rawId() );
413  if(i != sortedHits.end() )
414  rh.add8Neighbour( i->second );
415 }
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
std::map< unsigned, unsigned >::const_iterator IDH
DetId move(DetId cell, const CaloDirection &dir) const
DetId PFRecHitProducerECAL::move ( DetId  cell,
const CaloDirection dir 
) const
private

Definition at line 727 of file PFRecHitProducerECAL.cc.

References dir, EcalBarrel, EBDetId::hashedIndex(), EEDetId::hashedIndex(), neighbourmapcalculated_, neighboursEB_, neighboursEE_, NONE, query::result, and DetId::subdetId().

Referenced by python.Vispa.Gui.WidgetContainer.WidgetContainer::autosize(), and python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

729 {
730  DetId originalcell = cell;
731  if(dir==NONE || cell==DetId(0)) return false;
732 
733  // Conversion CaloDirection and index in the table
734  // CaloDirection :NONE,SOUTH,SOUTHEAST,SOUTHWEST,EAST,WEST, NORTHEAST,NORTHWEST,NORTH
735  // Table : SOUTHWEST,SOUTH,SOUTHEAST,WEST,EAST,NORTHWEST,NORTH, NORTHEAST
736  static const int calodirections[9]={-1,1,2,0,4,3,7,5,6};
737 
738  assert(neighbourmapcalculated_);
739 
740  DetId result = (originalcell.subdetId()==EcalBarrel) ?
741  neighboursEB_[EBDetId(originalcell).hashedIndex()][calodirections[dir]]:
742  neighboursEE_[EEDetId(originalcell).hashedIndex()][calodirections[dir]];
743  return result;
744 }
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:73
tuple result
Definition: query.py:137
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&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
int hashedIndex() const
Definition: EEDetId.h:177
std::vector< std::vector< DetId > > neighboursEE_
for each ecal endcap rechit, keep track of the neighbours
bool neighbourmapcalculated_
set to true in ecalNeighbArray
dbl *** dir
Definition: mlp_gen.cc:35
bool PFRecHitProducerECAL::stdmove ( DetId cell,
const CaloDirection dir,
const CaloSubdetectorTopology barrelTopo,
const CaloSubdetectorTopology endcapTopo,
const EcalBarrelGeometry barrelGeom,
const EcalEndcapGeometry endcapGeom 
) const
private

Definition at line 634 of file PFRecHitProducerECAL.cc.

References EAST, NORTH, NORTHEAST, NORTHWEST, query::result, SOUTH, SOUTHEAST, SOUTHWEST, stdsimplemove(), and WEST.

Referenced by ecalNeighbArray().

641  {
642 
643 
644  bool result;
645 
646  if(dir==NORTH) {
647  result = stdsimplemove(cell,NORTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
648  return result;
649  }
650  else if(dir==SOUTH) {
651  result = stdsimplemove(cell,SOUTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
652  return result;
653  }
654  else if(dir==EAST) {
655  result = stdsimplemove(cell,EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
656  return result;
657  }
658  else if(dir==WEST) {
659  result = stdsimplemove(cell,WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
660  return result;
661  }
662 
663 
664  // One has to try both paths
665  else if(dir==NORTHEAST)
666  {
667  result = stdsimplemove(cell,NORTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
668  if(result)
669  return stdsimplemove(cell,EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
670  else
671  {
672  result = stdsimplemove(cell,EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
673  if(result)
674  return stdsimplemove(cell,NORTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
675  else
676  return false;
677  }
678  }
679  else if(dir==NORTHWEST)
680  {
681  result = stdsimplemove(cell,NORTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
682  if(result)
683  return stdsimplemove(cell,WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
684  else
685  {
686  result = stdsimplemove(cell,WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
687  if(result)
688  return stdsimplemove(cell,NORTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
689  else
690  return false;
691  }
692  }
693  else if(dir == SOUTHEAST)
694  {
695  result = stdsimplemove(cell,SOUTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
696  if(result)
697  return stdsimplemove(cell,EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
698  else
699  {
700  result = stdsimplemove(cell,EAST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
701  if(result)
702  return stdsimplemove(cell,SOUTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
703  else
704  return false;
705  }
706  }
707  else if(dir == SOUTHWEST)
708  {
709  result = stdsimplemove(cell,SOUTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
710  if(result)
711  return stdsimplemove(cell,WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
712  else
713  {
714  result = stdsimplemove(cell,SOUTH, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
715  if(result)
716  return stdsimplemove(cell,WEST, barrelTopo, endcapTopo, barrelGeom, endcapGeom );
717  else
718  return false;
719  }
720  }
721  cell = DetId(0);
722  return false;
723 }
tuple result
Definition: query.py:137
bool stdsimplemove(DetId &cell, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom) const
Definition: DetId.h:20
dbl *** dir
Definition: mlp_gen.cc:35
bool PFRecHitProducerECAL::stdsimplemove ( DetId cell,
const CaloDirection dir,
const CaloSubdetectorTopology barrelTopo,
const CaloSubdetectorTopology endcapTopo,
const EcalBarrelGeometry barrelGeom,
const EcalEndcapGeometry endcapGeom 
) const
private

Definition at line 556 of file PFRecHitProducerECAL.cc.

References crossBarrelEndcapBorder_, EcalBarrel, EcalEndcap, EcalEndcapGeometry::getClosestBarrelCells(), EcalBarrelGeometry::getClosestEndcapCells(), CaloSubdetectorTopology::getNeighbours(), EBDetId::ietaAbs(), EEDetId::iPhiOuterRing(), EBDetId::MAX_IETA, and DetId::subdetId().

Referenced by stdmove().

562  {
563 
564  std::vector<DetId> neighbours;
565 
566  // BARREL CASE
567  if(cell.subdetId()==EcalBarrel) {
568  EBDetId ebDetId = cell;
569 
570  neighbours = barrelTopo.getNeighbours(ebDetId,dir);
571 
572  // first try to move according to the standard navigation
573  if(neighbours.size()>0 && !neighbours[0].null()) {
574  cell = neighbours[0];
575  return true;
576  }
577 
578  // failed.
579 
581  // are we on the outer ring ?
582  const int ietaAbs ( ebDetId.ietaAbs() ) ; // abs value of ieta
583  if( EBDetId::MAX_IETA == ietaAbs ) {
584  // get ee nbrs for for end of barrel crystals
585 
586  // yes we are
588  ol( * barrelGeom.getClosestEndcapCells( ebDetId ) ) ;
589 
590  // take closest neighbour on the other side, that is in the barrel.
591  cell = *(ol.begin() );
592  return true;
593  }
594  }
595  }
596 
597  // ENDCAP CASE
598  else if(cell.subdetId()==EcalEndcap) {
599 
600  EEDetId eeDetId = cell;
601 
602  neighbours= endcapTopo.getNeighbours(eeDetId,dir);
603 
604  if(neighbours.size()>0 && !neighbours[0].null()) {
605  cell = neighbours[0];
606  return true;
607  }
608 
609  // failed.
610 
612  // are we on the outer ring ?
613  const int iphi ( eeDetId.iPhiOuterRing() ) ;
614  if( iphi!= 0) {
615  // yes we are
617  ol( * endcapGeom.getClosestBarrelCells( eeDetId ) ) ;
618 
619  // take closest neighbour on the other side, that is in the barrel.
620  cell = *(ol.begin() );
621  return true;
622  }
623  }
624  }
625 
626  // everything failed
627  cell = DetId(0);
628  return false;
629 }
const OrderedListOfEEDetId * getClosestEndcapCells(EBDetId id) const
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
bool crossBarrelEndcapBorder_
if true, navigation will cross the barrel-endcap border
int iPhiOuterRing() const
Definition: EEDetId.cc:404
const OrderedListOfEBDetId * getClosestBarrelCells(EEDetId id) 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
static const int MAX_IETA
Definition: EBDetId.h:122
dbl *** dir
Definition: mlp_gen.cc:35
int ietaAbs() const
get the absolute value of the crystal ieta
Definition: EBDetId.h:42

Member Data Documentation

bool PFRecHitProducerECAL::crossBarrelEndcapBorder_
private

if true, navigation will cross the barrel-endcap border

Definition at line 117 of file PFRecHitProducerECAL.h.

Referenced by PFRecHitProducerECAL(), and stdsimplemove().

edm::InputTag PFRecHitProducerECAL::inputTagEcalRecHitsEB_
private

Definition at line 120 of file PFRecHitProducerECAL.h.

Referenced by createRecHits(), and PFRecHitProducerECAL().

edm::InputTag PFRecHitProducerECAL::inputTagEcalRecHitsEE_
private

Definition at line 121 of file PFRecHitProducerECAL.h.

Referenced by createRecHits(), and PFRecHitProducerECAL().

bool PFRecHitProducerECAL::neighbourmapcalculated_
private

set to true in ecalNeighbArray

Definition at line 114 of file PFRecHitProducerECAL.h.

Referenced by createRecHits(), ecalNeighbArray(), move(), and PFRecHitProducerECAL().

std::vector<std::vector<DetId> > PFRecHitProducerECAL::neighboursEB_
private

for each ecal barrel rechit, keep track of the neighbours

Definition at line 108 of file PFRecHitProducerECAL.h.

Referenced by ecalNeighbArray(), and move().

std::vector<std::vector<DetId> > PFRecHitProducerECAL::neighboursEE_
private

for each ecal endcap rechit, keep track of the neighbours

Definition at line 111 of file PFRecHitProducerECAL.h.

Referenced by ecalNeighbArray(), and move().

double PFRecHitProducerECAL::threshCleaning_
private

Definition at line 125 of file PFRecHitProducerECAL.h.

Referenced by createRecHits(), and PFRecHitProducerECAL().

bool PFRecHitProducerECAL::timingCleaning_
private

Definition at line 124 of file PFRecHitProducerECAL.h.

Referenced by createRecHits(), and PFRecHitProducerECAL().