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),
27 if (cfg.
exists(
"neutrinoSolutionType"))
31 if (cfg.
exists(
"jetCorrectionLevel")) {
34 produces<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >();
36 produces<int>(
"NumberOfRealNeutrinoSolutions");
37 produces<int>(
"NumberOfConsideredJets");
70 std::vector<std::vector<int> > matchVec;
74 matchVec = *matchHandle;
76 std::vector<int> dummyMatch;
77 for (
unsigned int i = 0;
i < 4; ++
i)
78 dummyMatch.push_back(-1);
79 matchVec.push_back(dummyMatch);
83 std::unique_ptr<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > > pOut(
85 std::unique_ptr<int> pKey(
new int);
86 std::unique_ptr<int> pNeutrinoSolutions(
new int);
87 std::unique_ptr<int> pJetsConsidered(
new int);
90 unsigned int idMatch = 0;
91 typedef std::vector<std::vector<int> >::iterator MatchVecIterator;
92 for (MatchVecIterator
match = matchVec.begin();
match != matchVec.end(); ++
match) {
97 pOut->push_back(std::make_pair(
hypo(), *
match));
109 evt.
put(
std::move(pNeutrinoSolutions),
"NumberOfRealNeutrinoSolutions");
112 *pJetsConsidered = *nJetsConsidered;
113 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);
165 if (dynamic_cast<const reco::Muon*>(cand)) {
167 }
else if (dynamic_cast<const reco::GsfElectron*>(cand)) {
178 <<
"Unconfigured jetCorrectionLevel. Please use an appropriate, non-empty string.\n";
181 if (!(quarkType ==
"wQuarkMix" || quarkType ==
"udsQuark" || quarkType ==
"cQuark" || quarkType ==
"bQuark"))
182 throw cms::Exception(
"Configuration") << quarkType <<
" is unknown as a quarkType for the jetCorrectionLevel.\n";
189 if (level ==
"L5Flavor:" || level ==
"L6UE:" || level ==
"L7Parton:") {
190 if (quarkType ==
"wQuarkMix") {
193 if (quarkType ==
"udsQuark") {
196 if (quarkType ==
"cQuark") {
199 if (quarkType ==
"bQuark") {
216 std::string step = correctionLevel.substr(0, correctionLevel.find(
':'));
217 std::string flavor = correctionLevel.substr(1 + correctionLevel.find(
':'));
218 float corrFactor = 1.;
219 if (flavor ==
"wMix")
220 corrFactor = 0.75 * ptr->jecFactor(step,
"uds") + 0.25 * ptr->jecFactor(step,
"charm");
222 corrFactor = ptr->jecFactor(step, flavor);
233 mez.SetMET(*(met->begin()));
235 mez.SetLepton((*leps)[idx],
true);
237 mez.SetLepton((*leps)[idx],
false);
240 <<
"Type of lepton given together with MET for solving neutrino kinematics is neither muon nor electron.\n";
241 double pz = mez.Calculate(type);
244 ptr->px(), ptr->py(), pz,
sqrt(ptr->px() * ptr->px() + ptr->py() * ptr->py() + pz * pz));
252 std::vector<int>&
match) {
256 for (
unsigned idx = 0; idx < match.size(); ++idx) {
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
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
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * lightQBar_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
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
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
TtSemiLepHypothesis(const edm::ParameterSet &)
default constructor
reco::ShallowClonePtrCandidate * neutrino_
void resetCandidates()
reset candidate pointers before hypo build process
virtual void buildKey()=0
build the event hypothesis key
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_
int numberOfRealNeutrinoSolutions_
static const std::string HadQ
T getParameter(std::string const &) const
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
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
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
reco::ShallowClonePtrCandidate * lightQ_
~TtSemiLepHypothesis() override
default destructor
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 ...