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
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
00072 bool fetchCandidateCollection(edm::Handle<reco::PFCandidateCollection>& c,
00073 const edm::InputTag& tag,
00074 const edm::Event& iEvent) const;
00075
00076
00077
00078
00079 void createBasicCluster(const reco::PFBlockElement & , reco::BasicClusterCollection & basicClusters,
00080 std::vector<const reco::PFCluster *> &,
00081 const reco::PFCandidate & coCandidate) const;
00082
00083 void createPreshowerCluster(const reco::PFBlockElement & PFBE,
00084 reco::PreshowerClusterCollection& preshowerClusters,
00085 unsigned plane) const;
00086
00087
00088 void createBasicClusterPtrs(const edm::OrphanHandle<reco::BasicClusterCollection> & basicClustersHandle );
00089
00090
00091 void createPreshowerClusterPtrs(const edm::OrphanHandle<reco::PreshowerClusterCollection> & preshowerClustersHandle );
00092
00093
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
00100 void createPhotonCores(const edm::OrphanHandle<reco::SuperClusterCollection> & superClustersHandle, const edm::OrphanHandle<reco::ConversionCollection> & oneLegConversionHandle, reco::PhotonCoreCollection &photonCores) ;
00101
00102
00103
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
00124 std::vector<reco::BasicClusterCollection> basicClusters_;
00125
00126 std::vector<std::vector<const reco::PFCluster *> > pfClusters_;
00127
00128 std::vector<reco::PreshowerClusterCollection> preshowerClusters_;
00129
00130 std::vector<reco::SuperClusterCollection> superClusters_;
00131
00132 std::vector<reco::CaloClusterPtrVector> basicClusterPtr_;
00133
00134 std::vector<reco::CaloClusterPtrVector> preshowerClusterPtr_;
00135
00136 std::vector<int> photPFCandidateIndex_;
00137
00138 std::vector<reco::CandidatePtr> CandidatePtr_;
00139
00140 std::vector<reco::SuperClusterRef> egSCRef_;
00141
00142 std::vector<reco::PhotonRef> egPhotonRef_;
00143
00144 std::vector<float> pfPhotonMva_;
00145 std::vector<float> energyRegression_;
00146 std::vector<float> energyRegressionError_;
00147
00148
00149 std::vector<reco::ConversionRefVector > pfConv_;
00150 std::vector< std::vector<reco::TrackRef> > pfSingleLegConv_;
00151 std::vector< std::vector<float> > pfSingleLegConvMva_;
00152
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