Go to the documentation of this file.00001
00002
00003
00004
00005
00011
00012
00013
00014
00015
00016
00017 #include "CommonTools/RecoUtils/interface/PFCand_NoPU_WithAM.h"
00018
00019
00020 #include <memory>
00021 #include <vector>
00022
00023
00024 #include "FWCore/Framework/interface/Frameworkfwd.h"
00025 #include "FWCore/Framework/interface/EDProducer.h"
00026
00027 #include "FWCore/Framework/interface/Event.h"
00028 #include "FWCore/Framework/interface/Run.h"
00029 #include "FWCore/Framework/interface/MakerMacros.h"
00030
00031 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00032 #include "FWCore/Utilities/interface/InputTag.h"
00033
00034 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00035 #include "DataFormats/Common/interface/AssociationMap.h"
00036 #include "DataFormats/Common/interface/Handle.h"
00037 #include "DataFormats/Common/interface/OneToManyWithQuality.h"
00038 #include "DataFormats/Common/interface/OneToManyWithQualityGeneric.h"
00039 #include "DataFormats/Common/interface/View.h"
00040
00041 #include "DataFormats/TrackReco/interface/Track.h"
00042 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00043 #include "DataFormats/TrackReco/interface/TrackBase.h"
00044 #include "DataFormats/VertexReco/interface/Vertex.h"
00045 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00046
00047 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00048 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00049 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h"
00050 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h"
00051 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
00052 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
00053 #include "DataFormats/Candidate/interface/VertexCompositeCandidate.h"
00054 #include "DataFormats/Candidate/interface/VertexCompositeCandidateFwd.h"
00055
00056
00057
00058
00059
00060 using namespace edm;
00061 using namespace std;
00062 using namespace reco;
00063
00064 typedef AssociationMap<OneToManyWithQuality< VertexCollection, PFCandidateCollection, float> > PFCandVertexAssMap;
00065
00066 typedef pair<PFCandidateRef, float> PFCandQualityPair;
00067 typedef vector< PFCandQualityPair > PFCandQualityPairVector;
00068
00069
00070
00071
00072 PFCand_NoPU_WithAM::PFCand_NoPU_WithAM(const edm::ParameterSet& iConfig)
00073 {
00074
00075
00076 produces<PFCandidateCollection>();
00077
00078
00079
00080 input_VertexPFCandAssociationMap_ = iConfig.getParameter<InputTag>("VertexPFCandAssociationMap");
00081
00082 }
00083
00084
00085 PFCand_NoPU_WithAM::~PFCand_NoPU_WithAM()
00086 {
00087
00088
00089
00090
00091 }
00092
00093
00094
00095
00096
00097
00098
00099 void
00100 PFCand_NoPU_WithAM::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00101 {
00102
00103 auto_ptr<PFCandidateCollection> firstvertexCandidates(new PFCandidateCollection() );
00104
00105
00106 Handle<PFCandVertexAssMap> PFCandAmH;
00107 iEvent.getByLabel(input_VertexPFCandAssociationMap_,PFCandAmH);
00108
00109 PFCandQualityPairVector pfcColl;
00110
00111 if(PFCandAmH->size()!=0){
00112 pfcColl = PFCandAmH->begin()->val;
00113 }
00114
00115 for(unsigned pfc_ite=0; pfc_ite<pfcColl.size(); pfc_ite++){
00116
00117 PFCandidateRef candref = pfcColl[pfc_ite].first;
00118 firstvertexCandidates->push_back(*candref);
00119
00120 }
00121
00122 iEvent.put( firstvertexCandidates );
00123 }
00124
00125
00126 void
00127 PFCand_NoPU_WithAM::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
00128
00129
00130 edm::ParameterSetDescription desc;
00131 desc.setUnknown();
00132 descriptions.addDefault(desc);
00133 }
00134
00135
00136 DEFINE_FWK_MODULE(PFCand_NoPU_WithAM);