CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
TtSemiLepKinFitProducer< LeptonCollection > Class Template Reference

#include <TtSemiLepKinFitProducer.h>

Inheritance diagram for TtSemiLepKinFitProducer< LeptonCollection >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  KinFitResult
 

Public Member Functions

 TtSemiLepKinFitProducer (const edm::ParameterSet &)
 
 ~TtSemiLepKinFitProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

TtSemiLepKinFitter::Constraint constraint (unsigned)
 
std::vector< TtSemiLepKinFitter::Constraintconstraints (std::vector< unsigned > &)
 
bool doBTagging (bool &useBTag_, edm::Handle< std::vector< pat::Jet >> &jets, std::vector< int > &combi, std::string &bTagAlgo_, double &minBTagValueBJets_, double &maxBTagValueNonBJets_)
 
TtSemiLepKinFitter::Param param (unsigned)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< edm::ParameterSetbResolutions_
 
std::string bTagAlgo_
 input tag for b-tagging algorithm More...
 
std::vector< unsigned > constraints_
 constrains More...
 
TtSemiLepKinFitterfitter
 
std::vector< double > jetEnergyResolutionEtaBinning_
 
std::vector< double > jetEnergyResolutionScaleFactors_
 scale factors for jet energy resolution More...
 
unsigned int jetParam_
 
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
 
unsigned int lepParam_
 
std::vector< edm::ParameterSetlepResolutions_
 
edm::EDGetTokenT< LeptonCollection > lepsToken_
 
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
 
double maxBTagValueNonBJet_
 max value of bTag for a non-b-jet More...
 
double maxDeltaS_
 maximal chi2 equivalent More...
 
double maxF_
 maximal deviation for contstraints More...
 
int maxNComb_
 maximal number of combinations to be written to the event More...
 
int maxNJets_
 maximal number of jets (-1 possible to indicate 'all') More...
 
unsigned int maxNrIter_
 maximal number of iterations to be performed for the fit More...
 
unsigned int metParam_
 
std::vector< edm::ParameterSetmetResolutions_
 
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
 
double minBTagValueBJet_
 min value of bTag for a b-jet More...
 
double mTop_
 
double mW_
 
std::vector< edm::ParameterSetudscResolutions_
 config-file-based object resolutions More...
 
bool useBTag_
 switch to tell whether to use b-tagging or not More...
 
bool useOnlyMatch_
 switch to use only a combination given by another hypothesis More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

template<typename LeptonCollection>
class TtSemiLepKinFitProducer< LeptonCollection >

Definition at line 13 of file TtSemiLepKinFitProducer.h.

Constructor & Destructor Documentation

◆ TtSemiLepKinFitProducer()

template<typename LeptonCollection >
TtSemiLepKinFitProducer< LeptonCollection >::TtSemiLepKinFitProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 96 of file TtSemiLepKinFitProducer.h.

