CMS 3D CMS Logo

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

#include <TtSemiLepHitFitProducer.h>

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

Classes

struct  FitResult
 

Public Member Functions

 TtSemiLepHitFitProducer (const edm::ParameterSet &)
 
 ~TtSemiLepHitFitProducer () 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::vector< ModuleDescription const * > &modules, 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 Types

typedef hitfit::RunHitFit< pat::Electron, pat::Muon, pat::Jet, pat::METPatHitFit
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::string bTagAlgo_
 input tag for b-tagging algorithm More...
 
hitfit::LeptonTranslatorBase< pat::ElectronelectronTranslator_
 
PatHitFitHitFit
 
edm::FileInPath hitfitBJetResolution_
 
edm::FileInPath hitfitDefault_
 
edm::FileInPath hitfitElectronResolution_
 
edm::FileInPath hitfitMETResolution_
 
edm::FileInPath hitfitMuonResolution_
 
edm::FileInPath hitfitUdscJetResolution_
 
double jes_
 jet energy scale More...
 
double jesB_
 
std::string jetCorrectionLevel_
 jet correction level More...
 
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
 
hitfit::JetTranslatorBase< pat::JetjetTranslator_
 
edm::EDGetTokenT< LeptonCollection > lepsToken_
 
double maxBTagValueNonBJet_
 max value of bTag for a non-b-jet More...
 
double maxEtaEle_
 maximum eta value for electrons, needed to limited range in which resolutions are provided More...
 
double maxEtaJet_
 maximum eta value for jets, needed to limited range in which resolutions are provided More...
 
double maxEtaMu_
 maximum eta value for muons, needed to limited range in which resolutions are provided 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...
 
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
 
hitfit::METTranslatorBase< pat::METmetTranslator_
 
double minBTagValueBJet_
 min value of bTag for a b-jet More...
 
double mTop_
 
hitfit::LeptonTranslatorBase< pat::MuonmuonTranslator_
 
double mW_
 constraints More...
 
bool useBTag_
 switch to tell whether to use b-tagging or not 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 TtSemiLepHitFitProducer< LeptonCollection >

Definition at line 20 of file TtSemiLepHitFitProducer.h.

Member Typedef Documentation

◆ PatHitFit

template<typename LeptonCollection >
typedef hitfit::RunHitFit<pat::Electron, pat::Muon, pat::Jet, pat::MET> TtSemiLepHitFitProducer< LeptonCollection >::PatHitFit
private

Definition at line 81 of file TtSemiLepHitFitProducer.h.

Constructor & Destructor Documentation

◆ TtSemiLepHitFitProducer()

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

Definition at line 99 of file TtSemiLepHitFitProducer.h.

