CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TtSemiLepHypGenMatch Class Reference

#include <TtSemiLepHypGenMatch.h>

Inheritance diagram for TtSemiLepHypGenMatch:
TtSemiLepHypothesis edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 TtSemiLepHypGenMatch (const edm::ParameterSet &)
 
 ~TtSemiLepHypGenMatch ()
 
- Public Member Functions inherited from TtSemiLepHypothesis
 TtSemiLepHypothesis (const edm::ParameterSet &)
 default constructor More...
 
 ~TtSemiLepHypothesis ()
 default destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void buildHypo (edm::Event &, const edm::Handle< edm::View< reco::RecoCandidate > > &, const edm::Handle< std::vector< pat::MET > > &, const edm::Handle< std::vector< pat::Jet > > &, std::vector< int > &, const unsigned int iComb)
 build event hypothesis from the reco objects of a semi-leptonic event More...
 
virtual void buildKey ()
 build the event hypothesis key More...
 
int findMatchingLepton (const edm::Handle< TtGenEvent > &genEvt, const edm::Handle< edm::View< reco::RecoCandidate > > &)
 find index of the candidate nearest to the singleLepton of the generator event in the collection; return -1 if this fails More...
 

Private Attributes

int neutrinoSolutionType_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from TtSemiLepHypothesis
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...
 
WDecay::LeptonType leptonType (const reco::RecoCandidate *cand)
 determine lepton type of reco candidate and return a corresponding WDecay::LeptonType; the type is kNone if it is whether a muon nor an electron More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 produce the event hypothesis as CompositeCandidate and Key More...
 
void resetCandidates ()
 reset candidate pointers before hypo build process More...
 
