CMS 3D CMS Logo

GlobalTrackingRegionProducerFromBeamSpot.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkTrackingRegions_GlobalTrackingRegionProducerFromBeamSpot_H
2 #define RecoTracker_TkTrackingRegions_GlobalTrackingRegionProducerFromBeamSpot_H
3 
15 
17 public:
21  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
22  thePtMin = regionPSet.getParameter<double>("ptMin");
23  theOriginRadius = regionPSet.getParameter<double>("originRadius");
24  if (!regionPSet.existsAs<double>("nSigmaZ") && !regionPSet.existsAs<double>("originHalfLength")) {
25  throw cms::Exception("Configuration") << "GlobalTrackingRegionProducerFromBeamSpot: at least one of nSigmaZ, "
26  "originHalfLength must be present in the cfg.\n";
27  }
28  theNSigmaZ = (regionPSet.existsAs<double>("nSigmaZ") ? regionPSet.getParameter<double>("nSigmaZ") : 0.0);
30  (regionPSet.existsAs<double>("originHalfLength") ? regionPSet.getParameter<double>("originHalfLength") : 0.0);
31  token_beamSpot = iC.consumes<reco::BeamSpot>(regionPSet.getParameter<edm::InputTag>("beamSpot"));
32  thePrecise = regionPSet.getParameter<bool>("precise");
33  theUseMS =
34  (regionPSet.existsAs<bool>("useMultipleScattering") ? regionPSet.getParameter<bool>("useMultipleScattering")
35  : false);
36  }
37 
39 
40  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
41  {
43 
44  desc.add<bool>("precise", true);
45  desc.add<bool>("useMultipleScattering", false);
46  desc.add<double>("nSigmaZ", 4.0);
47  desc.add<double>("originHalfLength", 0.0); // this is the default in constructor
48  desc.add<double>("originRadius", 0.2);
49  desc.add<double>("ptMin", 0.9);
50  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
51 
52  // Only for backwards-compatibility
54  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
55 
56  descriptions.add("globalTrackingRegionFromBeamSpot", descRegion);
57  }
58 
59  {
61 
62  desc.add<bool>("precise", true);
63  desc.add<bool>("useMultipleScattering", false);
64  desc.add<double>("nSigmaZ", 0.0); // this is the default in constructor
65  desc.add<double>("originHalfLength", 21.2);
66  desc.add<double>("originRadius", 0.2);
67  desc.add<double>("ptMin", 0.9);
68  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
69 
70  // Only for backwards-compatibility
72  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
73 
74  descriptions.add("globalTrackingRegionFromBeamSpotFixedZ", descRegion);
75  }
76  }
77 
78  std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event& ev, const edm::EventSetup&) const override {
79  std::vector<std::unique_ptr<TrackingRegion> > result;
81  ev.getByToken(token_beamSpot, bsHandle);
82  if (bsHandle.isValid()) {
83  const reco::BeamSpot& bs = *bsHandle;
84 
85  GlobalPoint origin(bs.x0(), bs.y0(), bs.z0());
86 
87  result.push_back(std::make_unique<GlobalTrackingRegion>(thePtMin,
88  origin,
91  thePrecise,
92  theUseMS));
93  }
94  return result;
95  }
96 
97 private:
98  double thePtMin;
101  double theNSigmaZ;
104  bool theUseMS;
105 };
106 
107 #endif
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:65
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
GlobalTrackingRegionProducerFromBeamSpot(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
bool ev
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &ev, const edm::EventSetup &) const override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:70
GlobalTrackingRegionProducerFromBeamSpot(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
double sigmaZ() const
sigma z
Definition: BeamSpot.h:76
void add(std::string const &label, ParameterSetDescription const &psetDescription)
double y0() const
y coordinate
Definition: BeamSpot.h:63
double x0() const
x coordinate
Definition: BeamSpot.h:61