100  : jetsToken_(consumes<std::vector<pat::Jet> >(cfg.getParameter<edm::InputTag>("jets"))),
101  lepsToken_(consumes<LeptonCollection>(cfg.getParameter<edm::InputTag>("leps"))),
102  metsToken_(consumes<std::vector<pat::MET> >(cfg.getParameter<edm::InputTag>("mets"))),
103  maxNJets_(cfg.getParameter<int>("maxNJets")),
104  maxNComb_(cfg.getParameter<int>("maxNComb")),
105  bTagAlgo_(cfg.getParameter<std::string>("bTagAlgo")),
106  minBTagValueBJet_(cfg.getParameter<double>("minBDiscBJets")),
107  maxBTagValueNonBJet_(cfg.getParameter<double>("maxBDiscLightJets")),
108  useBTag_(cfg.getParameter<bool>("useBTagging")),
109  mW_(cfg.getParameter<double>("mW")),
110  mTop_(cfg.getParameter<double>("mTop")),
111  jetCorrectionLevel_(cfg.getParameter<std::string>("jetCorrectionLevel")),
112  jes_(cfg.getParameter<double>("jes")),
113  jesB_(cfg.getParameter<double>("jesB")),
114 
115  // The following five initializers read the config parameters for the
116  // ASCII text files which contains the physics object resolutions.
117  hitfitDefault_(cfg.getUntrackedParameter<edm::FileInPath>(
118  std::string("hitfitDefault"),
119  edm::FileInPath(std::string("TopQuarkAnalysis/TopHitFit/data/setting/RunHitFitConfiguration.txt")))),
120  hitfitElectronResolution_(cfg.getUntrackedParameter<edm::FileInPath>(
121  std::string("hitfitElectronResolution"),
122  edm::FileInPath(std::string("TopQuarkAnalysis/TopHitFit/data/resolution/tqafElectronResolution.txt")))),
123  hitfitMuonResolution_(cfg.getUntrackedParameter<edm::FileInPath>(
124  std::string("hitfitMuonResolution"),
125  edm::FileInPath(std::string("TopQuarkAnalysis/TopHitFit/data/resolution/tqafMuonResolution.txt")))),
126  hitfitUdscJetResolution_(cfg.getUntrackedParameter<edm::FileInPath>(
127  std::string("hitfitUdscJetResolution"),
128  edm::FileInPath(std::string("TopQuarkAnalysis/TopHitFit/data/resolution/tqafUdscJetResolution.txt")))),
129  hitfitBJetResolution_(cfg.getUntrackedParameter<edm::FileInPath>(
130  std::string("hitfitBJetResolution"),
131  edm::FileInPath(std::string("TopQuarkAnalysis/TopHitFit/data/resolution/tqafBJetResolution.txt")))),
132  hitfitMETResolution_(cfg.getUntrackedParameter<edm::FileInPath>(
133  std::string("hitfitMETResolution"),
134  edm::FileInPath(std::string("TopQuarkAnalysis/TopHitFit/data/resolution/tqafKtResolution.txt")))),
135 
136  // The following four initializers instantiate the translator between PAT objects
137  // and HitFit objects using the ASCII text files which contains the resolutions.
143 
144 {
145  // Create an instance of RunHitFit and initialize it.
146  HitFit = new PatHitFit(
148 
149  maxEtaMu_ = 2.4;
150  maxEtaEle_ = 2.5;
151  maxEtaJet_ = 2.5;
152 
153  edm::LogVerbatim("TopHitFit") << "\n"
154  << "+++++++++++ TtSemiLepHitFitProducer ++++++++++++ \n"
155  << " Due to the eta ranges for which resolutions \n"
156  << " are provided in \n"
157  << " TopQuarkAnalysis/TopHitFit/data/resolution/ \n"
158  << " so far, the following cuts are currently \n"
159  << " implemented in the TtSemiLepHitFitProducer: \n"
160  << " |eta(muons )| <= " << maxEtaMu_ << " \n"
161  << " |eta(electrons)| <= " << maxEtaEle_ << " \n"
162  << " |eta(jets )| <= " << maxEtaJet_ << " \n"
163  << "++++++++++++++++++++++++++++++++++++++++++++++++ \n";
164 
165  produces<std::vector<pat::Particle> >("PartonsHadP");
166  produces<std::vector<pat::Particle> >("PartonsHadQ");
167  produces<std::vector<pat::Particle> >("PartonsHadB");
168  produces<std::vector<pat::Particle> >("PartonsLepB");
169  produces<std::vector<pat::Particle> >("Leptons");
170  produces<std::vector<pat::Particle> >("Neutrinos");
171 
172  produces<std::vector<std::vector<int> > >();
173  produces<std::vector<double> >("Chi2");
174  produces<std::vector<double> >("Prob");
175  produces<std::vector<double> >("MT");
176  produces<std::vector<double> >("SigMT");
177  produces<std::vector<int> >("Status");
178  produces<int>("NumberOfConsideredJets");
179 }

References TtSemiLepHitFitProducer< LeptonCollection >::electronTranslator_, edm::FileInPath::fullPath(), TtSemiLepHitFitProducer< LeptonCollection >::HitFit, TtSemiLepHitFitProducer< LeptonCollection >::hitfitDefault_, TtSemiLepHitFitProducer< LeptonCollection >::jetTranslator_, TtSemiLepHitFitProducer< LeptonCollection >::maxEtaEle_, TtSemiLepHitFitProducer< LeptonCollection >::maxEtaJet_, TtSemiLepHitFitProducer< LeptonCollection >::maxEtaMu_, TtSemiLepHitFitProducer< LeptonCollection >::metTranslator_, TtSemiLepHitFitProducer< LeptonCollection >::mTop_, TtSemiLepHitFitProducer< LeptonCollection >::muonTranslator_, and TtSemiLepHitFitProducer< LeptonCollection >::mW_.

◆ ~TtSemiLepHitFitProducer()

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

Definition at line 182 of file TtSemiLepHitFitProducer.h.

182  {
183  delete HitFit;
184 }

Member Function Documentation

◆ produce()

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

Implements edm::EDProducer.

Definition at line 187 of file TtSemiLepHitFitProducer.h.

187  {
188  std::unique_ptr<std::vector<pat::Particle> > pPartonsHadP(new std::vector<pat::Particle>);
189  std::unique_ptr<std::vector<pat::Particle> > pPartonsHadQ(new std::vector<pat::Particle>);
190  std::unique_ptr<std::vector<pat::Particle> > pPartonsHadB(new std::vector<pat::Particle>);
191  std::unique_ptr<std::vector<pat::Particle> > pPartonsLepB(new std::vector<pat::Particle>);
192  std::unique_ptr<std::vector<pat::Particle> > pLeptons(new std::vector<pat::Particle>);
193  std::unique_ptr<std::vector<pat::Particle> > pNeutrinos(new std::vector<pat::Particle>);
194 
195  std::unique_ptr<std::vector<std::vector<int> > > pCombi(new std::vector<std::vector<int> >);
196  std::unique_ptr<std::vector<double> > pChi2(new std::vector<double>);
197  std::unique_ptr<std::vector<double> > pProb(new std::vector<double>);
198  std::unique_ptr<std::vector<double> > pMT(new std::vector<double>);
199  std::unique_ptr<std::vector<double> > pSigMT(new std::vector<double>);
200  std::unique_ptr<std::vector<int> > pStatus(new std::vector<int>);
201  std::unique_ptr<int> pJetsConsidered(new int);
202 
204  evt.getByToken(jetsToken_, jets);
205 
207  evt.getByToken(metsToken_, mets);
208 
210  evt.getByToken(lepsToken_, leps);
211 
212  // -----------------------------------------------------
213  // skip events with no appropriate lepton candidate in
214  // or empty MET or less jets than partons
215  // -----------------------------------------------------
216 
217  const unsigned int nPartons = 4;
218 
219  // Clear the internal state
220  HitFit->clear();
221 
222  // Add lepton into HitFit
223  bool foundLepton = false;
224  if (!leps->empty()) {
225  double maxEtaLep = maxEtaMu_;
226  if (!dynamic_cast<const reco::Muon*>(&((*leps)[0]))) // assume electron if it is not a muon
227  maxEtaLep = maxEtaEle_;
228  for (unsigned iLep = 0; iLep < (*leps).size() && !foundLepton; ++iLep) {
229  if (std::abs((*leps)[iLep].eta()) <= maxEtaLep) {
230  HitFit->AddLepton((*leps)[iLep]);
231  foundLepton = true;
232  }
233  }
234  }
235 
236  // Add jets into HitFit
237  unsigned int nJetsFound = 0;
238  for (unsigned iJet = 0; iJet < (*jets).size() && (int)nJetsFound != maxNJets_; ++iJet) {
239  double jet_eta = (*jets)[iJet].eta();
240  if ((*jets)[iJet].isCaloJet()) {
241  jet_eta = ((reco::CaloJet*)((*jets)[iJet]).originalObject())->detectorP4().eta();
242  }
243  if (std::abs(jet_eta) <= maxEtaJet_) {
244  HitFit->AddJet((*jets)[iJet]);
245  nJetsFound++;
246  }
247  }
248  *pJetsConsidered = nJetsFound;
249 
250  // Add missing transverse energy into HitFit
251  if (!mets->empty())
252  HitFit->SetMet((*mets)[0]);
253 
254  if (!foundLepton || mets->empty() || nJetsFound < nPartons) {
255  // the kinFit getters return empty objects here
256  pPartonsHadP->push_back(pat::Particle());
257  pPartonsHadQ->push_back(pat::Particle());
258  pPartonsHadB->push_back(pat::Particle());
259  pPartonsLepB->push_back(pat::Particle());
260  pLeptons->push_back(pat::Particle());
261  pNeutrinos->push_back(pat::Particle());
262  // indices referring to the jet combination
263  std::vector<int> invalidCombi;
264  for (unsigned int i = 0; i < nPartons; ++i)
265  invalidCombi.push_back(-1);
266  pCombi->push_back(invalidCombi);
267  // chi2
268  pChi2->push_back(-1.);
269  // chi2 probability
270  pProb->push_back(-1.);
271  // fitted top mass
272  pMT->push_back(-1.);
273  pSigMT->push_back(-1.);
274  // status of the fitter
275  pStatus->push_back(-1);
276  // feed out all products
277  evt.put(std::move(pCombi));
278  evt.put(std::move(pPartonsHadP), "PartonsHadP");
279  evt.put(std::move(pPartonsHadQ), "PartonsHadQ");
280  evt.put(std::move(pPartonsHadB), "PartonsHadB");
281  evt.put(std::move(pPartonsLepB), "PartonsLepB");
282  evt.put(std::move(pLeptons), "Leptons");
283  evt.put(std::move(pNeutrinos), "Neutrinos");
284  evt.put(std::move(pChi2), "Chi2");
285  evt.put(std::move(pProb), "Prob");
286  evt.put(std::move(pMT), "MT");
287  evt.put(std::move(pSigMT), "SigMT");
288  evt.put(std::move(pStatus), "Status");
289  evt.put(std::move(pJetsConsidered), "NumberOfConsideredJets");
290  return;
291  }
292 
293  std::list<FitResult> FitResultList;
294 
295  //
296  // BEGIN DECLARATION OF VARIABLES FROM KINEMATIC FIT
297  //
298 
299  // In this part are variables from the
300  // kinematic fit procedure
301 
302  // Number of all permutations of the event
303  size_t nHitFit = 0;
304 
305  // Number of jets in the event
306  size_t nHitFitJet = 0;
307 
308  // Results of the fit for all jet permutations of the event
309  std::vector<hitfit::Fit_Result> hitFitResult;
310 
311  //
312  // R U N H I T F I T
313  //
314  // Run the kinematic fit and get how many permutations are possible
315  // in the fit
316 
317  nHitFit = HitFit->FitAllPermutation();
318 
319  //
320  // BEGIN PART WHICH EXTRACTS INFORMATION FROM HITFIT
321  //
322 
323  // Get the number of jets
324  nHitFitJet = HitFit->GetUnfittedEvent()[0].njets();
325 
326  // Get the fit results for all permutations
327  hitFitResult = HitFit->GetFitAllPermutation();
328 
329  // Loop over all permutations and extract the information
330  for (size_t fit = 0; fit != nHitFit; ++fit) {
331  // Get the event after the fit
332  hitfit::Lepjets_Event fittedEvent = hitFitResult[fit].ev();
333 
334  /*
335  Get jet permutation according to TQAF convention
336  11 : leptonic b
337  12 : hadronic b
338  13 : hadronic W
339  14 : hadronic W
340  */
341  std::vector<int> hitCombi(4);
342  for (size_t jet = 0; jet != nHitFitJet; ++jet) {
343  int jet_type = fittedEvent.jet(jet).type();
344 
345  switch (jet_type) {
346  case 11:
347  hitCombi[TtSemiLepEvtPartons::LepB] = jet;
348  break;
349  case 12:
350  hitCombi[TtSemiLepEvtPartons::HadB] = jet;
351  break;
352  case 13:
353  hitCombi[TtSemiLepEvtPartons::LightQ] = jet;
354  break;
355  case 14:
357  break;
358  }
359  }
360 
361  // Store the kinematic quantities in the corresponding containers.
362 
363  hitfit::Lepjets_Event_Jet hadP_ = fittedEvent.jet(hitCombi[TtSemiLepEvtPartons::LightQ]);
364  hitfit::Lepjets_Event_Jet hadQ_ = fittedEvent.jet(hitCombi[TtSemiLepEvtPartons::LightQBar]);
365  hitfit::Lepjets_Event_Jet hadB_ = fittedEvent.jet(hitCombi[TtSemiLepEvtPartons::HadB]);
366  hitfit::Lepjets_Event_Jet lepB_ = fittedEvent.jet(hitCombi[TtSemiLepEvtPartons::LepB]);
367  hitfit::Lepjets_Event_Lep lepL_ = fittedEvent.lep(0);
368 
369  /*
371  std::string bTagAlgo_;
373  double minBTagValueBJet_;
375  double maxBTagValueNonBJet_;
377  bool useBTag_;
378  */
379 
380  if (hitFitResult[fit].chisq() > 0 // only take into account converged fits
381  && (!useBTag_ ||
382  (useBTag_ // use btag information if chosen
383  && jets->at(hitCombi[TtSemiLepEvtPartons::LightQ]).bDiscriminator(bTagAlgo_) < maxBTagValueNonBJet_ &&
384  jets->at(hitCombi[TtSemiLepEvtPartons::LightQBar]).bDiscriminator(bTagAlgo_) < maxBTagValueNonBJet_ &&
385  jets->at(hitCombi[TtSemiLepEvtPartons::HadB]).bDiscriminator(bTagAlgo_) > minBTagValueBJet_ &&
386  jets->at(hitCombi[TtSemiLepEvtPartons::LepB]).bDiscriminator(bTagAlgo_) > minBTagValueBJet_))) {
387  FitResult result;
388  result.Status = 0;
389  result.Chi2 = hitFitResult[fit].chisq();
390  result.Prob = exp(-1.0 * (hitFitResult[fit].chisq()) / 2.0);
391  result.MT = hitFitResult[fit].mt();
392  result.SigMT = hitFitResult[fit].sigmt();
394  0, math::XYZTLorentzVector(hadB_.p().x(), hadB_.p().y(), hadB_.p().z(), hadB_.p().t()), math::XYZPoint()));
396  0, math::XYZTLorentzVector(hadP_.p().x(), hadP_.p().y(), hadP_.p().z(), hadP_.p().t()), math::XYZPoint()));
398  0, math::XYZTLorentzVector(hadQ_.p().x(), hadQ_.p().y(), hadQ_.p().z(), hadQ_.p().t()), math::XYZPoint()));
400  0, math::XYZTLorentzVector(lepB_.p().x(), lepB_.p().y(), lepB_.p().z(), lepB_.p().t()), math::XYZPoint()));
402  0, math::XYZTLorentzVector(lepL_.p().x(), lepL_.p().y(), lepL_.p().z(), lepL_.p().t()), math::XYZPoint()));
404  0,
406  fittedEvent.met().x(), fittedEvent.met().y(), fittedEvent.met().z(), fittedEvent.met().t()),
407  math::XYZPoint()));
408  result.JetCombi = hitCombi;
409 
410  FitResultList.push_back(result);
411  }
412  }
413 
414  // sort results w.r.t. chi2 values
415  FitResultList.sort();
416 
417  // -----------------------------------------------------
418  // feed out result
419  // starting with the JetComb having the smallest chi2
420  // -----------------------------------------------------
421 
422  if (((unsigned)FitResultList.size()) < 1) { // in case no fit results were stored in the list (all fits aborted)
423  pPartonsHadP->push_back(pat::Particle());
424  pPartonsHadQ->push_back(pat::Particle());
425  pPartonsHadB->push_back(pat::Particle());
426  pPartonsLepB->push_back(pat::Particle());
427  pLeptons->push_back(pat::Particle());
428  pNeutrinos->push_back(pat::Particle());
429  // indices referring to the jet combination
430  std::vector<int> invalidCombi;
431  for (unsigned int i = 0; i < nPartons; ++i)
432  invalidCombi.push_back(-1);
433  pCombi->push_back(invalidCombi);
434  // chi2
435  pChi2->push_back(-1.);
436  // chi2 probability
437  pProb->push_back(-1.);
438  // fitted top mass
439  pMT->push_back(-1.);
440  pSigMT->push_back(-1.);
441  // status of the fitter
442  pStatus->push_back(-1);
443  } else {
444  unsigned int iComb = 0;
445  for (typename std::list<FitResult>::const_iterator result = FitResultList.begin(); result != FitResultList.end();
446  ++result) {
447  if (maxNComb_ >= 1 && iComb == (unsigned int)maxNComb_)
448  break;
449  iComb++;
450  // partons
451  pPartonsHadP->push_back(result->HadP);
452  pPartonsHadQ->push_back(result->HadQ);
453  pPartonsHadB->push_back(result->HadB);
454  pPartonsLepB->push_back(result->LepB);
455  // lepton
456  pLeptons->push_back(result->LepL);
457  // neutrino
458  pNeutrinos->push_back(result->LepN);
459  // indices referring to the jet combination
460  pCombi->push_back(result->JetCombi);
461  // chi2
462  pChi2->push_back(result->Chi2);
463  // chi2 probability
464  pProb->push_back(result->Prob);
465  // fitted top mass
466  pMT->push_back(result->MT);
467  pSigMT->push_back(result->SigMT);
468  // status of the fitter
469  pStatus->push_back(result->Status);
470  }
471  }
472  evt.put(std::move(pCombi));
473  evt.put(std::move(pPartonsHadP), "PartonsHadP");
474  evt.put(std::move(pPartonsHadQ), "PartonsHadQ");
475  evt.put(std::move(pPartonsHadB), "PartonsHadB");
476  evt.put(std::move(pPartonsLepB), "PartonsLepB");
477  evt.put(std::move(pLeptons), "Leptons");
478  evt.put(std::move(pNeutrinos), "Neutrinos");
479  evt.put(std::move(pChi2), "Chi2");
480  evt.put(std::move(pProb), "Prob");
481  evt.put(std::move(pMT), "MT");
482  evt.put(std::move(pSigMT), "SigMT");
483  evt.put(std::move(pStatus), "Status");
484  evt.put(std::move(pJetsConsidered), "NumberOfConsideredJets");
485 }

