CMS 3D CMS Logo

TtFullHadHypGenMatch.cc
Go to the documentation of this file.
3 
5  TtFullHadHypothesis( cfg ),
6  genEvtToken_( consumes<TtGenEvent>( edm::InputTag( "genEvt" ) ) )
7 {
8 }
9 
11 
12 void
14  const edm::Handle<std::vector<pat::Jet> >& jets,
15  std::vector<int>& match,
16  const unsigned int iComb)
17 {
18  // -----------------------------------------------------
19  // get genEvent (to distinguish between uds and c quarks)
20  // -----------------------------------------------------
22  evt.getByToken(genEvtToken_, genEvt);
23 
24  // -----------------------------------------------------
25  // add jets
26  // -----------------------------------------------------
27  for(unsigned idx=0; idx<match.size(); ++idx){
28  if( isValid(match[idx], jets) ){
29  switch(idx){
31  if( std::abs(genEvt->daughterQuarkOfWPlus()->pdgId())==4 )
32  setCandidate(jets, match[idx], lightQ_ , jetCorrectionLevel("cQuark"));
33  else
34  setCandidate(jets, match[idx], lightQ_ , jetCorrectionLevel("udsQuark"));
35  break;
37  if( std::abs(genEvt->daughterQuarkBarOfWPlus()->pdgId())==4 )
38  setCandidate(jets, match[idx], lightQBar_, jetCorrectionLevel("cQuark"));
39  else
40  setCandidate(jets, match[idx], lightQBar_, jetCorrectionLevel("udsQuark"));
41  break;
43  setCandidate(jets, match[idx], b_ , jetCorrectionLevel("bQuark")); break;
45  if( std::abs(genEvt->daughterQuarkOfWMinus()->pdgId())==4 )
46  setCandidate(jets, match[idx], lightP_ , jetCorrectionLevel("cQuark"));
47  else
48  setCandidate(jets, match[idx], lightP_ , jetCorrectionLevel("udsQuark"));
49  break;
51  if( std::abs(genEvt->daughterQuarkBarOfWMinus()->pdgId())==4 )
52  setCandidate(jets, match[idx], lightPBar_, jetCorrectionLevel("cQuark"));
53  else
54  setCandidate(jets, match[idx], lightPBar_, jetCorrectionLevel("udsQuark"));
55  break;
57  setCandidate(jets, match[idx], bBar_ , jetCorrectionLevel("bQuark")); break;
58  }
59  }
60  }
61 }
void setCandidate(const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
use one object in a collection to set a ShallowClonePtrCandidate
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::string jetCorrectionLevel(const std::string &quarkType)
helper function to construct the proper correction level string for corresponding quarkType ...
const reco::GenParticle * daughterQuarkOfWPlus(bool invertQuarkCharge=false, bool invertBosonCharge=false) const
return quark daughter quark of W boson
Definition: TopGenEvent.cc:170
reco::ShallowClonePtrCandidate * lightPBar_
Class derived from the TopGenEvent for ttbar events.
Definition: TtGenEvent.h:18
vector< PseudoJet > jets
virtual int pdgId() const final
PDG identifier.
reco::ShallowClonePtrCandidate * lightQBar_
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
reco::ShallowClonePtrCandidate * lightP_
virtual void buildHypo(edm::Event &evt, const edm::Handle< std::vector< pat::Jet > > &jets, std::vector< int > &match, const unsigned int iComb)
build event hypothesis from the reco objects of a semi-leptonic event
reco::ShallowClonePtrCandidate * bBar_
HLT enums.
const reco::GenParticle * daughterQuarkBarOfWMinus() const
return anti-quark daughter of anti-W boson
Definition: TopGenEvent.h:79
reco::ShallowClonePtrCandidate * b_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
const reco::GenParticle * daughterQuarkBarOfWPlus() const
return anti-quark daughter of W boson
Definition: TopGenEvent.h:77
edm::EDGetTokenT< TtGenEvent > genEvtToken_
const reco::GenParticle * daughterQuarkOfWMinus() const
return quark daughter of anti-W boson
Definition: TopGenEvent.h:75
reco::ShallowClonePtrCandidate * lightQ_
TtFullHadHypGenMatch(const edm::ParameterSet &cfg)