CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalTrackingRegionProducerFromBeamSpot.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkTrackingRegions_GlobalTrackingRegionProducerFromBeamSpot_H
2 #define RecoTracker_TkTrackingRegions_GlobalTrackingRegionProducerFromBeamSpot_H
3 
11 
13 
14 public:
15 
17  edm::ConsumesCollector && iC) {
18 
19  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
20  thePtMin = regionPSet.getParameter<double>("ptMin");
21  theOriginRadius = regionPSet.getParameter<double>("originRadius");
22  if (!regionPSet.existsAs<double>("nSigmaZ") && !regionPSet.existsAs<double>("originHalfLength")) {
23  throw cms::Exception("Configuration") << "GlobalTrackingRegionProducerFromBeamSpot: at least one of nSigmaZ, originHalfLength must be present in the cfg.\n";
24  }
25  theNSigmaZ = (regionPSet.existsAs<double>("nSigmaZ") ? regionPSet.getParameter<double>("nSigmaZ") : 0.0);
26  theOriginHalfLength = (regionPSet.existsAs<double>("originHalfLength") ? regionPSet.getParameter<double>("originHalfLength") : 0.0);
27  token_beamSpot = iC.consumes<reco::BeamSpot>(regionPSet.getParameter<edm::InputTag>("beamSpot"));
28  thePrecise = regionPSet.getParameter<bool>("precise");
29  }
30 
32 
33  virtual std::vector<TrackingRegion* > regions(const edm::Event&ev, const edm::EventSetup&) const {
34  std::vector<TrackingRegion* > result;
36  ev.getByToken( token_beamSpot, bsHandle);
37  if(bsHandle.isValid()) {
38 
39  const reco::BeamSpot & bs = *bsHandle;
40 
41  GlobalPoint origin(bs.x0(), bs.y0(), bs.z0());
42 
43  result.push_back( new GlobalTrackingRegion(
45 
46  }
47  return result;
48  }
49 
50 private:
51  double thePtMin;
54  double theNSigmaZ;
56  bool thePrecise;
57 };
58 
59 #endif
60 
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:68
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
const T & max(const T &a, const T &b)
tuple result
Definition: query.py:137
bool isValid() const
Definition: HandleBase.h:76
GlobalTrackingRegionProducerFromBeamSpot(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
virtual std::vector< TrackingRegion * > regions(const edm::Event &ev, const edm::EventSetup &) const
double y0() const
y coordinate
Definition: BeamSpot.h:66
double x0() const
x coordinate
Definition: BeamSpot.h:64