97  : jetsToken_(consumes<std::vector<pat::Jet>>(cfg.getParameter<edm::InputTag>("jets"))),
98  lepsToken_(consumes<LeptonCollection>(cfg.getParameter<edm::InputTag>("leps"))),
99  metsToken_(consumes<std::vector<pat::MET>>(cfg.getParameter<edm::InputTag>("mets"))),
100  matchToken_(mayConsume<std::vector<std::vector<int>>>(cfg.getParameter<edm::InputTag>("match"))),
101  useOnlyMatch_(cfg.getParameter<bool>("useOnlyMatch")),
102  bTagAlgo_(cfg.getParameter<std::string>("bTagAlgo")),
103  minBTagValueBJet_(cfg.getParameter<double>("minBDiscBJets")),
104  maxBTagValueNonBJet_(cfg.getParameter<double>("maxBDiscLightJets")),
105  useBTag_(cfg.getParameter<bool>("useBTagging")),
106  maxNJets_(cfg.getParameter<int>("maxNJets")),
107  maxNComb_(cfg.getParameter<int>("maxNComb")),
108  maxNrIter_(cfg.getParameter<unsigned>("maxNrIter")),
109  maxDeltaS_(cfg.getParameter<double>("maxDeltaS")),
110  maxF_(cfg.getParameter<double>("maxF")),
111  jetParam_(cfg.getParameter<unsigned>("jetParametrisation")),
112  lepParam_(cfg.getParameter<unsigned>("lepParametrisation")),
113  metParam_(cfg.getParameter<unsigned>("metParametrisation")),
114  constraints_(cfg.getParameter<std::vector<unsigned>>("constraints")),
115  mW_(cfg.getParameter<double>("mW")),
116  mTop_(cfg.getParameter<double>("mTop")),
117  jetEnergyResolutionScaleFactors_(cfg.getParameter<std::vector<double>>("jetEnergyResolutionScaleFactors")),
118  jetEnergyResolutionEtaBinning_(cfg.getParameter<std::vector<double>>("jetEnergyResolutionEtaBinning")),
119  udscResolutions_(0),
120  bResolutions_(0),
121  lepResolutions_(0),
122  metResolutions_(0) {
123  if (cfg.exists("udscResolutions") && cfg.exists("bResolutions") && cfg.exists("lepResolutions") &&
124  cfg.exists("metResolutions")) {
125  udscResolutions_ = cfg.getParameter<std::vector<edm::ParameterSet>>("udscResolutions");
126  bResolutions_ = cfg.getParameter<std::vector<edm::ParameterSet>>("bResolutions");
127  lepResolutions_ = cfg.getParameter<std::vector<edm::ParameterSet>>("lepResolutions");
128  metResolutions_ = cfg.getParameter<std::vector<edm::ParameterSet>>("metResolutions");
129  } else if (cfg.exists("udscResolutions") || cfg.exists("bResolutions") || cfg.exists("lepResolutions") ||
130  cfg.exists("metResolutions")) {
131  throw cms::Exception("Configuration") << "Parameters 'udscResolutions', 'bResolutions', 'lepResolutions', "
132  "'metResolutions' should be used together.\n";
133  }
134 
136  param(lepParam_),
137  param(metParam_),
138  maxNrIter_,
139  maxDeltaS_,
140  maxF_,
142  mW_,
143  mTop_,
145  &bResolutions_,
150 
151  produces<std::vector<pat::Particle>>("PartonsHadP");
152  produces<std::vector<pat::Particle>>("PartonsHadQ");
153  produces<std::vector<pat::Particle>>("PartonsHadB");
154  produces<std::vector<pat::Particle>>("PartonsLepB");
155  produces<std::vector<pat::Particle>>("Leptons");
156  produces<std::vector<pat::Particle>>("Neutrinos");
157 
158  produces<std::vector<std::vector<int>>>();
159  produces<std::vector<double>>("Chi2");
160  produces<std::vector<double>>("Prob");
161  produces<std::vector<int>>("Status");
162 
163  produces<int>("NumberOfConsideredJets");
164 }

References TtSemiLepKinFitProducer< LeptonCollection >::bResolutions_, looper::cfg, TtSemiLepKinFitProducer< LeptonCollection >::constraints(), TtSemiLepKinFitProducer< LeptonCollection >::constraints_, Exception, TtSemiLepKinFitProducer< LeptonCollection >::fitter, TtSemiLepKinFitProducer< LeptonCollection >::jetEnergyResolutionEtaBinning_, TtSemiLepKinFitProducer< LeptonCollection >::jetEnergyResolutionScaleFactors_, TtSemiLepKinFitProducer< LeptonCollection >::jetParam_, TtSemiLepKinFitProducer< LeptonCollection >::lepParam_, TtSemiLepKinFitProducer< LeptonCollection >::lepResolutions_, TtSemiLepKinFitProducer< LeptonCollection >::maxDeltaS_, TtSemiLepKinFitProducer< LeptonCollection >::maxF_, TtSemiLepKinFitProducer< LeptonCollection >::maxNrIter_, TtSemiLepKinFitProducer< LeptonCollection >::metParam_, TtSemiLepKinFitProducer< LeptonCollection >::metResolutions_, TtSemiLepKinFitProducer< LeptonCollection >::mTop_, TtSemiLepKinFitProducer< LeptonCollection >::mW_, TtSemiLepKinFitProducer< LeptonCollection >::param(), and TtSemiLepKinFitProducer< LeptonCollection >::udscResolutions_.

◆ ~TtSemiLepKinFitProducer()

template<typename LeptonCollection >
TtSemiLepKinFitProducer< LeptonCollection >::~TtSemiLepKinFitProducer ( )
override

Definition at line 167 of file TtSemiLepKinFitProducer.h.

167  {
168  delete fitter;
169 }

Member Function Documentation

◆ constraint()

template<typename LeptonCollection >
TtSemiLepKinFitter::Constraint TtSemiLepKinFitProducer< LeptonCollection >::constraint ( unsigned  val)
private

◆ constraints()

template<typename LeptonCollection >
std::vector< TtSemiLepKinFitter::Constraint > TtSemiLepKinFitProducer< LeptonCollection >::constraints ( std::vector< unsigned > &  val)
private

Definition at line 463 of file TtSemiLepKinFitProducer.h.

464  {
465  std::vector<TtSemiLepKinFitter::Constraint> result;
466  for (unsigned i = 0; i < val.size(); ++i) {
467  result.push_back(constraint(val[i]));
468  }
469  return result;
470 }

References HLT_FULL_cff::constraint, mps_fire::i, mps_fire::result, and heppy_batch::val.