References funct::abs(), PVValHelper::eta, JetChargeProducer_cfi::exp, L1TowerCalibrationProducer_cfi::fit, edm::Event::getByToken(), TtSemiLepEvtPartons::HadB, mps_fire::i, createfilelist::int, metsig::jet, hitfit::Lepjets_Event::jet(), singleTopDQM_cfi::jets, hitfit::Lepjets_Event::lep(), TtSemiLepEvtPartons::LepB, TtSemiLepHitFitProducer_Electrons_cfi::leps, TtSemiLepEvtPartons::LightQ, TtSemiLepEvtPartons::LightQBar, hitfit::Lepjets_Event::met(), singleTopDQM_cfi::mets, eostools::move(), nPartons, hitfit::Lepjets_Event_Lep::p(), edm::Event::put(), mps_fire::result, hitfit::Lepjets_Event_Lep::type(), and trackerHitRTTI::vector.

Member Data Documentation

◆ bTagAlgo_

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

input tag for b-tagging algorithm

Definition at line 46 of file TtSemiLepHitFitProducer.h.

◆ electronTranslator_

template<typename LeptonCollection >
hitfit::LeptonTranslatorBase<pat::Electron> TtSemiLepHitFitProducer< LeptonCollection >::electronTranslator_
private

◆ HitFit

