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  }
34 
36 
37  virtual std::vector<TrackingRegion* > regions(const edm::Event& ev,
38  const edm::EventSetup& es) const {
39 
40  std::vector<TrackingRegion* > result;
41 
42  // optional constraint for vertex
43  // get highest Pt pixel vertex (if existing)
44  double deltaZVertex = theOriginHalfLength;
45  double originz = theOriginZPos;
46  if (theVertexSrc.length()>1) {
48  ev.getByLabel(theVertexSrc,vertices);
49  const reco::VertexCollection vertCollection = *(vertices.product());
50  reco::VertexCollection::const_iterator ci = vertCollection.begin();
51  if (vertCollection.size()>0) {
52  originz = ci->z();
53  } else {
54  originz = theOriginZPos;
55  deltaZVertex = 15.;
56  }
57  }
58 
60  ev.getByLabel(theInputTrkSrc, trks);
61 
62  for(reco::TrackCollection::const_iterator iTrk = trks->begin();iTrk != trks->end();iTrk++) {
63  double vz = (theVertexZconstrained) ? iTrk->dz() : originz;
64  GlobalVector dirVector((iTrk)->px(),(iTrk)->py(),(iTrk)->pz());
65  result.push_back(
66  new RectangularEtaPhiTrackingRegion( dirVector, GlobalPoint(0,0,float(vz)),
67  thePtMin, theOriginRadius, deltaZVertex, theDeltaEta, theDeltaPhi) );
68  }
69 
70  return result;
71  }
72 
73 private:
74 
75  std::string theVertexSrc;
77 
78  double thePtMin;
79  double theOriginRadius;
82  double theOriginZPos;
83 
84  double theDeltaEta;
85  double theDeltaPhi;
86 };
87 
88 #endif
89 
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:355
T const * product() const
Definition: Handle.h:74