CMS 3D CMS Logo

StringResolutionProvider.cc
Go to the documentation of this file.
1 #include <map>
2 #include <Math/Functions.h>
3 
7 
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 }
33 
35 
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 }
mps_fire.i
i
Definition: mps_fire.py:428
StringResolutionProvider::funcPhi_
std::vector< std::string > funcPhi_
Definition: StringResolutionProvider.h:65
StringResolutionProvider::~StringResolutionProvider
~StringResolutionProvider() override
default destructor
Definition: StringResolutionProvider.cc:34
StringResolutionProvider::funcEta_
std::vector< std::string > funcEta_
Definition: StringResolutionProvider.h:65
StringResolutionProvider::constraints_
std::vector< pat::CandKinResolution::Scalar > constraints_
Definition: StringResolutionProvider.h:58
ParametrizationHelper.h
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
edm::ParameterSet
Definition: ParameterSet.h:47
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
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper.cfg
cfg
Definition: looper.py:296
reco::Candidate
Definition: Candidate.h:27
StringResolutionProvider::getResolution
pat::CandKinResolution getResolution(const reco::Candidate &cand) const override
get a CandKinResolution object from the service
Definition: StringResolutionProvider.cc:36
StringCutObjectSelector.h
StringResolutionProvider::Function
StringObjectFunction< reco::Candidate > Function
short cut within the common namespace
Definition: StringResolutionProvider.h:46
StringCutObjectSelector< reco::Candidate >
Exception
Definition: hltDiff.cc:245
StringResolutionProvider.h
StringResolutionProvider::StringResolutionProvider
StringResolutionProvider(const edm::ParameterSet &cfg)
default constructor
Definition: StringResolutionProvider.cc:8