CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Attributes | Private Member Functions
TtFullHadHypGenMatch Class Reference
Inheritance diagram for TtFullHadHypGenMatch:
TtFullHadHypothesis edm::stream::EDProducer<>

Public Member Functions

 TtFullHadHypGenMatch (const edm::ParameterSet &cfg)
 
- Public Member Functions inherited from TtFullHadHypothesis
 TtFullHadHypothesis (const edm::ParameterSet &cfg)
 default constructor More...
 
- 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
 

Protected Attributes

edm::EDGetTokenT< TtGenEventgenEvtToken_
 
- Protected Attributes inherited from TtFullHadHypothesis
std::unique_ptr
< reco::ShallowClonePtrCandidate
b_
 
std::unique_ptr
< reco::ShallowClonePtrCandidate
bBar_
 
bool getMatch_
 
std::string jetCorrectionLevel_
 
edm::EDGetTokenT< std::vector
< pat::Jet > > 
jetsToken_
 input label for all necessary collections More...
 
int key_
 hypothesis key (to be set by the buildKey function) More...
 
std::unique_ptr
< reco::ShallowClonePtrCandidate
lightP_
 
std::unique_ptr
< reco::ShallowClonePtrCandidate
lightPBar_
 
std::unique_ptr
< reco::ShallowClonePtrCandidate
lightQ_
 
std::unique_ptr
< reco::ShallowClonePtrCandidate
lightQBar_
 
edm::EDGetTokenT< std::vector
< std::vector< int > > > 
matchToken_
 

Private Member Functions

void buildHypo (edm::Event &evt, const edm::Handle< std::vector< pat::Jet > > &jets, std::vector< int > &match, const unsigned int iComb) override
 build event hypothesis from the reco objects of a semi-leptonic event More...
 
void buildKey () override
 build the event hypothesis key More...
 

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
 
- Protected Member Functions inherited from TtFullHadHypothesis
reco::CompositeCandidate hypo ()
 return event hypothesis More...
 
