00001 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00002 #include "FWCore/Framework/interface/ESHandle.h" 00003 #include "FWCore/Framework/interface/Event.h" 00004 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00005 #include "RecoParticleFlow/PFProducer/plugins/PFBlockElementSuperClusterProducer.h" 00006 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h" 00007 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h" 00008 #include "DataFormats/EgammaReco/interface/SuperCluster.h" 00009 00010 00011 PFBlockElementSuperClusterProducer::PFBlockElementSuperClusterProducer(const edm::ParameterSet & iConfig) { 00012 inputTagSuperClusters_ 00013 = iConfig.getParameter<std::vector<edm::InputTag> >("ECALSuperClusters"); 00014 00015 outputName_ = iConfig.getParameter<std::string>("PFBESuperClusters"); 00016 00017 produces<reco::PFBlockElementSuperClusterCollection>(outputName_); 00018 00019 } 00020 00021 PFBlockElementSuperClusterProducer::~PFBlockElementSuperClusterProducer() {} 00022 00023 void PFBlockElementSuperClusterProducer::beginRun(edm::Run& run,const edm::EventSetup & es) {} 00024 00025 void PFBlockElementSuperClusterProducer::produce(edm::Event& iEvent, 00026 const edm::EventSetup& iSetup) { 00027 00028 std::auto_ptr<reco::PFBlockElementSuperClusterCollection> 00029 pfbeSuperClusters_p(new reco::PFBlockElementSuperClusterCollection); 00030 00031 00032 for(unsigned icol=0; icol<inputTagSuperClusters_.size() ; ++icol) { 00033 edm::Handle<reco::SuperClusterCollection> scH; 00034 bool found=iEvent.getByLabel(inputTagSuperClusters_[icol],scH); 00035 if(!found) { 00036 std::ostringstream err; 00037 err<<" cannot get SuperClusters: " 00038 <<inputTagSuperClusters_[icol]<<std::endl; 00039 edm::LogError("PFBlockElementSuperClusterProducer")<<err.str(); 00040 throw cms::Exception( "MissingProduct", err.str()); 00041 } 00042 00043 unsigned nsc=scH->size();; 00044 00045 for(unsigned isc=0;isc<nsc;++isc) { 00046 reco::SuperClusterRef theRef(scH,isc); 00047 reco::PFBlockElementSuperCluster myPFBE(theRef); 00048 myPFBE.setTrackIso(0.); 00049 myPFBE.setEcalIso(0.); 00050 myPFBE.setHcalIso(0.); 00051 myPFBE.setHoE(0.); 00052 pfbeSuperClusters_p->push_back(myPFBE); 00053 } 00054 } 00055 std::cout << "Size " << pfbeSuperClusters_p->size() << std::endl; 00056 iEvent.put(pfbeSuperClusters_p,outputName_); 00057 } 00058