17 template <
typename LeptonCollection>
95 template <
typename LeptonCollection>
98 lepsToken_(consumes<LeptonCollection>(
cfg.getParameter<
edm::
InputTag>(
"leps"))),
100 maxNJets_(
cfg.getParameter<
int>(
"maxNJets")),
101 maxNComb_(
cfg.getParameter<
int>(
"maxNComb")),
103 minBTagValueBJet_(
cfg.getParameter<double>(
"minBDiscBJets")),
104 maxBTagValueNonBJet_(
cfg.getParameter<double>(
"maxBDiscLightJets")),
105 useBTag_(
cfg.getParameter<
bool>(
"useBTagging")),
106 mW_(
cfg.getParameter<double>(
"mW")),
107 mTop_(
cfg.getParameter<double>(
"mTop")),
108 jetCorrectionLevel_(
cfg.getParameter<
std::
string>(
"jetCorrectionLevel")),
109 jes_(
cfg.getParameter<double>(
"jes")),
110 jesB_(
cfg.getParameter<double>(
"jesB")),
114 hitfitDefault_(
cfg.getUntrackedParameter<
edm::FileInPath>(
116 edm::FileInPath(
std::
string(
"TopQuarkAnalysis/TopHitFit/data/setting/RunHitFitConfiguration.txt")))),
117 hitfitElectronResolution_(
cfg.getUntrackedParameter<
edm::FileInPath>(
119 edm::FileInPath(
std::
string(
"TopQuarkAnalysis/TopHitFit/data/resolution/tqafElectronResolution.txt")))),
120 hitfitMuonResolution_(
cfg.getUntrackedParameter<
edm::FileInPath>(
122 edm::FileInPath(
std::
string(
"TopQuarkAnalysis/TopHitFit/data/resolution/tqafMuonResolution.txt")))),
123 hitfitUdscJetResolution_(
cfg.getUntrackedParameter<
edm::FileInPath>(
125 edm::FileInPath(
std::
string(
"TopQuarkAnalysis/TopHitFit/data/resolution/tqafUdscJetResolution.txt")))),
126 hitfitBJetResolution_(
cfg.getUntrackedParameter<
edm::FileInPath>(
128 edm::FileInPath(
std::
string(
"TopQuarkAnalysis/TopHitFit/data/resolution/tqafBJetResolution.txt")))),
129 hitfitMETResolution_(
cfg.getUntrackedParameter<
edm::FileInPath>(
131 edm::FileInPath(
std::
string(
"TopQuarkAnalysis/TopHitFit/data/resolution/tqafKtResolution.txt")))),
135 electronTranslator_(hitfitElectronResolution_.
fullPath()),
136 muonTranslator_(hitfitMuonResolution_.
fullPath()),
138 hitfitUdscJetResolution_.
fullPath(), hitfitBJetResolution_.
fullPath(), jetCorrectionLevel_, jes_, jesB_),
139 metTranslator_(hitfitMETResolution_.
fullPath())
143 HitFit = std::make_unique<PatHitFit>(
151 <<
"+++++++++++ TtSemiLepHitFitProducer ++++++++++++ \n" 152 <<
" Due to the eta ranges for which resolutions \n" 153 <<
" are provided in \n" 154 <<
" TopQuarkAnalysis/TopHitFit/data/resolution/ \n" 155 <<
" so far, the following cuts are currently \n" 156 <<
" implemented in the TtSemiLepHitFitProducer: \n" 157 <<
" |eta(muons )| <= " <<
maxEtaMu_ <<
" \n" 158 <<
" |eta(electrons)| <= " <<
maxEtaEle_ <<
" \n" 160 <<
"++++++++++++++++++++++++++++++++++++++++++++++++ \n";
162 produces<std::vector<pat::Particle> >(
"PartonsHadP");
163 produces<std::vector<pat::Particle> >(
"PartonsHadQ");
164 produces<std::vector<pat::Particle> >(
"PartonsHadB");
165 produces<std::vector<pat::Particle> >(
"PartonsLepB");
166 produces<std::vector<pat::Particle> >(
"Leptons");
167 produces<std::vector<pat::Particle> >(
"Neutrinos");
169 produces<std::vector<std::vector<int> > >();
170 produces<std::vector<double> >(
"Chi2");
171 produces<std::vector<double> >(
"Prob");
172 produces<std::vector<double> >(
"MT");
173 produces<std::vector<double> >(
"SigMT");
174 produces<std::vector<int> >(
"Status");
175 produces<int>(
"NumberOfConsideredJets");
178 template <
typename LeptonCollection>
180 std::unique_ptr<std::vector<pat::Particle> > pPartonsHadP(
new std::vector<pat::Particle>);
181 std::unique_ptr<std::vector<pat::Particle> > pPartonsHadQ(
new std::vector<pat::Particle>);
182 std::unique_ptr<std::vector<pat::Particle> > pPartonsHadB(
new std::vector<pat::Particle>);
183 std::unique_ptr<std::vector<pat::Particle> > pPartonsLepB(
new std::vector<pat::Particle>);
184 std::unique_ptr<std::vector<pat::Particle> > pLeptons(
new std::vector<pat::Particle>);
185 std::unique_ptr<std::vector<pat::Particle> > pNeutrinos(
new std::vector<pat::Particle>);
187 std::unique_ptr<std::vector<std::vector<int> > > pCombi(
new std::vector<std::vector<int> >);
188 std::unique_ptr<std::vector<double> > pChi2(
new std::vector<double>);
189 std::unique_ptr<std::vector<double> > pProb(
new std::vector<double>);
190 std::unique_ptr<std::vector<double> > pMT(
new std::vector<double>);
191 std::unique_ptr<std::vector<double> > pSigMT(
new std::vector<double>);
192 std::unique_ptr<std::vector<int> > pStatus(
new std::vector<int>);
193 std::unique_ptr<int> pJetsConsidered(
new int);
215 bool foundLepton =
false;
216 if (!
leps->empty()) {
217 double maxEtaLep = maxEtaMu_;
218 if (!dynamic_cast<const reco::Muon*>(&((*
leps)[0])))
219 maxEtaLep = maxEtaEle_;
220 for (
unsigned iLep = 0; iLep < (*leps).size() && !foundLepton; ++iLep) {
222 HitFit->AddLepton((*
leps)[iLep]);
229 unsigned int nJetsFound = 0;
230 for (
unsigned iJet = 0; iJet < (*jets).size() && (
int)nJetsFound != maxNJets_; ++iJet) {
231 double jet_eta = (*jets)[iJet].eta();
232 if ((*
jets)[iJet].isCaloJet()) {
233 jet_eta = ((
reco::CaloJet*)((*
jets)[iJet]).originalObject())->detectorP4().eta();
235 if (
std::abs(jet_eta) <= maxEtaJet_) {
236 HitFit->AddJet((*
jets)[iJet]);
240 *pJetsConsidered = nJetsFound;
244 HitFit->SetMet((*
mets)[0]);
246 if (!foundLepton ||
mets->empty() || nJetsFound <
nPartons) {
255 std::vector<int> invalidCombi;
257 invalidCombi.push_back(-1);
258 pCombi->push_back(invalidCombi);
260 pChi2->push_back(-1.);
262 pProb->push_back(-1.);
265 pSigMT->push_back(-1.);
267 pStatus->push_back(-1);
281 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
285 std::list<FitResult> FitResultList;
298 size_t nHitFitJet = 0;
301 std::vector<hitfit::Fit_Result> hitFitResult;
309 nHitFit = HitFit->FitAllPermutation();
316 nHitFitJet = HitFit->GetUnfittedEvent()[0].njets();
319 hitFitResult = HitFit->GetFitAllPermutation();
322 for (
size_t fit = 0;
fit != nHitFit; ++
fit) {
333 std::vector<int> hitCombi(4);
334 for (
size_t jet = 0;
jet != nHitFitJet; ++
jet) {
372 if (hitFitResult[
fit].chisq() > 0
382 result.Prob =
exp(-1.0 * (hitFitResult[
fit].chisq()) / 2.0);
384 result.SigMT = hitFitResult[
fit].sigmt();
398 fittedEvent.
met().x(), fittedEvent.
met().y(), fittedEvent.
met().z(), fittedEvent.
met().t()),
400 result.JetCombi = hitCombi;
402 FitResultList.push_back(
result);
407 FitResultList.sort();
414 if (((
unsigned)FitResultList.size()) < 1) {
422 std::vector<int> invalidCombi;
424 invalidCombi.push_back(-1);
425 pCombi->push_back(invalidCombi);
427 pChi2->push_back(-1.);
429 pProb->push_back(-1.);
432 pSigMT->push_back(-1.);
434 pStatus->push_back(-1);
436 unsigned int iComb = 0;
437 for (
typename std::list<FitResult>::const_iterator
result = FitResultList.begin();
result != FitResultList.end();
439 if (maxNComb_ >= 1 && iComb == (
unsigned int)maxNComb_)
443 pPartonsHadP->push_back(
result->HadP);
444 pPartonsHadQ->push_back(
result->HadQ);
445 pPartonsHadB->push_back(
result->HadB);
446 pPartonsLepB->push_back(
result->LepB);
448 pLeptons->push_back(
result->LepL);
450 pNeutrinos->push_back(
result->LepN);
452 pCombi->push_back(
result->JetCombi);
454 pChi2->push_back(
result->Chi2);
456 pProb->push_back(
result->Prob);
458 pMT->push_back(
result->MT);
459 pSigMT->push_back(
result->SigMT);
461 pStatus->push_back(
result->Status);
476 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
Log< level::Info, true > LogVerbatim
int maxNComb_
maximal number of combinations to be written to the event
double maxEtaEle_
maximum eta value for electrons, needed to limited range in which resolutions are provided ...
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
static const unsigned int nPartons
bool operator<(const FitResult &rhs)
hitfit::JetTranslatorBase< pat::Jet > jetTranslator_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::FileInPath hitfitMETResolution_
Jets made from CaloTowers.
Represent a lepton in an instance of Lepjets_Event class. This class hold the following information: ...
hitfit::LeptonTranslatorBase< pat::Electron > electronTranslator_
std::vector< int > JetCombi
TtSemiLepHitFitProducer(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
hitfit::LeptonTranslatorBase< pat::Muon > muonTranslator_
Lepjets_Event_Jet & jet(std::vector< Lepjets_Event_Jet >::size_type i)
Return a reference to jet at index position i.
double maxEtaJet_
maximum eta value for jets, needed to limited range in which resolutions are provided ...
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
int & type()
Return a reference to the type code.
edm::FileInPath hitfitUdscJetResolution_
void produce(edm::Event &, const edm::EventSetup &) override
edm::FileInPath hitfitMuonResolution_
A class to hold functions to calculate kinematic quantities of interest in events.
bool useBTag_
switch to tell whether to use b-tagging or not
TtSemiLepHitFitProducer< std::vector< pat::Electron > > TtSemiLepHitFitProducerElectron
Represent a simple event consisting of lepton(s) and jet(s). An instance of this class holds a list o...
edm::FileInPath hitfitBJetResolution_
std::unique_ptr< PatHitFit > HitFit
Abs< T >::type abs(const T &t)
Template class of function object to translate missing transverse energy object to HitFit's Fourvec o...
A class to represent a jet in an instance of Lepjets_Event class. The class is derived from the Lepje...
int maxNJets_
maximal number of jets (-1 possible to indicate 'all')
Template class of experiment-independent interface to HitFit.
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
Template class of experiment-independent interface to HitFit. This class is intended to be used insid...
hitfit::METTranslatorBase< pat::MET > metTranslator_
Template class of function object to translate jet physics object to HitFit's Lepjets_Event_Jet objec...
Fourvec & met()
Return a reference to the missing transverse energy.
Lepjets_Event_Lep & lep(std::vector< Lepjets_Event_Lep >::size_type i)
Return a reference to lepton at index position i.
edm::EDGetTokenT< LeptonCollection > lepsToken_
Template class of function object to translate lepton physics object to HitFit's Lepjets_Event_Lep ob...
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::FileInPath hitfitElectronResolution_
Analysis-level particle class.
std::string jetCorrectionLevel_
jet correction level
Fourvec & p()
Return a reference to the four-momentum.
TtSemiLepHitFitProducer< std::vector< pat::Muon > > TtSemiLepHitFitProducerMuon
hitfit::RunHitFit< pat::Electron, pat::Muon, pat::Jet, pat::MET > PatHitFit
edm::FileInPath hitfitDefault_
const std::string & fullPath() const
double maxEtaMu_
maximum eta value for muons, needed to limited range in which resolutions are provided ...
double minBTagValueBJet_
min value of bTag for a b-jet
std::string bTagAlgo_
input tag for b-tagging algorithm
double jes_
jet energy scale