CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalTrackingRegionWithVerticesProducer.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkTrackingRegions_GlobalTrackingRegionWithVerticesProducer_H
2 #define RecoTracker_TkTrackingRegions_GlobalTrackingRegionWithVerticesProducer_H
3 
8 
13 
15 {
16 public:
17 
19  {
20  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
21 
22  thePtMin = regionPSet.getParameter<double>("ptMin");
23  theOriginRadius = regionPSet.getParameter<double>("originRadius");
24  theNSigmaZ = regionPSet.getParameter<double>("nSigmaZ");
25  theBeamSpotTag = regionPSet.getParameter<edm::InputTag>("beamSpot");
26  thePrecise = regionPSet.getParameter<bool>("precise");
27 
28  theSigmaZVertex = regionPSet.getParameter<double>("sigmaZVertex");
29  theFixedError = regionPSet.getParameter<double>("fixedError");
30 
31  theUseFoundVertices = regionPSet.getParameter<bool>("useFoundVertices");
32  theUseFixedError = regionPSet.getParameter<bool>("useFixedError");
33  vertexCollName = regionPSet.getParameter<edm::InputTag>("VertexCollection");
34  }
35 
37 
38  virtual std::vector<TrackingRegion* > regions
39  (const edm::Event& ev, const edm::EventSetup&) const
40  {
41  std::vector<TrackingRegion* > result;
42 
43  GlobalPoint theOrigin;
45  ev.getByLabel( theBeamSpotTag, bsHandle);
46  double bsSigmaZ;
47  if(bsHandle.isValid()) {
48  const reco::BeamSpot & bs = *bsHandle;
49  bsSigmaZ = theNSigmaZ*bs.sigmaZ();
50  theOrigin = GlobalPoint(bs.x0(), bs.y0(), bs.z0());
51  }else{
52  throw cms::Exception("Seeding") << "ERROR: input beamSpot is not valid in GlobalTrackingRegionWithVertices";
53  }
54 
56  {
58  ev.getByLabel(vertexCollName,vertexCollection);
59 
60  for(reco::VertexCollection::const_iterator iV=vertexCollection->begin(); iV != vertexCollection->end() ; iV++) {
61  if (iV->isFake() || !iV->isValid()) continue;
62  GlobalPoint theOrigin_ = GlobalPoint(iV->x(),iV->y(),iV->z());
63  double theOriginHalfLength_ = (theUseFixedError ? theFixedError : (iV->zError())*theSigmaZVertex);
64  result.push_back( new GlobalTrackingRegion(thePtMin, theOrigin_, theOriginRadius, theOriginHalfLength_, thePrecise) );
65  }
66 
67  if (result.empty()) {
68  result.push_back( new GlobalTrackingRegion(thePtMin, theOrigin, theOriginRadius, bsSigmaZ, thePrecise) );
69  }
70  }
71  else
72  {
73  result.push_back(
74  new GlobalTrackingRegion(thePtMin, theOrigin, theOriginRadius, bsSigmaZ, thePrecise) );
75  }
76 
77  return result;
78  }
79 
80 private:
81  double thePtMin;
82  double theOriginRadius;
83  double theNSigmaZ;
85 
87  double theFixedError;
88  bool thePrecise;
89 
93 
94 
95 };
96 
97 #endif
virtual std::vector< TrackingRegion * > regions(const edm::Event &ev, const edm::EventSetup &) const
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
tuple vertexCollection
tuple result
Definition: query.py:137
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double sigmaZ() const
sigma z
Definition: BeamSpot.h:81
double y0() const
y coordinate
Definition: BeamSpot.h:67
double x0() const
x coordinate
Definition: BeamSpot.h:65