CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
GenJetGenPartMerger Class Reference
Inheritance diagram for GenJetGenPartMerger:
edm::stream::EDProducer<>

Public Member Functions

 GenJetGenPartMerger (const edm::ParameterSet &)
 
 ~GenJetGenPartMerger () 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

const StringCutObjectSelector< reco::Candidatecut_
 
const edm::EDGetTokenT< reco::GenJetCollectionjetToken_
 
const edm::EDGetTokenT< reco::GenParticleCollectionpartToken_
 
const edm::EDGetTokenT< edm::ValueMap< bool > > tauAncToken_
 

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 28 of file GenJetGenPartMerger.cc.

Constructor & Destructor Documentation

◆ GenJetGenPartMerger()

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

Definition at line 56 of file GenJetGenPartMerger.cc.

57  : jetToken_(consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("srcJet"))),
58  partToken_(consumes<reco::GenParticleCollection>(iConfig.getParameter<edm::InputTag>("srcPart"))),
59  cut_(iConfig.getParameter<std::string>("cut")),
60  tauAncToken_(consumes<edm::ValueMap<bool>>(iConfig.getParameter<edm::InputTag>("hasTauAnc"))) {
61  produces<reco::GenJetCollection>("merged");
62  produces<edm::ValueMap<bool>>("hasTauAnc");
63 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< reco::GenJetCollection > jetToken_
const StringCutObjectSelector< reco::Candidate > cut_
const edm::EDGetTokenT< reco::GenParticleCollection > partToken_
const edm::EDGetTokenT< edm::ValueMap< bool > > tauAncToken_

◆ ~GenJetGenPartMerger()

GenJetGenPartMerger::~GenJetGenPartMerger ( )
override

Definition at line 65 of file GenJetGenPartMerger.cc.

65 {}

Member Function Documentation

◆ beginStream()

void GenJetGenPartMerger::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 119 of file GenJetGenPartMerger.cc.

119 {}

◆ endStream()

void GenJetGenPartMerger::endStream ( )
overrideprivate

Definition at line 122 of file GenJetGenPartMerger.cc.

122 {}

◆ fillDescriptions()

void GenJetGenPartMerger::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 67 of file GenJetGenPartMerger.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

67  {
69  desc.add<edm::InputTag>("srcJet")->setComment("reco::GenJetCollection input collection");
70  desc.add<edm::InputTag>("srcPart")->setComment("reco::GenParticleCollection input collection");
71  desc.add<std::string>("cut")->setComment("a selection to apply to GenJet");
72  desc.add<edm::InputTag>("hasTauAnc")->setComment("value map defining GenJet tau origin");
73  descriptions.addWithDefaultLabel(desc);
74 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 80 of file GenJetGenPartMerger.cc.

References cut_, trigObjTnPSource_cfi::filler, iEvent, metsig::jet, jetToken_, eostools::move(), MillePedeFileConverter_cfg::out, partToken_, and tauAncToken_.

80  {
81  using namespace edm;
82  auto merged = std::make_unique<reco::GenJetCollection>();
83 
84  std::vector<bool> hasTauAncValues;
85 
86  auto jetHandle = iEvent.getHandle(jetToken_);
87  const auto& partProd = iEvent.get(partToken_);
88  const auto& tauAncProd = iEvent.get(tauAncToken_);
89 
90  for (unsigned int ijet = 0; ijet < jetHandle->size(); ++ijet) {
91  auto jet = jetHandle->at(ijet);
92  if (cut_(jet)) {
93  merged->push_back(reco::GenJet(jet));
94  reco::GenJetRef jetRef(jetHandle, ijet);
95  hasTauAncValues.push_back(tauAncProd[jetRef]);
96  }
97  }
98 
99  for (const auto& part : partProd) {
101  jet.setP4(part.p4());
102  jet.setPdgId(part.pdgId());
103  jet.setCharge(part.charge());
104  merged->push_back(jet);
105  hasTauAncValues.push_back(false);
106  }
107 
108  auto newmerged = iEvent.put(std::move(merged), "merged");
109 
110  auto out = std::make_unique<edm::ValueMap<bool>>();
112  filler.insert(newmerged, hasTauAncValues.begin(), hasTauAncValues.end());
113  filler.fill();
114 
115  iEvent.put(std::move(out), "hasTauAnc");
116 }
int iEvent
Definition: GenABIO.cc:224
Jets made from MC generator particles.
Definition: GenJet.h:23
part
Definition: HCALResponse.h:20
const edm::EDGetTokenT< reco::GenJetCollection > jetToken_
const StringCutObjectSelector< reco::Candidate > cut_
HLT enums.
const edm::EDGetTokenT< reco::GenParticleCollection > partToken_
const edm::EDGetTokenT< edm::ValueMap< bool > > tauAncToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ cut_

const StringCutObjectSelector<reco::Candidate> GenJetGenPartMerger::cut_
private

Definition at line 41 of file GenJetGenPartMerger.cc.

Referenced by produce().

◆ jetToken_

const edm::EDGetTokenT<reco::GenJetCollection> GenJetGenPartMerger::jetToken_
private

Definition at line 39 of file GenJetGenPartMerger.cc.

Referenced by produce().

◆ partToken_

const edm::EDGetTokenT<reco::GenParticleCollection> GenJetGenPartMerger::partToken_
private

Definition at line 40 of file GenJetGenPartMerger.cc.

Referenced by produce().

◆ tauAncToken_

const edm::EDGetTokenT<edm::ValueMap<bool> > GenJetGenPartMerger::tauAncToken_
private

Definition at line 42 of file GenJetGenPartMerger.cc.

Referenced by produce().