CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
BoostedJetMerger Class Reference

#include <BoostedJetMerger.h>

Inheritance diagram for BoostedJetMerger:
edm::stream::EDProducer<>

Public Member Functions

 BoostedJetMerger (const edm::ParameterSet &)
 
 ~BoostedJetMerger () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
 
edm::EDGetTokenT< edm::View< pat::Jet > > subjetToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 54 of file BoostedJetMerger.h.

Constructor & Destructor Documentation

◆ BoostedJetMerger()

BoostedJetMerger::BoostedJetMerger ( const edm::ParameterSet iConfig)
explicit

Definition at line 3 of file BoostedJetMerger.cc.

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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
edm::EDGetTokenT< edm::View< pat::Jet > > subjetToken_

◆ ~BoostedJetMerger()

BoostedJetMerger::~BoostedJetMerger ( )
override

Definition at line 11 of file BoostedJetMerger.cc.

11 {}

Member Function Documentation

◆ produce()

void BoostedJetMerger::produce ( edm::Event iEvent,
const edm::EventSetup  
)
overrideprivate

Definition at line 14 of file BoostedJetMerger.cc.

References iEvent, jetToken_, eostools::move(), PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, subjetToken_, and trackerHitRTTI::vector.

14  {
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 }
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::EDGetTokenT< edm::View< pat::Jet > > subjetToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ jetToken_

edm::EDGetTokenT<edm::View<pat::Jet> > BoostedJetMerger::jetToken_
private

Definition at line 65 of file BoostedJetMerger.h.

Referenced by produce().

◆ subjetToken_

edm::EDGetTokenT<edm::View<pat::Jet> > BoostedJetMerger::subjetToken_
private

Definition at line 66 of file BoostedJetMerger.h.

Referenced by produce().