CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PFRecHitProducer Class Referencefinal

#include <PFRecHitProducer.h>

Inheritance diagram for PFRecHitProducer:
edm::stream::EDProducer<>

Public Member Functions

 PFRecHitProducer (const edm::ParameterSet &iConfig)
 
 ~PFRecHitProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginLuminosityBlock (edm::LuminosityBlock const &, const edm::EventSetup &) override
 
void endLuminosityBlock (edm::LuminosityBlock const &, const edm::EventSetup &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< std::unique_ptr< PFRecHitCreatorBase > > creators_
 
bool init_
 
std::unique_ptr< PFRecHitNavigatorBasenavigator_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 21 of file PFRecHitProducer.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file PFRecHitProducer.cc.

References beamerCreator::create(), creators_, reco::get(), edm::ParameterSet::getParameter(), dataset::name, navigator_, AlCaHLTBitMon_QueryRunRegistry::string, and ~PFRecHitProducer().

15 {
16 
17  produces<reco::PFRecHitCollection>();
18  produces<reco::PFRecHitCollection>("Cleaned");
19 
20  edm::ConsumesCollector iC = consumesCollector();
21 
22  std::vector<edm::ParameterSet> creators = iConfig.getParameter<std::vector<edm::ParameterSet> >("producers");
23  for (auto & creator : creators) {
24  std::string name = creator.getParameter<std::string>("name");
25  creators_.emplace_back(PFRecHitFactory::get()->create(name,creator,iC));
26  }
27 
28 
29  edm::ParameterSet navSet = iConfig.getParameter<edm::ParameterSet>("navigator");
30 
31  navigator_ = std::unique_ptr<PFRecHitNavigatorBase>{PFRecHitNavigationFactory::get()->create(navSet.getParameter<std::string>("name"),navSet)};
32 
33 }
T getParameter(std::string const &) const
std::vector< std::unique_ptr< PFRecHitCreatorBase > > creators_
def create(alignables, pedeDump, additionalData, outputFile, config)
T get(const Candidate &c)
Definition: component.h:55
std::unique_ptr< PFRecHitNavigatorBase > navigator_
PFRecHitProducer::~PFRecHitProducer ( )
overridedefault

Referenced by PFRecHitProducer().

Member Function Documentation

void PFRecHitProducer::beginLuminosityBlock ( edm::LuminosityBlock const &  iLumi,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 44 of file PFRecHitProducer.cc.

References creators_.

44  {
45  for( const auto& creator : creators_ ) {
46  creator->init(iSetup);
47  }
48 }
std::vector< std::unique_ptr< PFRecHitCreatorBase > > creators_
void PFRecHitProducer::endLuminosityBlock ( edm::LuminosityBlock const &  iLumi,
const edm::EventSetup  
)
overrideprivate

Definition at line 51 of file PFRecHitProducer.cc.

51 { }
void PFRecHitProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 90 of file PFRecHitProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

90  {
91  //The following says we do not know what parameters are allowed so do no validation
92  // Please change this to state exactly what you do use, even if it is no parameters
94  desc.setUnknown();
95  descriptions.addDefault(desc);
96 }
void addDefault(ParameterSetDescription const &psetDescription)
void PFRecHitProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 55 of file PFRecHitProducer.cc.

References creators_, edm::Event::getRefBeforePut(), eostools::move(), navigator_, MillePedeFileConverter_cfg::out, edm::Event::put(), and jetUpdater_cfi::sort.

56 {
57  using namespace edm;
58  auto out = std::make_unique<reco::PFRecHitCollection>();
59  auto cleaned = std::make_unique<reco::PFRecHitCollection>();
60 
61  navigator_->beginEvent(iSetup);
62 
63  out->reserve(localRA1.upper());
64  cleaned->reserve(localRA2.upper());
65 
66  for( const auto& creator : creators_ ) {
67  creator->importRecHits(out,cleaned,iEvent,iSetup);
68  }
69 
70  if (out->capacity()>2*out->size()) out->shrink_to_fit();
71  if (cleaned->capacity()>2*cleaned->size()) cleaned->shrink_to_fit();
72  localRA1.update(out->size());
73  localRA2.update(cleaned->size());
74  std::sort(out->begin(),out->end(),sortByDetId);
75 
76  //create a refprod here
79 
80  for( auto& pfrechit : *out ) {
81  navigator_->associateNeighbours(pfrechit,out,refProd);
82  }
83 
84  iEvent.put(std::move(out),"");
85  iEvent.put(std::move(cleaned),"Cleaned");
86 
87 }
std::vector< std::unique_ptr< PFRecHitCreatorBase > > creators_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
RefProd< PROD > getRefBeforePut()
Definition: Event.h:150
HLT enums.
def move(src, dest)
Definition: eostools.py:511
std::unique_ptr< PFRecHitNavigatorBase > navigator_

Member Data Documentation

std::vector<std::unique_ptr<PFRecHitCreatorBase> > PFRecHitProducer::creators_
private

Definition at line 32 of file PFRecHitProducer.h.

Referenced by beginLuminosityBlock(), PFRecHitProducer(), and produce().

bool PFRecHitProducer::init_
private

Definition at line 34 of file PFRecHitProducer.h.

std::unique_ptr<PFRecHitNavigatorBase> PFRecHitProducer::navigator_
private

Definition at line 33 of file PFRecHitProducer.h.

Referenced by PFRecHitProducer(), and produce().