00001 //Package: EgammaHFProdcers 00002 // Class : HFEMClusterProducer 00003 // Original Author: Kevin Klapoetke (minnesota) 00004 // 00005 // $Id: HFEMClusterProducer.cc,v 1.2 2007/09/19 Kevin Klapoetke 00006 // 00007 00008 #include <iostream> 00009 #include "DataFormats/Common/interface/Handle.h" 00010 #include "FWCore/Framework/interface/ESHandle.h" 00011 #include "Geometry/Records/interface/CaloGeometryRecord.h" 00012 #include "RecoEgamma/EgammaHFProducers/plugins/HFEMClusterProducer.h" 00013 using namespace reco; 00014 HFEMClusterProducer::HFEMClusterProducer(edm::ParameterSet const& conf): hfreco_(conf.getUntrackedParameter<edm::InputTag>("hits")) { 00015 produces<reco::HFEMClusterShapeCollection>(); 00016 produces<reco::BasicClusterCollection>(); 00017 produces<reco::SuperClusterCollection>(); 00018 produces<reco::HFEMClusterShapeAssociationCollection>(); 00019 algo_.setup(conf.getParameter<double>("minTowerEnergy")); 00020 } 00021 00022 void HFEMClusterProducer::produce(edm::Event & e, edm::EventSetup const& iSetup) { 00023 00024 edm::Handle<HFRecHitCollection> hf_hits; 00025 00026 e.getByLabel(hfreco_,hf_hits); 00027 00028 edm::ESHandle<CaloGeometry> geometry; 00029 iSetup.get<CaloGeometryRecord>().get(geometry); 00030 00031 // create return data 00032 std::auto_ptr<reco::HFEMClusterShapeCollection> retdata1(new HFEMClusterShapeCollection()); 00033 std::auto_ptr<reco::BasicClusterCollection> retdata2(new BasicClusterCollection()); 00034 std::auto_ptr<reco::SuperClusterCollection> retdata3(new SuperClusterCollection()); 00035 std::auto_ptr<reco::HFEMClusterShapeAssociationCollection> retdata4(new HFEMClusterShapeAssociationCollection()); 00036 00037 00038 algo_.clusterize(*hf_hits, *geometry, *retdata1, *retdata2, *retdata3); 00039 edm::OrphanHandle<reco::SuperClusterCollection> SupHandle; 00040 edm::OrphanHandle<reco::HFEMClusterShapeCollection> ShapeHandle; 00041 00042 // put the results 00043 ShapeHandle=e.put(retdata1); 00044 e.put(retdata2); 00045 SupHandle=e.put(retdata3); 00046 for (unsigned int i=0; i < ShapeHandle->size();i++){ 00047 retdata4->insert(edm::Ref<reco::SuperClusterCollection>(SupHandle,i),edm::Ref<reco::HFEMClusterShapeCollection>(ShapeHandle,i)); 00048 } 00049 00050 00051 e.put(retdata4); 00052 00053 }