CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/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 "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
00045 
00046 #include <iostream>
00047 #include <string>
00048 #include <map>
00049 #include <vector>
00050 
00051 #include "DataFormats/Math/interface/Vector3D.h"
00052 #include "DataFormats/Math/interface/LorentzVector.h"
00053 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00054 #include "DataFormats/Common/interface/AssociationVector.h"
00055 
00056 #include <Math/VectorUtil.h>
00057 #include "TLorentzVector.h"
00058 #include "TMath.h"
00059 
00060 class PFPhotonTranslator : public edm::EDProducer
00061 {
00062  public:
00063   explicit PFPhotonTranslator(const edm::ParameterSet&);
00064   ~PFPhotonTranslator();
00065   
00066   virtual void produce(edm::Event &, const edm::EventSetup&);
00067   virtual void beginRun(edm::Run & run,const edm::EventSetup & c);
00068   //virtual void endRun (edm::Run& run, const edm::EventSetup & c);
00069 
00070   typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
00071 
00072  private:
00073   // to retrieve the collection from the event
00074   bool fetchCandidateCollection(edm::Handle<reco::PFCandidateCollection>& c, 
00075                                 const edm::InputTag& tag, 
00076                                 const edm::Event& iEvent) const;
00077 
00078 
00079   // makes a basic cluster from PFBlockElement and add it to the collection ; the corrected energy is taken
00080   // from the PFCandidate
00081   void createBasicCluster(const reco::PFBlockElement & ,  reco::BasicClusterCollection & basicClusters,
00082                           std::vector<const reco::PFCluster *> &,
00083                           const reco::PFCandidate & coCandidate) const;
00084   // makes a preshower cluster from of PFBlockElement and add it to the collection
00085   void createPreshowerCluster(const reco::PFBlockElement & PFBE, 
00086                               reco::PreshowerClusterCollection& preshowerClusters,
00087                               unsigned plane) const;
00088   
00089   // create the basic cluster Ptr
00090   void createBasicClusterPtrs(const edm::OrphanHandle<reco::BasicClusterCollection> & basicClustersHandle );
00091 
00092   // create the preshower cluster Refs
00093   void createPreshowerClusterPtrs(const edm::OrphanHandle<reco::PreshowerClusterCollection> & preshowerClustersHandle );
00094 
00095   // make a super cluster from its ingredients and add it to the collection
00096   void createSuperClusters(const reco::PFCandidateCollection &,
00097                           reco::SuperClusterCollection &superClusters) const;
00098   
00099   void createOneLegConversions(const edm::OrphanHandle<reco::SuperClusterCollection> & superClustersHandle, reco::ConversionCollection &oneLegConversions);
00100 
00101   //create photon cores
00102   void createPhotonCores(const edm::OrphanHandle<reco::SuperClusterCollection> & superClustersHandle, const edm::OrphanHandle<reco::ConversionCollection> & oneLegConversionHandle, 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   void createPhotons(reco::VertexCollection &vertexCollection, edm::Handle<reco::PhotonCollection> &egPhotons, const edm::OrphanHandle<reco::PhotonCoreCollection> & photonCoresHandle, const IsolationValueMaps& isolationValues, reco::PhotonCollection &photons) ;
00107 
00108   const reco::PFCandidate & correspondingDaughterCandidate(const reco::PFCandidate & cand, const reco::PFBlockElement & pfbe) const;
00109 
00110   edm::InputTag inputTagPFCandidates_;
00111   std::vector<edm::InputTag> inputTagIsoVals_;
00112   std::string PFBasicClusterCollection_;
00113   std::string PFPreshowerClusterCollection_;
00114   std::string PFSuperClusterCollection_;
00115   std::string PFPhotonCoreCollection_;
00116   std::string PFPhotonCollection_;
00117   std::string PFConversionCollection_;
00118   std::string EGPhotonCollection_;
00119   std::string  vertexProducer_;
00120   edm::InputTag barrelEcalHits_;
00121   edm::InputTag endcapEcalHits_;
00122   edm::InputTag hcalTowers_;
00123   double hOverEConeSize_;
00124 
00125   // the collection of basic clusters associated to a photon
00126   std::vector<reco::BasicClusterCollection> basicClusters_;
00127   // the correcsponding PFCluster ref
00128   std::vector<std::vector<const reco::PFCluster *> > pfClusters_;
00129   // the collection of preshower clusters associated to a photon
00130   std::vector<reco::PreshowerClusterCollection> preshowerClusters_;
00131   // the super cluster collection (actually only one) associated to a photon
00132   std::vector<reco::SuperClusterCollection> superClusters_;
00133   // the references to the basic clusters associated to a photon
00134   std::vector<reco::CaloClusterPtrVector> basicClusterPtr_;
00135   // the references to the basic clusters associated to a photon
00136   std::vector<reco::CaloClusterPtrVector> preshowerClusterPtr_;
00137    // keep track of the index of the PF Candidate
00138   std::vector<int> photPFCandidateIndex_;
00139   // the list of candidatePtr
00140   std::vector<reco::CandidatePtr> CandidatePtr_;
00141   // the e/g SC associated
00142   std::vector<reco::SuperClusterRef> egSCRef_;
00143   // the e/g photon associated
00144   std::vector<reco::PhotonRef> egPhotonRef_;
00145   // the PF MVA and regression 
00146   std::vector<float> pfPhotonMva_;
00147   std::vector<float> energyRegression_;
00148   std::vector<float> energyRegressionError_;
00149 
00150   //Vector of vector of Conversions Refs
00151   std::vector<reco::ConversionRefVector > pfConv_;
00152   std::vector< std::vector<reco::TrackRef> > pfSingleLegConv_;
00153   std::vector< std::vector<float> > pfSingleLegConvMva_;
00154   //std::vector<reco::TrackRef> * pfSingleLegConv_;
00155 
00156   std::vector<int> conv1legPFCandidateIndex_;
00157   std::vector<int> conv2legPFCandidateIndex_;
00158 
00159   edm::ESHandle<CaloTopology> theCaloTopo_;
00160   edm::ESHandle<CaloGeometry> theCaloGeom_;
00161 
00162   bool emptyIsOk_;
00163 
00164 };
00165 #endif