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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

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

Private Attributes

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<>
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
 

Detailed Description

Definition at line 24 of file GenJetGenPartMerger.cc.

Constructor & Destructor Documentation

◆ GenJetGenPartMerger()

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

Definition at line 50 of file GenJetGenPartMerger.cc.

51  : jetToken_(consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("srcJet"))),
52  partToken_(consumes<reco::GenParticleCollection>(iConfig.getParameter<edm::InputTag>("srcPart"))),
53  tauAncToken_(consumes<edm::ValueMap<bool>>(iConfig.getParameter<edm::InputTag>("hasTauAnc"))) {
54  produces<reco::GenJetCollection>("merged");
55  produces<edm::ValueMap<bool>>("hasTauAnc");
56 }

◆ ~GenJetGenPartMerger()

GenJetGenPartMerger::~GenJetGenPartMerger ( )
override

Definition at line 58 of file GenJetGenPartMerger.cc.

58 {}

Member Function Documentation

◆ beginStream()

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

Definition at line 107 of file GenJetGenPartMerger.cc.

107 {}

◆ endStream()

void GenJetGenPartMerger::endStream ( )
overrideprivate

Definition at line 110 of file GenJetGenPartMerger.cc.

110 {}

◆ produce()

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

Definition at line 65 of file GenJetGenPartMerger.cc.

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

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

Member Data Documentation

◆ jetToken_

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

Definition at line 34 of file GenJetGenPartMerger.cc.

Referenced by produce().

◆ partToken_

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

Definition at line 35 of file GenJetGenPartMerger.cc.

Referenced by produce().

◆ tauAncToken_

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

Definition at line 36 of file GenJetGenPartMerger.cc.

Referenced by produce().

GenJetGenPartMerger::tauAncToken_
const edm::EDGetTokenT< edm::ValueMap< bool > > tauAncToken_
Definition: GenJetGenPartMerger.cc:36
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
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:34
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:35
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