CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoTauTag/HLTProducers/src/TauRegionalPixelSeedGenerator.h

Go to the documentation of this file.
00001 #ifndef TauRegionalPixelSeedGenerator_h
00002 #define TauRegionalPixelSeedGenerator_h
00003 
00004 //
00005 // Class:           TauRegionalPixelSeedGenerator
00006 
00007 
00008 #include "FWCore/Framework/interface/EDProducer.h"
00009 #include "FWCore/Framework/interface/Event.h"
00010 #include "FWCore/Framework/interface/EventSetup.h"
00011 #include "FWCore/Utilities/interface/InputTag.h"
00012 #include "DataFormats/Common/interface/Handle.h"
00013 #include "DataFormats/Common/interface/EDProduct.h"
00014 #include "DataFormats/VertexReco/interface/Vertex.h"
00015 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00016 #include "DataFormats/TrackReco/interface/Track.h"
00017 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00018 #include "DataFormats/Math/interface/Vector3D.h"
00019 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h"
00020 #include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegion.h"
00021 #include "RecoTracker/TkTrackingRegions/interface/RectangularEtaPhiTrackingRegion.h"
00022 // Math
00023 #include "Math/GenVector/VectorUtil.h"
00024 #include "Math/GenVector/PxPyPzE4D.h"
00025 
00026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00027 
00028 #include "DataFormats/Common/interface/Ref.h"
00029 #include "DataFormats/JetReco/interface/Jet.h"
00030 
00031 
00032 class TauRegionalPixelSeedGenerator : public TrackingRegionProducer {
00033   public:
00034     
00035     explicit TauRegionalPixelSeedGenerator(const edm::ParameterSet& conf_){
00036       edm::LogInfo ("TauRegionalPixelSeedGenerator") << "Enter the TauRegionalPixelSeedGenerator";
00037 
00038       edm::ParameterSet regionPSet = conf_.getParameter<edm::ParameterSet>("RegionPSet");
00039 
00040       m_ptMin        = regionPSet.getParameter<double>("ptMin");
00041       m_originRadius = regionPSet.getParameter<double>("originRadius");
00042       m_halfLength   = regionPSet.getParameter<double>("originHalfLength");
00043       m_deltaEta     = regionPSet.getParameter<double>("deltaEtaRegion");
00044       m_deltaPhi     = regionPSet.getParameter<double>("deltaPhiRegion");
00045       m_jetSrc       = regionPSet.getParameter<edm::InputTag>("JetSrc");
00046       m_vertexSrc    = regionPSet.getParameter<edm::InputTag>("vertexSrc");
00047     }
00048   
00049     virtual ~TauRegionalPixelSeedGenerator() {}
00050     
00051 
00052     virtual std::vector<TrackingRegion* > regions(const edm::Event& e, const edm::EventSetup& es) const {
00053       std::vector<TrackingRegion* > result;
00054 
00055       //      double originZ;
00056       double deltaZVertex, deltaRho;
00057         GlobalPoint vertex;
00058       // get the primary vertex
00059       edm::Handle<reco::VertexCollection> h_vertices;
00060       e.getByLabel(m_vertexSrc, h_vertices);
00061       const reco::VertexCollection & vertices = * h_vertices;
00062       if (not vertices.empty()) {
00063 //        originZ      = vertices.front().z();
00064         GlobalPoint myTmp(vertices.at(0).position().x(),vertices.at(0).position().y(), vertices.at(0).position().z());
00065           vertex = myTmp;
00066           deltaZVertex = m_halfLength;
00067           deltaRho = m_originRadius;
00068       } else {
00069   //      originZ      =  0.;
00070           GlobalPoint myTmp(0.,0.,0.);
00071           vertex = myTmp;
00072           deltaRho = 1.;
00073          deltaZVertex = 15.;
00074       }
00075       
00076       // get the jet direction
00077       edm::Handle<edm::View<reco::Candidate> > h_jets;
00078       e.getByLabel(m_jetSrc, h_jets);
00079       
00080       for (unsigned int iJet =0; iJet < h_jets->size(); ++iJet)
00081         {
00082           const reco::Candidate & myJet = (*h_jets)[iJet];
00083           GlobalVector jetVector(myJet.momentum().x(),myJet.momentum().y(),myJet.momentum().z());
00084 //          GlobalPoint  vertex(0, 0, originZ);
00085           RectangularEtaPhiTrackingRegion* etaphiRegion = new RectangularEtaPhiTrackingRegion( jetVector,
00086                                                                                                vertex,
00087                                                                                                m_ptMin,
00088                                                                                                deltaRho,
00089                                                                                                deltaZVertex,
00090                                                                                                m_deltaEta,
00091                                                                                                m_deltaPhi );
00092           result.push_back(etaphiRegion);
00093       }
00094 
00095       return result;
00096     }
00097   
00098  private:
00099   edm::ParameterSet conf_;
00100 
00101   float m_ptMin;
00102   float m_originRadius;
00103   float m_halfLength;
00104   float m_deltaEta;
00105   float m_deltaPhi;
00106   edm::InputTag m_jetSrc;
00107   edm::InputTag m_vertexSrc;
00108 };
00109 
00110 #endif