Go to the documentation of this file.00001 #ifndef RecoMuon_L3MuonIsolationProducer_IsolationRegionAroundL3Muon_H
00002 #define RecoMuon_L3MuonIsolationProducer_IsolationRegionAroundL3Muon_H
00003
00004 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h"
00005 #include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegion.h"
00006 #include "RecoTracker/TkTrackingRegions/interface/RectangularEtaPhiTrackingRegion.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 #include "FWCore/Utilities/interface/InputTag.h"
00009 #include "DataFormats/VertexReco/interface/Vertex.h"
00010 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00011 #include "DataFormats/TrackReco/interface/Track.h"
00012
00013
00014 class IsolationRegionAroundL3Muon : public TrackingRegionProducer {
00015
00016 public:
00017
00018 IsolationRegionAroundL3Muon(const edm::ParameterSet& cfg) {
00019
00020 edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
00021
00022 theVertexSrc = regionPSet.getParameter<std::string>("vertexSrc");
00023 theInputTrkSrc = regionPSet.getParameter<edm::InputTag>("TrkSrc");
00024
00025 thePtMin = regionPSet.getParameter<double>("ptMin");
00026 theOriginRadius = regionPSet.getParameter<double>("originRadius");
00027 theOriginHalfLength = regionPSet.getParameter<double>("originHalfLength");
00028 theVertexZconstrained = regionPSet.getParameter<bool>("vertexZConstrained");
00029 theOriginZPos = regionPSet.getParameter<double>("vertexZDefault");
00030
00031 theDeltaEta = regionPSet.getParameter<double>("deltaEtaRegion");
00032 theDeltaPhi = regionPSet.getParameter<double>("deltaPhiRegion");
00033 theMeasurementTrackerName = regionPSet.getParameter<std::string>("measurementTrackerName");
00034 }
00035
00036 virtual ~IsolationRegionAroundL3Muon(){}
00037
00038 virtual std::vector<TrackingRegion* > regions(const edm::Event& ev,
00039 const edm::EventSetup& es) const {
00040
00041 std::vector<TrackingRegion* > result;
00042
00043
00044
00045 double deltaZVertex = theOriginHalfLength;
00046 double originz = theOriginZPos;
00047 if (theVertexSrc.length()>1) {
00048 edm::Handle<reco::VertexCollection> vertices;
00049 ev.getByLabel(theVertexSrc,vertices);
00050 const reco::VertexCollection vertCollection = *(vertices.product());
00051 reco::VertexCollection::const_iterator ci = vertCollection.begin();
00052 if (vertCollection.size()>0) {
00053 originz = ci->z();
00054 } else {
00055 originz = theOriginZPos;
00056 deltaZVertex = 15.;
00057 }
00058 }
00059
00060 edm::Handle<reco::TrackCollection> trks;
00061 ev.getByLabel(theInputTrkSrc, trks);
00062
00063 for(reco::TrackCollection::const_iterator iTrk = trks->begin();iTrk != trks->end();iTrk++) {
00064 double vz = (theVertexZconstrained) ? iTrk->dz() : originz;
00065 GlobalVector dirVector((iTrk)->px(),(iTrk)->py(),(iTrk)->pz());
00066 result.push_back(
00067 new RectangularEtaPhiTrackingRegion( dirVector, GlobalPoint(0,0,float(vz)),
00068 thePtMin, theOriginRadius, deltaZVertex, theDeltaEta, theDeltaPhi,
00069 0,true,theMeasurementTrackerName) );
00070 }
00071
00072 return result;
00073 }
00074
00075 private:
00076
00077 std::string theVertexSrc;
00078 edm::InputTag theInputTrkSrc;
00079
00080 double thePtMin;
00081 double theOriginRadius;
00082 double theOriginHalfLength;
00083 bool theVertexZconstrained;
00084 double theOriginZPos;
00085
00086 double theDeltaEta;
00087 double theDeltaPhi;
00088 std::string theMeasurementTrackerName;
00089 };
00090
00091 #endif
00092