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 
18 public:
19 
23  {}
26 
27  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
28  thePtMin = regionPSet.getParameter<double>("ptMin");
29  theOriginRadius = regionPSet.getParameter<double>("originRadius");
30  if (!regionPSet.existsAs<double>("nSigmaZ") && !regionPSet.existsAs<double>("originHalfLength")) {
31  throw cms::Exception("Configuration") << "GlobalTrackingRegionProducerFromBeamSpot: at least one of nSigmaZ, originHalfLength must be present in the cfg.\n";
32  }
33  theNSigmaZ = (regionPSet.existsAs<double>("nSigmaZ") ? regionPSet.getParameter<double>("nSigmaZ") : 0.0);
34  theOriginHalfLength = (regionPSet.existsAs<double>("originHalfLength") ? regionPSet.getParameter<double>("originHalfLength") : 0.0);
35  token_beamSpot = iC.consumes<reco::BeamSpot>(regionPSet.getParameter<edm::InputTag>("beamSpot"));
36  thePrecise = regionPSet.getParameter<bool>("precise");
37  theUseMS = (regionPSet.existsAs<bool>("useMultipleScattering") ? regionPSet.getParameter<bool>("useMultipleScattering") : false);
38 
39  }
40 
42 
43  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
44  {
46 
47  desc.add<bool>("precise", true);
48  desc.add<bool>("useMultipleScattering", false);
49  desc.add<double>("nSigmaZ", 4.0);
50  desc.add<double>("originHalfLength", 0.0); // this is the default in constructor
51  desc.add<double>("originRadius", 0.2);
52  desc.add<double>("ptMin", 0.9);
53  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
54 
55  // Only for backwards-compatibility
57  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
58 
59  descriptions.add("globalTrackingRegionFromBeamSpot", descRegion);
60  }
61 
62  {
64 
65  desc.add<bool>("precise", true);
66  desc.add<bool>("useMultipleScattering", false);
67  desc.add<double>("nSigmaZ", 0.0); // this is the default in constructor
68  desc.add<double>("originHalfLength", 21.2);
69  desc.add<double>("originRadius", 0.2);
70  desc.add<double>("ptMin", 0.9);
71  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
72 
73  // Only for backwards-compatibility
75  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
76 
77  descriptions.add("globalTrackingRegionFromBeamSpotFixedZ", descRegion);
78  }
79  }
80 
81  std::vector<std::unique_ptr<TrackingRegion> > regions(const edm::Event&ev, const edm::EventSetup&) const override {
82  std::vector<std::unique_ptr<TrackingRegion> > result;
84  ev.getByToken( token_beamSpot, bsHandle);
85  if(bsHandle.isValid()) {
86 
87  const reco::BeamSpot & bs = *bsHandle;
88 
89  GlobalPoint origin(bs.x0(), bs.y0(), bs.z0());
90 
91  result.push_back( std::make_unique<GlobalTrackingRegion>(
93 
94  }
95  return result;
96  }
97 
98 private:
99  double thePtMin;
102  double theNSigmaZ;
105  bool theUseMS;
106 };
107 
108 #endif
109 
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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:186
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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:74
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
double x0() const
x coordinate
Definition: BeamSpot.h:64