template<typename LeptonCollection >
PatHitFit* TtSemiLepHitFitProducer< LeptonCollection >::HitFit
private

◆ hitfitBJetResolution_

template<typename LeptonCollection >
edm::FileInPath TtSemiLepHitFitProducer< LeptonCollection >::hitfitBJetResolution_
private

Definition at line 87 of file TtSemiLepHitFitProducer.h.

◆ hitfitDefault_

template<typename LeptonCollection >
edm::FileInPath TtSemiLepHitFitProducer< LeptonCollection >::hitfitDefault_
private

◆ hitfitElectronResolution_

template<typename LeptonCollection >
edm::FileInPath TtSemiLepHitFitProducer< LeptonCollection >::hitfitElectronResolution_
private

Definition at line 84 of file TtSemiLepHitFitProducer.h.

◆ hitfitMETResolution_

template<typename LeptonCollection >
edm::FileInPath TtSemiLepHitFitProducer< LeptonCollection >::hitfitMETResolution_
private

Definition at line 88 of file TtSemiLepHitFitProducer.h.

◆ hitfitMuonResolution_

template<typename LeptonCollection >
edm::FileInPath TtSemiLepHitFitProducer< LeptonCollection >::hitfitMuonResolution_
private

Definition at line 85 of file TtSemiLepHitFitProducer.h.

