CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonShowerInformationProducer.cc
Go to the documentation of this file.
1 #include <string>
2 #include <vector>
3 
9 
16 
18 
20 public:
22  inputMuonCollection_(iConfig.getParameter<edm::InputTag>("muonCollection")),
23  inputTrackCollection_(iConfig.getParameter<edm::InputTag>("trackCollection"))
24  {
26  showerFiller_ = new MuonShowerInformationFiller(iConfig.getParameter<edm::ParameterSet>("ShowerInformationFillerParameters"),iC);
27 
28  muonToken_ = consumes<reco::MuonCollection>(inputMuonCollection_);
29 
30  produces<edm::ValueMap<reco::MuonShower> >().setBranchAlias("muonShowerInformation");
31  }
33  if( showerFiller_)
34  delete showerFiller_;
35  }
36 
37 private:
38  virtual void produce(edm::Event&, const edm::EventSetup&) override;
42 
43 
44 
46 };
47 
48 void
50 {
52  iEvent.getByToken(muonToken_, muons);
53 
54  // reserve some space for output
55  std::vector<reco::MuonShower> showerInfoValues;
56  showerInfoValues.reserve(muons->size());
57 
58  for(reco::MuonCollection::const_iterator muon = muons->begin();
59  muon != muons->end(); ++muon)
60  {
61  // if (!muon->isGlobalMuon() && !muon->isStandAloneMuon()) continue;
62  showerInfoValues.push_back(showerFiller_->fillShowerInformation(*muon,iEvent,iSetup));
63  }
64 
65  // create and fill value map
66  std::auto_ptr<edm::ValueMap<reco::MuonShower> > outC(new edm::ValueMap<reco::MuonShower>());
68  fillerC.insert(muons, showerInfoValues.begin(), showerInfoValues.end());
69  fillerC.fill();
70 
71  // put value map into event
72  iEvent.put(outC);
73 }
T getParameter(std::string const &) const
reco::MuonShower fillShowerInformation(const reco::Muon &muon, const edm::Event &, const edm::EventSetup &)
fill muon shower variables
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
MuonShowerInformationProducer(const edm::ParameterSet &iConfig)
MuonShowerInformationFiller * showerFiller_
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< reco::MuonCollection > muonToken_
tuple muons
Definition: patZpeak.py:38
virtual void produce(edm::Event &, const edm::EventSetup &) override