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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper TtSemiLepHypGenMatch TtSemiLepHypGeom TtSemiLepHypHitFit TtSemiLepHypKinFit TtSemiLepHypMaxSumPtWMass TtSemiLepHypMVADisc TtSemiLepHypWMassDeltaTopMass TtSemiLepHypWMassMaxSumPt

Public Member Functions

 TtSemiLepHypothesis (const edm::ParameterSet &)
 default constructor More...
 
 ~TtSemiLepHypothesis ()
 default destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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...
 
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Protected Attributes

bool getMatch_
 
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_
 
reco::ShallowClonePtrCandidatelepton_
 
reco::ShallowClonePtrCandidateleptonicB_
 
reco::ShallowClonePtrCandidatelightQ_
 
reco::ShallowClonePtrCandidatelightQBar_
 
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
 
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
 
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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 31 of file TtSemiLepHypothesis.h.

Constructor & Destructor Documentation

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

default constructor

Definition at line 10 of file TtSemiLepHypothesis.cc.

References edm::ParameterSet::exists(), getMatch_, edm::ParameterSet::getParameter(), jetCorrectionLevel_, matchToken_, neutrinoSolutionType_, and AlCaHLTBitMon_QueryRunRegistry::string.

10  :
11  jetsToken_(consumes<std::vector<pat::Jet> >(cfg.getParameter<edm::InputTag>("jets"))),
13  metsToken_(consumes<std::vector<pat::MET> >(cfg.getParameter<edm::InputTag>("mets"))),
14  nJetsConsideredToken_(consumes<int>(cfg.getParameter<edm::InputTag>("nJetsConsidered"))),
16  lightQ_(0), lightQBar_(0), hadronicB_(0),
17  leptonicB_(0), neutrino_(0), lepton_(0)
18 {
19  getMatch_ = false;
20  if( cfg.exists("match") ) {
21  getMatch_ = true;
22  matchToken_ = consumes<std::vector<std::vector<int> > >(cfg.getParameter<edm::InputTag>("match"));
23  }
24  if( cfg.exists("neutrinoSolutionType") )
25  neutrinoSolutionType_ = cfg.getParameter<int>("neutrinoSolutionType");
26  else
28  if( cfg.exists("jetCorrectionLevel") ) {
29  jetCorrectionLevel_ = cfg.getParameter<std::string>("jetCorrectionLevel");
30  }
31  produces<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >();
32  produces<int>("Key");
33  produces<int>("NumberOfRealNeutrinoSolutions");
34  produces<int>("NumberOfConsideredJets");
35 }
std::string jetCorrectionLevel_
T getParameter(std::string const &) const
edm::EDGetTokenT< int > nJetsConsideredToken_
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * lightQBar_
bool exists(std::string const &parameterName) const
checks if a parameter exists
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
reco::ShallowClonePtrCandidate * neutrino_
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
input label for all necessary collections
reco::ShallowClonePtrCandidate * hadronicB_
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)
reco::ShallowClonePtrCandidate * lightQ_
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
reco::ShallowClonePtrCandidate * leptonicB_
TtSemiLepHypothesis::~TtSemiLepHypothesis ( )

default destructor

Definition at line 38 of file TtSemiLepHypothesis.cc.

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

39 {
40  if( lightQ_ ) delete lightQ_;
41  if( lightQBar_ ) delete lightQBar_;
42  if( hadronicB_ ) delete hadronicB_;
43  if( leptonicB_ ) delete leptonicB_;
44  if( neutrino_ ) delete neutrino_;
45  if( lepton_ ) delete lepton_;
46 }
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * lightQBar_
reco::ShallowClonePtrCandidate * neutrino_
reco::ShallowClonePtrCandidate * hadronicB_
reco::ShallowClonePtrCandidate * lightQ_
reco::ShallowClonePtrCandidate * leptonicB_

Member Function Documentation

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 249 of file TtSemiLepHypothesis.cc.