◆ hitfitUdscJetResolution_

template<typename LeptonCollection >
edm::FileInPath TtSemiLepHitFitProducer< LeptonCollection >::hitfitUdscJetResolution_
private

Definition at line 86 of file TtSemiLepHitFitProducer.h.

◆ jes_

template<typename LeptonCollection >
double TtSemiLepHitFitProducer< LeptonCollection >::jes_
private

jet energy scale

Definition at line 62 of file TtSemiLepHitFitProducer.h.

◆ jesB_

template<typename LeptonCollection >
double TtSemiLepHitFitProducer< LeptonCollection >::jesB_
private

Definition at line 63 of file TtSemiLepHitFitProducer.h.

◆ jetCorrectionLevel_

template<typename LeptonCollection >
std::string TtSemiLepHitFitProducer< LeptonCollection >::jetCorrectionLevel_
private

jet correction level

Definition at line 59 of file TtSemiLepHitFitProducer.h.

◆ jetsToken_

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

Definition at line 29 of file TtSemiLepHitFitProducer.h.

◆ jetTranslator_

template<typename LeptonCollection >
hitfit::JetTranslatorBase<pat::Jet> TtSemiLepHitFitProducer< LeptonCollection >::jetTranslator_
private

◆ lepsToken_

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

Definition at line 30 of file TtSemiLepHitFitProducer.h.

