CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
TtSemiLepHypothesis Class Referenceabstract

#include <TtSemiLepHypothesis.h>

Inheritance diagram for TtSemiLepHypothesis:
edm::stream::EDProducer<> TtSemiLepHypGenMatch TtSemiLepHypGeom TtSemiLepHypHitFit TtSemiLepHypKinFit TtSemiLepHypMaxSumPtWMass TtSemiLepHypMVADisc TtSemiLepHypWMassDeltaTopMass TtSemiLepHypWMassMaxSumPt

Public Member Functions

 TtSemiLepHypothesis (const edm::ParameterSet &)
 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 Member Functions

void buildHypo (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 > &jetPartonAssociation)
 minimalistic build function for simple hypotheses More...
 
virtual void buildHypo (edm::Event &event, const edm::Handle< edm::View< reco::RecoCandidate > > &lepton, const edm::Handle< std::vector< pat::MET > > &neutrino, const edm::Handle< std::vector< pat::Jet > > &jets, std::vector< int > &jetPartonAssociation, const unsigned int iComb)=0
 build event hypothesis from the reco objects of a semi-leptonic event More...
 
virtual void buildKey ()=0
 build the event hypothesis key More...
 
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
 
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...
 
template<typename C >
std::unique_ptr< reco::ShallowClonePtrCandidatemakeCandidate (const edm::Handle< C > &handle, const int &idx)
 use one object in a collection to set a ShallowClonePtrCandidate More...
 
std::unique_ptr< reco::ShallowClonePtrCandidatemakeCandidate (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...
 
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 Attributes

bool getMatch_
 
std::unique_ptr< reco::ShallowClonePtrCandidatehadronicB_
 
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...
 
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
 
std::unique_ptr< reco::ShallowClonePtrCandidatelepton_
 
std::unique_ptr< reco::ShallowClonePtrCandidateleptonicB_
 
std::unique_ptr< reco::ShallowClonePtrCandidatelightQ_
 
std::unique_ptr< reco::ShallowClonePtrCandidatelightQBar_
 
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
 
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
 
std::unique_ptr< reco::ShallowClonePtrCandidateneutrino_
 
int neutrinoSolutionType_
 algorithm used to calculate neutrino solutions (see cfi for further details) More...
 
edm::EDGetTokenT< int > nJetsConsideredToken_
 
int numberOfRealNeutrinoSolutions_
 

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
 

Detailed Description

Definition at line 31 of file TtSemiLepHypothesis.h.

Constructor & Destructor Documentation

◆ TtSemiLepHypothesis()

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

default constructor

Definition at line 10 of file TtSemiLepHypothesis.cc.

References looper::cfg, getMatch_, jetCorrectionLevel_, matchToken_, neutrinoSolutionType_, and AlCaHLTBitMon_QueryRunRegistry::string.

11  : jetsToken_(consumes<std::vector<pat::Jet> >(cfg.getParameter<edm::InputTag>("jets"))),
12  lepsToken_(consumes<edm::View<reco::RecoCandidate> >(cfg.getParameter<edm::InputTag>("leps"))),
13  metsToken_(consumes<std::vector<pat::MET> >(cfg.getParameter<edm::InputTag>("mets"))),
14  nJetsConsideredToken_(consumes<int>(cfg.getParameter<edm::InputTag>("nJetsConsidered"))),
16  getMatch_ = false;
17  if (cfg.exists("match")) {
18  getMatch_ = true;
19  matchToken_ = consumes<std::vector<std::vector<int> > >(cfg.getParameter<edm::InputTag>("match"));
20  }
21  if (cfg.exists("neutrinoSolutionType"))
22  neutrinoSolutionType_ = cfg.getParameter<int>("neutrinoSolutionType");
23  else
25  if (cfg.exists("jetCorrectionLevel")) {
26  jetCorrectionLevel_ = cfg.getParameter<std::string>("jetCorrectionLevel");
27  }
28  produces<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >();
29  produces<int>("Key");
30  produces<int>("NumberOfRealNeutrinoSolutions");
31  produces<int>("NumberOfConsideredJets");
32 }
std::string jetCorrectionLevel_
edm::EDGetTokenT< int > nJetsConsideredToken_
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
input label for all necessary collections
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
int neutrinoSolutionType_
algorithm used to calculate neutrino solutions (see cfi for further details)
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_

