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