◆ maxBTagValueNonBJet_

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

max value of bTag for a non-b-jet

Definition at line 50 of file TtSemiLepHitFitProducer.h.

◆ maxEtaEle_

template<typename LeptonCollection >
double TtSemiLepHitFitProducer< LeptonCollection >::maxEtaEle_
private

maximum eta value for electrons, needed to limited range in which resolutions are provided

Definition at line 41 of file TtSemiLepHitFitProducer.h.

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

◆ maxEtaJet_

template<typename LeptonCollection >
double TtSemiLepHitFitProducer< LeptonCollection >::maxEtaJet_
private

maximum eta value for jets, needed to limited range in which resolutions are provided

Definition at line 43 of file TtSemiLepHitFitProducer.h.

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

◆ maxEtaMu_

template<typename LeptonCollection >
double TtSemiLepHitFitProducer< LeptonCollection >::maxEtaMu_
private

maximum eta value for muons, needed to limited range in which resolutions are provided

Definition at line 39 of file TtSemiLepHitFitProducer.h.

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

◆ maxNComb_

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

maximal number of combinations to be written to the event

Definition at line 36 of file TtSemiLepHitFitProducer.h.

◆ maxNJets_

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

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

Definition at line 34 of file TtSemiLepHitFitProducer.h.

◆ metsToken_

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

Definition at line 31 of file TtSemiLepHitFitProducer.h.

◆ metTranslator_

template<typename LeptonCollection >
hitfit::METTranslatorBase<pat::MET> TtSemiLepHitFitProducer< LeptonCollection >::metTranslator_
private

◆ minBTagValueBJet_

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

min value of bTag for a b-jet

Definition at line 48 of file TtSemiLepHitFitProducer.h.

◆ mTop_

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

◆ muonTranslator_

template<typename LeptonCollection >
hitfit::LeptonTranslatorBase<pat::Muon> TtSemiLepHitFitProducer< LeptonCollection >::muonTranslator_
private