Referenced by TtSemiLepKinFitProducer< LeptonCollection >::TtSemiLepKinFitProducer().

◆ doBTagging()

template<typename LeptonCollection >
bool TtSemiLepKinFitProducer< LeptonCollection >::doBTagging ( bool &  useBTag_,
edm::Handle< std::vector< pat::Jet >> &  jets,
std::vector< int > &  combi,
std::string &  bTagAlgo_,
double &  minBTagValueBJets_,
double &  maxBTagValueNonBJets_ 
)
private

Definition at line 172 of file TtSemiLepKinFitProducer.h.

177  {
178  if (!useBTag_) {
179  return true;
180  }
181  if (useBTag_ && (*jets)[combi[TtSemiLepEvtPartons::HadB]].bDiscriminator(bTagAlgo_) >= minBTagValueBJet_ &&
182  (*jets)[combi[TtSemiLepEvtPartons::LepB]].bDiscriminator(bTagAlgo_) >= minBTagValueBJet_ &&
183  (*jets)[combi[TtSemiLepEvtPartons::LightQ]].bDiscriminator(bTagAlgo_) < maxBTagValueNonBJet_ &&
184  (*jets)[combi[TtSemiLepEvtPartons::LightQBar]].bDiscriminator(bTagAlgo_) < maxBTagValueNonBJet_) {
185  return true;
186  } else {
187  return false;
188  }
189 }

References TtSemiLepEvtPartons::HadB, singleTopDQM_cfi::jets, TtSemiLepEvtPartons::LepB, TtSemiLepEvtPartons::LightQ, and TtSemiLepEvtPartons::LightQBar.

◆ param()

template<typename LeptonCollection >
TtSemiLepKinFitter::Param TtSemiLepKinFitProducer< LeptonCollection >::param ( unsigned  val)
private

Definition at line 411 of file TtSemiLepKinFitProducer.h.

411  {
413  switch (val) {
416  break;
419  break;
422  break;
423  default:
424  throw cms::Exception("Configuration") << "Chosen jet parametrization is not supported: " << val << "\n";
425  break;
426  }
427  return result;
428 }

References Exception, TopKinFitter::kEMom, TopKinFitter::kEtEtaPhi, TopKinFitter::kEtThetaPhi, mps_fire::result, and heppy_batch::val.

Referenced by TtSemiLepKinFitProducer< LeptonCollection >::TtSemiLepKinFitProducer().

◆ produce()