Member Function Documentation

◆ buildHypo() [1/2]

void TtSemiLepHypothesis::buildHypo ( 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 > &  jetPartonAssociation 
)
protected

minimalistic build function for simple hypotheses

return key minimalistic build function for simple hypotheses

Definition at line 225 of file TtSemiLepHypothesis.cc.

References TtSemiLepEvtPartons::HadB, hadronicB_, heavyIonCSV_trainingSettings::idx, isValid(), jetCorrectionLevel(), PDWG_EXODelayedJetMET_cff::jets, TtSemiLepEvtPartons::LepB, TtSemiLepHitFitProducer_Electrons_cfi::leps, lepton_, leptonicB_, TtSemiLepEvtPartons::LightQ, lightQ_, TtSemiLepEvtPartons::LightQBar, lightQBar_, makeCandidate(), match(), singleTopDQM_cfi::mets, neutrino_, neutrinoSolutionType_, and setNeutrino().

Referenced by TtSemiLepHypGeom::buildHypo(), TtSemiLepHypMaxSumPtWMass::buildHypo(), TtSemiLepHypWMassMaxSumPt::buildHypo(), TtSemiLepHypWMassDeltaTopMass::buildHypo(), TtSemiLepHypMVADisc::buildHypo(), and produce().

228  {
229  // -----------------------------------------------------
230  // add jets
231  // -----------------------------------------------------
232  for (unsigned idx = 0; idx < match.size(); ++idx) {
233  if (isValid(match[idx], jets)) {
234  switch (idx) {
237  break;
240  break;
243  break;
246  break;
247  }
248  }
249  }
250 
251  // -----------------------------------------------------
252  // add lepton
253  // -----------------------------------------------------
254  if (leps->empty())
255  return;
256  lepton_ = makeCandidate(leps, 0);
257  match.push_back(0);
258 
259  // -----------------------------------------------------
260  // add neutrino
261  // -----------------------------------------------------
262  if (mets->empty())
263  return;
264  if (neutrinoSolutionType_ == -1)
266  else
268 }
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
check if index is in valid range of selected jets
std::unique_ptr< reco::ShallowClonePtrCandidate > leptonicB_
std::unique_ptr< reco::ShallowClonePtrCandidate > lepton_
std::unique_ptr< reco::ShallowClonePtrCandidate > makeCandidate(const edm::Handle< C > &handle, const int &idx)
use one object in a collection to set a ShallowClonePtrCandidate
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQBar_
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
std::unique_ptr< reco::ShallowClonePtrCandidate > neutrino_
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQ_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
int neutrinoSolutionType_
algorithm used to calculate neutrino solutions (see cfi for further details)
std::unique_ptr< reco::ShallowClonePtrCandidate > hadronicB_
std::string jetCorrectionLevel(const std::string &quarkType)
helper function to construct the proper correction level string for corresponding quarkType ...

◆ buildHypo() [2/2]

virtual void TtSemiLepHypothesis::buildHypo ( edm::Event event,
const edm::Handle< edm::View< reco::RecoCandidate > > &  lepton,
const edm::Handle< std::vector< pat::MET > > &  neutrino,
const edm::Handle< std::vector< pat::Jet > > &  jets,
std::vector< int > &  jetPartonAssociation,
const unsigned int  iComb 
)
protectedpure virtual

◆ buildKey()

virtual void TtSemiLepHypothesis::buildKey ( )
protectedpure virtual

◆ hypo()

reco::CompositeCandidate TtSemiLepHypothesis::hypo ( )
protected

return event hypothesis

Definition at line 106 of file TtSemiLepHypothesis.cc.

References reco::CompositeCandidate::addDaughter(), TtSemiLepDaughter::HadB, TtSemiLepDaughter::HadP, TtSemiLepDaughter::HadQ, hadronicB_, TtSemiLepDaughter::HadTop, TtSemiLepDaughter::HadW, TtSemiLepDaughter::Lep, TtSemiLepDaughter::LepB, lepton_, leptonicB_, TtSemiLepDaughter::LepTop, TtSemiLepDaughter::LepW, lightQ_, lightQBar_, eostools::move(), neutrino_, TtSemiLepDaughter::Nu, and AddFourMomenta::set().

Referenced by produce().

