CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
TtFullHadKinFitProducer Class Reference

#include <TtFullHadKinFitProducer.h>

Inheritance diagram for TtFullHadKinFitProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 TtFullHadKinFitProducer (const edm::ParameterSet &cfg)
 default constructor More...
 
 ~TtFullHadKinFitProducer ()
 default destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Public Attributes

TtFullHadKinFitter::KinFitkinFitter
 kinematic fit interface More...
 

Private Member Functions

virtual void produce (edm::Event &event, const edm::EventSetup &setup)
 produce fitted object collections and meta data describing fit quality More...
 

Private Attributes

std::vector< edm::ParameterSetbResolutions_
 
std::string bTagAlgo_
 input tag for b-tagging algorithm More...
 
unsigned int bTags_
 minimal number of b-jets More...
 
std::vector< unsigned > constraints_
 numbering of different possible kinematic constraints More...
 
std::string jetCorrectionLevel_
 correction level for jets More...
 
unsigned int jetParam_
 numbering of different possible jet parametrizations More...
 
edm::InputTag jets_
 input tag for jets More...
 
edm::InputTag match_
 input tag for matches (in case the fit should be performed on certain matches) More...
 
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...
 
double minBTagValueBJet_
 min value of bTag for a b-jet More...
 
double mTop_
 top mass value used for constraints More...
 
double mW_
 W mass value used for constraints. More...
 
double resolutionSmearFactor_
 smearing factor for jet energy resolutions More...
 
std::vector< edm::ParameterSetudscResolutions_
 store the resolutions for the jets More...
 
bool useBTagging_
 switch to tell whether to use b-tagging or not More...
 
bool useOnlyMatch_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 22 of file TtFullHadKinFitProducer.h.

Constructor & Destructor Documentation

TtFullHadKinFitProducer::TtFullHadKinFitProducer ( const edm::ParameterSet cfg)
explicit

default constructor

Definition at line 6 of file TtFullHadKinFitProducer.cc.

References bResolutions_, bTagAlgo_, bTags_, constraints_, edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), jetCorrectionLevel_, jetParam_, kinFitter, maxBTagValueNonBJet_, maxDeltaS_, maxF_, maxNComb_, maxNJets_, maxNrIter_, minBTagValueBJet_, mTop_, mW_, resolutionSmearFactor_, udscResolutions_, and useBTagging_.