References TtSemiLepEvtPartons::HadB, hadronicB_, training_settings::idx, isValid(), jetCorrectionLevel(), fwrapper::jets, TtSemiLepEvtPartons::LepB, TtSemiLepHitFitProducer_Electrons_cfi::leps, lepton_, leptonicB_, TtSemiLepEvtPartons::LightQ, lightQ_, TtSemiLepEvtPartons::LightQBar, lightQBar_, TtSemiLepSignalSelMVAComputer_cfi::mets, neutrino_, neutrinoSolutionType_, setCandidate(), and setNeutrino().

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

253 {
254  // -----------------------------------------------------
255  // add jets
256  // -----------------------------------------------------
257  for(unsigned idx=0; idx<match.size(); ++idx){
258  if( isValid(match[idx], jets) ){
259  switch(idx){
261  setCandidate(jets, match[idx], lightQ_, jetCorrectionLevel("wQuarkMix")); break;
263  setCandidate(jets, match[idx], lightQBar_, jetCorrectionLevel("wQuarkMix")); break;
265  setCandidate(jets, match[idx], hadronicB_, jetCorrectionLevel("bQuark")); break;
267  setCandidate(jets, match[idx], leptonicB_, jetCorrectionLevel("bQuark")); break;
268  }
269  }
270  }
271 
272  // -----------------------------------------------------
273  // add lepton
274  // -----------------------------------------------------
275  if( leps->empty() )
276  return;
277  setCandidate(leps, 0, lepton_);
278  match.push_back( 0 );
279 
280  // -----------------------------------------------------
281  // add neutrino
282  // -----------------------------------------------------
283  if( mets->empty() )
284  return;
285  if(neutrinoSolutionType_ == -1)
286  setCandidate(mets, 0, neutrino_);
287  else
288  setNeutrino(mets, leps, 0, neutrinoSolutionType_);
289 }
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_
reco::ShallowClonePtrCandidate * neutrino_
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:10
int neutrinoSolutionType_
algorithm used to calculate neutrino solutions (see cfi for further details)
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 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
virtual void TtSemiLepHypothesis::buildKey ( )
protectedpure virtual
reco::CompositeCandidate TtSemiLepHypothesis::hypo ( )
protected

return event hypothesis

Definition at line 126 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_, neutrino_, TtSemiLepDaughter::Nu, and AddFourMomenta::set().

Referenced by key(), and produce().

127 {
128  // check for sanity of the hypothesis
129  if( !lightQ_ || !lightQBar_ || !hadronicB_ ||
130  !leptonicB_ || !neutrino_ || !lepton_ )
131  return reco::CompositeCandidate();
132 
133  // setup transient references
134  reco::CompositeCandidate hyp, hadTop, hadW, lepTop, lepW;
135 
136  AddFourMomenta addFourMomenta;
137  // build up the top branch that decays leptonically
140  addFourMomenta.set( lepW );
141  lepTop.addDaughter( lepW, TtSemiLepDaughter::LepW );
143  addFourMomenta.set( lepTop );
144 
145  // build up the top branch that decays hadronically
148  addFourMomenta.set( hadW );
149  hadTop.addDaughter( hadW, TtSemiLepDaughter::HadW );
151  addFourMomenta.set( hadTop );
152 
153  // build ttbar hypotheses
154  hyp.addDaughter( lepTop, TtSemiLepDaughter::LepTop );
155  hyp.addDaughter( hadTop, TtSemiLepDaughter::HadTop );
156  addFourMomenta.set( hyp );
157 
158  return hyp;
159 }
static const std::string HadB
static const std::string LepTop
static const std::string Lep
static const std::string LepW
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * lightQBar_
static const std::string HadP
reco::ShallowClonePtrCandidate * neutrino_
static const std::string HadTop
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
reco::ShallowClonePtrCandidate * hadronicB_
static const std::string HadQ
static const std::string HadW
static const std::string Nu
static const std::string LepB
void set(reco::Candidate &c) const
set up a candidate
reco::ShallowClonePtrCandidate * lightQ_
reco::ShallowClonePtrCandidate * leptonicB_
bool TtSemiLepHypothesis::isValid ( const int &  idx,
const edm::Handle< std::vector< pat::Jet > > &  jets 
)
inlineprotected