106  {
107  // check for sanity of the hypothesis
108  if (!lightQ_ || !lightQBar_ || !hadronicB_ || !leptonicB_ || !neutrino_ || !lepton_)
109  return reco::CompositeCandidate();
110 
111  // setup transient references
112  reco::CompositeCandidate hyp, hadTop, hadW, lepTop, lepW;
113 
114  AddFourMomenta addFourMomenta;
115  // build up the top branch that decays leptonically
118  addFourMomenta.set(lepW);
119  lepTop.addDaughter(lepW, TtSemiLepDaughter::LepW);
121  addFourMomenta.set(lepTop);
122 
123  // build up the top branch that decays hadronically
126  addFourMomenta.set(hadW);
127  hadTop.addDaughter(hadW, TtSemiLepDaughter::HadW);
129  addFourMomenta.set(hadTop);
130 
131  // build ttbar hypotheses
134  addFourMomenta.set(hyp);
135 
136  return hyp;
137 }
static const std::string HadB
static const std::string LepTop
static const std::string Lep
static const std::string LepW
void set(reco::Candidate &c) const
set up a candidate
static const std::string HadP
std::unique_ptr< reco::ShallowClonePtrCandidate > leptonicB_
std::unique_ptr< reco::ShallowClonePtrCandidate > lepton_
static const std::string HadTop
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
static const std::string HadQ
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQBar_
static const std::string HadW
std::unique_ptr< reco::ShallowClonePtrCandidate > neutrino_
static const std::string Nu
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQ_
static const std::string LepB
def move(src, dest)
Definition: eostools.py:511
std::unique_ptr< reco::ShallowClonePtrCandidate > hadronicB_

◆ isValid()

bool TtSemiLepHypothesis::isValid ( const int &  idx,
const edm::Handle< std::vector< pat::Jet > > &  jets 
)
inlineprotected

◆ jetCorrectionLevel()

std::string TtSemiLepHypothesis::jetCorrectionLevel ( const std::string &  quarkType)
protected

helper function to construct the proper correction level string for corresponding quarkType

helper function to construct the proper correction level string for corresponding quarkType, for unknown quarkTypes an empty string is returned

Definition at line 152 of file TtSemiLepHypothesis.cc.

References jetCorrectionLevel_, personalPlayback::level, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by TtSemiLepHypGenMatch::buildHypo(), and buildHypo().

152  {
153  // jetCorrectionLevel was not configured
154  if (jetCorrectionLevel_.empty())
155  throw cms::Exception("Configuration")
156  << "Unconfigured jetCorrectionLevel. Please use an appropriate, non-empty string.\n";
157 
158  // quarkType is unknown
159  if (!(quarkType == "wQuarkMix" || quarkType == "udsQuark" || quarkType == "cQuark" || quarkType == "bQuark"))
160  throw cms::Exception("Configuration") << quarkType << " is unknown as a quarkType for the jetCorrectionLevel.\n";
161 
162  // combine correction level; start with a ':' even if
163  // there is no flavor tag to be added, as it is needed
164  // by makeCandidate to disentangle the correction tag
165  // from a potential flavor tag, which can be empty
167  if (level == "L5Flavor:" || level == "L6UE:" || level == "L7Parton:") {
168  if (quarkType == "wQuarkMix") {
169  level += "wMix";
170  }
171  if (quarkType == "udsQuark") {
172  level += "uds";
173  }
174  if (quarkType == "cQuark") {
175  level += "charm";
176  }
177  if (quarkType == "bQuark") {
178  level += "bottom";
179  }
180  } else {
181  level += "none";
182  }
183  return level;
184 }
std::string jetCorrectionLevel_

◆ key()

int TtSemiLepHypothesis::key ( ) const
inlineprotected

Definition at line 62 of file TtSemiLepHypothesis.h.

References key_.

Referenced by produce().

62 { return key_; };
int key_
hypothesis key (to be set by the buildKey function)

◆ leptonType()

WDecay::LeptonType TtSemiLepHypothesis::leptonType ( const reco::RecoCandidate cand)
protected

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

Definition at line 140 of file TtSemiLepHypothesis.cc.

References WDecay::kElec, WDecay::kMuon, and WDecay::kNone.

Referenced by TtSemiLepHypGenMatch::findMatchingLepton(), and setNeutrino().

