CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
StringResolutionProvider Class Reference

Class to provide resolution factors for PAT candidates. More...

#include "PhysicsTools/PatAlgos/interface/StringResolutionProvider.h"

Inheritance diagram for StringResolutionProvider:
KinematicResolutionProvider

Public Types

typedef StringObjectFunction< reco::CandidateFunction
 short cut within the common namespace More...
 

Public Member Functions

pat::CandKinResolution getResolution (const reco::Candidate &cand) const override
 get a CandKinResolution object from the service More...
 
 StringResolutionProvider (const edm::ParameterSet &cfg)
 default constructor More...
 
 ~StringResolutionProvider () override
 default destructor More...
 
- Public Member Functions inherited from KinematicResolutionProvider
virtual void setup (const edm::EventSetup &iSetup) const
 everything that needs to be done before the event loop More...
 
virtual ~KinematicResolutionProvider ()=default
 

Private Attributes

std::vector< std::string > bins_
 a vector of strings for the binning More...
 
std::vector< pat::CandKinResolution::Scalarconstraints_
 
std::vector< std::string > funcEt_
 vectors for the resolution functions More...
 
std::vector< std::string > funcEta_
 
std::vector< std::string > funcPhi_
 
pat::CandKinResolution::Parametrization parametrization_
 

Detailed Description

Class to provide resolution factors for PAT candidates.

A class to provide resolution functions for PAT candidates. The class is derived from the KinematicResolutionProvider class. It expects the following parameters:

parametrization : indicates the used representation (e.g. EtEtaPhi). This parameter is MANDATORY. resolutions : a vector of edm::ParameterSets, that contain the resolutions func- tionspotentially in multiple bins of a cetain parameter. For the default implementeation we have bins of reco::Candidate's eta in mind, though might be any kind of variable that is accessible as memeber function of reco::Candidate. This parameter is MANDATORY.

The edm::ParameterSets of the resolutions parameter are expected to be of form:

bin : Indicated the binning compatible with the StringCutObjectSelector. If omitted no binning is applied and the obtained resolution func- tions are assumed to be valid for all candidates. This parameter is OPTIONAL. et/eta/phi : Contain the parametrization in et if working in the EtEtaPhi pa- rametrization. These parameters are OPTIONAL. They are expected to be present in the et/eta/phi representation though. constraint : adding further information on constraints. It needs to investigated further what the meaning of this parameter exactly is before we can decide about its future. This parameter is OPTIONAL.

We expect that cfi files of this form will be generated automatically. edm::ParameterSets for other represenations will be implemented on request.

Definition at line 43 of file StringResolutionProvider.h.

Member Typedef Documentation

◆ Function

short cut within the common namespace

Definition at line 46 of file StringResolutionProvider.h.

Constructor & Destructor Documentation

◆ StringResolutionProvider()

StringResolutionProvider::StringResolutionProvider ( const edm::ParameterSet cfg)

default constructor

Definition at line 8 of file StringResolutionProvider.cc.

8  : constraints_() {
9  typedef pat::CandKinResolution::Parametrization Parametrization;
10 
11  //
12  std::vector<double> constr = cfg.getParameter<std::vector<double> >("constraints");
13  constraints_.insert(constraints_.end(), constr.begin(), constr.end());
14 
15  std::string parametrization(cfg.getParameter<std::string>("parametrization"));
17 
18  std::vector<edm::ParameterSet> functionSets_ = cfg.getParameter<std::vector<edm::ParameterSet> >("functions");
19  for (std::vector<edm::ParameterSet>::const_iterator iSet = functionSets_.begin(); iSet != functionSets_.end();
20  ++iSet) {
21  if (iSet->exists("bin"))
22  bins_.push_back(iSet->getParameter<std::string>("bin"));
23  else if (functionSets_.size() == 1)
24  bins_.push_back("");
25  else
26  throw cms::Exception("WrongConfig") << "Parameter 'bin' is needed if more than one PSet is specified\n";
27 
28  funcEt_.push_back(iSet->getParameter<std::string>("et"));
29  funcEta_.push_back(iSet->getParameter<std::string>("eta"));
30  funcPhi_.push_back(iSet->getParameter<std::string>("phi"));
31  }
32 }

References bins_, looper::cfg, constraints_, Exception, pat::helper::ParametrizationHelper::fromString(), funcEt_, funcEta_, funcPhi_, stringResolutionProvider_cfi::parametrization, parametrization_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~StringResolutionProvider()

