CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IsolationRegionAroundL3Muon.h
Go to the documentation of this file.
1 #ifndef RecoMuon_L3MuonIsolationProducer_IsolationRegionAroundL3Muon_H
2 #define RecoMuon_L3MuonIsolationProducer_IsolationRegionAroundL3Muon_H
3 
12 
13 
15 
16 public:
17 
19 
20  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
21 
22  theVertexSrc = regionPSet.getParameter<std::string>("vertexSrc");
23  theInputTrkSrc = regionPSet.getParameter<edm::InputTag>("TrkSrc");
24 
25  thePtMin = regionPSet.getParameter<double>("ptMin");
26  theOriginRadius = regionPSet.getParameter<double>("originRadius");
27  theOriginHalfLength = regionPSet.getParameter<double>("originHalfLength");
28  theVertexZconstrained = regionPSet.getParameter<bool>("vertexZConstrained");
29  theOriginZPos = regionPSet.getParameter<double>("vertexZDefault");
30 
31  theDeltaEta = regionPSet.getParameter<double>("deltaEtaRegion");
32  theDeltaPhi = regionPSet.getParameter<double>("deltaPhiRegion");
33  theMeasurementTrackerName = regionPSet.getParameter<std::string>("measurementTrackerName");
34  }
35 
37 
38  virtual std::vector<TrackingRegion* > regions(const edm::Event& ev,
39  const edm::EventSetup& es) const {
40 
41  std::vector<TrackingRegion* > result;
42 
43  // optional constraint for vertex
44  // get highest Pt pixel vertex (if existing)
45  double deltaZVertex = theOriginHalfLength;
46  double originz = theOriginZPos;
47  if (theVertexSrc.length()>1) {
49  ev.getByLabel(theVertexSrc,vertices);
50  const reco::VertexCollection vertCollection = *(vertices.product());
51  reco::VertexCollection::const_iterator ci = vertCollection.begin();
52  if (vertCollection.size()>0) {
53  originz = ci->z();
54  } else {
55  originz = theOriginZPos;
56  deltaZVertex = 15.;
57  }
58  }
59 
61  ev.getByLabel(theInputTrkSrc, trks);
62 
63  for(reco::TrackCollection::const_iterator iTrk = trks->begin();iTrk != trks->end();iTrk++) {
64  double vz = (theVertexZconstrained) ? iTrk->dz() : originz;
65  GlobalVector dirVector((iTrk)->px(),(iTrk)->py(),(iTrk)->pz());
66  result.push_back(
67  new RectangularEtaPhiTrackingRegion( dirVector, GlobalPoint(0,0,float(vz)),
69  0,true,theMeasurementTrackerName) );
70  }
71 
72  return result;
73  }
74 
75 private:
76 
77  std::string theVertexSrc;
79 
80  double thePtMin;
81  double theOriginRadius;
84  double theOriginZPos;
85 
86  double theDeltaEta;
87  double theDeltaPhi;
89 };
90 
91 #endif
92 
T getParameter(std::string const &) const
IsolationRegionAroundL3Muon(const edm::ParameterSet &cfg)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
virtual std::vector< TrackingRegion * > regions(const edm::Event &ev, const edm::EventSetup &es) const
tuple result
Definition: query.py:137
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
T const * product() const
Definition: Handle.h:74