template<typename LeptonCollection >
void TtSemiLepKinFitProducer< LeptonCollection >::produce ( edm::Event evt,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 192 of file TtSemiLepKinFitProducer.h.

192  {
193  std::unique_ptr<std::vector<pat::Particle>> pPartonsHadP(new std::vector<pat::Particle>);
194  std::unique_ptr<std::vector<pat::Particle>> pPartonsHadQ(new std::vector<pat::Particle>);
195  std::unique_ptr<std::vector<pat::Particle>> pPartonsHadB(new std::vector<pat::Particle>);
196  std::unique_ptr<std::vector<pat::Particle>> pPartonsLepB(new std::vector<pat::Particle>);
197  std::unique_ptr<std::vector<pat::Particle>> pLeptons(new std::vector<pat::Particle>);
198  std::unique_ptr<std::vector<pat::Particle>> pNeutrinos(new std::vector<pat::Particle>);
199 
200  std::unique_ptr<std::vector<std::vector<int>>> pCombi(new std::vector<std::vector<int>>);
201  std::unique_ptr<std::vector<double>> pChi2(new std::vector<double>);
202  std::unique_ptr<std::vector<double>> pProb(new std::vector<double>);
203  std::unique_ptr<std::vector<int>> pStatus(new std::vector<int>);
204 
205  std::unique_ptr<int> pJetsConsidered(new int);
206 
208  evt.getByToken(jetsToken_, jets);
209 
211  evt.getByToken(metsToken_, mets);
212 
214  evt.getByToken(lepsToken_, leps);
215 
216  const unsigned int nPartons = 4;
217 
218  std::vector<int> match;
219  bool invalidMatch = false;
220  if (useOnlyMatch_) {
221  *pJetsConsidered = nPartons;
223  evt.getByToken(matchToken_, matchHandle);
224  match = *(matchHandle->begin());
225  // check if match is valid
226  if (match.size() != nPartons)
227  invalidMatch = true;
228  else {
229  for (unsigned int idx = 0; idx < match.size(); ++idx) {
230  if (match[idx] < 0 || match[idx] >= (int)jets->size()) {
231  invalidMatch = true;
232  break;
233  }
234  }
235  }
236  }
237 
238  // -----------------------------------------------------
239  // skip events with no appropriate lepton candidate in
240  // or empty MET or less jets than partons or invalid match
241  // -----------------------------------------------------
242 
243  if (leps->empty() || mets->empty() || jets->size() < nPartons || invalidMatch) {
244  // the kinFit getters return empty objects here
245  pPartonsHadP->push_back(fitter->fittedHadP());
246  pPartonsHadQ->push_back(fitter->fittedHadQ());
247  pPartonsHadB->push_back(fitter->fittedHadB());
248  pPartonsLepB->push_back(fitter->fittedLepB());
249  pLeptons->push_back(fitter->fittedLepton());
250  pNeutrinos->push_back(fitter->fittedNeutrino());
251  // indices referring to the jet combination
252  std::vector<int> invalidCombi;
253  for (unsigned int i = 0; i < nPartons; ++i)
254  invalidCombi.push_back(-1);
255  pCombi->push_back(invalidCombi);
256  // chi2
257  pChi2->push_back(-1.);
258  // chi2 probability
259  pProb->push_back(-1.);
260  // status of the fitter
261  pStatus->push_back(-1);
262  // number of jets
263  *pJetsConsidered = jets->size();
264  // feed out all products
265  evt.put(std::move(pCombi));
266  evt.put(std::move(pPartonsHadP), "PartonsHadP");
267  evt.put(std::move(pPartonsHadQ), "PartonsHadQ");
268  evt.put(std::move(pPartonsHadB), "PartonsHadB");
269  evt.put(std::move(pPartonsLepB), "PartonsLepB");
270  evt.put(std::move(pLeptons), "Leptons");
271  evt.put(std::move(pNeutrinos), "Neutrinos");
272  evt.put(std::move(pChi2), "Chi2");
273  evt.put(std::move(pProb), "Prob");
274  evt.put(std::move(pStatus), "Status");
275  evt.put(std::move(pJetsConsidered), "NumberOfConsideredJets");
276  return;
277  }
278 
279  // -----------------------------------------------------
280  // analyze different jet combinations using the KinFitter
281  // (or only a given jet combination if useOnlyMatch=true)
282  // -----------------------------------------------------
283 
284  std::vector<int> jetIndices;
285  if (!useOnlyMatch_) {
286  for (unsigned int i = 0; i < jets->size(); ++i) {
287  if (maxNJets_ >= (int)nPartons && maxNJets_ == (int)i) {
288  *pJetsConsidered = i;
289  break;
290  }
291  jetIndices.push_back(i);
292  }
293  }
294 
295  std::vector<int> combi;
296  for (unsigned int i = 0; i < nPartons; ++i) {
297  if (useOnlyMatch_)
298  combi.push_back(match[i]);
299  else
300  combi.push_back(i);
301  }
302 
303  std::list<KinFitResult> FitResultList;
304 
305  do {
306  for (int cnt = 0; cnt < TMath::Factorial(combi.size()); ++cnt) {
307  // take into account indistinguishability of the two jets from the hadr. W decay,
308  // reduces combinatorics by a factor of 2
311  std::vector<pat::Jet> jetCombi;
312  jetCombi.resize(nPartons);
313  jetCombi[TtSemiLepEvtPartons::LightQ] = (*jets)[combi[TtSemiLepEvtPartons::LightQ]];
315  jetCombi[TtSemiLepEvtPartons::HadB] = (*jets)[combi[TtSemiLepEvtPartons::HadB]];
316  jetCombi[TtSemiLepEvtPartons::LepB] = (*jets)[combi[TtSemiLepEvtPartons::LepB]];
317 
318  // do the kinematic fit
319  const int status = fitter->fit(jetCombi, (*leps)[0], (*mets)[0]);
320 
321  if (status == 0) { // only take into account converged fits
322  KinFitResult result;
323  result.Status = status;
324  result.Chi2 = fitter->fitS();
325  result.Prob = fitter->fitProb();
326  result.HadB = fitter->fittedHadB();
327  result.HadP = fitter->fittedHadP();
328  result.HadQ = fitter->fittedHadQ();
329  result.LepB = fitter->fittedLepB();
330  result.LepL = fitter->fittedLepton();
331  result.LepN = fitter->fittedNeutrino();
332  result.JetCombi = combi;
333 
334  FitResultList.push_back(result);
335  }
336  }
337  if (useOnlyMatch_)
338  break; // don't go through combinatorics if useOnlyMatch was chosen
339  next_permutation(combi.begin(), combi.end());
340  }
341  if (useOnlyMatch_)
342  break; // don't go through combinatorics if useOnlyMatch was chosen
343  } while (stdcomb::next_combination(jetIndices.begin(), jetIndices.end(), combi.begin(), combi.end()));
344 
345  // sort results w.r.t. chi2 values
346  FitResultList.sort();
347 
348  // -----------------------------------------------------
349  // feed out result
350  // starting with the JetComb having the smallest chi2
351  // -----------------------------------------------------
352 
353  if ((unsigned)FitResultList.size() < 1) { // in case no fit results were stored in the list (all fits aborted)
354  pPartonsHadP->push_back(fitter->fittedHadP());
355  pPartonsHadQ->push_back(fitter->fittedHadQ());
356  pPartonsHadB->push_back(fitter->fittedHadB());
357  pPartonsLepB->push_back(fitter->fittedLepB());
358  pLeptons->push_back(fitter->fittedLepton());
359  pNeutrinos->push_back(fitter->fittedNeutrino());
360  // indices referring to the jet combination
361  std::vector<int> invalidCombi;
362  for (unsigned int i = 0; i < nPartons; ++i)
363  invalidCombi.push_back(-1);
364  pCombi->push_back(invalidCombi);
365  // chi2
366  pChi2->push_back(-1.);
367  // chi2 probability
368  pProb->push_back(-1.);
369  // status of the fitter
370  pStatus->push_back(-1);
371  } else {
372  unsigned int iComb = 0;
373  for (typename std::list<KinFitResult>::const_iterator result = FitResultList.begin(); result != FitResultList.end();
374  ++result) {
375  if (maxNComb_ >= 1 && iComb == (unsigned int)maxNComb_)
376  break;
377  iComb++;
378  // partons
379  pPartonsHadP->push_back(result->HadP);
380  pPartonsHadQ->push_back(result->HadQ);
381  pPartonsHadB->push_back(result->HadB);
382  pPartonsLepB->push_back(result->LepB);
383  // lepton
384  pLeptons->push_back(result->LepL);
385  // neutrino
386  pNeutrinos->push_back(result->LepN);
387  // indices referring to the jet combination
388  pCombi->push_back(result->JetCombi);
389  // chi2
390  pChi2->push_back(result->Chi2);
391  // chi2 probability
392  pProb->push_back(result->Prob);
393  // status of the fitter
394  pStatus->push_back(result->Status);
395  }
396  }
397  evt.put(std::move(pCombi));
398  evt.put(std::move(pPartonsHadP), "PartonsHadP");
399  evt.put(std::move(pPartonsHadQ), "PartonsHadQ");
400  evt.put(std::move(pPartonsHadB), "PartonsHadB");
401  evt.put(std::move(pPartonsLepB), "PartonsLepB");
402  evt.put(std::move(pLeptons), "Leptons");
403  evt.put(std::move(pNeutrinos), "Neutrinos");
404  evt.put(std::move(pChi2), "Chi2");
405  evt.put(std::move(pProb), "Prob");
406  evt.put(std::move(pStatus), "Status");
407  evt.put(std::move(pJetsConsidered), "NumberOfConsideredJets");
408 }

