CMS 3D CMS Logo

PFRecHitProducer.cc
Go to the documentation of this file.
3 
4 namespace {
5  bool sortByDetId(const reco::PFRecHit& a, const reco::PFRecHit& b) { return a.detId() < b.detId(); }
6 
7  edm::RunningAverage localRA1;
8  edm::RunningAverage localRA2;
9 } // namespace
10 
12  produces<reco::PFRecHitCollection>();
13  produces<reco::PFRecHitCollection>("Cleaned");
14 
15  edm::ConsumesCollector iC = consumesCollector();
16 
17  std::vector<edm::ParameterSet> creators = iConfig.getParameter<std::vector<edm::ParameterSet> >("producers");
18  for (auto& creator : creators) {
19  std::string name = creator.getParameter<std::string>("name");
20  creators_.emplace_back(PFRecHitFactory::get()->create(name, creator, iC));
21  }
22 
23  edm::ParameterSet navSet = iConfig.getParameter<edm::ParameterSet>("navigator");
24  navigator_ = PFRecHitNavigationFactory::get()->create(navSet.getParameter<std::string>("name"), navSet);
25 }
26 
28 
29 //
30 // member functions
31 //
32 
34  for (const auto& creator : creators_) {
35  creator->init(iSetup);
36  }
37  navigator_->init(iSetup);
38 }
39 
41 
42 // ------------ method called to produce the data ------------
44  using namespace edm;
45  auto out = std::make_unique<reco::PFRecHitCollection>();
46  auto cleaned = std::make_unique<reco::PFRecHitCollection>();
47 
48  out->reserve(localRA1.upper());
49  cleaned->reserve(localRA2.upper());
50 
51  for (const auto& creator : creators_) {
52  creator->importRecHits(out, cleaned, iEvent, iSetup);
53  }
54 
55  if (out->capacity() > 2 * out->size())
56  out->shrink_to_fit();
57  if (cleaned->capacity() > 2 * cleaned->size())
58  cleaned->shrink_to_fit();
59  localRA1.update(out->size());
60  localRA2.update(cleaned->size());
61  std::sort(out->begin(), out->end(), sortByDetId);
62 
63  //create a refprod here
65 
66  for (auto& pfrechit : *out) {
67  navigator_->associateNeighbours(pfrechit, out, refProd);
68  }
69 
70  iEvent.put(std::move(out), "");
71  iEvent.put(std::move(cleaned), "Cleaned");
72 }
73 
75  //The following says we do not know what parameters are allowed so do no validation
76  // Please change this to state exactly what you do use, even if it is no parameters
78  desc.setUnknown();
79  descriptions.addDefault(desc);
80 }
RunningAverage.h
edm::RefProd
Definition: EDProductfwd.h:25
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
PFRecHitProducer::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &, const edm::EventSetup &) override
Definition: PFRecHitProducer.cc:33
PFRecHitProducer::~PFRecHitProducer
~PFRecHitProducer() override
PFRecHitProducer::PFRecHitProducer
PFRecHitProducer(const edm::ParameterSet &iConfig)
Definition: PFRecHitProducer.cc:11
reco::PFRecHitCollection
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
b
double b
Definition: hdecay.h:118
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
PFRecHitProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: PFRecHitProducer.cc:43
iEvent
int iEvent
Definition: GenABIO.cc:224
PFRecHitProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PFRecHitProducer.cc:74
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
PFRecHitProducer::creators_
std::vector< std::unique_ptr< PFRecHitCreatorBase > > creators_
Definition: PFRecHitProducer.h:32
PFRecHitProducer::navigator_
std::unique_ptr< PFRecHitNavigatorBase > navigator_
Definition: PFRecHitProducer.h:33
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
reco::PFRecHit
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
PFRecHitProducer::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &, const edm::EventSetup &) override
Definition: PFRecHitProducer.cc:40
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::Event
Definition: Event.h:73
PFRecHitProducer.h
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
edm::RunningAverage
Definition: RunningAverage.h:17