10 jets_(cfg.getParameter<edm::InputTag>(
"jets")),
11 leps_(cfg.getParameter<edm::InputTag>(
"leps")),
12 mets_(cfg.getParameter<edm::InputTag>(
"mets")),
13 numberOfRealNeutrinoSolutions_(-1),
14 lightQ_(0), lightQBar_(0), hadronicB_(0),
15 leptonicB_(0), neutrino_(0), lepton_(0)
18 if( cfg.
exists(
"match") ) {
22 if( cfg.
exists(
"jetCorrectionLevel") ) {
25 produces<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >();
27 produces<int>(
"NumberOfRealNeutrinoSolutions");
54 std::vector<std::vector<int> > matchVec;
58 matchVec = *matchHandle;
61 std::vector<int> dummyMatch;
62 for(
unsigned int i = 0;
i < 4; ++
i)
63 dummyMatch.push_back( -1 );
64 matchVec.push_back( dummyMatch );
68 std::auto_ptr<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >
70 std::auto_ptr<int> pKey(
new int);
71 std::auto_ptr<int> pNeutrinoSolutions(
new int);
74 unsigned int idMatch = 0;
75 typedef std::vector<std::vector<int> >::iterator MatchVecIterator;
76 for(MatchVecIterator
match = matchVec.begin();
match != matchVec.end(); ++
match) {
81 pOut->push_back( std::make_pair(
hypo(), *
match) );
93 evt.
put(pNeutrinoSolutions,
"NumberOfRealNeutrinoSolutions");
125 addFourMomenta.
set( lepW );
128 addFourMomenta.
set( lepTop );
133 addFourMomenta.
set( hadW );
136 addFourMomenta.
set( hadTop );
141 addFourMomenta.
set( hyp );
152 if( dynamic_cast<const reco::Muon*>(cand) ){
155 else if( dynamic_cast<const reco::GsfElectron*>(cand) ){
168 <<
"Unconfigured jetCorrectionLevel. Please use an appropriate, non-empty string.\n";
171 if( !(quarkType==
"wQuarkMix" ||
172 quarkType==
"udsQuark" ||
173 quarkType==
"cQuark" ||
174 quarkType==
"bQuark") )
176 << quarkType <<
" is unknown as a quarkType for the jetCorrectionLevel.\n";
183 if( level==
"L5Flavor:" || level==
"L6UE:" || level==
"L7Parton:" ){
184 if(quarkType==
"wQuarkMix"){level+=
"wMix";}
185 if(quarkType==
"udsQuark" ){level+=
"uds";}
186 if(quarkType==
"cQuark" ){level+=
"charm";}
187 if(quarkType==
"bQuark" ){level+=
"bottom";}
203 std::string
step = correctionLevel.substr(0,correctionLevel.find(
":"));
204 std::string flavor = correctionLevel.substr(1+correctionLevel.find(
":"));
205 float corrFactor = 1.;
207 corrFactor = 0.75*ptr->jecFactor(step,
"uds") + 0.25*ptr->jecFactor(step,
"charm");
209 corrFactor = ptr->jecFactor(step, flavor);
219 mez.SetMET( *(met->begin()) );
221 mez.SetLepton( (*leps)[idx],
true );
223 mez.SetLepton( (*leps)[idx],
false );
225 throw cms::Exception(
"UnimplementedFeature") <<
"Type of lepton given together with MET for solving neutrino kinematics is neither muon nor electron.\n";
226 double pz = mez.Calculate(type);
std::string jetCorrectionLevel_
T getParameter(std::string const &) const
static const std::string HadB
static const std::string LepTop
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...
reco::ShallowClonePtrCandidate * lepton_
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
reco::ShallowClonePtrCandidate * lightQBar_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
static const std::string HadP
~TtSemiLepHypothesis()
default destructor
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
TtSemiLepHypothesis(const edm::ParameterSet &)
default constructor
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
reco::ShallowClonePtrCandidate * neutrino_
void resetCandidates()
reset candidate pointers before hypo build process
edm::InputTag jets_
input label for all necessary collections
virtual void buildKey()=0
build the event hypothesis key
static const std::string HadTop
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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
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
int key() const
return key
void setCandidate(const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
use one object in a collection to set a ShallowClonePtrCandidate
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
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 ...