#include <TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepHypGeom.h>
Public Member Functions | |
TtSemiLepHypGeom (const edm::ParameterSet &) | |
~TtSemiLepHypGeom () | |
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 | |
virtual void | buildKey () |
build the event hypothesis key | |
double | distance (const math::XYZTLorentzVector &, const math::XYZTLorentzVector &) |
Private Attributes | |
int | maxNJets_ |
bool | useDeltaR_ |
Definition at line 7 of file TtSemiLepHypGeom.h.
TtSemiLepHypGeom::TtSemiLepHypGeom | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
Definition at line 6 of file TtSemiLepHypGeom.cc.
References Exception, and maxNJets_.
00006 : 00007 TtSemiLepHypothesis( cfg ), 00008 maxNJets_ (cfg.getParameter<int> ("maxNJets" )), 00009 useDeltaR_(cfg.getParameter<bool>("useDeltaR")) 00010 { 00011 if(maxNJets_<4 && maxNJets_!=-1) 00012 throw cms::Exception("WrongConfig") 00013 << "Parameter maxNJets can not be set to " << maxNJets_ << ". \n" 00014 << "It has to be larger than 4 or can be set to -1 to take all jets."; 00015 }
TtSemiLepHypGeom::~TtSemiLepHypGeom | ( | ) |
void TtSemiLepHypGeom::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 | |||
) | [private, virtual] |
build event hypothesis from the reco objects of a semi-leptonic event
Implements TtSemiLepHypothesis.
Definition at line 20 of file TtSemiLepHypGeom.cc.
References dist(), distance(), TtSemiLepEvtPartons::HadB, TtSemiLepHypothesis::hadronicB_, i, TtSemiLepHypothesis::isValid(), pfTauBenchmarkGeneric_cfi::jets, TtSemiLepEvtPartons::LepB, TtSemiLepEvtPartons::Lepton, TtSemiLepHypothesis::lepton_, TtSemiLepHypothesis::leptonicB_, TtSemiLepEvtPartons::LightQ, TtSemiLepHypothesis::lightQ_, TtSemiLepEvtPartons::LightQBar, TtSemiLepHypothesis::lightQBar_, maxNJets_, TtSemiLepHypothesis::neutrino_, p4, and TtSemiLepHypothesis::setCandidate().
00025 { 00026 if(leps->empty() || mets->empty() || jets->size()<4){ 00027 // create empty hypothesis 00028 return; 00029 } 00030 00031 unsigned maxNJets = maxNJets_; 00032 if(maxNJets_ == -1 || (int)jets->size() < maxNJets_) maxNJets = jets->size(); 00033 00034 match.clear(); 00035 for(unsigned int i=0; i<5; ++i) 00036 match.push_back(-1); 00037 00038 // ----------------------------------------------------- 00039 // associate those two jets to the hadronic W boson that 00040 // have the smallest distance to each other 00041 // ----------------------------------------------------- 00042 double minDist=-1.; 00043 int lightQ =-1; 00044 int lightQBar=-1; 00045 for(unsigned int idx=0; idx<maxNJets; ++idx){ 00046 for(unsigned int jdx=(idx+1); jdx<maxNJets; ++jdx){ 00047 double dist = distance((*jets)[idx].p4(), (*jets)[jdx].p4()); 00048 if( minDist<0. || dist<minDist ){ 00049 minDist=dist; 00050 lightQ =idx; 00051 lightQBar=jdx; 00052 } 00053 } 00054 } 00055 00056 reco::Particle::LorentzVector wHad = (*jets)[lightQ].p4() + (*jets)[lightQBar].p4(); 00057 00058 // ----------------------------------------------------- 00059 // associate to the hadronic b quark the remaining jet 00060 // that has the smallest distance to the hadronic W 00061 // ----------------------------------------------------- 00062 minDist=-1.; 00063 int hadB=-1; 00064 for(unsigned int idx=0; idx<maxNJets; ++idx){ 00065 // make sure it's not used up already from the hadronic W 00066 if( (int)idx!=lightQ && (int)idx!=lightQBar ) { 00067 double dist = distance((*jets)[idx].p4(), wHad); 00068 if( minDist<0. || dist<minDist ){ 00069 minDist=dist; 00070 hadB=idx; 00071 } 00072 } 00073 } 00074 00075 // ----------------------------------------------------- 00076 // associate to the leptonic b quark the remaining jet 00077 // that has the smallest distance to the leading lepton 00078 // ----------------------------------------------------- 00079 minDist=-1.; 00080 int lepB=-1; 00081 for(unsigned int idx=0; idx<maxNJets; ++idx){ 00082 // make sure it's not used up already from the hadronic decay chain 00083 if( (int)idx!=lightQ && (int)idx!=lightQBar && (int)idx!=hadB ){ 00084 double dist = distance((*jets)[idx].p4(), (*leps)[0].p4()); 00085 if( minDist<0. || dist<minDist ){ 00086 minDist=dist; 00087 lepB=idx; 00088 } 00089 } 00090 } 00091 00092 // ----------------------------------------------------- 00093 // add jets 00094 // ----------------------------------------------------- 00095 if( isValid(lightQ, jets) ){ 00096 setCandidate(jets, lightQ, lightQ_); 00097 match[TtSemiLepEvtPartons::LightQ] = lightQ; 00098 } 00099 00100 if( isValid(lightQBar, jets) ){ 00101 setCandidate(jets, lightQBar, lightQBar_); 00102 match[TtSemiLepEvtPartons::LightQBar] = lightQBar; 00103 } 00104 00105 if( isValid(hadB, jets) ){ 00106 setCandidate(jets, hadB, hadronicB_); 00107 match[TtSemiLepEvtPartons::HadB] = hadB; 00108 } 00109 00110 if( isValid(lepB, jets) ){ 00111 setCandidate(jets, lepB, leptonicB_); 00112 match[TtSemiLepEvtPartons::LepB] = lepB; 00113 } 00114 00115 // ----------------------------------------------------- 00116 // add lepton 00117 // ----------------------------------------------------- 00118 setCandidate(leps, 0, lepton_); 00119 match[TtSemiLepEvtPartons::Lepton] = 0; 00120 00121 // ----------------------------------------------------- 00122 // add neutrino 00123 // ----------------------------------------------------- 00124 setCandidate(mets, 0, neutrino_); 00125 }
virtual void TtSemiLepHypGeom::buildKey | ( | ) | [inline, private, virtual] |
build the event hypothesis key
Implements TtSemiLepHypothesis.
Definition at line 17 of file TtSemiLepHypGeom.h.
References TtSemiLepHypothesis::key_, and TtEvent::kGeom.
00017 { key_= TtSemiLeptonicEvent::kGeom; };
double TtSemiLepHypGeom::distance | ( | const math::XYZTLorentzVector & | v1, | |
const math::XYZTLorentzVector & | v2 | |||
) | [private] |
Definition at line 128 of file TtSemiLepHypGeom.cc.
References useDeltaR_.
Referenced by buildHypo().
00129 { 00130 // calculate the distance between two lorentz vectors 00131 // using DeltaR or DeltaTheta 00132 if(useDeltaR_) return ROOT::Math::VectorUtil::DeltaR(v1, v2); 00133 return fabs(v1.theta() - v2.theta()); 00134 }
int TtSemiLepHypGeom::maxNJets_ [private] |
Definition at line 28 of file TtSemiLepHypGeom.h.
Referenced by buildHypo(), and TtSemiLepHypGeom().
bool TtSemiLepHypGeom::useDeltaR_ [private] |