CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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  edm::ConsumesCollector iC = consumesCollector();
26  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  void produce(edm::Event&, const edm::EventSetup&) override;
42 
44 };
45 
48  iEvent.getByToken(muonToken_, muons);
49 
50  // reserve some space for output
51  std::vector<reco::MuonShower> showerInfoValues;
52  showerInfoValues.reserve(muons->size());
53 
54  for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
55  // if (!muon->isGlobalMuon() && !muon->isStandAloneMuon()) continue;
56  showerInfoValues.push_back(showerFiller_->fillShowerInformation(*muon, iEvent, iSetup));
57  }
58 
59  // create and fill value map
60  auto outC = std::make_unique<edm::ValueMap<reco::MuonShower>>();
62  fillerC.insert(muons, showerInfoValues.begin(), showerInfoValues.end());
63  fillerC.fill();
64 
65  // put value map into event
66  iEvent.put(std::move(outC));
67 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
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:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MuonShowerInformationProducer(const edm::ParameterSet &iConfig)
MuonShowerInformationFiller * showerFiller_
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
edm::EDGetTokenT< reco::MuonCollection > muonToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
tuple muons
Definition: patZpeak.py:39
void produce(edm::Event &, const edm::EventSetup &) override