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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 BoostedJetMerger (const edm::ParameterSet &)
 
 ~BoostedJetMerger ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual 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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 57 of file BoostedJetMerger.h.

Constructor & Destructor Documentation

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

Definition at line 4 of file BoostedJetMerger.cc.

4  :
7 {
8  //register products
9  produces<std::vector<pat::Jet> > ();
10  produces<std::vector<pat::Jet> > ("SubJets");
11 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
edm::EDGetTokenT< edm::View< pat::Jet > > subjetToken_
BoostedJetMerger::~BoostedJetMerger ( )

Definition at line 14 of file BoostedJetMerger.cc.

15 {
16 }

Member Function Documentation

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

Definition at line 21 of file BoostedJetMerger.cc.

References DEFINE_FWK_MODULE, edm::Event::getByToken(), edm::Event::getRefBeforePut(), jetToken_, eostools::move(), PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, edm::Event::put(), and subjetToken_.

22 {
23 
24  auto outputs = std::make_unique<std::vector<pat::Jet>>();
25  auto outputSubjets = std::make_unique<std::vector<pat::Jet>>();
26 
27  edm::RefProd< std::vector<pat::Jet> > h_subJetsOut = iEvent.getRefBeforePut< std::vector<pat::Jet> >( "SubJets" );
28 
30  edm::Handle< edm::View<pat::Jet> > subjetHandle;
31 
32  iEvent.getByToken( jetToken_, jetHandle );
33  iEvent.getByToken( subjetToken_, subjetHandle );
34 
35  for ( edm::View<pat::Jet>::const_iterator ijetBegin = jetHandle->begin(),
36  ijetEnd = jetHandle->end(), ijet = ijetBegin; ijet != ijetEnd; ++ijet ) {
37 
38  outputs->push_back( *ijet );
39  std::vector< edm::Ptr<reco::Candidate> > nextSubjets;
40 
41  for ( unsigned int isubjet = 0; isubjet < ijet->numberOfDaughters(); ++isubjet ) {
42  edm::Ptr<reco::Candidate> const & subjet = ijet->daughterPtr(isubjet);
43  edm::View<pat::Jet>::const_iterator ifound = find_if( subjetHandle->begin(),
44  subjetHandle->end(),
45  FindCorrectedSubjet(subjet) );
46  if ( ifound != subjetHandle->end() ) {
47 
48  outputSubjets->push_back( *ifound );
49 
50  edm::Ref<std::vector<pat::Jet> > subjetRef ( h_subJetsOut, outputSubjets->size() - 1);
51  edm::Ptr< pat::Jet > subjetPtr ( h_subJetsOut.id(), subjetRef.key(), h_subJetsOut.productGetter() );
52  nextSubjets.push_back( subjetPtr );
53  }
54  }
55  outputs->back().clearDaughters();
56  for ( std::vector< edm::Ptr<reco::Candidate> >::const_iterator nextSubjet = nextSubjets.begin(),
57  nextSubjetEnd = nextSubjets.end(); nextSubjet != nextSubjetEnd; ++nextSubjet ) {
58  outputs->back().addDaughter( *nextSubjet );
59  }
60 
61 
62  }
63 
64 
65  iEvent.put(std::move(outputs));
66  iEvent.put(std::move(outputSubjets), "SubJets");
67 
68 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
RefProd< PROD > getRefBeforePut()
Definition: Event.h:134
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:510

Member Data Documentation

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

Definition at line 68 of file BoostedJetMerger.h.

Referenced by produce().

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

Definition at line 69 of file BoostedJetMerger.h.

Referenced by produce().