test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
PFHGCalRecHitCreator< DET, Layer, subdet > Class Template Reference

#include <PFHGCalRecHitCreator.h>

Inheritance diagram for PFHGCalRecHitCreator< DET, Layer, subdet >:
PFRecHitCreatorBase

Public Member Functions

void importRecHits (std::auto_ptr< reco::PFRecHitCollection > &out, std::auto_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 PFHGCalRecHitCreator (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from PFRecHitCreatorBase
 PFRecHitCreatorBase ()
 
 PFRecHitCreatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 

Protected Attributes

std::string geometryInstance_
 
edm::EDGetTokenT
< HGCRecHitCollection
recHitToken_
 
- Protected Attributes inherited from PFRecHitCreatorBase
std::vector< std::unique_ptr
< PFRecHitQTestBase > > 
qualityTests_
 

Additional Inherited Members

- Protected Member Functions inherited from PFRecHitCreatorBase
void beginEvent (const edm::Event &event, const edm::EventSetup &setup)
 

Detailed Description

template<typename DET, PFLayer::Layer Layer, ForwardSubdetector subdet>
class PFHGCalRecHitCreator< DET, Layer, subdet >

Definition at line 23 of file PFHGCalRecHitCreator.h.

Constructor & Destructor Documentation

template<typename DET , PFLayer::Layer Layer, ForwardSubdetector subdet>
PFHGCalRecHitCreator< DET, Layer, subdet >::PFHGCalRecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Member Function Documentation

template<typename DET , PFLayer::Layer Layer, ForwardSubdetector subdet>
void PFHGCalRecHitCreator< DET, Layer, subdet >::importRecHits ( std::auto_ptr< reco::PFRecHitCollection > &  out,
std::auto_ptr< reco::PFRecHitCollection > &  cleaned,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlinevirtual

Implements PFRecHitCreatorBase.

Definition at line 33 of file PFHGCalRecHitCreator.h.

References assert(), CaloRecHit::detid(), CaloRecHit::energy(), relval_parameters_module::energy, Exception, PFHGCalRecHitCreator< DET, Layer, subdet >::geometryInstance_, edm::EventSetup::get(), edm::Event::getByToken(), HGCalGeometry::getCorners(), HGCalGeometry::getGeometry(), HGCalGeometry::getPosition(), i, keep, LogDebug, eostools::move(), position, PFRecHitCreatorBase::qualityTests_, HI_PhotonSkim_cff::rechits, PFHGCalRecHitCreator< DET, Layer, subdet >::recHitToken_, reco::PFRecHit::setOriginalRecHit(), edm::SortedCollection< T, SORT >::size(), CaloRecHit::time(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

33  {
34 
35  for (unsigned int i=0;i<qualityTests_.size();++i) {
36  qualityTests_.at(i)->beginEvent(iEvent,iSetup);
37  }
38 
40  iEvent.getByToken(recHitToken_,recHitHandle);
41  const HGCRecHitCollection& rechits = *recHitHandle;
42 
44  iSetup.get<IdealGeometryRecord>().get(geometryInstance_,geoHandle);
45  const HGCalGeometry& hgcGeo = *geoHandle;
46 
47  unsigned skipped_rechits = 0;
48  for (unsigned int i=0;i<rechits.size();++i) {
49  const HGCRecHit& hgrh = rechits[i];
50  const DET detid(hgrh.detid());
51 
52  if( subdet != detid.subdet() ) {
53  throw cms::Exception("IncorrectHGCSubdetector")
54  << "subdet expected: " << subdet
55  << " subdet gotten: " << detid.subdet() << std::endl;
56  }
57 
58  double energy = hgrh.energy();
59  double time = hgrh.time();
60 
61  const FlatTrd *thisCell =
62  static_cast<const FlatTrd*>(hgcGeo.getGeometry(detid));
63 
64  // find rechit geometry
65  if(!thisCell) {
66  LogDebug("PFHGCalRecHitCreator")
67  <<"warning detid "<<detid.rawId()
68  <<" not found in geometry"<<std::endl;
69  ++skipped_rechits;
70  continue;
71  }
72 
73  const GlobalPoint position( std::move( hgcGeo.getPosition( detid ) ) );
74  //std::cout << "geometry cell position: " << position << std::endl;
75 
76  reco::PFRecHit rh( detid.rawId(),Layer,
77  energy,
78  position.x(), position.y(), position.z(),
79  0, 0, 0 );
80 
82 
83  const HGCalGeometry::CornersVec corners( std::move( hgcGeo.getCorners( detid ) ) );
84  assert( corners.size() == 8 );
85 
86  rh.setNECorner( corners[0].x(), corners[0].y(), corners[0].z() );
87  rh.setSECorner( corners[1].x(), corners[1].y(), corners[1].z() );
88  rh.setSWCorner( corners[2].x(), corners[2].y(), corners[2].z() );
89  rh.setNWCorner( corners[3].x(), corners[3].y(), corners[3].z() );
90 
91  bool rcleaned = false;
92  bool keep=true;
93 
94  //Apply Q tests
95  for (unsigned int i=0;i<qualityTests_.size();++i) {
96  if (!qualityTests_.at(i)->test(rh,hgrh,rcleaned)) {
97  keep = false;
98  }
99  }
100 
101  if(keep) {
102  rh.setTime(time);
103  out->push_back(rh);
104  }
105  else if (rcleaned)
106  cleaned->push_back(rh);
107  }
108  edm::LogInfo("HGCalRecHitCreator")
109  << "Skipped " << skipped_rechits
110  << " out of " << rechits.size() << " rechits!" << std::endl;
111  edm::LogInfo("HGCalRecHitCreator")
112  << "Created " << out->size() << " PFRecHits!" << std::endl;
113  }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
A base class to handle the particular shape of HGCal volumes.
Definition: FlatTrd.h:19
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
const DetId & detid() const
Definition: CaloRecHit.h:20
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
assert(m_qm.get())
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:37
GlobalPoint getPosition(const DetId &id) const
float time() const
Definition: CaloRecHit.h:19
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell&#39;s volume.
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
const int keep
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:35
float energy() const
Definition: CaloRecHit.h:17
def move
Definition: eostools.py:510
edm::EDGetTokenT< HGCRecHitCollection > recHitToken_
const T & get() const
Definition: EventSetup.h:56
size_type size() const
static int position[264][3]
Definition: ReadPGInfo.cc:509
virtual const CaloCellGeometry * getGeometry(const DetId &id) const override
Get the cell geometry of a given detector id. Should return false if not found.
void setOriginalRecHit(const T &rh)
Definition: PFRecHit.h:167

Member Data Documentation

template<typename DET , PFLayer::Layer Layer, ForwardSubdetector subdet>
std::string PFHGCalRecHitCreator< DET, Layer, subdet >::geometryInstance_
protected
template<typename DET , PFLayer::Layer Layer, ForwardSubdetector subdet>
edm::EDGetTokenT<HGCRecHitCollection> PFHGCalRecHitCreator< DET, Layer, subdet >::recHitToken_
protected