bool isValid (const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
 check if index is in valid range of selected jets More...
 
std::string jetCorrectionLevel (const std::string &quarkType)
 helper function to construct the proper correction level string for corresponding quarkType More...
 
int key () const
 return key More...
 
template<typename C >
std::unique_ptr
< reco::ShallowClonePtrCandidate
makeCandidate (const edm::Handle< C > &handle, const int &idx)
 use one object in a collection to set a ShallowClonePtrCandidate More...
 
std::unique_ptr
< reco::ShallowClonePtrCandidate
makeCandidate (const edm::Handle< std::vector< pat::Jet > > &handle, const int &idx, const std::string &correctionLevel)
 use one object in a jet collection to set a ShallowClonePtrCandidate with proper jet corrections More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 produce the event hypothesis as CompositeCandidate and Key More...
 
void resetCandidates ()
 reset candidate pointers before hypo build process More...
 

Detailed Description

Definition at line 5 of file TtFullHadHypGenMatch.cc.

Constructor & Destructor Documentation

TtFullHadHypGenMatch::TtFullHadHypGenMatch ( const edm::ParameterSet cfg)
explicit

Definition at line 22 of file TtFullHadHypGenMatch.cc.

23  : TtFullHadHypothesis(cfg), genEvtToken_(consumes<TtGenEvent>(edm::InputTag("genEvt"))) {}
TtFullHadHypothesis(const edm::ParameterSet &cfg)
default constructor
edm::EDGetTokenT< TtGenEvent > genEvtToken_

Member Function Documentation

void TtFullHadHypGenMatch::buildHypo ( edm::Event evt,
const edm::Handle< std::vector< pat::Jet > > &  jets,
std::vector< int > &  match,
const unsigned int  iComb 
)
overrideprivatevirtual

build event hypothesis from the reco objects of a semi-leptonic event

Implements TtFullHadHypothesis.

Definition at line 25 of file TtFullHadHypGenMatch.cc.

References funct::abs(), TtFullHadEvtPartons::B, TtFullHadHypothesis::b_, TtFullHadEvtPartons::BBar, TtFullHadHypothesis::bBar_, TtGenEvtProducer_cfi::genEvt, genEvtToken_, edm::Event::getByToken(), TtFullHadHypothesis::isValid(), TtFullHadHypothesis::jetCorrectionLevel(), fwrapper::jets, TtFullHadEvtPartons::LightP, TtFullHadHypothesis::lightP_, TtFullHadEvtPartons::LightPBar, TtFullHadHypothesis::lightPBar_, TtFullHadEvtPartons::LightQ, TtFullHadHypothesis::lightQ_, TtFullHadEvtPartons::LightQBar, TtFullHadHypothesis::lightQBar_, and TtFullHadHypothesis::makeCandidate().

28  {
29  // -----------------------------------------------------
30  // get genEvent (to distinguish between uds and c quarks)
31  // -----------------------------------------------------
33  evt.getByToken(genEvtToken_, genEvt);
34 
35  // -----------------------------------------------------
36  // add jets
37  // -----------------------------------------------------
38  for (unsigned idx = 0; idx < match.size(); ++idx) {
39  if (isValid(match[idx], jets)) {
40  switch (idx) {
42  if (std::abs(genEvt->daughterQuarkOfWPlus()->pdgId()) == 4)
43  lightQ_ = makeCandidate(jets, match[idx], jetCorrectionLevel("cQuark"));
44  else
45  lightQ_ = makeCandidate(jets, match[idx], jetCorrectionLevel("udsQuark"));
46  break;
48  if (std::abs(genEvt->daughterQuarkBarOfWPlus()->pdgId()) == 4)
49  lightQBar_ = makeCandidate(jets, match[idx], jetCorrectionLevel("cQuark"));
50  else
51  lightQBar_ = makeCandidate(jets, match[idx], jetCorrectionLevel("udsQuark"));
52  break;
54  b_ = makeCandidate(jets, match[idx], jetCorrectionLevel("bQuark"));
55  break;
57  if (std::abs(genEvt->daughterQuarkOfWMinus()->pdgId()) == 4)
58  lightP_ = makeCandidate(jets, match[idx], jetCorrectionLevel("cQuark"));
59  else
60  lightP_ = makeCandidate(jets, match[idx], jetCorrectionLevel("udsQuark"));
61  break;
63  if (std::abs(genEvt->daughterQuarkBarOfWMinus()->pdgId()) == 4)
64  lightPBar_ = makeCandidate(jets, match[idx], jetCorrectionLevel("cQuark"));
65  else
66  lightPBar_ = makeCandidate(jets, match[idx], jetCorrectionLevel("udsQuark"));
67  break;
69  bBar_ = makeCandidate(jets, match[idx], jetCorrectionLevel("bQuark"));
70  break;
71  }
72  }
73  }
74 }
std::unique_ptr< reco::ShallowClonePtrCandidate > makeCandidate(const edm::Handle< C > &handle, const int &idx)
use one object in a collection to set a ShallowClonePtrCandidate
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::string jetCorrectionLevel(const std::string &quarkType)
helper function to construct the proper correction level string for corresponding quarkType ...
std::unique_ptr< reco::ShallowClonePtrCandidate > b_
std::unique_ptr< reco::ShallowClonePtrCandidate > lightP_
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
check if index is in valid range of selected jets
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::unique_ptr< reco::ShallowClonePtrCandidate > bBar_
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQ_
std::unique_ptr< reco::ShallowClonePtrCandidate > lightPBar_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
edm::EDGetTokenT< TtGenEvent > genEvtToken_
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQBar_
void TtFullHadHypGenMatch::buildKey ( )
inlineoverrideprivatevirtual

build the event hypothesis key

Implements TtFullHadHypothesis.

Definition at line 11 of file TtFullHadHypGenMatch.cc.

References TtFullHadHypothesis::key_, and TtEvent::kGenMatch.

int key_
hypothesis key (to be set by the buildKey function)

Member Data Documentation

edm::EDGetTokenT<TtGenEvent> TtFullHadHypGenMatch::genEvtToken_
protected

Definition at line 19 of file TtFullHadHypGenMatch.cc.

Referenced by buildHypo().