References edm::Event::getByToken(), TtSemiLepEvtPartons::HadB, mps_fire::i, heavyIonCSV_trainingSettings::idx, createfilelist::int, singleTopDQM_cfi::jets, TtSemiLepEvtPartons::LepB, TtSemiLepHitFitProducer_Electrons_cfi::leps, TtSemiLepEvtPartons::LightQ, TtSemiLepEvtPartons::LightQBar, match(), singleTopDQM_cfi::mets, eostools::move(), stdcomb::next_combination(), nPartons, edm::Event::put(), mps_fire::result, mps_update::status, and trackerHitRTTI::vector.

Member Data Documentation

◆ bResolutions_

template<typename LeptonCollection >
std::vector<edm::ParameterSet> TtSemiLepKinFitProducer< LeptonCollection >::bResolutions_
private

◆ bTagAlgo_

template<typename LeptonCollection >
std::string TtSemiLepKinFitProducer< LeptonCollection >::bTagAlgo_
private

input tag for b-tagging algorithm

Definition at line 44 of file TtSemiLepKinFitProducer.h.

◆ constraints_

template<typename LeptonCollection >
std::vector<unsigned> TtSemiLepKinFitProducer< LeptonCollection >::constraints_
private

◆ fitter

template<typename LeptonCollection >
TtSemiLepKinFitter* TtSemiLepKinFitProducer< LeptonCollection >::fitter
private

◆ jetEnergyResolutionEtaBinning_

template<typename LeptonCollection >
std::vector<double> TtSemiLepKinFitProducer< LeptonCollection >::jetEnergyResolutionEtaBinning_
private

◆ jetEnergyResolutionScaleFactors_

template<typename LeptonCollection >
std::vector<double> TtSemiLepKinFitProducer< LeptonCollection >::jetEnergyResolutionScaleFactors_
private

scale factors for jet energy resolution

Definition at line 70 of file TtSemiLepKinFitProducer.h.

Referenced by TtSemiLepKinFitProducer< LeptonCollection >::TtSemiLepKinFitProducer().

◆ jetParam_

template<typename LeptonCollection >
unsigned int TtSemiLepKinFitProducer< LeptonCollection >::jetParam_
private

