CMS 3D CMS Logo

CollectionFromZLegProducer.cc
Go to the documentation of this file.
3 
9 
10 #include <memory>
11 #include <vector>
12 #include <sstream>
13 
15 // class definition
18 public:
19 
20  explicit CollectionFromZLegProducer(edm::ParameterSet const& iConfig);
21  void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;
22 
23 private:
25 };
26 
27 
28 
30 // construction
32 
34  : v_RecoCompositeCandidateToken_{consumes<std::vector<reco::CompositeCandidate>>(iConfig.getParameter<edm::InputTag>("ZCandidateCollection"))}
35 {
36  produces<std::vector<reco::CompositeCandidate>>("theTagLeg");
37  produces<std::vector<reco::CompositeCandidate>>("theProbeLeg");
38 }
39 
41 // implementation of member functions
43 
44 //______________________________________________________________________________
46 {
47  auto tagLegs = std::make_unique<std::vector<reco::CompositeCandidate>>();
48  auto probeLegs = std::make_unique<std::vector<reco::CompositeCandidate>>();
49 
52 
53  // this is specific for our 'tag and probe'
54  for (auto const& z : *zs) {
55  int c {};
56  for (auto const& leg : z) {
57  if (c == 0) {
58  tagLegs->emplace_back(leg);
59  }
60  else if (c == 1){
61  probeLegs->emplace_back(leg);
62  }
63  else {
64  break;
65  }
66  ++c;
67  }
68  }
69  iEvent.put(std::move(tagLegs), "theTagLeg");
70  iEvent.put(std::move(probeLegs), "theProbeLeg");
71 }
72 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
edm::EDGetTokenT< std::vector< reco::CompositeCandidate > > v_RecoCompositeCandidateToken_
CollectionFromZLegProducer(edm::ParameterSet const &iConfig)
def move(src, dest)
Definition: eostools.py:510