CMS 3D CMS Logo

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