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  explicit CollectionFromZLegProducer(edm::ParameterSet const& iConfig);
20  void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;
21 
22 private:
24 };
25 
27 // construction
29 
31  : v_RecoCompositeCandidateToken_{consumes<std::vector<reco::CompositeCandidate>>(
32  iConfig.getParameter<edm::InputTag>("ZCandidateCollection"))} {
33  produces<std::vector<reco::CompositeCandidate>>("theTagLeg");
34  produces<std::vector<reco::CompositeCandidate>>("theProbeLeg");
35 }
36 
38 // implementation of member functions
40 
41 //______________________________________________________________________________
43  auto tagLegs = std::make_unique<std::vector<reco::CompositeCandidate>>();
44  auto probeLegs = std::make_unique<std::vector<reco::CompositeCandidate>>();
45 
48 
49  // this is specific for our 'tag and probe'
50  for (auto const& z : *zs) {
51  int c{};
52  for (auto const& leg : z) {
53  if (c == 0) {
54  tagLegs->emplace_back(leg);
55  } else if (c == 1) {
56  probeLegs->emplace_back(leg);
57  } else {
58  break;
59  }
60  ++c;
61  }
62  }
63  iEvent.put(std::move(tagLegs), "theTagLeg");
64  iEvent.put(std::move(probeLegs), "theProbeLeg");
65 }
66 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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:511