◆ mW_

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

◆ useBTag_

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

switch to tell whether to use b-tagging or not

Definition at line 52 of file TtSemiLepHitFitProducer.h.

TtSemiLepHitFitProducer::jes_
double jes_
jet energy scale
Definition: TtSemiLepHitFitProducer.h:62
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
mps_fire.i
i
Definition: mps_fire.py:428
TtSemiLepEvtPartons::LightQBar
Definition: TtSemiLepEvtPartons.h:25
hitfit::RunHitFit::clear
void clear()
Clear the internal event, fit results, and jets.
Definition: RunHitFit.h:276
TtSemiLepHitFitProducer::electronTranslator_
hitfit::LeptonTranslatorBase< pat::Electron > electronTranslator_
Definition: TtSemiLepHitFitProducer.h:90
TtSemiLepEvtPartons::LepB
Definition: TtSemiLepEvtPartons.h:25
TtSemiLepHitFitProducer::hitfitMETResolution_
edm::FileInPath hitfitMETResolution_
Definition: TtSemiLepHitFitProducer.h:88
hitfit::Lepjets_Event::lep
Lepjets_Event_Lep & lep(std::vector< Lepjets_Event_Lep >::size_type i)
Return a reference to lepton at index position i.
Definition: Lepjets_Event.cc:122
TtSemiLepHitFitProducer::metsToken_
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
Definition: TtSemiLepHitFitProducer.h:31
hitfit::RunHitFit::AddJet
void AddJet(const AJet &jet, bool useObjRes=false)
Add one jet into the internal event. This function will do nothing if the internal event has already ...
Definition: RunHitFit.h:332
TtSemiLepHitFitProducer::muonTranslator_
hitfit::LeptonTranslatorBase< pat::Muon > muonTranslator_
Definition: TtSemiLepHitFitProducer.h:91
L1TowerCalibrationProducer_cfi.fit
fit
Definition: L1TowerCalibrationProducer_cfi.py:36
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
singleTopDQM_cfi.mets
mets
Definition: singleTopDQM_cfi.py:43
TtSemiLepHitFitProducer::mW_
double mW_
constraints
Definition: TtSemiLepHitFitProducer.h:55
TtSemiLepHitFitProducer::jesB_
double jesB_
Definition: TtSemiLepHitFitProducer.h:63
edm::Handle
Definition: AssociativeIterator.h:50
hitfit::RunHitFit::GetFitAllPermutation
std::vector< Fit_Result > GetFitAllPermutation()
Return the results of fitting all permutations of the internal event.
Definition: RunHitFit.h:475
TtSemiLepHitFitProducer::maxEtaJet_
double maxEtaJet_
maximum eta value for jets, needed to limited range in which resolutions are provided
Definition: TtSemiLepHitFitProducer.h:43
TtSemiLepHitFitProducer::mTop_
double mTop_
Definition: TtSemiLepHitFitProducer.h:56
TtSemiLepHitFitProducer_Electrons_cfi.leps
leps
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:5
edm::FileInPath
Definition: FileInPath.h:64
TtSemiLepHitFitProducer::hitfitUdscJetResolution_
edm::FileInPath hitfitUdscJetResolution_
Definition: TtSemiLepHitFitProducer.h:86
hitfit::Lepjets_Event::met
Fourvec & met()
Return a reference to the missing transverse energy.
Definition: Lepjets_Event.cc:182
hitfit::Lepjets_Event
Represent a simple event consisting of lepton(s) and jet(s). An instance of this class holds a list o...
Definition: Lepjets_Event.h:62
hitfit::Lepjets_Event_Jet
A class to represent a jet in an instance of Lepjets_Event class. The class is derived from the Lepje...
Definition: Lepjets_Event_Jet.h:76
PVValHelper::eta
Definition: PVValidationHelpers.h:69
TtSemiLepHitFitProducer::useBTag_
bool useBTag_
switch to tell whether to use b-tagging or not
Definition: TtSemiLepHitFitProducer.h:52
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
hitfit::RunHitFit::SetMet
void SetMet(const AMet &met, bool useObjRes=false)
Set the missing transverse energy of the internal event.
Definition: RunHitFit.h:349
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TtSemiLepHitFitProducer::hitfitMuonResolution_
edm::FileInPath hitfitMuonResolution_
Definition: TtSemiLepHitFitProducer.h:85
TtSemiLepHitFitProducer::jetsToken_
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
Definition: TtSemiLepHitFitProducer.h:29
TtSemiLepHitFitProducer::metTranslator_
hitfit::METTranslatorBase< pat::MET > metTranslator_
Definition: TtSemiLepHitFitProducer.h:93
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
TtSemiLepHitFitProducer::hitfitBJetResolution_
edm::FileInPath hitfitBJetResolution_
Definition: TtSemiLepHitFitProducer.h:87
TtSemiLepEvtPartons::HadB
Definition: TtSemiLepEvtPartons.h:25
hitfit::Lepjets_Event_Lep::p
Fourvec & p()
Return a reference to the four-momentum.
Definition: Lepjets_Event_Lep.cc:49
TtSemiLepHitFitProducer::maxNJets_
int maxNJets_
maximal number of jets (-1 possible to indicate 'all')
Definition: TtSemiLepHitFitProducer.h:34
nPartons
static const unsigned int nPartons
Definition: TtFullHadKinFitProducer.cc:3
hitfit::Lepjets_Event_Lep::type
int & type()
Return a reference to the type code.
Definition: Lepjets_Event_Lep.cc:71
TtSemiLepEvtPartons::LightQ
Definition: TtSemiLepEvtPartons.h:25
createfilelist.int
int
Definition: createfilelist.py:10
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
TtSemiLepHitFitProducer::lepsToken_
edm::EDGetTokenT< LeptonCollection > lepsToken_
Definition: TtSemiLepHitFitProducer.h:30
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
TtSemiLepHitFitProducer::hitfitElectronResolution_
edm::FileInPath hitfitElectronResolution_
Definition: TtSemiLepHitFitProducer.h:84
TtSemiLepHitFitProducer::jetCorrectionLevel_
std::string jetCorrectionLevel_
jet correction level
Definition: TtSemiLepHitFitProducer.h:59
hitfit::RunHitFit::AddLepton
void AddLepton(const AElectron &electron, bool useObjRes=false)
Add one electron into the internal event.
Definition: RunHitFit.h:293
hitfit::Lepjets_Event::jet
Lepjets_Event_Jet & jet(std::vector< Lepjets_Event_Jet >::size_type i)
Return a reference to jet at index position i.
Definition: Lepjets_Event.cc:137
hitfit::RunHitFit::GetUnfittedEvent
std::vector< Lepjets_Event > GetUnfittedEvent()
Return the unfitted events for all permutations.
Definition: RunHitFit.h:469
looper.cfg
cfg
Definition: looper.py:297
eostools.move
def move(src, dest)
Definition: eostools.py:511
TtSemiLepHitFitProducer::HitFit
PatHitFit * HitFit
Definition: TtSemiLepHitFitProducer.h:95
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
metsig::jet
Definition: SignAlgoResolutions.h:47
TtSemiLepHitFitProducer::maxEtaMu_
double maxEtaMu_
maximum eta value for muons, needed to limited range in which resolutions are provided
Definition: TtSemiLepHitFitProducer.h:39
TtSemiLepHitFitProducer::PatHitFit
hitfit::RunHitFit< pat::Electron, pat::Muon, pat::Jet, pat::MET > PatHitFit
Definition: TtSemiLepHitFitProducer.h:81
TtSemiLepHitFitProducer::minBTagValueBJet_
double minBTagValueBJet_
min value of bTag for a b-jet
Definition: TtSemiLepHitFitProducer.h:48
reco::LeafCandidate
Definition: LeafCandidate.h:16
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TtSemiLepHitFitProducer::hitfitDefault_
edm::FileInPath hitfitDefault_
Definition: TtSemiLepHitFitProducer.h:83
TtSemiLepHitFitProducer::bTagAlgo_
std::string bTagAlgo_
input tag for b-tagging algorithm
Definition: TtSemiLepHitFitProducer.h:46
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
pat::Particle
Analysis-level particle class.
Definition: Particle.h:30
edm::InputTag
Definition: InputTag.h:15
fit
Definition: CombinedChiSquaredLikelihood.h:6
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
TtSemiLepHitFitProducer::maxNComb_
int maxNComb_
maximal number of combinations to be written to the event
Definition: TtSemiLepHitFitProducer.h:36
hitfit::RunHitFit::FitAllPermutation
std::vector< Fit_Result >::size_type FitAllPermutation()
Fit all permutations of the internal event. Returns the number of permutations.
Definition: RunHitFit.h:385
TtSemiLepHitFitProducer::maxEtaEle_
double maxEtaEle_
maximum eta value for electrons, needed to limited range in which resolutions are provided
Definition: TtSemiLepHitFitProducer.h:41
hitfit::Lepjets_Event_Lep
Represent a lepton in an instance of Lepjets_Event class. This class hold the following information:
Definition: Lepjets_Event_Lep.h:64
TtSemiLepHitFitProducer::maxBTagValueNonBJet_
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
Definition: TtSemiLepHitFitProducer.h:50
TtSemiLepHitFitProducer::jetTranslator_
hitfit::JetTranslatorBase< pat::Jet > jetTranslator_
Definition: TtSemiLepHitFitProducer.h:92