◆ jetsToken_

template<typename LeptonCollection >
edm::EDGetTokenT<std::vector<pat::Jet> > TtSemiLepKinFitProducer< LeptonCollection >::jetsToken_
private

Definition at line 36 of file TtSemiLepKinFitProducer.h.

◆ lepParam_

template<typename LeptonCollection >
unsigned int TtSemiLepKinFitProducer< LeptonCollection >::lepParam_
private

◆ lepResolutions_

template<typename LeptonCollection >
std::vector<edm::ParameterSet> TtSemiLepKinFitProducer< LeptonCollection >::lepResolutions_
private

◆ lepsToken_

template<typename LeptonCollection >
edm::EDGetTokenT<LeptonCollection> TtSemiLepKinFitProducer< LeptonCollection >::lepsToken_
private

Definition at line 37 of file TtSemiLepKinFitProducer.h.

◆ matchToken_

template<typename LeptonCollection >
edm::EDGetTokenT<std::vector<std::vector<int> > > TtSemiLepKinFitProducer< LeptonCollection >::matchToken_
private

Definition at line 40 of file TtSemiLepKinFitProducer.h.

◆ maxBTagValueNonBJet_

template<typename LeptonCollection >
double TtSemiLepKinFitProducer< LeptonCollection >::maxBTagValueNonBJet_
private

max value of bTag for a non-b-jet

Definition at line 48 of file TtSemiLepKinFitProducer.h.

◆ maxDeltaS_

template<typename LeptonCollection >
double TtSemiLepKinFitProducer< LeptonCollection >::maxDeltaS_
private

maximal chi2 equivalent

Definition at line 59 of file TtSemiLepKinFitProducer.h.

Referenced by TtSemiLepKinFitProducer< LeptonCollection >::TtSemiLepKinFitProducer().

◆ maxF_

template<typename LeptonCollection >
double TtSemiLepKinFitProducer< LeptonCollection >::maxF_
private

maximal deviation for contstraints

Definition at line 61 of file TtSemiLepKinFitProducer.h.

Referenced by TtSemiLepKinFitProducer< LeptonCollection >::TtSemiLepKinFitProducer().

◆ maxNComb_

template<typename LeptonCollection >
int TtSemiLepKinFitProducer< LeptonCollection >::maxNComb_
private

maximal number of combinations to be written to the event

Definition at line 54 of file TtSemiLepKinFitProducer.h.

◆ maxNJets_

template<typename LeptonCollection >
int TtSemiLepKinFitProducer< LeptonCollection >::maxNJets_
private

maximal number of jets (-1 possible to indicate 'all')

Definition at line 52 of file TtSemiLepKinFitProducer.h.

◆ maxNrIter_

template<typename LeptonCollection >
unsigned int TtSemiLepKinFitProducer< LeptonCollection >::maxNrIter_
private

maximal number of iterations to be performed for the fit

Definition at line 57 of file TtSemiLepKinFitProducer.h.

Referenced by TtSemiLepKinFitProducer< LeptonCollection >::TtSemiLepKinFitProducer().

◆ metParam_

template<typename LeptonCollection >
unsigned int TtSemiLepKinFitProducer< LeptonCollection >::metParam_
private

◆ metResolutions_

template<typename LeptonCollection >
std::vector<edm::ParameterSet> TtSemiLepKinFitProducer< LeptonCollection >::metResolutions_
private

◆ metsToken_

template<typename LeptonCollection >
edm::EDGetTokenT<std::vector<pat::MET> > TtSemiLepKinFitProducer< LeptonCollection >::metsToken_
private

Definition at line 38 of file TtSemiLepKinFitProducer.h.

◆ minBTagValueBJet_

template<typename LeptonCollection >
double TtSemiLepKinFitProducer< LeptonCollection >::minBTagValueBJet_
private

min value of bTag for a b-jet

Definition at line 46 of file TtSemiLepKinFitProducer.h.

◆ mTop_

template<typename LeptonCollection >
double TtSemiLepKinFitProducer< LeptonCollection >::mTop_
private

◆ mW_

template<typename LeptonCollection >
double TtSemiLepKinFitProducer< LeptonCollection >::mW_
private

◆ udscResolutions_

template<typename LeptonCollection >
std::vector<edm::ParameterSet> TtSemiLepKinFitProducer< LeptonCollection >::udscResolutions_
private

config-file-based object resolutions

Definition at line 73 of file TtSemiLepKinFitProducer.h.

Referenced by TtSemiLepKinFitProducer< LeptonCollection >::TtSemiLepKinFitProducer().

◆ useBTag_

template<typename LeptonCollection >
bool TtSemiLepKinFitProducer< LeptonCollection >::useBTag_
private

switch to tell whether to use b-tagging or not

