#include <PFClusterShapeProducer.h>
Public Member Functions | |
PFClusterShapeProducer (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &ev, const edm::EventSetup &es) |
~PFClusterShapeProducer () | |
Private Member Functions | |
edm::Handle < reco::PFClusterCollection > | getClusterCollection (edm::Event &evt) |
edm::Handle < reco::PFRecHitCollection > | getRecHitCollection (edm::Event &evt) |
Private Attributes | |
PFClusterShapeAlgo * | csAlgo_p |
edm::InputTag | inputTagPFClustersECAL_ |
edm::InputTag | inputTagPFRecHitsECAL_ |
std::string | shapesLabel_ |
Definition at line 33 of file PFClusterShapeProducer.h.
PFClusterShapeProducer::PFClusterShapeProducer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 13 of file PFClusterShapeProducer.cc.
References edm::ParameterSet::getParameter().
{ shapesLabel_ = ps.getParameter<std::string>("PFClusterShapesLabel"); inputTagPFClustersECAL_ = ps.getParameter<InputTag>("PFClustersECAL"); inputTagPFRecHitsECAL_ = ps.getParameter<InputTag>("PFRecHitsECAL"); csAlgo_p = new PFClusterShapeAlgo(ps.getParameter<bool>("useFractions"), ps.getParameter<double>("W0")); produces<reco::ClusterShapeCollection>(shapesLabel_); produces<reco::PFClusterShapeAssociationCollection>(shapesLabel_); }
PFClusterShapeProducer::~PFClusterShapeProducer | ( | ) |
Definition at line 30 of file PFClusterShapeProducer.cc.
{ delete csAlgo_p; }
edm::Handle< reco::PFClusterCollection > PFClusterShapeProducer::getClusterCollection | ( | edm::Event & | evt | ) | [private] |
Definition at line 74 of file PFClusterShapeProducer.cc.
References Exception, newFWLiteAna::found, edm::Event::getByLabel(), and patZpeak::handle.
{ edm::Handle<reco::PFClusterCollection> handle; bool found = evt.getByLabel(inputTagPFClustersECAL_, handle); if (!found) { ostringstream err; err<<"cannot find clusters: "<<inputTagPFClustersECAL_; LogError("PFSimParticleProducer")<<err.str()<<endl; throw cms::Exception( "MissingProduct", err.str()); } return handle; }
edm::Handle< reco::PFRecHitCollection > PFClusterShapeProducer::getRecHitCollection | ( | edm::Event & | evt | ) | [private] |
Definition at line 93 of file PFClusterShapeProducer.cc.
References Exception, newFWLiteAna::found, edm::Event::getByLabel(), and patZpeak::handle.
{ edm::Handle<reco::PFRecHitCollection> handle; bool found = evt.getByLabel(inputTagPFRecHitsECAL_, handle); if (!found) { ostringstream err; err<<"cannot find rechits: "<<inputTagPFRecHitsECAL_; LogError("PFSimParticleProducer")<<err.str()<<endl; throw cms::Exception( "MissingProduct", err.str()); } return handle; }
void PFClusterShapeProducer::produce | ( | edm::Event & | ev, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 36 of file PFClusterShapeProducer.cc.
References DetId::Ecal, EcalBarrel, EcalEndcap, edm::EventSetup::get(), i, and edm::Event::put().
{ edm::Handle<reco::PFClusterCollection> clusterHandle = getClusterCollection(evt); edm::Handle<reco::PFRecHitCollection> rechitHandle = getRecHitCollection(evt); edm::ESHandle<CaloGeometry> geoHandle; es.get<CaloGeometryRecord>().get(geoHandle); const CaloSubdetectorGeometry * barrelGeo_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); const CaloSubdetectorTopology * barrelTop_p = new EcalBarrelTopology(geoHandle); const CaloSubdetectorGeometry * endcapGeo_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap); const CaloSubdetectorTopology * endcapTop_p = new EcalEndcapTopology(geoHandle); std::auto_ptr<reco::ClusterShapeCollection> csCollection_ap(csAlgo_p->makeClusterShapes(clusterHandle, rechitHandle, barrelGeo_p, barrelTop_p, endcapGeo_p, endcapTop_p)); edm::OrphanHandle<reco::ClusterShapeCollection> shape_h = evt.put(csCollection_ap, shapesLabel_); std::auto_ptr<reco::PFClusterShapeAssociationCollection> association_ap(new reco::PFClusterShapeAssociationCollection); for (unsigned int i = 0; i < clusterHandle->size(); i++){ association_ap->insert(edm::Ref<reco::PFClusterCollection>(clusterHandle, i), edm::Ref<reco::ClusterShapeCollection>(shape_h, i)); } evt.put(association_ap, shapesLabel_); delete barrelTop_p; delete endcapTop_p; }
Definition at line 50 of file PFClusterShapeProducer.h.
Definition at line 47 of file PFClusterShapeProducer.h.
Definition at line 48 of file PFClusterShapeProducer.h.
std::string PFClusterShapeProducer::shapesLabel_ [private] |
Definition at line 45 of file PFClusterShapeProducer.h.