7 jetsToken_ (consumes<
std::vector<
pat::
Jet> >(cfg.getParameter<
edm::InputTag>(
"jets"))),
8 matchToken_ (mayConsume<
std::vector<
std::vector<
int> > >(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 jetEnergyResolutionScaleFactors_(cfg.getParameter<
std::vector<double> >(
"jetEnergyResolutionScaleFactors")),
26 jetEnergyResolutionEtaBinning_ (cfg.getParameter<
std::vector<double> >(
"jetEnergyResolutionEtaBinning"))
28 if(cfg.
exists(
"udscResolutions") && cfg.
exists(
"bResolutions")){
32 else if(cfg.
exists(
"udscResolutions") || cfg.
exists(
"bResolutions")){
33 if(cfg.
exists(
"udscResolutions"))
throw cms::Exception(
"Configuration") <<
"Parameter 'bResolutions' is needed if parameter 'udscResolutions' is defined!\n";
34 else throw cms::Exception(
"Configuration") <<
"Parameter 'udscResolutions' is needed if parameter 'bResolutions' is defined!\n";
44 produces< std::vector<pat::Particle> >(
"PartonsB");
45 produces< std::vector<pat::Particle> >(
"PartonsBBar");
46 produces< std::vector<pat::Particle> >(
"PartonsLightQ");
47 produces< std::vector<pat::Particle> >(
"PartonsLightQBar");
48 produces< std::vector<pat::Particle> >(
"PartonsLightP");
49 produces< std::vector<pat::Particle> >(
"PartonsLightPBar");
51 produces< std::vector<std::vector<int> > >();
52 produces< std::vector<double> >(
"Chi2");
53 produces< std::vector<double> >(
"Prob");
54 produces< std::vector<int> >(
"Status");
72 std::vector<int>
match;
73 bool invalidMatch=
false;
79 match = *(matches->begin());
85 for(
unsigned int idx=0;
idx<match.size(); ++
idx) {
86 if(match[
idx]<0 || match[
idx]>=(
int)jets->size()) {
99 std::list<TtFullHadKinFitter::KinFitResult> fitResults =
kinFitter->
fit(*jets);
102 std::unique_ptr< std::vector<pat::Particle> > pPartonsB(
new std::vector<pat::Particle> );
103 std::unique_ptr< std::vector<pat::Particle> > pPartonsBBar(
new std::vector<pat::Particle> );
104 std::unique_ptr< std::vector<pat::Particle> > pPartonsLightQ (
new std::vector<pat::Particle> );
105 std::unique_ptr< std::vector<pat::Particle> > pPartonsLightQBar(
new std::vector<pat::Particle> );
106 std::unique_ptr< std::vector<pat::Particle> > pPartonsLightP (
new std::vector<pat::Particle> );
107 std::unique_ptr< std::vector<pat::Particle> > pPartonsLightPBar(
new std::vector<pat::Particle> );
109 std::unique_ptr< std::vector<std::vector<int> > > pCombi (
new std::vector<std::vector<int> > );
110 std::unique_ptr< std::vector<double> > pChi2 (
new std::vector<double> );
111 std::unique_ptr< std::vector<double> > pProb (
new std::vector<double> );
112 std::unique_ptr< std::vector<int> > pStatus(
new std::vector<int> );
114 unsigned int iComb = 0;
115 for(std::list<TtFullHadKinFitter::KinFitResult>::const_iterator
res = fitResults.begin();
res != fitResults.end(); ++
res){
121 pPartonsB ->push_back(
res->B );
122 pPartonsBBar ->push_back(
res->BBar );
123 pPartonsLightQ ->push_back(
res->LightQ );
124 pPartonsLightQBar->push_back(
res->LightQBar );
125 pPartonsLightP ->push_back(
res->LightP );
126 pPartonsLightPBar->push_back(
res->LightPBar );
128 pCombi ->push_back(
res->JetCombi );
129 pChi2 ->push_back(
res->Chi2 );
130 pProb ->push_back(
res->Prob );
131 pStatus->push_back(
res->Status );
136 event.put(
std::move(pPartonsB ),
"PartonsB" );
137 event.put(
std::move(pPartonsBBar ),
"PartonsBBar" );
138 event.put(
std::move(pPartonsLightQ ),
"PartonsLightQ" );
139 event.put(
std::move(pPartonsLightQBar),
"PartonsLightQBar");
140 event.put(
std::move(pPartonsLightP ),
"PartonsLightP" );
141 event.put(
std::move(pPartonsLightPBar),
"PartonsLightPBar");
144 event.put(
std::move(pStatus ),
"Status" );
T getParameter(std::string const &) const
static const unsigned int nPartons
TtFullHadKinFitter::KinFit * kinFitter
kinematic fit interface
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
input tag for matches (in case the fit should be performed on certain matches)
#define DEFINE_FWK_MODULE(type)
void produce(edm::Event &event, const edm::EventSetup &setup) override
produce fitted object collections and meta data describing fit quality
void setUseOnlyMatch(bool useOnlyMatch)
set useOnlyMatch
bool exists(std::string const ¶meterName) const
checks if a parameter exists
def setup(process, global_tag, zero_tesla=False)
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::list< TtFullHadKinFitter::KinFitResult > fit(const std::vector< pat::Jet > &jets)
do the fitting and return fit result
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
void setMatch(const std::vector< int > &match)
set match to be used
std::vector< edm::ParameterSet > bResolutions_
~TtFullHadKinFitProducer() override
default destructor
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 maxDeltaS_
maximal chi2 equivalent
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
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
std::vector< double > jetEnergyResolutionScaleFactors_
scale factors for jet energy resolution
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
int maxNJets_
maximal number of jets (-1 possible to indicate 'all')
double maxBTagValueNonBJet_
max value of bTag for a non-b-jet
unsigned int bTags_
minimal number of b-jets
std::vector< double > jetEnergyResolutionEtaBinning_
double minBTagValueBJet_
min value of bTag for a b-jet
TtFullHadKinFitProducer(const edm::ParameterSet &cfg)
default constructor
void setMatchInvalidity(bool invalidMatch)
set the validity of a match