Definition at line 50 of file TtSemiLepKinFitProducer.h.

◆ useOnlyMatch_

template<typename LeptonCollection >
bool TtSemiLepKinFitProducer< LeptonCollection >::useOnlyMatch_
private

switch to use only a combination given by another hypothesis

Definition at line 42 of file TtSemiLepKinFitProducer.h.

TtSemiLepKinFitProducer::lepParam_
unsigned int lepParam_
Definition: TtSemiLepKinFitProducer.h:63
TopKinFitter::kEtEtaPhi
Definition: TopKinFitter.h:20
TtSemiLepKinFitProducer::maxBTagValueNonBJet_
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
Definition: TtSemiLepKinFitProducer.h:48
TtSemiLepKinFitProducer::jetsToken_
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
Definition: TtSemiLepKinFitProducer.h:36
mps_fire.i
i
Definition: mps_fire.py:428
TtSemiLepEvtPartons::LightQBar
Definition: TtSemiLepEvtPartons.h:25
TtSemiLepKinFitter::fittedNeutrino
const pat::Particle fittedNeutrino() const
return neutrino candidate
Definition: TtSemiLepKinFitter.h:96
TtSemiLepKinFitter::kSumPt
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitProducer::jetEnergyResolutionScaleFactors_
std::vector< double > jetEnergyResolutionScaleFactors_
scale factors for jet energy resolution
Definition: TtSemiLepKinFitProducer.h:70
mps_update.status
status
Definition: mps_update.py:69
TtSemiLepEvtPartons::LepB
Definition: TtSemiLepEvtPartons.h:25
TtSemiLepKinFitProducer::bTagAlgo_
std::string bTagAlgo_
input tag for b-tagging algorithm
Definition: TtSemiLepKinFitProducer.h:44
TtSemiLepKinFitter::fittedHadB
const pat::Particle fittedHadB() const
return hadronic b quark candidate
Definition: TtSemiLepKinFitter.h:86
TtSemiLepKinFitProducer::constraints
std::vector< TtSemiLepKinFitter::Constraint > constraints(std::vector< unsigned > &)
Definition: TtSemiLepKinFitProducer.h:463
TtSemiLepKinFitter::fit
int fit(const std::vector< pat::Jet > &jets, const pat::Lepton< LeptonType > &leps, const pat::MET &met)
kinematic fit interface for PAT objects
Definition: TtSemiLepKinFitter.h:156
TtSemiLepKinFitProducer::jetParam_
unsigned int jetParam_
Definition: TtSemiLepKinFitProducer.h:62
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
singleTopDQM_cfi.mets
mets
Definition: singleTopDQM_cfi.py:43
edm::Handle
Definition: AssociativeIterator.h:50
TtSemiLepKinFitProducer::maxNJets_
int maxNJets_
maximal number of jets (-1 possible to indicate 'all')
Definition: TtSemiLepKinFitProducer.h:52
TopKinFitter::kEMom
Definition: TopKinFitter.h:20
TopKinFitter::fitProb
double fitProb() const
return fit probability
Definition: TopKinFitter.h:37
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
TtSemiLepHitFitProducer_Electrons_cfi.leps
leps
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:5
TtSemiLepKinFitter::kEqualTopMasses
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitter::fittedLepton
const pat::Particle fittedLepton() const
return lepton candidate
Definition: TtSemiLepKinFitter.h:94
TtSemiLepKinFitter
Definition: TtSemiLepKinFitter.h:32
TtSemiLepKinFitter::fittedHadQ
const pat::Particle fittedHadQ() const
return hadronic light quark candidate
Definition: TtSemiLepKinFitter.h:90
edm::EDConsumerBase::mayConsume
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
Definition: EDConsumerBase.h:175
TtSemiLepKinFitProducer::doBTagging
bool doBTagging(bool &useBTag_, edm::Handle< std::vector< pat::Jet >> &jets, std::vector< int > &combi, std::string &bTagAlgo_, double &minBTagValueBJets_, double &maxBTagValueNonBJets_)
Definition: TtSemiLepKinFitProducer.h:172
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
TtSemiLepKinFitter::kTopHadMass
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitProducer::jetEnergyResolutionEtaBinning_
std::vector< double > jetEnergyResolutionEtaBinning_
Definition: TtSemiLepKinFitProducer.h:71
TtSemiLepKinFitProducer::metParam_
unsigned int metParam_
Definition: TtSemiLepKinFitProducer.h:64
TtSemiLepKinFitter::kNeutrinoMass
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitProducer::maxNrIter_
unsigned int maxNrIter_
maximal number of iterations to be performed for the fit
Definition: TtSemiLepKinFitProducer.h:57
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TtSemiLepKinFitter::fittedHadP
const pat::Particle fittedHadP() const
return hadronic light quark candidate
Definition: TtSemiLepKinFitter.h:88
TtSemiLepKinFitProducer::mW_
double mW_
Definition: TtSemiLepKinFitProducer.h:67
TtSemiLepKinFitProducer::matchToken_
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
Definition: TtSemiLepKinFitProducer.h:40
TtSemiLepEvtPartons::HadB
Definition: TtSemiLepEvtPartons.h:25
TtSemiLepKinFitProducer::constraints_
std::vector< unsigned > constraints_
constrains
Definition: TtSemiLepKinFitProducer.h:66
TtSemiLepKinFitter::Constraint
Constraint
supported constraints
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitProducer::fitter
TtSemiLepKinFitter * fitter
Definition: TtSemiLepKinFitProducer.h:78
nPartons
static const unsigned int nPartons
Definition: TtFullHadKinFitProducer.cc:3
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
TtSemiLepEvtPartons::LightQ
Definition: TtSemiLepEvtPartons.h:25
createfilelist.int
int
Definition: createfilelist.py:10
TtSemiLepKinFitProducer::udscResolutions_
std::vector< edm::ParameterSet > udscResolutions_
config-file-based object resolutions
Definition: TtSemiLepKinFitProducer.h:73
TtSemiLepKinFitter::fittedLepB
const pat::Particle fittedLepB() const
return leptonic b quark candidate
Definition: TtSemiLepKinFitter.h:92
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
TtSemiLepKinFitProducer::lepsToken_
edm::EDGetTokenT< LeptonCollection > lepsToken_
Definition: TtSemiLepKinFitProducer.h:37
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
TtSemiLepKinFitProducer::maxNComb_
int maxNComb_
maximal number of combinations to be written to the event
Definition: TtSemiLepKinFitProducer.h:54
TtSemiLepKinFitProducer::constraint
TtSemiLepKinFitter::Constraint constraint(unsigned)
Definition: TtSemiLepKinFitProducer.h:431
TtSemiLepKinFitter::kWLepMass
Definition: TtSemiLepKinFitter.h:35
TopKinFitter::fitS
double fitS() const
return chi2 of fit (not normalized to degrees of freedom)
Definition: TopKinFitter.h:33
TopKinFitter::kEtThetaPhi
Definition: TopKinFitter.h:20
looper.cfg
cfg
Definition: looper.py:297
TtSemiLepKinFitProducer::metResolutions_
std::vector< edm::ParameterSet > metResolutions_
Definition: TtSemiLepKinFitProducer.h:76
heppy_batch.val
val
Definition: heppy_batch.py:351
eostools.move
def move(src, dest)
Definition: eostools.py:511
stdcomb::next_combination
bool next_combination(BidIt n_begin, BidIt n_end, BidIt r_begin, BidIt r_end)
Definition: combination.h:19
TtSemiLepKinFitProducer::useOnlyMatch_
bool useOnlyMatch_
switch to use only a combination given by another hypothesis
Definition: TtSemiLepKinFitProducer.h:42
TtSemiLepKinFitProducer::useBTag_
bool useBTag_
switch to tell whether to use b-tagging or not
Definition: TtSemiLepKinFitProducer.h:50
TtSemiLepKinFitProducer::maxF_
double maxF_
maximal deviation for contstraints
Definition: TtSemiLepKinFitProducer.h:61
Exception
Definition: hltDiff.cc:245
TtSemiLepKinFitter::kTopLepMass
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitProducer::param
TtSemiLepKinFitter::Param param(unsigned)
Definition: TtSemiLepKinFitProducer.h:411
TtSemiLepKinFitter::kWHadMass
Definition: TtSemiLepKinFitter.h:35
TtSemiLepKinFitProducer::mTop_
double mTop_
Definition: TtSemiLepKinFitProducer.h:68
TtSemiLepKinFitProducer::lepResolutions_
std::vector< edm::ParameterSet > lepResolutions_
Definition: TtSemiLepKinFitProducer.h:75
mps_fire.result
result
Definition: mps_fire.py:311
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:155
TopKinFitter::Param
Param
supported parameterizations
Definition: TopKinFitter.h:20
TtSemiLepKinFitProducer::maxDeltaS_
double maxDeltaS_
maximal chi2 equivalent
Definition: TtSemiLepKinFitProducer.h:59
edm::InputTag
Definition: InputTag.h:15
TtSemiLepKinFitProducer::metsToken_
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
Definition: TtSemiLepKinFitProducer.h:38
TtSemiLepKinFitProducer::bResolutions_
std::vector< edm::ParameterSet > bResolutions_
Definition: TtSemiLepKinFitProducer.h:74
TtSemiLepKinFitProducer::minBTagValueBJet_
double minBTagValueBJet_
min value of bTag for a b-jet
Definition: TtSemiLepKinFitProducer.h:46