CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFClusterShapeProducer Class Reference

#include <PFClusterShapeProducer.h>

Inheritance diagram for PFClusterShapeProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PFClusterShapeProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &ev, const edm::EventSetup &es)
 
 ~PFClusterShapeProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

edm::Handle< reco::PFClusterCollectiongetClusterCollection (edm::Event &evt)
 
edm::Handle< reco::PFRecHitCollectiongetRecHitCollection (edm::Event &evt)
 

Private Attributes

PFClusterShapeAlgocsAlgo_p
 
edm::InputTag inputTagPFClustersECAL_
 
edm::InputTag inputTagPFRecHitsECAL_
 
std::string shapesLabel_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 33 of file PFClusterShapeProducer.h.

Constructor & Destructor Documentation

PFClusterShapeProducer::PFClusterShapeProducer ( const edm::ParameterSet ps)
explicit

Definition at line 13 of file PFClusterShapeProducer.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

14 {
15  shapesLabel_ = ps.getParameter<std::string>("PFClusterShapesLabel");
16 
18  = ps.getParameter<InputTag>("PFClustersECAL");
20  = ps.getParameter<InputTag>("PFRecHitsECAL");
21 
22  csAlgo_p = new PFClusterShapeAlgo(ps.getParameter<bool>("useFractions"),
23  ps.getParameter<double>("W0"));
24 
25  produces<reco::ClusterShapeCollection>(shapesLabel_);
26  produces<reco::PFClusterShapeAssociationCollection>(shapesLabel_);
27 }
T getParameter(std::string const &) const
PFClusterShapeAlgo * csAlgo_p
PFClusterShapeProducer::~PFClusterShapeProducer ( )

Definition at line 30 of file PFClusterShapeProducer.cc.

31 {
32  delete csAlgo_p;
33 }
PFClusterShapeAlgo * csAlgo_p

Member Function Documentation

edm::Handle< reco::PFClusterCollection > PFClusterShapeProducer::getClusterCollection ( edm::Event evt)
private

Definition at line 74 of file PFClusterShapeProducer.cc.

References Exception, runEdmFileComparison::found, edm::Event::getByLabel(), and cmsBatch::handle.

75 {
77 
78  bool found = evt.getByLabel(inputTagPFClustersECAL_, handle);
79  if (!found) {
80  ostringstream err;
81  err<<"cannot find clusters: "<<inputTagPFClustersECAL_;
82  LogError("PFSimParticleProducer")<<err.str()<<endl;
83 
84  throw cms::Exception( "MissingProduct", err.str());
85  }
86 
87  return handle;
88 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
edm::Handle< reco::PFRecHitCollection > PFClusterShapeProducer::getRecHitCollection ( edm::Event evt)
private

Definition at line 93 of file PFClusterShapeProducer.cc.

References Exception, runEdmFileComparison::found, edm::Event::getByLabel(), and cmsBatch::handle.

94 {
96 
97  bool found = evt.getByLabel(inputTagPFRecHitsECAL_, handle);
98  if (!found) {
99  ostringstream err;
100  err<<"cannot find rechits: "<<inputTagPFRecHitsECAL_;
101  LogError("PFSimParticleProducer")<<err.str()<<endl;
102 
103  throw cms::Exception( "MissingProduct", err.str());
104  }
105 
106  return handle;
107 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
void PFClusterShapeProducer::produce ( edm::Event ev,
const edm::EventSetup es 
)
virtual

Definition at line 36 of file PFClusterShapeProducer.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, edm::EventSetup::get(), CaloGeometry::getSubdetectorGeometry(), mps_fire::i, eostools::move(), and edm::Event::put().

37 {
38 
40  clusterHandle = getClusterCollection(evt);
42  rechitHandle = getRecHitCollection(evt);
43 
45  es.get<CaloGeometryRecord>().get(geoHandle);
46 
47  const CaloSubdetectorGeometry * barrelGeo_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
48  const CaloSubdetectorTopology * barrelTop_p = new EcalBarrelTopology(geoHandle);
49  const CaloSubdetectorGeometry * endcapGeo_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
50  const CaloSubdetectorTopology * endcapTop_p = new EcalEndcapTopology(geoHandle);
51 
52  std::unique_ptr<reco::ClusterShapeCollection>
53  csCollection_ap(csAlgo_p->makeClusterShapes(clusterHandle, rechitHandle,
54  barrelGeo_p, barrelTop_p,
55  endcapGeo_p, endcapTop_p));
56 
57  edm::OrphanHandle<reco::ClusterShapeCollection> shape_h = evt.put(std::move(csCollection_ap), shapesLabel_);
58 
59  auto association_ap = std::make_unique<reco::PFClusterShapeAssociationCollection>();
60 
61  for (unsigned int i = 0; i < clusterHandle->size(); i++){
62  association_ap->insert(edm::Ref<reco::PFClusterCollection>(clusterHandle, i),
64  }
65 
66  evt.put(std::move(association_ap), shapesLabel_);
67 
68  delete barrelTop_p;
69  delete endcapTop_p;
70 }
edm::Handle< reco::PFRecHitCollection > getRecHitCollection(edm::Event &evt)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
PFClusterShapeAlgo * csAlgo_p
edm::Handle< reco::PFClusterCollection > getClusterCollection(edm::Event &evt)
reco::ClusterShapeCollection * makeClusterShapes(edm::Handle< reco::PFClusterCollection > clusterHandle, edm::Handle< reco::PFRecHitCollection > rechitHandle, const CaloSubdetectorGeometry *barrelGeo_p, const CaloSubdetectorTopology *barrelTop_p, const CaloSubdetectorGeometry *endcapGeo_p, const CaloSubdetectorTopology *endcapTop_p)
const T & get() const
Definition: EventSetup.h:56
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

PFClusterShapeAlgo* PFClusterShapeProducer::csAlgo_p
private

Definition at line 50 of file PFClusterShapeProducer.h.

edm::InputTag PFClusterShapeProducer::inputTagPFClustersECAL_
private

Definition at line 47 of file PFClusterShapeProducer.h.

edm::InputTag PFClusterShapeProducer::inputTagPFRecHitsECAL_
private

Definition at line 48 of file PFClusterShapeProducer.h.

std::string PFClusterShapeProducer::shapesLabel_
private

Definition at line 45 of file PFClusterShapeProducer.h.