CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.h

Go to the documentation of this file.
00001 #ifndef RecoParticleFlow_PFProducer_PFPhotonTranslator_H
00002 #define RecoParticleFlow_PFProducer_PFPhotonTranslator_H
00003 #include "FWCore/Framework/interface/EDProducer.h"
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00006 #include "FWCore/Framework/interface/MakerMacros.h"
00007 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h"
00008 #include "DataFormats/Common/interface/ValueMap.h"
00009 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00010 #include "DataFormats/EgammaReco/interface/PreshowerClusterFwd.h"
00011 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00012 #include "DataFormats/EgammaCandidates/interface/PhotonCore.h"
00013 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00014 #include "DataFormats/EgammaCandidates/interface/PhotonCoreFwd.h"
00015 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00016 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
00017 #include "DataFormats/VertexReco/interface/Vertex.h"
00018 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00019 //#include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
00020 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
00021 
00022 #include "DataFormats/Common/interface/Handle.h"
00023 #include "FWCore/Framework/interface/ESHandle.h"
00024 
00025 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00026 #include "RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h"
00027 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h"
00028 
00029 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00030 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00031 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00032 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00033 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00034 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00035 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
00036 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00037 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
00038 #include "RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h"
00039 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h"
00040 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h" 
00041 #include "CondFormats/EcalObjects/interface/EcalFunctionParameters.h" 
00042 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
00043 
00044 #include <iostream>
00045 #include <string>
00046 #include <map>
00047 #include <vector>
00048 
00049 #include "DataFormats/Math/interface/Vector3D.h"
00050 #include "DataFormats/Math/interface/LorentzVector.h"
00051 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00052 #include "DataFormats/Common/interface/AssociationVector.h"
00053 
00054 #include <Math/VectorUtil.h>
00055 #include "TLorentzVector.h"
00056 #include "TMath.h"
00057 
00058 
00059 
00060 
00061 
00062 class PFPhotonTranslator : public edm::EDProducer
00063 {
00064  public:
00065   explicit PFPhotonTranslator(const edm::ParameterSet&);
00066   ~PFPhotonTranslator();
00067   
00068   virtual void produce(edm::Event &, const edm::EventSetup&);
00069   virtual void beginRun(edm::Run & run,const edm::EventSetup & c);
00070   //virtual void endRun (edm::Run& run, const edm::EventSetup & c);
00071 
00072   typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
00073 
00074  private:
00075   // to retrieve the collection from the event
00076   bool fetchCandidateCollection(edm::Handle<reco::PFCandidateCollection>& c, 
00077                                 const edm::InputTag& tag, 
00078                                 const edm::Event& iEvent) const;
00079 
00080 
00081   // makes a basic cluster from PFBlockElement and add it to the collection ; the corrected energy is taken
00082   // from the PFCandidate
00083   void createBasicCluster(const reco::PFBlockElement & ,  reco::BasicClusterCollection & basicClusters,
00084                           std::vector<const reco::PFCluster *> &,
00085                           const reco::PFCandidate & coCandidate) const;
00086   // makes a preshower cluster from of PFBlockElement and add it to the collection
00087   void createPreshowerCluster(const reco::PFBlockElement & PFBE, 
00088                               reco::PreshowerClusterCollection& preshowerClusters,
00089                               unsigned plane) const;
00090   
00091   // create the basic cluster Ptr
00092   void createBasicClusterPtrs(const edm::OrphanHandle<reco::BasicClusterCollection> & basicClustersHandle );
00093 
00094   // create the preshower cluster Refs
00095   void createPreshowerClusterPtrs(const edm::OrphanHandle<reco::PreshowerClusterCollection> & preshowerClustersHandle );
00096 
00097   // make a super cluster from its ingredients and add it to the collection
00098   void createSuperClusters(const reco::PFCandidateCollection &,
00099                           reco::SuperClusterCollection &superClusters) const;
00100   
00101   //create photon cores
00102   void createPhotonCores(const edm::OrphanHandle<reco::SuperClusterCollection> & superClustersHandle, reco::PhotonCoreCollection &photonCores) ;
00103 
00104   //create photons
00105   void createPhotons(reco::VertexCollection &vertexCollection, const edm::OrphanHandle<reco::PhotonCoreCollection> & superClustersHandle, const CaloTopology* topology, const EcalRecHitCollection * barrelRecHits, const EcalRecHitCollection * endcapRecHits, const edm::Handle<CaloTowerCollection> & hcalTowersHandle, const IsolationValueMaps& isolationValues, reco::PhotonCollection &photons) ;
00106 
00107 
00108   const reco::PFCandidate & correspondingDaughterCandidate(const reco::PFCandidate & cand, const reco::PFBlockElement & pfbe) const;
00109 
00110 
00111   edm::InputTag inputTagPFCandidates_;
00112   std::vector<edm::InputTag> inputTagIsoVals_;
00113   std::string PFBasicClusterCollection_;
00114   std::string PFPreshowerClusterCollection_;
00115   std::string PFSuperClusterCollection_;
00116   std::string PFPhotonCoreCollection_;
00117   std::string PFPhotonCollection_;
00118   std::string  vertexProducer_;
00119   edm::InputTag barrelEcalHits_;
00120   edm::InputTag endcapEcalHits_;
00121   edm::InputTag hcalTowers_;
00122   double hOverEConeSize_;
00123 
00124   // the collection of basic clusters associated to a photon
00125   std::vector<reco::BasicClusterCollection> basicClusters_;
00126   // the correcsponding PFCluster ref
00127   std::vector<std::vector<const reco::PFCluster *> > pfClusters_;
00128   // the collection of preshower clusters associated to a photon
00129   std::vector<reco::PreshowerClusterCollection> preshowerClusters_;
00130   // the super cluster collection (actually only one) associated to a photon
00131   std::vector<reco::SuperClusterCollection> superClusters_;
00132   // the references to the basic clusters associated to a photon
00133   std::vector<reco::CaloClusterPtrVector> basicClusterPtr_;
00134   // the references to the basic clusters associated to a photon
00135   std::vector<reco::CaloClusterPtrVector> preshowerClusterPtr_;
00136    // keep track of the index of the PF Candidate
00137   std::vector<int> photPFCandidateIndex_;
00138   // the list of candidatePtr
00139   std::vector<reco::CandidatePtr> CandidatePtr_;
00140   // the e/g SC associated
00141   std::vector<reco::SuperClusterRef> egSCRef_;
00142 
00143   edm::ESHandle<CaloTopology> theCaloTopo_;
00144   edm::ESHandle<CaloGeometry> theCaloGeom_;
00145 
00146   bool emptyIsOk_;
00147 
00148 };
00149 #endif