6  :
7  jets_ (cfg.getParameter<edm::InputTag>("jets")),
8  match_ (cfg.getParameter<edm::InputTag>("match")),
9  useOnlyMatch_ (cfg.getParameter<bool>("useOnlyMatch")),
10  bTagAlgo_ (cfg.getParameter<std::string>("bTagAlgo")),
11  minBTagValueBJet_ (cfg.getParameter<double>("minBTagValueBJet")),
12  maxBTagValueNonBJet_ (cfg.getParameter<double>("maxBTagValueNonBJet")),
13  useBTagging_ (cfg.getParameter<bool>("useBTagging")),
14  bTags_ (cfg.getParameter<unsigned int>("bTags")),
15  jetCorrectionLevel_ (cfg.getParameter<std::string>("jetCorrectionLevel")),
16  maxNJets_ (cfg.getParameter<int>("maxNJets")),
17  maxNComb_ (cfg.getParameter<int>("maxNComb")),
18  maxNrIter_ (cfg.getParameter<unsigned int>("maxNrIter")),
19  maxDeltaS_ (cfg.getParameter<double>("maxDeltaS")),
20  maxF_ (cfg.getParameter<double>("maxF")),
21  jetParam_ (cfg.getParameter<unsigned>("jetParametrisation")),
22  constraints_ (cfg.getParameter<std::vector<unsigned> >("constraints")),
23  mW_ (cfg.getParameter<double>("mW" )),
24  mTop_ (cfg.getParameter<double>("mTop")),
25  resolutionSmearFactor_(cfg.getParameter<double>("resolutionSmearFactor"))
26 {
27  if(cfg.exists("udscResolutions") && cfg.exists("bResolutions")){
28  udscResolutions_ = cfg.getParameter <std::vector<edm::ParameterSet> >("udscResolutions");
29  bResolutions_ = cfg.getParameter <std::vector<edm::ParameterSet> >("bResolutions");
30  }
31  else if(cfg.exists("udscResolutions") || cfg.exists("bResolutions")){
32  if(cfg.exists("udscResolutions")) throw cms::Exception("WrongConfig") << "Parameter 'bResolutions' is needed if parameter 'udscResolutions' is defined!\n";
33  else throw cms::Exception("WrongConfig") << "Parameter 'udscResolutions' is needed if parameter 'bResolutions' is defined!\n";
34  }
35 
36  // define kinematic fit interface
41 
42  // produces the following collections
43  produces< std::vector<pat::Particle> >("PartonsB");
44  produces< std::vector<pat::Particle> >("PartonsBBar");
45  produces< std::vector<pat::Particle> >("PartonsLightQ");
46  produces< std::vector<pat::Particle> >("PartonsLightQBar");
47  produces< std::vector<pat::Particle> >("PartonsLightP");
48  produces< std::vector<pat::Particle> >("PartonsLightPBar");
49 
50  produces< std::vector<std::vector<int> > >();
51  produces< std::vector<double> >("Chi2");
52  produces< std::vector<double> >("Prob");
53  produces< std::vector<int> >("Status");
54 }
T getParameter(std::string const &) const
TtFullHadKinFitter::KinFit * kinFitter
kinematic fit interface
edm::InputTag match_
input tag for matches (in case the fit should be performed on certain matches)
bool exists(std::string const &parameterName) const
checks if a parameter exists
unsigned int jetParam_
numbering of different possible jet parametrizations
double mTop_
top mass value used for constraints
std::vector< unsigned > constraints_
numbering of different possible kinematic constraints
double mW_
W mass value used for constraints.
std::vector< edm::ParameterSet > udscResolutions_
store the resolutions for the jets
class that does the fitting
bool useBTagging_
switch to tell whether to use b-tagging or not
std::vector< edm::ParameterSet > bResolutions_
int maxNComb_
maximal number of combinations to be written to the event
std::string jetCorrectionLevel_
correction level for jets
double maxF_
maximal deviation for contstraints
double resolutionSmearFactor_
smearing factor for jet energy resolutions
double maxDeltaS_
maximal chi2 equivalent
edm::InputTag jets_
input tag for jets
unsigned int maxNrIter_
maximal number of iterations to be performed for the fit
std::string bTagAlgo_
input tag for b-tagging algorithm
int maxNJets_
maximal number of jets (-1 possible to indicate &#39;all&#39;)
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
unsigned int bTags_
minimal number of b-jets
double minBTagValueBJet_
min value of bTag for a b-jet
TtFullHadKinFitProducer::~TtFullHadKinFitProducer ( )

default destructor

Definition at line 57 of file TtFullHadKinFitProducer.cc.

References kinFitter.

58 {
59  delete kinFitter;
60 }
TtFullHadKinFitter::KinFit * kinFitter
kinematic fit interface

Member Function Documentation

void TtFullHadKinFitProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
privatevirtual

produce fitted object collections and meta data describing fit quality

set match to be used

set the validity of a match

Implements edm::EDProducer.

Definition at line 64 of file TtFullHadKinFitProducer.cc.

References TtFullHadKinFitter::KinFit::fit(), analyzePatCleaning_cfg::jets, jets_, kinFitter, match(), match_, maxNComb_, nPartons, TtFullHadKinFitter::KinFit::setMatch(), TtFullHadKinFitter::KinFit::setMatchInvalidity(), TtFullHadKinFitter::KinFit::setUseOnlyMatch(), and useOnlyMatch_.

65 {
66  // get jet collection
68  event.getByLabel(jets_, jets);
69 
70  // get match in case that useOnlyMatch_ is true
71  std::vector<int> match;
72  bool invalidMatch=false;
73  if(useOnlyMatch_) {
75  // in case that only a ceratin match should be used, get match here
77  event.getByLabel(match_, matches);
78  match = *(matches->begin());
79  // check if match is valid
80  if( match.size()!=nPartons ){
81  invalidMatch=true;
82  }
83  else {
84  for(unsigned int idx=0; idx<match.size(); ++idx) {
85  if(match[idx]<0 || match[idx]>=(int)jets->size()) {
86  invalidMatch=true;
87  break;
88  }
89  }
90  }
92  kinFitter->setMatch(match);
93  }
94 
96  kinFitter->setMatchInvalidity(invalidMatch);
97 
98  std::list<TtFullHadKinFitter::KinFitResult> fitResults = kinFitter->fit(*jets);
99 
100  // pointer for output collections
101  std::auto_ptr< std::vector<pat::Particle> > pPartonsB( new std::vector<pat::Particle> );
102  std::auto_ptr< std::vector<pat::Particle> > pPartonsBBar( new std::vector<pat::Particle> );
103  std::auto_ptr< std::vector<pat::Particle> > pPartonsLightQ ( new std::vector<pat::Particle> );
104  std::auto_ptr< std::vector<pat::Particle> > pPartonsLightQBar( new std::vector<pat::Particle> );
105  std::auto_ptr< std::vector<pat::Particle> > pPartonsLightP ( new std::vector<pat::Particle> );
106  std::auto_ptr< std::vector<pat::Particle> > pPartonsLightPBar( new std::vector<pat::Particle> );
107  // pointer for meta information
108  std::auto_ptr< std::vector<std::vector<int> > > pCombi ( new std::vector<std::vector<int> > );
109  std::auto_ptr< std::vector<double> > pChi2 ( new std::vector<double> );
110  std::auto_ptr< std::vector<double> > pProb ( new std::vector<double> );
111  std::auto_ptr< std::vector<int> > pStatus( new std::vector<int> );
112 
113  unsigned int iComb = 0;
114  for(std::list<TtFullHadKinFitter::KinFitResult>::const_iterator res = fitResults.begin(); res != fitResults.end(); ++res){
115  if(maxNComb_>=1 && iComb==(unsigned int)maxNComb_){
116  break;
117  }
118  ++iComb;
119 
120  pPartonsB ->push_back( res->B );
121  pPartonsBBar ->push_back( res->BBar );
122  pPartonsLightQ ->push_back( res->LightQ );
123  pPartonsLightQBar->push_back( res->LightQBar );
124  pPartonsLightP ->push_back( res->LightP );
125  pPartonsLightPBar->push_back( res->LightPBar );
126 
127  pCombi ->push_back( res->JetCombi );
128  pChi2 ->push_back( res->Chi2 );
129  pProb ->push_back( res->Prob );
130  pStatus->push_back( res->Status );
131 
132  }
133 
134  event.put(pCombi);
135  event.put(pPartonsB , "PartonsB" );
136  event.put(pPartonsBBar , "PartonsBBar" );
137  event.put(pPartonsLightQ , "PartonsLightQ" );
138  event.put(pPartonsLightQBar, "PartonsLightQBar");
139  event.put(pPartonsLightP , "PartonsLightP" );
140  event.put(pPartonsLightPBar, "PartonsLightPBar");
141  event.put(pChi2 , "Chi2" );
142  event.put(pProb , "Prob" );
143  event.put(pStatus , "Status" );
144 }
static const unsigned int nPartons
TtFullHadKinFitter::KinFit * kinFitter
kinematic fit interface
edm::InputTag match_
input tag for matches (in case the fit should be performed on certain matches)
void setUseOnlyMatch(bool useOnlyMatch)
set useOnlyMatch
std::list< TtFullHadKinFitter::KinFitResult > fit(const std::vector< pat::Jet > &jets)
do the fitting and return fit result
int maxNComb_
maximal number of combinations to be written to the event
edm::InputTag jets_
input tag for jets
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
void setMatch(std::vector< int > match)
set match to be used
void setMatchInvalidity(bool invalidMatch)
set the validity of a match

Member Data Documentation

std::vector<edm::ParameterSet> TtFullHadKinFitProducer::bResolutions_
private

Definition at line 73 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

std::string TtFullHadKinFitProducer::bTagAlgo_
private

input tag for b-tagging algorithm

Definition at line 43 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

unsigned int TtFullHadKinFitProducer::bTags_
private

minimal number of b-jets

Definition at line 51 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

std::vector<unsigned> TtFullHadKinFitProducer::constraints_
private

numbering of different possible kinematic constraints

Definition at line 67 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

std::string TtFullHadKinFitProducer::jetCorrectionLevel_
private

correction level for jets

Definition at line 53 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

unsigned int TtFullHadKinFitProducer::jetParam_
private

numbering of different possible jet parametrizations

Definition at line 65 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

edm::InputTag TtFullHadKinFitProducer::jets_
private

input tag for jets

Definition at line 36 of file TtFullHadKinFitProducer.h.

Referenced by produce().

TtFullHadKinFitter::KinFit* TtFullHadKinFitProducer::kinFitter

kinematic fit interface

Definition at line 80 of file TtFullHadKinFitProducer.h.

Referenced by produce(), TtFullHadKinFitProducer(), and ~TtFullHadKinFitProducer().

edm::InputTag TtFullHadKinFitProducer::match_
private

input tag for matches (in case the fit should be performed on certain matches)

Definition at line 38 of file TtFullHadKinFitProducer.h.

Referenced by produce().

double TtFullHadKinFitProducer::maxBTagValueNonBJet_
private

max value of bTag for a non-b-jet

Definition at line 47 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

double TtFullHadKinFitProducer::maxDeltaS_
private

maximal chi2 equivalent

Definition at line 61 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

double TtFullHadKinFitProducer::maxF_
private

maximal deviation for contstraints

Definition at line 63 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

int TtFullHadKinFitProducer::maxNComb_
private

maximal number of combinations to be written to the event

Definition at line 57 of file TtFullHadKinFitProducer.h.

Referenced by produce(), and TtFullHadKinFitProducer().

int TtFullHadKinFitProducer::maxNJets_
private

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

Definition at line 55 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

unsigned int TtFullHadKinFitProducer::maxNrIter_
private

maximal number of iterations to be performed for the fit

Definition at line 59 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

double TtFullHadKinFitProducer::minBTagValueBJet_
private

min value of bTag for a b-jet

Definition at line 45 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

double TtFullHadKinFitProducer::mTop_
private

top mass value used for constraints

Definition at line 71 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

double TtFullHadKinFitProducer::mW_
private

W mass value used for constraints.

Definition at line 69 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

double TtFullHadKinFitProducer::resolutionSmearFactor_
private

smearing factor for jet energy resolutions

Definition at line 75 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

std::vector<edm::ParameterSet> TtFullHadKinFitProducer::udscResolutions_
private

store the resolutions for the jets

Definition at line 73 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

bool TtFullHadKinFitProducer::useBTagging_
private

switch to tell whether to use b-tagging or not

Definition at line 49 of file TtFullHadKinFitProducer.h.

Referenced by TtFullHadKinFitProducer().

bool TtFullHadKinFitProducer::useOnlyMatch_
private

switch to tell whether all possible combinations should be used for the fit or only a certain combination

Definition at line 41 of file TtFullHadKinFitProducer.h.

Referenced by produce().