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