140  {
141  // check whetherwe are dealing with a reco muon or a reco electron
143  if (dynamic_cast<const reco::Muon*>(cand)) {
145  } else if (dynamic_cast<const reco::GsfElectron*>(cand)) {
147  }
148  return type;
149 }

◆ makeCandidate() [1/2]

template<typename C >
std::unique_ptr< reco::ShallowClonePtrCandidate > TtSemiLepHypothesis::makeCandidate ( const edm::Handle< C > &  handle,
const int &  idx 
)
protected

use one object in a collection to set a ShallowClonePtrCandidate

Definition at line 120 of file TtSemiLepHypothesis.h.

References patZpeak::handle, and heavyIonCSV_trainingSettings::idx.

Referenced by TtSemiLepHypHitFit::buildHypo(), TtSemiLepHypKinFit::buildHypo(), TtSemiLepHypGenMatch::buildHypo(), and buildHypo().

121  {
122  typedef typename C::value_type O;
124  return std::make_unique<reco::ShallowClonePtrCandidate>(ptr, ptr->charge(), ptr->p4(), ptr->vertex());
125 }

◆ makeCandidate() [2/2]

std::unique_ptr< reco::ShallowClonePtrCandidate > TtSemiLepHypothesis::makeCandidate ( const edm::Handle< std::vector< pat::Jet > > &  handle,
const int &  idx,
const std::string &  correctionLevel 
)
protected

use one object in a jet collection to set a ShallowClonePtrCandidate with proper jet corrections

Definition at line 187 of file TtSemiLepHypothesis.cc.

References reco::LeafCandidate::charge(), patZpeak::handle, heavyIonCSV_trainingSettings::idx, pat::Jet::jecFactor(), and AlCaHLTBitMon_QueryRunRegistry::string.

188  {
190  // disentangle the correction from the potential flavor tag
191  // by the separating ':'; the flavor tag can be empty though
192  std::string step = correctionLevel.substr(0, correctionLevel.find(':'));
193  std::string flavor = correctionLevel.substr(1 + correctionLevel.find(':'));
194  float corrFactor = 1.;
195  if (flavor == "wMix")
196  corrFactor = 0.75 * ptr->jecFactor(step, "uds") + 0.25 * ptr->jecFactor(step, "charm");
197  else
198  corrFactor = ptr->jecFactor(step, flavor);
199  return std::make_unique<reco::ShallowClonePtrCandidate>(ptr, ptr->charge(), ptr->p4() * corrFactor, ptr->vertex());
200 }
float jecFactor(const std::string &level, const std::string &flavor="none", const std::string &set="") const
step
Definition: StallMonitor.cc:98
int charge() const final
electric charge

◆ produce()

void TtSemiLepHypothesis::produce ( edm::Event evt,
const edm::EventSetup setup 
)
overrideprotected

produce the event hypothesis as CompositeCandidate and Key

Definition at line 35 of file TtSemiLepHypothesis.cc.

References buildHypo(), buildKey(), edm::Event::getByToken(), getMatch_, hypo(), mps_fire::i, PDWG_EXODelayedJetMET_cff::jets, jetsToken_, key(), TtSemiLepHitFitProducer_Electrons_cfi::leps, lepsToken_, match(), matchToken_, singleTopDQM_cfi::mets, metsToken_, eostools::move(), TtSemiLepHypGenMatch_cfi::nJetsConsidered, nJetsConsideredToken_, numberOfRealNeutrinoSolutions_, edm::Event::put(), resetCandidates(), and trackerHitRTTI::vector.

