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
PFEcalRecHitCreator< Geometry, Layer, Detector > Class Template Reference

#include <PFEcalRecHitCreator.h>

Inheritance diagram for PFEcalRecHitCreator< Geometry, Layer, Detector >:
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)
 
 PFEcalRecHitCreator (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_
 

Additional Inherited Members

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

Detailed Description

template<typename Geometry, PFLayer::Layer Layer, int Detector>
class PFEcalRecHitCreator< Geometry, Layer, Detector >

Definition at line 27 of file PFEcalRecHitCreator.h.

Constructor & Destructor Documentation

template<typename Geometry , PFLayer::Layer Layer, int Detector>
PFEcalRecHitCreator< Geometry, Layer, Detector >::PFEcalRecHitCreator ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Definition at line 30 of file PFEcalRecHitCreator.h.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), and PFEcalRecHitCreator< Geometry, Layer, Detector >::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

template<typename Geometry , PFLayer::Layer Layer, int Detector>
void PFEcalRecHitCreator< Geometry, Layer, Detector >::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 PFEcalRecHitCreator.h.

References PFRecHitCreatorBase::beginEvent(), align::Detector, DetId::Ecal, relval_parameters_module::energy, edm::EventSetup::get(), edm::Event::getByToken(), keep, eostools::move(), PFRecHitCreatorBase::qualityTests_, DetId::rawId(), and PFEcalRecHitCreator< Geometry, Layer, Detector >::recHitToken_.

36  {
37 
38  beginEvent(iEvent,iSetup);
39 
41 
43  iSetup.get<CaloGeometryRecord>().get(geoHandle);
44 
45  // get the ecal geometry
46  const CaloSubdetectorGeometry *gTmp =
47  geoHandle->getSubdetectorGeometry(DetId::Ecal, Detector);
48 
49  const Geometry *ecalGeo =dynamic_cast< const Geometry* > (gTmp);
50 
51  iEvent.getByToken(recHitToken_,recHitHandle);
52  for(const auto& erh : *recHitHandle ) {
53  const DetId& detid = erh.detid();
54  auto energy = erh.energy();
55  auto time = erh.time();
56 
57  const CaloCellGeometry * thisCell= ecalGeo->getGeometry(detid);
58 
59  // find rechit geometry
60  if(!thisCell) {
61  edm::LogError("PFEcalRecHitCreator")
62  <<"warning detid "<<detid.rawId()
63  <<" not found in geometry"<<std::endl;
64  continue;
65  }
66 
67  out->emplace_back(thisCell, detid.rawId(),Layer,
68  energy);
69 
70  auto & rh = out->back();
71 
72  bool rcleaned = false;
73  bool keep=true;
74 
75  //Apply Q tests
76  for( const auto& qtest : qualityTests_ ) {
77  if (!qtest->test(rh,erh,rcleaned)) {
78  keep = false;
79  }
80  }
81 
82  if(keep) {
83  rh.setTime(time);
84  rh.setDepth(1);
85  }
86  else {
87  if (rcleaned)
88  cleaned->push_back(std::move(out->back()));
89  out->pop_back();
90  }
91  }
92  }
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const int keep
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
def move
Definition: eostools.py:510
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:56

Member Data Documentation

template<typename Geometry , PFLayer::Layer Layer, int Detector>
edm::EDGetTokenT<EcalRecHitCollection> PFEcalRecHitCreator< Geometry, Layer, Detector >::recHitToken_
protected