CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AreaSeededTrackingRegionsProducer.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkTrackingRegions_AreaSeededTrackingRegionsProducer_h
2 #define RecoTracker_TkTrackingRegions_AreaSeededTrackingRegionsProducer_h
3 
5 
17 
18 #include "VertexBeamspotOrigins.h"
20 
21 #include <array>
22 #include <limits>
23 
49 public:
51 
53  : m_origins(conf.getParameter<edm::ParameterSet>("RegionPSet"), iC),
54  m_builder(conf.getParameter<edm::ParameterSet>("RegionPSet"), iC) {
55  edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet");
56  for (const auto& area : regPSet.getParameter<std::vector<edm::ParameterSet> >("areas")) {
57  m_areas.emplace_back(area.getParameter<double>("rmin"),
58  area.getParameter<double>("rmax"),
59  area.getParameter<double>("phimin"),
60  area.getParameter<double>("phimax"),
61  area.getParameter<double>("zmin"),
62  area.getParameter<double>("zmax"));
63  }
64  if (m_areas.empty())
65  throw cms::Exception("Configuration") << "Empty 'areas' parameter.";
66  }
67 
69 
70  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
72 
74  descAreas.add<double>("rmin", 0.0);
75  descAreas.add<double>("rmax", 0.0);
76  descAreas.add<double>("zmin", 0.0);
77  descAreas.add<double>("zmax", 0.0);
78  descAreas.add<double>("phimin", 0.0);
79  descAreas.add<double>("phimax", 0.0);
80  std::vector<edm::ParameterSet> vDefaults;
81  desc.addVPSet("areas", descAreas, vDefaults);
82 
85 
86  // Only for backwards-compatibility
88  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
89 
90  descriptions.add("areaSeededTrackingRegion", descRegion);
91  }
92 
93  std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event& e, const edm::EventSetup& es) const {
94  auto origins = m_origins.origins(e);
95  auto builder = m_builder.beginEvent(e, es);
96  return builder.regions(origins, m_areas);
97  }
98 
99 private:
102  std::vector<AreaSeededTrackingRegionsBuilder::Area> m_areas;
103 };
104 
105 #endif
Origins origins(const edm::Event &iEvent) const
static void fillDescriptions(edm::ParameterSetDescription &desc)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
static void fillDescriptions(edm::ParameterSetDescription &desc, const std::string &defaultBeamSpot="offlineBeamSpot", const std::string &defaultVertex="firstStepPrimaryVertices", int defaultMaxVertices=-1)
Builder beginEvent(const edm::Event &e, const edm::EventSetup &es) const
std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &e, const edm::EventSetup &es) const
std::vector< std::unique_ptr< TrackingRegion > > regions(const Origins &origins, const std::vector< Area > &areas) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< AreaSeededTrackingRegionsBuilder::Area > m_areas
AreaSeededTrackingRegionsProducer(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)