CMS 3D CMS Logo

BoostedJetMerger.cc
Go to the documentation of this file.
2 
4  : jetToken_(consumes<edm::View<pat::Jet>>(iConfig.getParameter<edm::InputTag>("jetSrc"))),
5  subjetToken_(consumes<edm::View<pat::Jet>>(iConfig.getParameter<edm::InputTag>("subjetSrc"))) {
6  //register products
7  produces<std::vector<pat::Jet>>();
8  produces<std::vector<pat::Jet>>("SubJets");
9 }
10 
12 
13 // ------------ method called to produce the data ------------
15  auto outputs = std::make_unique<std::vector<pat::Jet>>();
16  auto outputSubjets = std::make_unique<std::vector<pat::Jet>>();
17 
18  edm::RefProd<std::vector<pat::Jet>> h_subJetsOut = iEvent.getRefBeforePut<std::vector<pat::Jet>>("SubJets");
19 
21  edm::Handle<edm::View<pat::Jet>> subjetHandle;
22 
23  iEvent.getByToken(jetToken_, jetHandle);
24  iEvent.getByToken(subjetToken_, subjetHandle);
25 
26  for (edm::View<pat::Jet>::const_iterator ijetBegin = jetHandle->begin(), ijetEnd = jetHandle->end(), ijet = ijetBegin;
27  ijet != ijetEnd;
28  ++ijet) {
29  outputs->push_back(*ijet);
30  std::vector<edm::Ptr<reco::Candidate>> nextSubjets;
31 
32  for (unsigned int isubjet = 0; isubjet < ijet->numberOfDaughters(); ++isubjet) {
33  edm::Ptr<reco::Candidate> const& subjet = ijet->daughterPtr(isubjet);
35  find_if(subjetHandle->begin(), subjetHandle->end(), FindCorrectedSubjet(subjet));
36  if (ifound != subjetHandle->end()) {
37  outputSubjets->push_back(*ifound);
38 
39  edm::Ref<std::vector<pat::Jet>> subjetRef(h_subJetsOut, outputSubjets->size() - 1);
40  edm::Ptr<pat::Jet> subjetPtr(h_subJetsOut.id(), subjetRef.key(), h_subJetsOut.productGetter());
41  nextSubjets.push_back(subjetPtr);
42  }
43  }
44  outputs->back().clearDaughters();
45  for (std::vector<edm::Ptr<reco::Candidate>>::const_iterator nextSubjet = nextSubjets.begin(),
46  nextSubjetEnd = nextSubjets.end();
47  nextSubjet != nextSubjetEnd;
48  ++nextSubjet) {
49  outputs->back().addDaughter(*nextSubjet);
50  }
51  }
52 
53  iEvent.put(std::move(outputs));
54  iEvent.put(std::move(outputSubjets), "SubJets");
55 }
56 
57 //define this as a plug-in
edm::RefProd
Definition: EDProductfwd.h:25
BoostedJetMerger
Definition: BoostedJetMerger.h:54
sistrip::View
View
Definition: ConstantsForView.h:26
edm
HLT enums.
Definition: AlignableModifier.h:19
PatBasicFWLiteJetAnalyzer_Selector_cfg.outputs
outputs
Definition: PatBasicFWLiteJetAnalyzer_Selector_cfg.py:48
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
BoostedJetMerger::BoostedJetMerger
BoostedJetMerger(const edm::ParameterSet &)
Definition: BoostedJetMerger.cc:3
BoostedJetMerger::jetToken_
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
Definition: BoostedJetMerger.h:65
FindCorrectedSubjet
Definition: BoostedJetMerger.h:38
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Jet
Definition: Jet.py:1
BoostedJetMerger::~BoostedJetMerger
~BoostedJetMerger() override
Definition: BoostedJetMerger.cc:11
BoostedJetMerger::subjetToken_
edm::EDGetTokenT< edm::View< pat::Jet > > subjetToken_
Definition: BoostedJetMerger.h:66
edm::ParameterSet
Definition: ParameterSet.h:47
BoostedJetMerger::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: BoostedJetMerger.cc:14
iEvent
int iEvent
Definition: GenABIO.cc:224
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
BoostedJetMerger.h
edm::EventSetup
Definition: EventSetup.h:57
pat
Definition: HeavyIon.h:7
edm::Ptr< reco::Candidate >
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::Event
Definition: Event.h:73