StringResolutionProvider::~StringResolutionProvider ( )
override

default destructor

Definition at line 34 of file StringResolutionProvider.cc.

34 {}

Member Function Documentation

◆ getResolution()

pat::CandKinResolution StringResolutionProvider::getResolution ( const reco::Candidate cand) const
overridevirtual

get a CandKinResolution object from the service

Implements KinematicResolutionProvider.

Definition at line 36 of file StringResolutionProvider.cc.

36  {
37  int selectedBin = -1;
38  for (unsigned int i = 0; i < bins_.size(); ++i) {
40  if (select_(cand)) {
41  selectedBin = i;
42  break;
43  }
44  }
45  std::vector<pat::CandKinResolution::Scalar> covariances(3);
46  if (selectedBin >= 0) {
47  covariances[0] = ROOT::Math::Square(Function(funcEt_[selectedBin]).operator()(cand));
48  covariances[1] = ROOT::Math::Square(Function(funcEta_[selectedBin]).operator()(cand));
49  covariances[2] = ROOT::Math::Square(Function(funcPhi_[selectedBin]).operator()(cand));
50  }
51  // fill 0. for not selected candidates
52  else
53  for (int i = 0; i < 3; ++i) {
54  covariances[i] = 0.;
55  }
56 
58 }

References bins_, constraints_, funcEt_, funcEta_, funcPhi_, mps_fire::i, parametrization_, and HGCalGeometryMode::Square.

Member Data Documentation

◆ bins_

std::vector<std::string> StringResolutionProvider::bins_
private

a vector of strings for the binning

Definition at line 63 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

◆ constraints_

std::vector<pat::CandKinResolution::Scalar> StringResolutionProvider::constraints_
private

a vector of constrtaints for the CanKinResolution object

Definition at line 58 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

◆ funcEt_

std::vector<std::string> StringResolutionProvider::funcEt_
private

vectors for the resolution functions

Definition at line 65 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

◆ funcEta_

std::vector<std::string> StringResolutionProvider::funcEta_
private

Definition at line 65 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

◆ funcPhi_

std::vector<std::string> StringResolutionProvider::funcPhi_
private

Definition at line 65 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

◆ parametrization_

pat::CandKinResolution::Parametrization StringResolutionProvider::parametrization_
private

a parametrization for the CanKinResolution object (this needs an extension)

Definition at line 61 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

mps_fire.i
i
Definition: mps_fire.py:428
StringResolutionProvider::funcPhi_
std::vector< std::string > funcPhi_
Definition: StringResolutionProvider.h:65
StringResolutionProvider::funcEta_
std::vector< std::string > funcEta_
Definition: StringResolutionProvider.h:65
StringResolutionProvider::constraints_
std::vector< pat::CandKinResolution::Scalar > constraints_
Definition: StringResolutionProvider.h:58
pat::helper::ParametrizationHelper::fromString
pat::CandKinResolution::Parametrization fromString(const std::string &name)
Convert a name into a parametrization code.
Definition: ParametrizationHelper.cc:14
pat::CandKinResolution::Parametrization
Parametrization
Definition: CandKinResolution.h:35
HGCalGeometryMode::Square
Definition: HGCalGeometryMode.h:26
stringResolutionProvider_cfi.parametrization
parametrization
specify parametrization (see SWGuidePATKinematicResolutions for more details)
Definition: stringResolutionProvider_cfi.py:6
StringResolutionProvider::funcEt_
std::vector< std::string > funcEt_
vectors for the resolution functions
Definition: StringResolutionProvider.h:65
pat::CandKinResolution
Definition: CandKinResolution.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
StringResolutionProvider::bins_
std::vector< std::string > bins_
a vector of strings for the binning
Definition: StringResolutionProvider.h:63
cand
Definition: decayParser.h:32
StringResolutionProvider::parametrization_
pat::CandKinResolution::Parametrization parametrization_
Definition: StringResolutionProvider.h:61
looper.cfg
cfg
Definition: looper.py:297
StringResolutionProvider::Function
StringObjectFunction< reco::Candidate > Function
short cut within the common namespace
Definition: StringResolutionProvider.h:46
StringCutObjectSelector< reco::Candidate >
Exception
Definition: hltDiff.cc:245