CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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&) override;
00067 
00068   typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
00069 
00070  private:
00071   // to retrieve the collection from the event
00072   bool fetchCandidateCollection(edm::Handle<reco::PFCandidateCollection>& c, 
00073                                 const edm::InputTag& tag, 
00074                                 const edm::Event& iEvent) const;
00075 
00076 
00077   // makes a basic cluster from PFBlockElement and add it to the collection ; the corrected energy is taken
00078   // from the PFCandidate
00079   void createBasicCluster(const reco::PFBlockElement & ,  reco::BasicClusterCollection & basicClusters,
00080                           std::vector<const reco::PFCluster *> &,
00081                           const reco::PFCandidate & coCandidate) const;
00082   // makes a preshower cluster from of PFBlockElement and add it to the collection
00083   void createPreshowerCluster(const reco::PFBlockElement & PFBE, 
00084                               reco::PreshowerClusterCollection& preshowerClusters,
00085                               unsigned plane) const;
00086   
00087   // create the basic cluster Ptr
00088   void createBasicClusterPtrs(const edm::OrphanHandle<reco::BasicClusterCollection> & basicClustersHandle );
00089 
00090   // create the preshower cluster Refs
00091   void createPreshowerClusterPtrs(const edm::OrphanHandle<reco::PreshowerClusterCollection> & preshowerClustersHandle );
00092 
00093   // make a super cluster from its ingredients and add it to the collection
00094   void createSuperClusters(const reco::PFCandidateCollection &,
00095                           reco::SuperClusterCollection &superClusters) const;
00096   
00097   void createOneLegConversions(const edm::OrphanHandle<reco::SuperClusterCollection> & superClustersHandle, reco::ConversionCollection &oneLegConversions);
00098 
00099   //create photon cores
00100   void createPhotonCores(const edm::OrphanHandle<reco::SuperClusterCollection> & superClustersHandle, const edm::OrphanHandle<reco::ConversionCollection> & oneLegConversionHandle, reco::PhotonCoreCollection &photonCores) ;
00101 
00102   //create photons
00103   //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) ;
00104   void createPhotons(reco::VertexCollection &vertexCollection, edm::Handle<reco::PhotonCollection> &egPhotons, const edm::OrphanHandle<reco::PhotonCoreCollection> & photonCoresHandle, const IsolationValueMaps& isolationValues, reco::PhotonCollection &photons) ;
00105 
00106   const reco::PFCandidate & correspondingDaughterCandidate(const reco::PFCandidate & cand, const reco::PFBlockElement & pfbe) const;
00107 
00108   edm::InputTag inputTagPFCandidates_;
00109   std::vector<edm::InputTag> inputTagIsoVals_;
00110   std::string PFBasicClusterCollection_;
00111   std::string PFPreshowerClusterCollection_;
00112   std::string PFSuperClusterCollection_;
00113   std::string PFPhotonCoreCollection_;
00114   std::string PFPhotonCollection_;
00115   std::string PFConversionCollection_;
00116   std::string EGPhotonCollection_;
00117   std::string  vertexProducer_;
00118   edm::InputTag barrelEcalHits_;
00119   edm::InputTag endcapEcalHits_;
00120   edm::InputTag hcalTowers_;
00121   double hOverEConeSize_;
00122 
00123   // the collection of basic clusters associated to a photon
00124   std::vector<reco::BasicClusterCollection> basicClusters_;
00125   // the correcsponding PFCluster ref
00126   std::vector<std::vector<const reco::PFCluster *> > pfClusters_;
00127   // the collection of preshower clusters associated to a photon
00128   std::vector<reco::PreshowerClusterCollection> preshowerClusters_;
00129   // the super cluster collection (actually only one) associated to a photon
00130   std::vector<reco::SuperClusterCollection> superClusters_;
00131   // the references to the basic clusters associated to a photon
00132   std::vector<reco::CaloClusterPtrVector> basicClusterPtr_;
00133   // the references to the basic clusters associated to a photon
00134   std::vector<reco::CaloClusterPtrVector> preshowerClusterPtr_;
00135    // keep track of the index of the PF Candidate
00136   std::vector<int> photPFCandidateIndex_;
00137   // the list of candidatePtr
00138   std::vector<reco::CandidatePtr> CandidatePtr_;
00139   // the e/g SC associated
00140   std::vector<reco::SuperClusterRef> egSCRef_;
00141   // the e/g photon associated
00142   std::vector<reco::PhotonRef> egPhotonRef_;
00143   // the PF MVA and regression 
00144   std::vector<float> pfPhotonMva_;
00145   std::vector<float> energyRegression_;
00146   std::vector<float> energyRegressionError_;
00147 
00148   //Vector of vector of Conversions Refs
00149   std::vector<reco::ConversionRefVector > pfConv_;
00150   std::vector< std::vector<reco::TrackRef> > pfSingleLegConv_;
00151   std::vector< std::vector<float> > pfSingleLegConvMva_;
00152   //std::vector<reco::TrackRef> * pfSingleLegConv_;
00153 
00154   std::vector<int> conv1legPFCandidateIndex_;
00155   std::vector<int> conv2legPFCandidateIndex_;
00156 
00157   edm::ESHandle<CaloTopology> theCaloTopo_;
00158   edm::ESHandle<CaloGeometry> theCaloGeom_;
00159 
00160   bool emptyIsOk_;
00161 
00162 };
00163 #endif