CMS 3D CMS Logo

List of all members | 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
 

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

Constructor & Destructor Documentation

◆ GenJetGenPartMerger()

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

Definition at line 53 of file GenJetGenPartMerger.cc.

54  : jetToken_(consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("srcJet"))),
55  partToken_(consumes<reco::GenParticleCollection>(iConfig.getParameter<edm::InputTag>("srcPart"))),
56  cut_(iConfig.getParameter<std::string>("cut")),
57  tauAncToken_(consumes<edm::ValueMap<bool>>(iConfig.getParameter<edm::InputTag>("hasTauAnc"))) {
58  produces<reco::GenJetCollection>("merged");
59  produces<edm::ValueMap<bool>>("hasTauAnc");
60 }

◆ ~GenJetGenPartMerger()

GenJetGenPartMerger::~GenJetGenPartMerger ( )
override

Definition at line 62 of file GenJetGenPartMerger.cc.

62 {}

Member Function Documentation

◆ beginStream()

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

Definition at line 113 of file GenJetGenPartMerger.cc.

113 {}

◆ endStream()

void GenJetGenPartMerger::endStream ( )
overrideprivate

Definition at line 116 of file GenJetGenPartMerger.cc.

116 {}

◆ produce()

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

Definition at line 69 of file GenJetGenPartMerger.cc.

69  {
70  using namespace edm;
71  std::unique_ptr<reco::GenJetCollection> merged(new reco::GenJetCollection);
72 
73  std::vector<bool> hasTauAncValues;
74 
76  iEvent.getByToken(jetToken_, jetHandle);
77 
79  iEvent.getByToken(partToken_, partHandle);
80 
81  edm::Handle<edm::ValueMap<bool>> tauAncHandle;
82  iEvent.getByToken(tauAncToken_, tauAncHandle);
83 
84  for (unsigned int ijet = 0; ijet < jetHandle->size(); ++ijet) {
85  auto jet = jetHandle->at(ijet);
86  if (cut_(jet)) {
87  merged->push_back(reco::GenJet(jet));
88  reco::GenJetRef jetRef(jetHandle, ijet);
89  hasTauAncValues.push_back((*tauAncHandle)[jetRef]);
90  }
91  }
92 
93  for (auto& part : *partHandle) {
95  jet.setP4(part.p4());
96  jet.setPdgId(part.pdgId());
97  jet.setCharge(part.charge());
98  merged->push_back(jet);
99  hasTauAncValues.push_back(false);
100  }
101 
102  auto newmerged = iEvent.put(std::move(merged), "merged");
103 
104  std::unique_ptr<edm::ValueMap<bool>> out(new edm::ValueMap<bool>());
106  filler.insert(newmerged, hasTauAncValues.begin(), hasTauAncValues.end());
107  filler.fill();
108 
109  iEvent.put(std::move(out), "hasTauAnc");
110 }

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

Member Data Documentation

◆ cut_

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

Definition at line 38 of file GenJetGenPartMerger.cc.

Referenced by produce().

◆ jetToken_

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

Definition at line 36 of file GenJetGenPartMerger.cc.

Referenced by produce().

◆ partToken_

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

Definition at line 37 of file GenJetGenPartMerger.cc.

Referenced by produce().

◆ tauAncToken_

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

Definition at line 39 of file GenJetGenPartMerger.cc.

Referenced by produce().

GenJetGenPartMerger::tauAncToken_
const edm::EDGetTokenT< edm::ValueMap< bool > > tauAncToken_
Definition: GenJetGenPartMerger.cc:39
reco::GenJet
Jets made from MC generator particles.
Definition: GenJet.h:23
reco::GenJetCollection
std::vector< GenJet > GenJetCollection
collection of GenJet objects
Definition: GenJetCollection.h:14
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::Handle< reco::GenJetCollection >
edm::Ref
Definition: AssociativeIterator.h:58
part
part
Definition: HCALResponse.h:20
GenJetGenPartMerger::cut_
const StringCutObjectSelector< reco::Candidate > cut_
Definition: GenJetGenPartMerger.cc:38
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
GenJetGenPartMerger::jetToken_
const edm::EDGetTokenT< reco::GenJetCollection > jetToken_
Definition: GenJetGenPartMerger.cc:36
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
eostools.move
def move(src, dest)
Definition: eostools.py:511
metsig::jet
Definition: SignAlgoResolutions.h:47
GenJetGenPartMerger::partToken_
const edm::EDGetTokenT< reco::GenParticleCollection > partToken_
Definition: GenJetGenPartMerger.cc:37
edm::ValueMap
Definition: ValueMap.h:107
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::helper::Filler
Definition: ValueMap.h:22
edm::InputTag
Definition: InputTag.h:15