14 nJetsConsideredToken_(consumes<
int>(
cfg.getParameter<
edm::
InputTag>(
"nJetsConsidered"))),
15 numberOfRealNeutrinoSolutions_(-1) {
17 if (
cfg.exists(
"match")) {
21 if (
cfg.exists(
"neutrinoSolutionType"))
25 if (
cfg.exists(
"jetCorrectionLevel")) {
28 produces<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >();
30 produces<int>(
"NumberOfRealNeutrinoSolutions");
31 produces<int>(
"NumberOfConsideredJets");
48 std::vector<std::vector<int> > matchVec;
52 matchVec = *matchHandle;
54 std::vector<int> dummyMatch;
55 for (
unsigned int i = 0;
i < 4; ++
i)
56 dummyMatch.push_back(-1);
57 matchVec.push_back(dummyMatch);
61 std::unique_ptr<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > > pOut(
63 std::unique_ptr<int> pKey(
new int);
64 std::unique_ptr<int> pNeutrinoSolutions(
new int);
65 std::unique_ptr<int> pJetsConsidered(
new int);
68 unsigned int idMatch = 0;
69 typedef std::vector<std::vector<int> >::iterator MatchVecIterator;
70 for (MatchVecIterator
match = matchVec.begin();
match != matchVec.end(); ++
match) {
75 pOut->push_back(std::make_pair(
hypo(), *
match));
87 evt.
put(
std::move(pNeutrinoSolutions),
"NumberOfRealNeutrinoSolutions");
91 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
118 addFourMomenta.
set(lepW);
121 addFourMomenta.
set(lepTop);
126 addFourMomenta.
set(hadW);
129 addFourMomenta.
set(hadTop);
134 addFourMomenta.
set(hyp);
143 if (dynamic_cast<const reco::Muon*>(
cand)) {
145 }
else if (dynamic_cast<const reco::GsfElectron*>(
cand)) {
156 <<
"Unconfigured jetCorrectionLevel. Please use an appropriate, non-empty string.\n";
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";
167 if (
level ==
"L5Flavor:" ||
level ==
"L6UE:" ||
level ==
"L7Parton:") {
168 if (quarkType ==
"wQuarkMix") {
171 if (quarkType ==
"udsQuark") {
174 if (quarkType ==
"cQuark") {
177 if (quarkType ==
"bQuark") {
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")
199 return std::make_unique<reco::ShallowClonePtrCandidate>(ptr, ptr->
charge(), ptr->p4() * corrFactor, ptr->vertex());
209 mez.SetMET(*(
met->begin()));
211 mez.SetLepton((*
leps)[
idx],
true);
213 mez.SetLepton((*
leps)[
idx],
false);
216 <<
"Type of lepton given together with MET for solving neutrino kinematics is neither muon nor electron.\n";
217 double pz = mez.Calculate(
type);
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());
228 std::vector<int>&
match) {
std::string jetCorrectionLevel_
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
float jecFactor(const std::string &level, const std::string &flavor="none", const std::string &set="") const
static const std::string LepW
void set(reco::Candidate &c) const
set up a candidate
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
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
std::unique_ptr< reco::ShallowClonePtrCandidate > leptonicB_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
TtSemiLepHypothesis(const edm::ParameterSet &)
default constructor
double px() const final
x coordinate of momentum vector
std::unique_ptr< reco::ShallowClonePtrCandidate > lepton_
void resetCandidates()
reset candidate pointers before hypo build process
std::unique_ptr< reco::ShallowClonePtrCandidate > makeCandidate(const edm::Handle< C > &handle, const int &idx)
use one object in a collection to set a ShallowClonePtrCandidate
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
double py() const final
y coordinate of momentum vector
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
int numberOfRealNeutrinoSolutions_
static const std::string HadQ
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQBar_
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
std::unique_ptr< reco::ShallowClonePtrCandidate > neutrino_
static const std::string Nu
std::unique_ptr< reco::ShallowClonePtrCandidate > lightQ_
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
static const std::string LepB
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
int neutrinoSolutionType_
algorithm used to calculate neutrino solutions (see cfi for further details)
void produce(edm::Event &, const edm::EventSetup &) override
produce the event hypothesis as CompositeCandidate and Key
std::unique_ptr< reco::ShallowClonePtrCandidate > hadronicB_
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
int charge() const final
electric charge
std::string jetCorrectionLevel(const std::string &quarkType)
helper function to construct the proper correction level string for corresponding quarkType ...