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

#include <PFPSRecHitCreator.h>

Inheritance diagram for PFPSRecHitCreator:
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)
 
 PFPSRecHitCreator (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from PFRecHitCreatorBase
 PFRecHitCreatorBase ()
 
 PFRecHitCreatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 

Protected Attributes

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

Detailed Description

Definition at line 27 of file PFPSRecHitCreator.h.

Constructor & Destructor Documentation

PFPSRecHitCreator::PFPSRecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Definition at line 30 of file PFPSRecHitCreator.h.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), and recHitToken_.

30  :
31  PFRecHitCreatorBase(iConfig,iC)
32  {
34  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_

Member Function Documentation

void PFPSRecHitCreator::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 36 of file PFPSRecHitCreator.h.

References cond::rpcobgas::detid, DetId::Ecal, EcalPreshower, relval_parameters_module::energy, edm::hlt::Exception, edm::EventSetup::get(), edm::Event::getByToken(), CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), i, keep, PFLayer::NONE, position, PFLayer::PS1, PFLayer::PS2, PFRecHitCreatorBase::qualityTests_, recHitToken_, reco::PFRecHit::setNECorner(), reco::PFRecHit::setNWCorner(), reco::PFRecHit::setSECorner(), reco::PFRecHit::setSWCorner(), EZArrayFL< T >::size(), x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

36  {
37 
38  for (unsigned int i=0;i<qualityTests_.size();++i) {
39  qualityTests_.at(i)->beginEvent(iEvent,iSetup);
40  }
41 
42 
45  iSetup.get<CaloGeometryRecord>().get(geoHandle);
46 
47  // get the ecal geometry
48  const CaloSubdetectorGeometry *psGeometry =
49  geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
50 
51  iEvent.getByToken(recHitToken_,recHitHandle);
52  for( const auto& erh : *recHitHandle ) {
53  ESDetId detid(erh.detid());
54  double energy = erh.energy();
55 
56 
58 
60 
61  switch( detid.plane() ) {
62  case 1:
63  layer = PFLayer::PS1;
64  break;
65  case 2:
66  layer = PFLayer::PS2;
67  break;
68  default:
69  throw cms::Exception("PFRecHitBadInput")
70  <<"incorrect preshower plane !! plane number "
71  <<detid.plane()<<std::endl;
72  }
73 
74 
75 
76  const CaloCellGeometry *thisCell;
77  thisCell= psGeometry->getGeometry(detid);
78 
79  // find rechit geometry
80  if(!thisCell) {
81  edm::LogError("PFPSRecHitCreator")
82  <<"warning detid "<<detid.rawId()
83  <<" not found in geometry"<<std::endl;
84  continue;
85  }
86 
87  position.SetCoordinates ( thisCell->getPosition().x(),
88  thisCell->getPosition().y(),
89  thisCell->getPosition().z() );
90 
91  reco::PFRecHit rh( detid.rawId(),layer,
92  energy,
93  position.x(), position.y(), position.z(),
94  0.0,0.0,0.0);
95 
96 
97 
98  const CaloCellGeometry::CornersVec& corners = thisCell->getCorners();
99  assert( corners.size() == 8 );
100 
101  rh.setNECorner( corners[0].x(), corners[0].y(), corners[0].z() );
102  rh.setSECorner( corners[1].x(), corners[1].y(), corners[1].z() );
103  rh.setSWCorner( corners[2].x(), corners[2].y(), corners[2].z() );
104  rh.setNWCorner( corners[3].x(), corners[3].y(), corners[3].z() );
105 
106 
107  bool rcleaned = false;
108  bool keep=true;
109 
110  //Apply Q tests
111  for( const auto& qtest : qualityTests_ ) {
112  if (!qtest->test(rh,erh,rcleaned)) {
113  keep = false;
114  }
115  }
116 
117  if(keep) {
118  out->push_back(rh);
119  }
120  else if (rcleaned)
121  cleaned->push_back(rh);
122  }
123  }
int i
Definition: DBlmapReader.cc:9
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
T y() const
Definition: PV3DBase.h:63
float float float z
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const int keep
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:35
T z() const
Definition: PV3DBase.h:64
tuple out
Definition: dbtoconf.py:99
Layer
layer definition
Definition: PFLayer.h:31
size_type size() const
Definition: EZArrayFL.h:81
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const T & get() const
Definition: EventSetup.h:55
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
static int position[264][3]
Definition: ReadPGInfo.cc:509
Definition: DDAxes.h:10
const CornersVec & getCorners() const
Returns the corner points of this cell&#39;s volume.
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

edm::EDGetTokenT<EcalRecHitCollection> PFPSRecHitCreator::recHitToken_
protected

Definition at line 128 of file PFPSRecHitCreator.h.

Referenced by importRecHits(), and PFPSRecHitCreator().