35  {
38 
41 
44 
47 
48  std::vector<std::vector<int> > matchVec;
49  if (getMatch_) {
51  evt.getByToken(matchToken_, matchHandle);
52  matchVec = *matchHandle;
53  } else {
54  std::vector<int> dummyMatch;
55  for (unsigned int i = 0; i < 4; ++i)
56  dummyMatch.push_back(-1);
57  matchVec.push_back(dummyMatch);
58  }
59 
60  // declare unique_ptr for products
61  std::unique_ptr<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > > pOut(
62  new std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > >);
63  std::unique_ptr<int> pKey(new int);
64  std::unique_ptr<int> pNeutrinoSolutions(new int);
65  std::unique_ptr<int> pJetsConsidered(new int);
66 
67  // go through given vector of jet combinations
68  unsigned int idMatch = 0;
69  typedef std::vector<std::vector<int> >::iterator MatchVecIterator;
70  for (MatchVecIterator match = matchVec.begin(); match != matchVec.end(); ++match) {
71  // reset pointers
73  // build hypothesis
74  buildHypo(evt, leps, mets, jets, *match, idMatch++);
75  pOut->push_back(std::make_pair(hypo(), *match));
76  }
77  // feed out hyps and matches
78  evt.put(std::move(pOut));
79 
80  // build and feed out key
81  buildKey();
82  *pKey = key();
83  evt.put(std::move(pKey), "Key");
84 
85  // feed out number of real neutrino solutions
86  *pNeutrinoSolutions = numberOfRealNeutrinoSolutions_;
87  evt.put(std::move(pNeutrinoSolutions), "NumberOfRealNeutrinoSolutions");
88 
89  // feed out number of considered jets
90  *pJetsConsidered = *nJetsConsidered;
91  evt.put(std::move(pJetsConsidered), "NumberOfConsideredJets");
92 }
edm::EDGetTokenT< int > nJetsConsideredToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:536
void buildHypo(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 > &jetPartonAssociation)
minimalistic build function for simple hypotheses
void resetCandidates()
reset candidate pointers before hypo build process
virtual void buildKey()=0
build the event hypothesis key
nJetsConsidered
number of considered jets
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
input label for all necessary collections
reco::CompositeCandidate hypo()
return event hypothesis
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
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< std::vector< std::vector< int > > > matchToken_
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_

◆ resetCandidates()

void TtSemiLepHypothesis::resetCandidates ( )
protected

reset candidate pointers before hypo build process

Definition at line 95 of file TtSemiLepHypothesis.cc.

References hadronicB_, lepton_, leptonicB_, lightQ_, lightQBar_, neutrino_, and numberOfRealNeutrinoSolutions_.

Referenced by produce().

95  {
97  lightQ_.reset();
98  lightQBar_.reset();
99  hadronicB_.reset();
100  leptonicB_.reset();
101  neutrino_.reset();
102  lepton_.reset();
103 }
std::unique_ptr< reco::ShallowClonePtrCandidate > leptonicB_
std::unique_ptr< reco::ShallowClonePtrCandidate > lepton_
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQBar_
std::unique_ptr< reco::ShallowClonePtrCandidate > neutrino_
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQ_
std::unique_ptr< reco::ShallowClonePtrCandidate > hadronicB_

◆ setNeutrino()

void TtSemiLepHypothesis::setNeutrino ( const edm::Handle< std::vector< pat::MET > > &  met,
const edm::Handle< edm::View< reco::RecoCandidate > > &  leps,
const int &  idx,
const int &  type 
)
protected

set neutrino, using mW = 80.4 to calculate the neutrino pz

Definition at line 203 of file TtSemiLepHypothesis.cc.

References reco::LeafCandidate::charge(), Exception, heavyIonCSV_trainingSettings::idx, WDecay::kElec, WDecay::kMuon, TtSemiLepHitFitProducer_Electrons_cfi::leps, leptonType(), BTaggingMonitor_cfi::met, neutrino_, numberOfRealNeutrinoSolutions_, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and mathSSE::sqrt().

Referenced by TtSemiLepHypGenMatch::buildHypo(), and buildHypo().

206  {
208  MEzCalculator mez;
209  mez.SetMET(*(met->begin()));
210  if (leptonType(&(leps->front())) == WDecay::kMuon)
211  mez.SetLepton((*leps)[idx], true);
212  else if (leptonType(&(leps->front())) == WDecay::kElec)
213  mez.SetLepton((*leps)[idx], false);
214  else
215  throw cms::Exception("UnimplementedFeature")
216  << "Type of lepton given together with MET for solving neutrino kinematics is neither muon nor electron.\n";
217  double pz = mez.Calculate(type);
218  numberOfRealNeutrinoSolutions_ = mez.IsComplex() ? 0 : 2;
219  const math::XYZTLorentzVector p4(
220  ptr->px(), ptr->py(), pz, sqrt(ptr->px() * ptr->px() + ptr->py() * ptr->py() + pz * pz));
221  neutrino_ = std::make_unique<reco::ShallowClonePtrCandidate>(ptr, ptr->charge(), p4, ptr->vertex());
222 }
WDecay::LeptonType leptonType(const reco::RecoCandidate *cand)
determine lepton type of reco candidate and return a corresponding WDecay::LeptonType; the type is kN...
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
double px() const final
x coordinate of momentum vector
T sqrt(T t)
Definition: SSEVec.h:19
double py() const final
y coordinate of momentum vector
std::unique_ptr< reco::ShallowClonePtrCandidate > neutrino_
int charge() const final
electric charge

