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 
13 
14 
16 
17 public:
18 
20  edm::ConsumesCollector && iC) {
21 
22  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
23 
24  theVertexSrc = regionPSet.getParameter<edm::InputTag>("vertexSrc");
25  if (theVertexSrc.label().length()>1) theVertexToken = iC.consumes<reco::VertexCollection>(theVertexSrc);
26  theInputTrkToken = iC.consumes<reco::TrackCollection>(regionPSet.getParameter<edm::InputTag>("TrkSrc"));
27 
28  thePtMin = regionPSet.getParameter<double>("ptMin");
29  theOriginRadius = regionPSet.getParameter<double>("originRadius");
30  theOriginHalfLength = regionPSet.getParameter<double>("originHalfLength");
31  theVertexZconstrained = regionPSet.getParameter<bool>("vertexZConstrained");
32  theOriginZPos = regionPSet.getParameter<double>("vertexZDefault");
33 
34  theDeltaEta = regionPSet.getParameter<double>("deltaEtaRegion");
35  theDeltaPhi = regionPSet.getParameter<double>("deltaPhiRegion");
36  theMeasurementTrackerName = regionPSet.getParameter<std::string>("measurementTrackerName");
37  }
38 
40 
41  virtual std::vector<TrackingRegion* > regions(const edm::Event& ev,
42  const edm::EventSetup& es) const {
43 
44  std::vector<TrackingRegion* > result;
45 
46  // optional constraint for vertex
47  // get highest Pt pixel vertex (if existing)
48  double deltaZVertex = theOriginHalfLength;
49  double originz = theOriginZPos;
50  if (theVertexSrc.label().length()>1) {
52  ev.getByToken(theVertexToken,vertices);
53  const reco::VertexCollection vertCollection = *(vertices.product());
54  reco::VertexCollection::const_iterator ci = vertCollection.begin();
55  if (vertCollection.size()>0) {
56  originz = ci->z();
57  } else {
58  originz = theOriginZPos;
59  deltaZVertex = 15.;
60  }
61  }
62 
64  ev.getByToken(theInputTrkToken, trks);
65 
66  for(reco::TrackCollection::const_iterator iTrk = trks->begin();iTrk != trks->end();iTrk++) {
67  double vz = (theVertexZconstrained) ? iTrk->dz() : originz;
68  GlobalVector dirVector((iTrk)->px(),(iTrk)->py(),(iTrk)->pz());
69  result.push_back(
70  new RectangularEtaPhiTrackingRegion( dirVector, GlobalPoint(0,0,float(vz)),
72  0,true,theMeasurementTrackerName) );
73  }
74 
75  return result;
76  }
77 
78 private:
79 
83 
84  double thePtMin;
85  double theOriginRadius;
88  double theOriginZPos;
89 
90  double theDeltaEta;
91  double theDeltaPhi;
93 };
94 
95 #endif
96 
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.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
IsolationRegionAroundL3Muon(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
tuple result
Definition: query.py:137
edm::EDGetTokenT< reco::VertexCollection > theVertexToken
edm::EDGetTokenT< reco::TrackCollection > theInputTrkToken
T const * product() const
Definition: Handle.h:81
std::string const & label() const
Definition: InputTag.h:42