CMS 3D CMS Logo

DistanceBetweenComponentsESProducer.cc
Go to the documentation of this file.
9 
10 #include <memory>
11 #include <string>
12 
17 template <unsigned int N>
19 public:
21 
22  std::unique_ptr<DistanceBetweenComponents<N> > produce(const TrackingComponentsRecord&);
23 
24  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
25 
26 private:
27  const bool useKullbackLeibler_;
28 };
29 
33 
34 template <unsigned int N>
36  : useKullbackLeibler_(p.getParameter<std::string>("DistanceMeasure") == "KullbackLeibler") {
37  std::string myname = p.getParameter<std::string>("ComponentName");
38  setWhatProduced(this, myname);
39 }
40 
41 template <unsigned int N>
42 typename std::unique_ptr<DistanceBetweenComponents<N> > DistanceBetweenComponentsESProducer<N>::produce(
43  const TrackingComponentsRecord& iRecord) {
44  std::unique_ptr<DistanceBetweenComponents<N> > distance;
45  if (useKullbackLeibler_)
46  distance = std::unique_ptr<DistanceBetweenComponents<N> >(new KullbackLeiblerDistance<N>());
47  // // else if ( distName == "Mahalanobis" )
48  // // distance = std::unique_ptr<DistanceBetweenComponents>(new MahalanobisDistance());
49 
50  return distance;
51 }
52 
53 template <unsigned int N>
56  desc.add<std::string>("DistanceMeasure");
57  desc.add<std::string>("ComponentName");
58 
59  descriptions.addDefault(desc);
60 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
DistanceBetweenComponentsESProducer< 5 > DistanceBetweenComponentsESProducer5D
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< DistanceBetweenComponents< N > > produce(const TrackingComponentsRecord &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61