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 }
00034
00035 virtual ~IsolationRegionAroundL3Muon(){}
00036
00037 virtual std::vector<TrackingRegion* > regions(const edm::Event& ev,
00038 const edm::EventSetup& es) const {
00039
00040 std::vector<TrackingRegion* > result;
00041
00042
00043
00044 double deltaZVertex = theOriginHalfLength;
00045 double originz = theOriginZPos;
00046 if (theVertexSrc.length()>1) {
00047 edm::Handle<reco::VertexCollection> vertices;
00048 ev.getByLabel(theVertexSrc,vertices);
00049 const reco::VertexCollection vertCollection = *(vertices.product());
00050 reco::VertexCollection::const_iterator ci = vertCollection.begin();
00051 if (vertCollection.size()>0) {
00052 originz = ci->z();
00053 } else {
00054 originz = theOriginZPos;
00055 deltaZVertex = 15.;
00056 }
00057 }
00058
00059 edm::Handle<reco::TrackCollection> trks;
00060 ev.getByLabel(theInputTrkSrc, trks);
00061
00062 for(reco::TrackCollection::const_iterator iTrk = trks->begin();iTrk != trks->end();iTrk++) {
00063 double vz = (theVertexZconstrained) ? iTrk->dz() : originz;
00064 GlobalVector dirVector((iTrk)->px(),(iTrk)->py(),(iTrk)->pz());
00065 result.push_back(
00066 new RectangularEtaPhiTrackingRegion( dirVector, GlobalPoint(0,0,float(vz)),
00067 thePtMin, theOriginRadius, deltaZVertex, theDeltaEta, theDeltaPhi) );
00068 }
00069
00070 return result;
00071 }
00072
00073 private:
00074
00075 std::string theVertexSrc;
00076 edm::InputTag theInputTrkSrc;
00077
00078 double thePtMin;
00079 double theOriginRadius;
00080 double theOriginHalfLength;
00081 bool theVertexZconstrained;
00082 double theOriginZPos;
00083
00084 double theDeltaEta;
00085 double theDeltaPhi;
00086 };
00087
00088 #endif
00089