Go to the documentation of this file.00001 #include "RecoParticleFlow/PFClusterProducer/plugins/PFHCALSuperClusterProducer.h"
00002
00003 #include <memory>
00004
00005 #include "RecoParticleFlow/PFClusterProducer/interface/PFHcalSuperClusterAlgo.h"
00006
00007 #include "DataFormats/ParticleFlowReco/interface/PFRecHit.h"
00008 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
00009 #include "DataFormats/ParticleFlowReco/interface/PFSuperCluster.h"
00010
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012 #include "FWCore/Framework/interface/ESHandle.h"
00013 #include "FWCore/Framework/interface/EventSetup.h"
00014
00015 using namespace std;
00016 using namespace edm;
00017
00018 PFHCALSuperClusterProducer::PFHCALSuperClusterProducer(const edm::ParameterSet& iConfig)
00019 {
00020
00021 verbose_ =
00022 iConfig.getUntrackedParameter<bool>("verbose",false);
00023
00024
00025
00026
00027
00028
00029 inputTagPFClusters_ = iConfig.getParameter<InputTag>("PFClusters");
00030 inputTagPFClustersHO_ = iConfig.getParameter<InputTag>("PFClustersHO");
00031
00032 produces<reco::PFClusterCollection>();
00033 produces<reco::PFSuperClusterCollection>();
00034
00035 }
00036
00037
00038
00039 PFHCALSuperClusterProducer::~PFHCALSuperClusterProducer() {}
00040
00041
00042
00043
00044 void PFHCALSuperClusterProducer::produce(edm::Event& iEvent,
00045 const edm::EventSetup& iSetup) {
00046
00047
00048 edm::Handle< reco::PFClusterCollection > clustersHandle;
00049 edm::Handle< reco::PFClusterCollection > clustersHOHandle;
00050
00051
00052 bool found = iEvent.getByLabel( inputTagPFClusters_, clustersHandle );
00053 bool foundHO = iEvent.getByLabel( inputTagPFClustersHO_, clustersHOHandle );
00054
00055 if(!found ) {
00056
00057 ostringstream err;
00058 err<<"cannot find clusters: "<<inputTagPFClusters_;
00059 LogError("PFHCALSuperClusterProducer")<<err.str()<<endl;
00060
00061 throw cms::Exception( "MissingProduct", err.str());
00062 }
00063
00064 if(!foundHO ) {
00065
00066 ostringstream err;
00067 err<<"cannot find HO clusters: "<<inputTagPFClustersHO_;
00068 LogError("PFHCALSuperClusterProducer")<<err.str()<<endl;
00069
00070 throw cms::Exception( "MissingProduct", err.str());
00071 }
00072
00073
00074 hcalSuperClusterAlgo_.doClustering( clustersHandle, clustersHOHandle );
00075
00076 if( verbose_ ) {
00077 LogInfo("PFHCALSuperClusterProducer")
00078 <<" superclusters --------------------------------- "<<endl
00079 <<hcalSuperClusterAlgo_<<endl;
00080 }
00081
00082
00083
00084 auto_ptr< vector<reco::PFCluster> > outClusters( hcalSuperClusterAlgo_.clusters() );
00085 auto_ptr< vector<reco::PFSuperCluster> > outSuperClusters( hcalSuperClusterAlgo_.superClusters() );
00086 iEvent.put( outClusters );
00087 iEvent.put( outSuperClusters );
00088
00089 }
00090
00091 void PFHCALSuperClusterProducer::endJob(){
00092
00093 hcalSuperClusterAlgo_.write();
00094
00095 }
00096
00097