CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFRecHitProducer.cc
Go to the documentation of this file.
2 
3 namespace {
4  bool sortByDetId(const reco::PFRecHit& a,
5  const reco::PFRecHit& b) {
6  return a.detId() < b.detId();
7  }
8 }
9 
11 {
12 
13  produces<reco::PFRecHitCollection>();
14  produces<reco::PFRecHitCollection>("Cleaned");
15 
17 
18  std::vector<edm::ParameterSet> creators = iConfig.getParameter<std::vector<edm::ParameterSet> >("producers");
19  for (unsigned int i=0;i<creators.size();++i) {
20  std::string name = creators.at(i).getParameter<std::string>("name");
21  creators_.emplace_back(PFRecHitFactory::get()->create(name,creators.at(i),iC));
22  }
23 
24 
25  edm::ParameterSet navSet = iConfig.getParameter<edm::ParameterSet>("navigator");
26 
28 
29 }
30 
31 
33 {
34  }
35 
36 
37 //
38 // member functions
39 //
40 
41 // ------------ method called to produce the data ------------
42 void
44 {
45  using namespace edm;
46  std::auto_ptr<reco::PFRecHitCollection> out(new reco::PFRecHitCollection );
47  std::auto_ptr<reco::PFRecHitCollection> cleaned(new reco::PFRecHitCollection );
48 
49  navigator_->beginEvent(iSetup);
50 
51  for( const auto& creator : creators_ ) {
52  creator->importRecHits(out,cleaned,iEvent,iSetup);
53  }
54 
55  std::sort(out->begin(),out->end(),sortByDetId);
56 
57  //create a refprod here
60 
61  for( auto& pfrechit : *out ) {
62  navigator_->associateNeighbours(pfrechit,out,refProd);
63  }
64 
65  iEvent.put(out,"");
66  iEvent.put(cleaned,"Cleaned");
67 
68 }
69 
70 void
72  //The following says we do not know what parameters are allowed so do no validation
73  // Please change this to state exactly what you do use, even if it is no parameters
75  desc.setUnknown();
76  descriptions.addDefault(desc);
77 }
78 
T getParameter(std::string const &) const
std::vector< std::unique_ptr< PFRecHitCreatorBase > > creators_
int i
Definition: DBlmapReader.cc:9
unsigned detId() const
rechit detId
Definition: PFRecHit.h:106
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
virtual void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:35
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
RefProd< PROD > getRefBeforePut()
Definition: Event.h:141
PFRecHitProducer(const edm::ParameterSet &iConfig)
double b
Definition: hdecay.h:120
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double a
Definition: hdecay.h:121
SurfaceDeformation * create(int type, const std::vector< double > &params)
T get(const Candidate &c)
Definition: component.h:55
std::unique_ptr< PFRecHitNavigatorBase > navigator_