template<typename C >
void setCandidate (const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
 use one object in a collection to set a ShallowClonePtrCandidate More...
 
void setCandidate (const edm::Handle< std::vector< pat::Jet > > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone, const std::string &correctionLevel)
 use one object in a jet collection to set a ShallowClonePtrCandidate with proper jet corrections More...
 
void setNeutrino (const edm::Handle< std::vector< pat::MET > > &met, const edm::Handle< edm::View< reco::RecoCandidate > > &leps, const int &idx, const int &type)
 set neutrino, using mW = 80.4 to calculate the neutrino pz More...
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 
- Protected Attributes inherited from TtSemiLepHypothesis
bool getMatch_
 
reco::ShallowClonePtrCandidatehadronicB_
 
std::string jetCorrectionLevel_
 
edm::InputTag jets_
 input label for all necessary collections More...
 
int key_
 hypothesis key (to be set by the buildKey function) More...
 
edm::InputTag leps_
 
reco::ShallowClonePtrCandidatelepton_
 
reco::ShallowClonePtrCandidateleptonicB_
 
reco::ShallowClonePtrCandidatelightQ_
 
reco::ShallowClonePtrCandidatelightQBar_
 
edm::InputTag match_
 
edm::InputTag mets_
 
reco::ShallowClonePtrCandidateneutrino_
 
int numberOfRealNeutrinoSolutions_
 

Detailed Description

Definition at line 7 of file TtSemiLepHypGenMatch.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file TtSemiLepHypGenMatch.cc.

6  :
7  TtSemiLepHypothesis( cfg ),
8  neutrinoSolutionType_(cfg.getParameter<int>("neutrinoSolutionType"))
9 { }
T getParameter(std::string const &) const
TtSemiLepHypothesis(const edm::ParameterSet &)
default constructor
TtSemiLepHypGenMatch::~TtSemiLepHypGenMatch ( )

Definition at line 11 of file TtSemiLepHypGenMatch.cc.

11 { }

Member Function Documentation

void TtSemiLepHypGenMatch::buildHypo ( edm::Event evt,
const edm::Handle< edm::View< reco::RecoCandidate > > &  leps,
const edm::Handle< std::vector< pat::MET > > &  mets,
const edm::Handle< std::vector< pat::Jet > > &  jets,
std::vector< int > &  match,
const unsigned int  iComb 
)
privatevirtual

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

Implements TtSemiLepHypothesis.

Definition at line 14 of file TtSemiLepHypGenMatch.cc.

References abs, findMatchingLepton(), TtGenEvtProducer_cfi::genEvt, edm::Event::getByLabel(), TtSemiLepEvtPartons::HadB, TtSemiLepHypothesis::hadronicB_, TtSemiLepHypothesis::isValid(), TtSemiLepHypothesis::jetCorrectionLevel(), analyzePatCleaning_cfg::jets, TtSemiLepEvtPartons::LepB, TtSemiLepHypothesis::lepton_, TtSemiLepHypothesis::leptonicB_, TtSemiLepEvtPartons::LightQ, TtSemiLepHypothesis::lightQ_, TtSemiLepEvtPartons::LightQBar, TtSemiLepHypothesis::lightQBar_, TtSemiLepHypothesis::neutrino_, neutrinoSolutionType_, TtSemiLepHypothesis::setCandidate(), and TtSemiLepHypothesis::setNeutrino().

19 {
20  // -----------------------------------------------------
21  // get genEvent (to distinguish between uds and c quarks
22  // and for the lepton matching)
23  // -----------------------------------------------------
25  evt.getByLabel("genEvt", genEvt);
26 
27  // -----------------------------------------------------
28  // add jets
29  // -----------------------------------------------------
30  for(unsigned idx=0; idx<match.size(); ++idx){
31  if( isValid(match[idx], jets) ){
32  switch(idx){
34  if( std::abs(genEvt->hadronicDecayQuark()->pdgId())==4 )
35  setCandidate(jets, match[idx], lightQ_, jetCorrectionLevel("cQuark"));
36  else
37  setCandidate(jets, match[idx], lightQ_, jetCorrectionLevel("udsQuark"));
38  break;
40  if( std::abs(genEvt->hadronicDecayQuarkBar()->pdgId())==4 )
41  setCandidate(jets, match[idx], lightQBar_, jetCorrectionLevel("cQuark"));
42  else
43  setCandidate(jets, match[idx], lightQBar_, jetCorrectionLevel("udsQuark"));
44  break;
46  setCandidate(jets, match[idx], hadronicB_, jetCorrectionLevel("bQuark")); break;
48  setCandidate(jets, match[idx], leptonicB_, jetCorrectionLevel("bQuark")); break;
49  }
50  }
51  }
52 
53  // -----------------------------------------------------
54  // add lepton
55  // -----------------------------------------------------
56  int iLepton = findMatchingLepton(genEvt, leps);
57  if( iLepton<0 )
58  return;
59  setCandidate(leps, iLepton, lepton_);
60  match.push_back( iLepton );
61 
62  // -----------------------------------------------------
63  // add neutrino
64  // -----------------------------------------------------
65  if( mets->empty() )
66  return;
67  if(neutrinoSolutionType_ == -1)
68  setCandidate(mets, 0, neutrino_);
69  else
70  setNeutrino(mets, leps, iLepton, neutrinoSolutionType_);
71 }
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
check if index is in valid range of selected jets
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * lightQBar_
#define abs(x)
Definition: mlp_lapack.h:159
reco::ShallowClonePtrCandidate * neutrino_
int findMatchingLepton(const edm::Handle< TtGenEvent > &genEvt, const edm::Handle< edm::View< reco::RecoCandidate > > &)
find index of the candidate nearest to the singleLepton of the generator event in the collection; ret...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
reco::ShallowClonePtrCandidate * hadronicB_
void setNeutrino(const edm::Handle< std::vector< pat::MET > > &met, const edm::Handle< edm::View< reco::RecoCandidate > > &leps, const int &idx, const int &type)
set neutrino, using mW = 80.4 to calculate the neutrino pz
void setCandidate(const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
use one object in a collection to set a ShallowClonePtrCandidate
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
reco::ShallowClonePtrCandidate * lightQ_
reco::ShallowClonePtrCandidate * leptonicB_
std::string jetCorrectionLevel(const std::string &quarkType)
helper function to construct the proper correction level string for corresponding quarkType ...
virtual void TtSemiLepHypGenMatch::buildKey ( )
inlineprivatevirtual

build the event hypothesis key

Implements TtSemiLepHypothesis.

Definition at line 17 of file TtSemiLepHypGenMatch.h.

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

int key_
hypothesis key (to be set by the buildKey function)
int TtSemiLepHypGenMatch::findMatchingLepton ( const edm::Handle< TtGenEvent > &  genEvt,
const edm::Handle< edm::View< reco::RecoCandidate > > &  leps 
)
private

find index of the candidate nearest to the singleLepton of the generator event in the collection; return -1 if this fails

Definition at line 75 of file TtSemiLepHypGenMatch.cc.

References deltaR(), i, and TtSemiLepHypothesis::leptonType().

Referenced by buildHypo().

77 {
78  int genIdx=-1;
79 
80  // jump out with -1 when the collection is empty
81  if( leps->empty() ) return genIdx;
82 
83  if( genEvt->isTtBar() && genEvt->isSemiLeptonic( leptonType( &(leps->front()) ) ) && genEvt->singleLepton() ){
84  double minDR=-1;
85  for(unsigned i=0; i<leps->size(); ++i){
86  double dR = deltaR(genEvt->singleLepton()->eta(), genEvt->singleLepton()->phi(), (*leps)[i].eta(), (*leps)[i].phi());
87  if(minDR<0 || dR<minDR){
88  minDR=dR;
89  genIdx=i;
90  }
91  }
92  }
93  return genIdx;
94 }
int i
Definition: DBlmapReader.cc:9
WDecay::LeptonType leptonType(const reco::RecoCandidate *cand)
determine lepton type of reco candidate and return a corresponding WDecay::LeptonType; the type is kN...
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17

Member Data Documentation

int TtSemiLepHypGenMatch::neutrinoSolutionType_
private

Definition at line 30 of file TtSemiLepHypGenMatch.h.

Referenced by buildHypo().