CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

TtSemiLepKinFitter::Constraint constraint (unsigned)
 
std::vector
< TtSemiLepKinFitter::Constraint
constraints (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)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

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
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)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<typename LeptonCollection>
class TtSemiLepKinFitProducer< LeptonCollection >

Definition at line 13 of file TtSemiLepKinFitProducer.h.

Constructor & Destructor Documentation

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

Definition at line 94 of file TtSemiLepKinFitProducer.h.

References TtSemiLepKinFitProducer< LeptonCollection >::bResolutions_, TtSemiLepKinFitProducer< LeptonCollection >::constraints(), TtSemiLepKinFitProducer< LeptonCollection >::constraints_, Exception, edm::ParameterSet::exists(), TtSemiLepKinFitProducer< LeptonCollection >::fitter, edm::ParameterSet::getParameter(), 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_.

94  :
95  jetsToken_ (consumes<std::vector<pat::Jet> >(cfg.getParameter<edm::InputTag>("jets"))),
96  lepsToken_ (consumes<LeptonCollection>(cfg.getParameter<edm::InputTag>("leps"))),
97  metsToken_ (consumes<std::vector<pat::MET> >(cfg.getParameter<edm::InputTag>("mets"))),
98  matchToken_ (mayConsume<std::vector<std::vector<int> > >(cfg.getParameter<edm::InputTag>("match"))),
99  useOnlyMatch_ (cfg.getParameter<bool> ("useOnlyMatch" )),
100  bTagAlgo_ (cfg.getParameter<std::string> ("bTagAlgo" )),
101  minBTagValueBJet_ (cfg.getParameter<double> ("minBDiscBJets" )),
102  maxBTagValueNonBJet_ (cfg.getParameter<double> ("maxBDiscLightJets" )),
103  useBTag_ (cfg.getParameter<bool> ("useBTagging" )),
104  maxNJets_ (cfg.getParameter<int> ("maxNJets" )),
105  maxNComb_ (cfg.getParameter<int> ("maxNComb" )),
106  maxNrIter_ (cfg.getParameter<unsigned> ("maxNrIter" )),
107  maxDeltaS_ (cfg.getParameter<double> ("maxDeltaS" )),
108  maxF_ (cfg.getParameter<double> ("maxF" )),
109  jetParam_ (cfg.getParameter<unsigned> ("jetParametrisation" )),
110  lepParam_ (cfg.getParameter<unsigned> ("lepParametrisation" )),
111  metParam_ (cfg.getParameter<unsigned> ("metParametrisation" )),
112  constraints_ (cfg.getParameter<std::vector<unsigned> >("constraints")),
113  mW_ (cfg.getParameter<double> ("mW" )),
114  mTop_ (cfg.getParameter<double> ("mTop" )),
115  jetEnergyResolutionScaleFactors_(cfg.getParameter<std::vector<double> >("jetEnergyResolutionScaleFactors")),
116  jetEnergyResolutionEtaBinning_ (cfg.getParameter<std::vector<double> >("jetEnergyResolutionEtaBinning")),
118 {
119  if(cfg.exists("udscResolutions") && cfg.exists("bResolutions") && cfg.exists("lepResolutions") && cfg.exists("metResolutions")){
120  udscResolutions_ = cfg.getParameter<std::vector<edm::ParameterSet> >("udscResolutions");
121  bResolutions_ = cfg.getParameter<std::vector<edm::ParameterSet> >("bResolutions" );
122  lepResolutions_ = cfg.getParameter<std::vector<edm::ParameterSet> >("lepResolutions" );
123  metResolutions_ = cfg.getParameter<std::vector<edm::ParameterSet> >("metResolutions" );
124  }
125  else if(cfg.exists("udscResolutions") || cfg.exists("bResolutions") || cfg.exists("lepResolutions") || cfg.exists("metResolutions") ){
126  throw cms::Exception("Configuration") << "Parameters 'udscResolutions', 'bResolutions', 'lepResolutions', 'metResolutions' should be used together.\n";
127  }
128 
132 
133  produces< std::vector<pat::Particle> >("PartonsHadP");
134  produces< std::vector<pat::Particle> >("PartonsHadQ");
135  produces< std::vector<pat::Particle> >("PartonsHadB");
136  produces< std::vector<pat::Particle> >("PartonsLepB");
137  produces< std::vector<pat::Particle> >("Leptons");
138  produces< std::vector<pat::Particle> >("Neutrinos");
139 
140  produces< std::vector<std::vector<int> > >();
141  produces< std::vector<double> >("Chi2");
142  produces< std::vector<double> >("Prob");
143  produces< std::vector<int> >("Status");
144 
145  produces<int>("NumberOfConsideredJets");
146 }
std::vector< edm::ParameterSet > bResolutions_
std::vector< double > jetEnergyResolutionScaleFactors_
scale factors for jet energy resolution
T getParameter(std::string const &) const
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
std::string bTagAlgo_
input tag for b-tagging algorithm
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
double minBTagValueBJet_
min value of bTag for a b-jet
std::vector< TtSemiLepKinFitter::Constraint > constraints(std::vector< unsigned > &)
bool exists(std::string const &parameterName) const
checks if a parameter exists
int maxNJets_
maximal number of jets (-1 possible to indicate &#39;all&#39;)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< double > jetEnergyResolutionEtaBinning_
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
std::vector< unsigned > constraints_
constrains
unsigned int maxNrIter_
maximal number of iterations to be performed for the fit
std::vector< edm::ParameterSet > udscResolutions_
config-file-based object resolutions
int maxNComb_
maximal number of combinations to be written to the event
double maxF_
maximal deviation for contstraints
edm::EDGetTokenT< LeptonCollection > lepsToken_
std::vector< edm::ParameterSet > metResolutions_
bool useOnlyMatch_
switch to use only a combination given by another hypothesis
bool useBTag_
switch to tell whether to use b-tagging or not
TtSemiLepKinFitter::Param param(unsigned)
double maxDeltaS_
maximal chi2 equivalent
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
std::vector< edm::ParameterSet > lepResolutions_
template<typename LeptonCollection >
TtSemiLepKinFitProducer< LeptonCollection >::~TtSemiLepKinFitProducer ( )

Definition at line 149 of file TtSemiLepKinFitProducer.h.

150 {
151  delete fitter;
152 }

Member Function Documentation

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

Definition at line 407 of file TtSemiLepKinFitProducer.h.

References Exception, TtSemiLepKinFitter::kEqualTopMasses, TtSemiLepKinFitter::kNeutrinoMass, TtSemiLepKinFitter::kSumPt, TtSemiLepKinFitter::kTopHadMass, TtSemiLepKinFitter::kTopLepMass, TtSemiLepKinFitter::kWHadMass, TtSemiLepKinFitter::kWLepMass, and mps_fire::result.

408 {
410  switch(val){
418  default:
419  throw cms::Exception("Configuration")
420  << "Chosen fit constraint is not supported: " << val << "\n";
421  break;
422  }
423  return result;
424 }
tuple result
Definition: mps_fire.py:95
Constraint
supported constraints
template<typename LeptonCollection >
std::vector< TtSemiLepKinFitter::Constraint > TtSemiLepKinFitProducer< LeptonCollection >::constraints ( std::vector< unsigned > &  val)
private

Definition at line 427 of file TtSemiLepKinFitProducer.h.

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

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

428 {
429  std::vector<TtSemiLepKinFitter::Constraint> result;
430  for(unsigned i=0; i<val.size(); ++i){
431  result.push_back(constraint(val[i]));
432  }
433  return result;
434 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: mps_fire.py:95
TtSemiLepKinFitter::Constraint constraint(unsigned)
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 155 of file TtSemiLepKinFitProducer.h.

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

156  {
157 
158  if( !useBTag_ ) {
159  return true;
160  }
161  if( useBTag_ &&
162  (*jets)[combi[TtSemiLepEvtPartons::HadB ]].bDiscriminator(bTagAlgo_) >= minBTagValueBJet_ &&
163  (*jets)[combi[TtSemiLepEvtPartons::LepB ]].bDiscriminator(bTagAlgo_) >= minBTagValueBJet_ &&
164  (*jets)[combi[TtSemiLepEvtPartons::LightQ ]].bDiscriminator(bTagAlgo_) < maxBTagValueNonBJet_ &&
165  (*jets)[combi[TtSemiLepEvtPartons::LightQBar]].bDiscriminator(bTagAlgo_) < maxBTagValueNonBJet_ ) {
166  return true;
167  }
168  else{
169  return false;
170  }
171 }
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
std::string bTagAlgo_
input tag for b-tagging algorithm
double minBTagValueBJet_
min value of bTag for a b-jet
bool useBTag_
switch to tell whether to use b-tagging or not
template<typename LeptonCollection >
TtSemiLepKinFitter::Param TtSemiLepKinFitProducer< LeptonCollection >::param ( unsigned  val)
private

Definition at line 391 of file TtSemiLepKinFitProducer.h.

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

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

392 {
394  switch(val){
398  default:
399  throw cms::Exception("Configuration")
400  << "Chosen jet parametrization is not supported: " << val << "\n";
401  break;
402  }
403  return result;
404 }
Param
supported parameterizations
Definition: TopKinFitter.h:22
tuple result
Definition: mps_fire.py:95
template<typename LeptonCollection >
void TtSemiLepKinFitProducer< LeptonCollection >::produce ( edm::Event evt,
const edm::EventSetup setup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 174 of file TtSemiLepKinFitProducer.h.

References TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::Chi2, edm::Event::getByToken(), TtSemiLepEvtPartons::HadB, TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::HadB, TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::HadP, TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::HadQ, i, customizeTrackingMonitorSeedNumber::idx, TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::JetCombi, fwrapper::jets, TtSemiLepEvtPartons::LepB, TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::LepB, TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::LepL, TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::LepN, TtSemiLepEvtPartons::LightQ, TtSemiLepEvtPartons::LightQBar, match(), stdcomb::next_combination(), nPartons, TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::Prob, edm::Event::put(), mps_fire::result, mps_update::status, and TtSemiLepKinFitProducer< LeptonCollection >::KinFitResult::Status.

175 {
176  std::auto_ptr< std::vector<pat::Particle> > pPartonsHadP( new std::vector<pat::Particle> );
177  std::auto_ptr< std::vector<pat::Particle> > pPartonsHadQ( new std::vector<pat::Particle> );
178  std::auto_ptr< std::vector<pat::Particle> > pPartonsHadB( new std::vector<pat::Particle> );
179  std::auto_ptr< std::vector<pat::Particle> > pPartonsLepB( new std::vector<pat::Particle> );
180  std::auto_ptr< std::vector<pat::Particle> > pLeptons ( new std::vector<pat::Particle> );
181  std::auto_ptr< std::vector<pat::Particle> > pNeutrinos ( new std::vector<pat::Particle> );
182 
183  std::auto_ptr< std::vector<std::vector<int> > > pCombi ( new std::vector<std::vector<int> > );
184  std::auto_ptr< std::vector<double> > pChi2 ( new std::vector<double> );
185  std::auto_ptr< std::vector<double> > pProb ( new std::vector<double> );
186  std::auto_ptr< std::vector<int> > pStatus( new std::vector<int> );
187 
188  std::auto_ptr<int> pJetsConsidered(new int);
189 
191  evt.getByToken(jetsToken_, jets);
192 
194  evt.getByToken(metsToken_, mets);
195 
197  evt.getByToken(lepsToken_, leps);
198 
199  const unsigned int nPartons = 4;
200 
201  std::vector<int> match;
202  bool invalidMatch = false;
203  if(useOnlyMatch_) {
204  *pJetsConsidered = nPartons;
206  evt.getByToken(matchToken_, matchHandle);
207  match = *(matchHandle->begin());
208  // check if match is valid
209  if(match.size()!=nPartons) invalidMatch=true;
210  else {
211  for(unsigned int idx=0; idx<match.size(); ++idx) {
212  if(match[idx]<0 || match[idx]>=(int)jets->size()) {
213  invalidMatch=true;
214  break;
215  }
216  }
217  }
218  }
219 
220  // -----------------------------------------------------
221  // skip events with no appropriate lepton candidate in
222  // or empty MET or less jets than partons or invalid match
223  // -----------------------------------------------------
224 
225  if( leps->empty() || mets->empty() || jets->size()<nPartons || invalidMatch ) {
226  // the kinFit getters return empty objects here
227  pPartonsHadP->push_back( fitter->fittedHadP() );
228  pPartonsHadQ->push_back( fitter->fittedHadQ() );
229  pPartonsHadB->push_back( fitter->fittedHadB() );
230  pPartonsLepB->push_back( fitter->fittedLepB() );
231  pLeptons ->push_back( fitter->fittedLepton() );
232  pNeutrinos ->push_back( fitter->fittedNeutrino() );
233  // indices referring to the jet combination
234  std::vector<int> invalidCombi;
235  for(unsigned int i = 0; i < nPartons; ++i)
236  invalidCombi.push_back( -1 );
237  pCombi->push_back( invalidCombi );
238  // chi2
239  pChi2->push_back( -1. );
240  // chi2 probability
241  pProb->push_back( -1. );
242  // status of the fitter
243  pStatus->push_back( -1 );
244  // number of jets
245  *pJetsConsidered = jets->size();
246  // feed out all products
247  evt.put(pCombi);
248  evt.put(pPartonsHadP, "PartonsHadP");
249  evt.put(pPartonsHadQ, "PartonsHadQ");
250  evt.put(pPartonsHadB, "PartonsHadB");
251  evt.put(pPartonsLepB, "PartonsLepB");
252  evt.put(pLeptons , "Leptons" );
253  evt.put(pNeutrinos , "Neutrinos" );
254  evt.put(pChi2 , "Chi2" );
255  evt.put(pProb , "Prob" );
256  evt.put(pStatus , "Status" );
257  evt.put(pJetsConsidered, "NumberOfConsideredJets");
258  return;
259  }
260 
261  // -----------------------------------------------------
262  // analyze different jet combinations using the KinFitter
263  // (or only a given jet combination if useOnlyMatch=true)
264  // -----------------------------------------------------
265 
266  std::vector<int> jetIndices;
267  if(!useOnlyMatch_) {
268  for(unsigned int i=0; i<jets->size(); ++i){
269  if(maxNJets_ >= (int) nPartons && maxNJets_ == (int) i) {
270  *pJetsConsidered = i;
271  break;
272  }
273  jetIndices.push_back(i);
274  }
275  }
276 
277  std::vector<int> combi;
278  for(unsigned int i=0; i<nPartons; ++i) {
279  if(useOnlyMatch_) combi.push_back( match[i] );
280  else combi.push_back(i);
281  }
282 
283  std::list<KinFitResult> FitResultList;
284 
285  do{
286  for(int cnt = 0; cnt < TMath::Factorial( combi.size() ); ++cnt){
287  // take into account indistinguishability of the two jets from the hadr. W decay,
288  // reduces combinatorics by a factor of 2
291 
292  std::vector<pat::Jet> jetCombi;
293  jetCombi.resize(nPartons);
294  jetCombi[TtSemiLepEvtPartons::LightQ ] = (*jets)[combi[TtSemiLepEvtPartons::LightQ ]];
296  jetCombi[TtSemiLepEvtPartons::HadB ] = (*jets)[combi[TtSemiLepEvtPartons::HadB ]];
297  jetCombi[TtSemiLepEvtPartons::LepB ] = (*jets)[combi[TtSemiLepEvtPartons::LepB ]];
298 
299  // do the kinematic fit
300  const int status = fitter->fit(jetCombi, (*leps)[0], (*mets)[0]);
301 
302  if( status == 0 ) { // only take into account converged fits
303  KinFitResult result;
304  result.Status = status;
305  result.Chi2 = fitter->fitS();
306  result.Prob = fitter->fitProb();
307  result.HadB = fitter->fittedHadB();
308  result.HadP = fitter->fittedHadP();
309  result.HadQ = fitter->fittedHadQ();
310  result.LepB = fitter->fittedLepB();
311  result.LepL = fitter->fittedLepton();
312  result.LepN = fitter->fittedNeutrino();
313  result.JetCombi = combi;
314 
315  FitResultList.push_back(result);
316  }
317 
318  }
319  if(useOnlyMatch_) break; // don't go through combinatorics if useOnlyMatch was chosen
320  next_permutation( combi.begin(), combi.end() );
321  }
322  if(useOnlyMatch_) break; // don't go through combinatorics if useOnlyMatch was chosen
323  }
324  while(stdcomb::next_combination( jetIndices.begin(), jetIndices.end(), combi.begin(), combi.end() ));
325 
326  // sort results w.r.t. chi2 values
327  FitResultList.sort();
328 
329  // -----------------------------------------------------
330  // feed out result
331  // starting with the JetComb having the smallest chi2
332  // -----------------------------------------------------
333 
334  if( (unsigned)FitResultList.size() < 1 ) { // in case no fit results were stored in the list (all fits aborted)
335  pPartonsHadP->push_back( fitter->fittedHadP() );
336  pPartonsHadQ->push_back( fitter->fittedHadQ() );
337  pPartonsHadB->push_back( fitter->fittedHadB() );
338  pPartonsLepB->push_back( fitter->fittedLepB() );
339  pLeptons ->push_back( fitter->fittedLepton() );
340  pNeutrinos ->push_back( fitter->fittedNeutrino() );
341  // indices referring to the jet combination
342  std::vector<int> invalidCombi;
343  for(unsigned int i = 0; i < nPartons; ++i)
344  invalidCombi.push_back( -1 );
345  pCombi->push_back( invalidCombi );
346  // chi2
347  pChi2->push_back( -1. );
348  // chi2 probability
349  pProb->push_back( -1. );
350  // status of the fitter
351  pStatus->push_back( -1 );
352  }
353  else {
354  unsigned int iComb = 0;
355  for(typename std::list<KinFitResult>::const_iterator result = FitResultList.begin(); result != FitResultList.end(); ++result) {
356  if(maxNComb_ >= 1 && iComb == (unsigned int) maxNComb_) break;
357  iComb++;
358  // partons
359  pPartonsHadP->push_back( result->HadP );
360  pPartonsHadQ->push_back( result->HadQ );
361  pPartonsHadB->push_back( result->HadB );
362  pPartonsLepB->push_back( result->LepB );
363  // lepton
364  pLeptons->push_back( result->LepL );
365  // neutrino
366  pNeutrinos->push_back( result->LepN );
367  // indices referring to the jet combination
368  pCombi->push_back( result->JetCombi );
369  // chi2
370  pChi2->push_back( result->Chi2 );
371  // chi2 probability
372  pProb->push_back( result->Prob );
373  // status of the fitter
374  pStatus->push_back( result->Status );
375  }
376  }
377  evt.put(pCombi);
378  evt.put(pPartonsHadP, "PartonsHadP");
379  evt.put(pPartonsHadQ, "PartonsHadQ");
380  evt.put(pPartonsHadB, "PartonsHadB");
381  evt.put(pPartonsLepB, "PartonsLepB");
382  evt.put(pLeptons , "Leptons" );
383  evt.put(pNeutrinos , "Neutrinos" );
384  evt.put(pChi2 , "Chi2" );
385  evt.put(pProb , "Prob" );
386  evt.put(pStatus , "Status" );
387  evt.put(pJetsConsidered, "NumberOfConsideredJets");
388 }
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
const pat::Particle fittedHadP() const
return hadronic light quark candidate
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
int i
Definition: DBlmapReader.cc:9
std::string bTagAlgo_
input tag for b-tagging algorithm
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
static const unsigned int nPartons
double minBTagValueBJet_
min value of bTag for a b-jet
const pat::Particle fittedNeutrino() const
return neutrino candidate
const pat::Particle fittedLepB() const
return leptonic b quark candidate
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
double fitProb() const
return fit probability
Definition: TopKinFitter.h:36
int maxNJets_
maximal number of jets (-1 possible to indicate &#39;all&#39;)
tuple result
Definition: mps_fire.py:95
int fit(const std::vector< pat::Jet > &jets, const pat::Lepton< LeptonType > &leps, const pat::MET &met)
kinematic fit interface for PAT objects
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
vector< PseudoJet > jets
const pat::Particle fittedHadB() const
return hadronic b quark candidate
bool doBTagging(bool &useBTag_, edm::Handle< std::vector< pat::Jet > > &jets, std::vector< int > &combi, std::string &bTagAlgo_, double &minBTagValueBJets_, double &maxBTagValueNonBJets_)
int maxNComb_
maximal number of combinations to be written to the event
edm::EDGetTokenT< LeptonCollection > lepsToken_
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
const pat::Particle fittedHadQ() const
return hadronic light quark candidate
const pat::Particle fittedLepton() const
return lepton candidate
bool useOnlyMatch_
switch to use only a combination given by another hypothesis
double fitS() const
return chi2 of fit (not normalized to degrees of freedom)
Definition: TopKinFitter.h:32
bool useBTag_
switch to tell whether to use b-tagging or not
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
bool next_combination(BidIt n_begin, BidIt n_end, BidIt r_begin, BidIt r_end)
Definition: combination.h:22
tuple status
Definition: mps_update.py:57

Member Data Documentation

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

input tag for b-tagging algorithm

Definition at line 42 of file TtSemiLepKinFitProducer.h.

template<typename LeptonCollection >
std::vector<unsigned> TtSemiLepKinFitProducer< LeptonCollection >::constraints_
private
template<typename LeptonCollection >
TtSemiLepKinFitter* TtSemiLepKinFitProducer< LeptonCollection >::fitter
private
template<typename LeptonCollection >
std::vector<double> TtSemiLepKinFitProducer< LeptonCollection >::jetEnergyResolutionEtaBinning_
private
template<typename LeptonCollection >
std::vector<double> TtSemiLepKinFitProducer< LeptonCollection >::jetEnergyResolutionScaleFactors_
private

scale factors for jet energy resolution

Definition at line 68 of file TtSemiLepKinFitProducer.h.

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

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

Definition at line 34 of file TtSemiLepKinFitProducer.h.

template<typename LeptonCollection >
unsigned int TtSemiLepKinFitProducer< LeptonCollection >::lepParam_
private
template<typename LeptonCollection >
std::vector<edm::ParameterSet> TtSemiLepKinFitProducer< LeptonCollection >::lepResolutions_
private
template<typename LeptonCollection >
edm::EDGetTokenT<LeptonCollection> TtSemiLepKinFitProducer< LeptonCollection >::lepsToken_
private

Definition at line 35 of file TtSemiLepKinFitProducer.h.

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

Definition at line 38 of file TtSemiLepKinFitProducer.h.

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

max value of bTag for a non-b-jet

Definition at line 46 of file TtSemiLepKinFitProducer.h.

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

maximal chi2 equivalent

Definition at line 57 of file TtSemiLepKinFitProducer.h.

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

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

maximal deviation for contstraints

Definition at line 59 of file TtSemiLepKinFitProducer.h.

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

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

maximal number of combinations to be written to the event

Definition at line 52 of file TtSemiLepKinFitProducer.h.

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

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

Definition at line 50 of file TtSemiLepKinFitProducer.h.

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

maximal number of iterations to be performed for the fit

Definition at line 55 of file TtSemiLepKinFitProducer.h.

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

template<typename LeptonCollection >
unsigned int TtSemiLepKinFitProducer< LeptonCollection >::metParam_
private
template<typename LeptonCollection >
std::vector<edm::ParameterSet> TtSemiLepKinFitProducer< LeptonCollection >::metResolutions_
private
template<typename LeptonCollection >
edm::EDGetTokenT<std::vector<pat::MET> > TtSemiLepKinFitProducer< LeptonCollection >::metsToken_
private

Definition at line 36 of file TtSemiLepKinFitProducer.h.

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

min value of bTag for a b-jet

Definition at line 44 of file TtSemiLepKinFitProducer.h.

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

config-file-based object resolutions

Definition at line 71 of file TtSemiLepKinFitProducer.h.

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

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

switch to tell whether to use b-tagging or not

Definition at line 48 of file TtSemiLepKinFitProducer.h.

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

switch to use only a combination given by another hypothesis

Definition at line 40 of file TtSemiLepKinFitProducer.h.