Member Data Documentation

◆ getMatch_

bool TtSemiLepHypothesis::getMatch_
protected

internal check whether the match information exists or not, if false a blind dummy match vector will be used internally

Definition at line 90 of file TtSemiLepHypothesis.h.

Referenced by produce(), and TtSemiLepHypothesis().

◆ hadronicB_

std::unique_ptr<reco::ShallowClonePtrCandidate> TtSemiLepHypothesis::hadronicB_
protected

◆ jetCorrectionLevel_

std::string TtSemiLepHypothesis::jetCorrectionLevel_
protected

specify the desired jet correction level (the default should be L3Absolute-'abs')

Definition at line 99 of file TtSemiLepHypothesis.h.

Referenced by jetCorrectionLevel(), and TtSemiLepHypothesis().

◆ jetsToken_

edm::EDGetTokenT<std::vector<pat::Jet> > TtSemiLepHypothesis::jetsToken_
protected

input label for all necessary collections

Definition at line 92 of file TtSemiLepHypothesis.h.

Referenced by produce().

◆ key_

int TtSemiLepHypothesis::key_
protected

◆ lepsToken_

edm::EDGetTokenT<edm::View<reco::RecoCandidate> > TtSemiLepHypothesis::lepsToken_
protected

Definition at line 93 of file TtSemiLepHypothesis.h.

Referenced by produce().

◆ lepton_

std::unique_ptr<reco::ShallowClonePtrCandidate> TtSemiLepHypothesis::lepton_
protected

◆ leptonicB_

std::unique_ptr<reco::ShallowClonePtrCandidate> TtSemiLepHypothesis::leptonicB_
protected

◆ lightQ_

std::unique_ptr<reco::ShallowClonePtrCandidate> TtSemiLepHypothesis::lightQ_
protected

candidates for internal use for the creation of the hypothesis candidate

Definition at line 109 of file TtSemiLepHypothesis.h.

Referenced by TtSemiLepHypHitFit::buildHypo(), TtSemiLepHypKinFit::buildHypo(), TtSemiLepHypGenMatch::buildHypo(), buildHypo(), hypo(), and resetCandidates().

◆ lightQBar_

std::unique_ptr<reco::ShallowClonePtrCandidate> TtSemiLepHypothesis::lightQBar_
protected

◆ matchToken_

edm::EDGetTokenT<std::vector<std::vector<int> > > TtSemiLepHypothesis::matchToken_
protected

Definition at line 95 of file TtSemiLepHypothesis.h.

Referenced by produce(), and TtSemiLepHypothesis().

◆ metsToken_

edm::EDGetTokenT<std::vector<pat::MET> > TtSemiLepHypothesis::metsToken_
protected

Definition at line 94 of file TtSemiLepHypothesis.h.

Referenced by produce().

◆ neutrino_

std::unique_ptr<reco::ShallowClonePtrCandidate> TtSemiLepHypothesis::neutrino_
protected

◆ neutrinoSolutionType_

int TtSemiLepHypothesis::neutrinoSolutionType_
protected

algorithm used to calculate neutrino solutions (see cfi for further details)

Definition at line 103 of file TtSemiLepHypothesis.h.

Referenced by TtSemiLepHypGenMatch::buildHypo(), buildHypo(), and TtSemiLepHypothesis().

◆ nJetsConsideredToken_

edm::EDGetTokenT<int> TtSemiLepHypothesis::nJetsConsideredToken_
protected

Definition at line 96 of file TtSemiLepHypothesis.h.

Referenced by produce().

◆ numberOfRealNeutrinoSolutions_

int TtSemiLepHypothesis::numberOfRealNeutrinoSolutions_
protected

number of real neutrino solutions: -1 if not determined, 0 if only complex, 2 if two real solutions

Definition at line 106 of file TtSemiLepHypothesis.h.

Referenced by produce(), resetCandidates(), and setNeutrino().