CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
47  iEvent.getByToken(v_RecoCompositeCandidateToken_, zs);
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 
edm::StreamID
Definition: StreamID.h:30
CompositeCandidate.h
CollectionFromZLegProducer::CollectionFromZLegProducer
CollectionFromZLegProducer(edm::ParameterSet const &iConfig)
Definition: CollectionFromZLegProducer.cc:30
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CollectionFromZLegProducer::produce
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
Definition: CollectionFromZLegProducer.cc:42
DDAxes::z
CollectionFromZLegProducer::v_RecoCompositeCandidateToken_
edm::EDGetTokenT< std::vector< reco::CompositeCandidate > > v_RecoCompositeCandidateToken_
Definition: CollectionFromZLegProducer.cc:23
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
InputTag.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
View.h
ParameterSet.h
CollectionFromZLegProducer
Definition: CollectionFromZLegProducer.cc:17
EDProducer.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15