check if index is in valid range of selected jets

Definition at line 64 of file TtSemiLepHypothesis.h.

References buildHypo(), buildKey(), fwrapper::jets, and leptonType().

Referenced by ntupleDataFormat._Object::_checkIsValid(), TtSemiLepHypGenMatch::buildHypo(), buildHypo(), and core.AutoHandle.AutoHandle::ReallyLoad().

64 { return (0<=idx && idx<(int)jets->size()); };
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 178 of file TtSemiLepHypothesis.cc.

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

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

179 {
180  // jetCorrectionLevel was not configured
181  if(jetCorrectionLevel_.empty())
182  throw cms::Exception("Configuration")
183  << "Unconfigured jetCorrectionLevel. Please use an appropriate, non-empty string.\n";
184 
185  // quarkType is unknown
186  if( !(quarkType=="wQuarkMix" ||
187  quarkType=="udsQuark" ||
188  quarkType=="cQuark" ||
189  quarkType=="bQuark") )
190  throw cms::Exception("Configuration")
191  << quarkType << " is unknown as a quarkType for the jetCorrectionLevel.\n";
192 
193  // combine correction level; start with a ':' even if
194  // there is no flavor tag to be added, as it is needed
195  // by setCandidate to disentangle the correction tag
196  // from a potential flavor tag, which can be empty
198  if( level=="L5Flavor:" || level=="L6UE:" || level=="L7Parton:" ){
199  if(quarkType=="wQuarkMix"){level+="wMix";}
200  if(quarkType=="udsQuark" ){level+="uds";}
201  if(quarkType=="cQuark" ){level+="charm";}
202  if(quarkType=="bQuark" ){level+="bottom";}
203  }
204  else{
205  level+="none";
206  }
207  return level;
208 }
std::string jetCorrectionLevel_
int TtSemiLepHypothesis::key ( ) const
inlineprotected

Definition at line 60 of file TtSemiLepHypothesis.h.

References hypo(), and key_.

Referenced by produce().

60 { return key_; };
int key_
hypothesis key (to be set by the buildKey function)
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 163 of file TtSemiLepHypothesis.cc.

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

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

164 {
165  // check whetherwe are dealing with a reco muon or a reco electron
167  if( dynamic_cast<const reco::Muon*>(cand) ){
168  type = WDecay::kMuon;
169  }
170  else if( dynamic_cast<const reco::GsfElectron*>(cand) ){
171  type = WDecay::kElec;
172  }
173  return type;
174 }
type
Definition: HCALResponse.h:21
void TtSemiLepHypothesis::produce ( edm::Event evt,
const edm::EventSetup setup 
)
protectedvirtual

produce the event hypothesis as CompositeCandidate and Key

Definition at line 50 of file TtSemiLepHypothesis.cc.

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

