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"))),
15 numberOfRealNeutrinoSolutions_(-1),
16 lightQ_(0), lightQBar_(0), hadronicB_(0),
17 leptonicB_(0), neutrino_(0), lepton_(0)
20 if( cfg.
exists(
"match") ) {
24 if( cfg.
exists(
"neutrinoSolutionType") )
28 if( cfg.
exists(
"jetCorrectionLevel") ) {
31 produces<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >();
33 produces<int>(
"NumberOfRealNeutrinoSolutions");
34 produces<int>(
"NumberOfConsideredJets");
64 std::vector<std::vector<int> > matchVec;
68 matchVec = *matchHandle;
71 std::vector<int> dummyMatch;
72 for(
unsigned int i = 0;
i < 4; ++
i)
73 dummyMatch.push_back( -1 );
74 matchVec.push_back( dummyMatch );
78 std::unique_ptr<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);
85 unsigned int idMatch = 0;
86 typedef std::vector<std::vector<int> >::iterator MatchVecIterator;
87 for(MatchVecIterator
match = matchVec.begin();
match != matchVec.end(); ++
match) {
92 pOut->push_back( std::make_pair(
hypo(), *
match) );
104 evt.
put(
std::move(pNeutrinoSolutions),
"NumberOfRealNeutrinoSolutions");
108 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
140 addFourMomenta.
set( lepW );
143 addFourMomenta.
set( lepTop );
148 addFourMomenta.
set( hadW );
151 addFourMomenta.
set( hadTop );
156 addFourMomenta.
set( hyp );
167 if( dynamic_cast<const reco::Muon*>(cand) ){
170 else if( dynamic_cast<const reco::GsfElectron*>(cand) ){
183 <<
"Unconfigured jetCorrectionLevel. Please use an appropriate, non-empty string.\n";
186 if( !(quarkType==
"wQuarkMix" ||
187 quarkType==
"udsQuark" ||
188 quarkType==
"cQuark" ||
189 quarkType==
"bQuark") )
191 << quarkType <<
" is unknown as a quarkType for the jetCorrectionLevel.\n";
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";}
218 std::string step = correctionLevel.substr(0,correctionLevel.find(
":"));
219 std::string flavor = correctionLevel.substr(1+correctionLevel.find(
":"));
220 float corrFactor = 1.;
224 corrFactor = ptr->
jecFactor(step, flavor);
234 mez.SetMET( *(met->
begin()) );
236 mez.SetLepton( (*
leps)[idx],
true );
238 mez.SetLepton( (*
leps)[idx],
false );
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);
252 std::vector<int>&
match)
257 for(
unsigned idx=0;
idx<match.size(); ++
idx){
278 match.push_back( 0 );
std::string jetCorrectionLevel_
T getParameter(std::string const &) const
edm::EDGetTokenT< int > nJetsConsideredToken_
static const std::string HadB
static const std::string LepTop
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static const std::string Lep
static const std::string LepW
WDecay::LeptonType leptonType(const reco::RecoCandidate *cand)
determine lepton type of reco candidate and return a corresponding WDecay::LeptonType; the type is kN...
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
check if index is in valid range of selected jets
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual const Point & vertex() const
vertex position (overwritten by PF...)
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * lightQBar_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
def setup(process, global_tag, zero_tesla=False)
static const std::string HadP
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
~TtSemiLepHypothesis()
default destructor
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual int charge() const final
electric charge
TtSemiLepHypothesis(const edm::ParameterSet &)
default constructor
reco::ShallowClonePtrCandidate * neutrino_
virtual double px() const final
x coordinate of momentum vector
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
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_
virtual void produce(edm::Event &, const edm::EventSetup &)
produce the event hypothesis as CompositeCandidate and Key
int numberOfRealNeutrinoSolutions_
static const std::string HadQ
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
static const std::string HadW
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
reco::CompositeCandidate hypo()
return event hypothesis
static const std::string Nu
void setCandidate(const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
use one object in a collection to set a ShallowClonePtrCandidate
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
static const std::string LepB
const_iterator begin() const
first daughter const_iterator
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
void set(reco::Candidate &c) const
set up a candidate
float jecFactor(const std::string &level, const std::string &flavor="none", const std::string &set="") const
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
int neutrinoSolutionType_
algorithm used to calculate neutrino solutions (see cfi for further details)
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
reco::ShallowClonePtrCandidate * lightQ_
virtual double py() const final
y coordinate of momentum vector
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
reco::ShallowClonePtrCandidate * leptonicB_
std::string jetCorrectionLevel(const std::string &quarkType)
helper function to construct the proper correction level string for corresponding quarkType ...