CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

edm::Handle
< reco::PFClusterCollection
getClusterCollection (edm::Event &evt)
 
edm::Handle
< reco::PFRecHitCollection
getRecHitCollection (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 edm::hlt::Exception, newFWLiteAna::found, edm::Event::getByLabel(), and patZpeak::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 }
tuple handle
Definition: patZpeak.py:22
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 edm::hlt::Exception, newFWLiteAna::found, edm::Event::getByLabel(), and patZpeak::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 }
tuple handle
Definition: patZpeak.py:22
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
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().

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::auto_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(csCollection_ap, shapesLabel_);
58 
59  std::auto_ptr<reco::PFClusterShapeAssociationCollection> association_ap(new 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(association_ap, shapesLabel_);
67 
68  delete barrelTop_p;
69  delete endcapTop_p;
70 }
edm::Handle< reco::PFRecHitCollection > getRecHitCollection(edm::Event &evt)
int i
Definition: DBlmapReader.cc:9
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:55

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.