51 {
53  evt.getByToken(jetsToken_, jets);
54 
56  evt.getByToken(lepsToken_, leps);
57 
59  evt.getByToken(metsToken_, mets);
60 
62  evt.getByToken(nJetsConsideredToken_, nJetsConsidered);
63 
64  std::vector<std::vector<int> > matchVec;
65  if( getMatch_ ) {
67  evt.getByToken(matchToken_, matchHandle);
68  matchVec = *matchHandle;
69  }
70  else {
71  std::vector<int> dummyMatch;
72  for(unsigned int i = 0; i < 4; ++i)
73  dummyMatch.push_back( -1 );
74  matchVec.push_back( dummyMatch );
75  }
76 
77  // declare unique_ptr for products
78  std::unique_ptr<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >
79  pOut( new std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > );
80  std::unique_ptr<int> pKey(new int);
81  std::unique_ptr<int> pNeutrinoSolutions(new int);
82  std::unique_ptr<int> pJetsConsidered(new int);
83 
84  // go through given vector of jet combinations
85  unsigned int idMatch = 0;
86  typedef std::vector<std::vector<int> >::iterator MatchVecIterator;
87  for(MatchVecIterator match = matchVec.begin(); match != matchVec.end(); ++match) {
88  // reset pointers
90  // build hypothesis
91  buildHypo(evt, leps, mets, jets, *match, idMatch++);
92  pOut->push_back( std::make_pair(hypo(), *match) );
93  }
94  // feed out hyps and matches
95  evt.put(std::move(pOut));
96 
97  // build and feed out key
98  buildKey();
99  *pKey=key();
100  evt.put(std::move(pKey), "Key");
101 
102  // feed out number of real neutrino solutions
103  *pNeutrinoSolutions=numberOfRealNeutrinoSolutions_;
104  evt.put(std::move(pNeutrinoSolutions), "NumberOfRealNeutrinoSolutions");
105 
106  // feed out number of considered jets
107  *pJetsConsidered=*nJetsConsidered;
108  evt.put(std::move(pJetsConsidered), "NumberOfConsideredJets");
109 }
edm::EDGetTokenT< int > nJetsConsideredToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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
vector< PseudoJet > jets
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:510
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
void TtSemiLepHypothesis::resetCandidates ( )
protected

reset candidate pointers before hypo build process

Definition at line 113 of file TtSemiLepHypothesis.cc.

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

Referenced by produce().

114 {
116  lightQ_ = 0;
117  lightQBar_ = 0;
118  hadronicB_ = 0;
119  leptonicB_ = 0;
120  neutrino_ = 0;
121  lepton_ = 0;
122 }
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * lightQBar_
reco::ShallowClonePtrCandidate * neutrino_
reco::ShallowClonePtrCandidate * hadronicB_
reco::ShallowClonePtrCandidate * lightQ_
reco::ShallowClonePtrCandidate * leptonicB_
template<typename C >
void TtSemiLepHypothesis::setCandidate ( const edm::Handle< C > &  handle,
const int &  idx,
reco::ShallowClonePtrCandidate *&  clone 
)
protected

use one object in a collection to set a ShallowClonePtrCandidate

Definition at line 117 of file TtSemiLepHypothesis.h.

References cmsBatch::handle, and training_settings::idx.

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

117  {
118  typedef typename C::value_type O;
120  clone = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), ptr->p4(), ptr->vertex() );
121 }
void TtSemiLepHypothesis::setCandidate ( const edm::Handle< std::vector< pat::Jet > > &  handle,
const int &  idx,
reco::ShallowClonePtrCandidate *&  clone,
const std::string &  correctionLevel 
)
protected

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

Definition at line 212 of file TtSemiLepHypothesis.cc.

References reco::LeafCandidate::charge(), cmsBatch::handle, training_settings::idx, pat::Jet::jecFactor(), reco::LeafCandidate::p4(), AlCaHLTBitMon_QueryRunRegistry::string, and reco::LeafCandidate::vertex().

214 {
216  // disentangle the correction from the potential flavor tag
217  // by the separating ':'; the flavor tag can be empty though
218  std::string step = correctionLevel.substr(0,correctionLevel.find(":"));
219  std::string flavor = correctionLevel.substr(1+correctionLevel.find(":"));
220  float corrFactor = 1.;
221  if(flavor=="wMix")
222  corrFactor = 0.75*ptr->jecFactor(step, "uds") + 0.25*ptr->jecFactor(step, "charm");
223  else
224  corrFactor = ptr->jecFactor(step, flavor);
225  clone = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), ptr->p4()*corrFactor, ptr->vertex() );
226 }
virtual const Point & vertex() const
vertex position (overwritten by PF...)
virtual int charge() const final
electric charge
Definition: LeafCandidate.h:91
float jecFactor(const std::string &level, const std::string &flavor="none", const std::string &set="") const
step
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
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 229 of file TtSemiLepHypothesis.cc.

References reco::Candidate::begin(), reco::LeafCandidate::charge(), Exception, WDecay::kElec, WDecay::kMuon, TtSemiLepHitFitProducer_Electrons_cfi::leps, leptonType(), RazorAnalyzer::met, neutrino_, numberOfRealNeutrinoSolutions_, p4, reco::LeafCandidate::px(), reco::LeafCandidate::py(), mathSSE::sqrt(), and reco::LeafCandidate::vertex().

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

231 {
233  MEzCalculator mez;
234  mez.SetMET( *(met->begin()) );
235  if( leptonType( &(leps->front()) ) == WDecay::kMuon )
236  mez.SetLepton( (*leps)[idx], true );
237  else if( leptonType( &(leps->front()) ) == WDecay::kElec )
238  mez.SetLepton( (*leps)[idx], false );
239  else
240  throw cms::Exception("UnimplementedFeature") << "Type of lepton given together with MET for solving neutrino kinematics is neither muon nor electron.\n";
241  double pz = mez.Calculate(type);
242  numberOfRealNeutrinoSolutions_ = mez.IsComplex() ? 0 : 2;
243  const math::XYZTLorentzVector p4( ptr->px(), ptr->py(), pz, sqrt(ptr->px()*ptr->px() + ptr->py()*ptr->py() + pz*pz) );
244  neutrino_ = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), p4, ptr->vertex() );
245 }
type
Definition: HCALResponse.h:21
WDecay::LeptonType leptonType(const reco::RecoCandidate *cand)
determine lepton type of reco candidate and return a corresponding WDecay::LeptonType; the type is kN...
virtual const Point & vertex() const
vertex position (overwritten by PF...)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual int charge() const final
electric charge
Definition: LeafCandidate.h:91
reco::ShallowClonePtrCandidate * neutrino_
virtual double px() const final
x coordinate of momentum vector
T sqrt(T t)
Definition: SSEVec.h:18
double p4[4]
Definition: TauolaWrapper.h:92
met
===> hadronic RAZOR
const_iterator begin() const
first daughter const_iterator
Definition: Candidate.h:144
virtual double py() const final
y coordinate of momentum vector

Member Data Documentation

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 86 of file TtSemiLepHypothesis.h.

Referenced by produce(), and TtSemiLepHypothesis().

reco::ShallowClonePtrCandidate* TtSemiLepHypothesis::hadronicB_
protected
std::string TtSemiLepHypothesis::jetCorrectionLevel_
protected

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

Definition at line 95 of file TtSemiLepHypothesis.h.

Referenced by jetCorrectionLevel(), and TtSemiLepHypothesis().

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

input label for all necessary collections

Definition at line 88 of file TtSemiLepHypothesis.h.

Referenced by produce().

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

Definition at line 89 of file TtSemiLepHypothesis.h.

Referenced by produce().

reco::ShallowClonePtrCandidate* TtSemiLepHypothesis::lepton_
protected
reco::ShallowClonePtrCandidate* TtSemiLepHypothesis::leptonicB_
protected
reco::ShallowClonePtrCandidate* TtSemiLepHypothesis::lightQ_
protected

candidates for internal use for the creation of the hypothesis candidate

Definition at line 105 of file TtSemiLepHypothesis.h.

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

reco::ShallowClonePtrCandidate* TtSemiLepHypothesis::lightQBar_
protected
edm::EDGetTokenT<std::vector<std::vector<int> > > TtSemiLepHypothesis::matchToken_
protected

Definition at line 91 of file TtSemiLepHypothesis.h.

Referenced by produce(), and TtSemiLepHypothesis().

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

Definition at line 90 of file TtSemiLepHypothesis.h.

Referenced by produce().

reco::ShallowClonePtrCandidate* TtSemiLepHypothesis::neutrino_
protected
int TtSemiLepHypothesis::neutrinoSolutionType_
protected

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

Definition at line 99 of file TtSemiLepHypothesis.h.

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

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

Definition at line 92 of file TtSemiLepHypothesis.h.

Referenced by produce().

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 102 of file TtSemiLepHypothesis.h.

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