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
ExampleClusterProducer Class Reference

#include <ExampleClusterProducer.h>

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

Public Member Functions

 ExampleClusterProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
 ~ExampleClusterProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

bool counterExceeded () const
 

Private Attributes

ExampleClusterAlgoalgo_
 
std::string clusterCollection_
 
std::string hitCollection_
 
std::string hitProducer_
 
int nEvt_
 
int nMaxPrintout_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

example of producer for BasicCluster from recHits

Id:
ExampleClusterProducer.h,v 1.1 2006/04/13 14:40:05 rahatlou Exp
Date:
2006/04/13 14:40:05
Revision:
1.1
Author
Shahram Rahatlou, University of Rome & INFN, April 2006

Definition at line 21 of file ExampleClusterProducer.h.

Constructor & Destructor Documentation

ExampleClusterProducer::ExampleClusterProducer ( const edm::ParameterSet ps)

Definition at line 12 of file ExampleClusterProducer.cc.

References algo_, clusterCollection_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hitCollection_, hitProducer_, nMaxPrintout_, and AlCaHLTBitMon_QueryRunRegistry::string.

12  {
13 
14 
15  // use onfiguration file to setup input/output collection names
16  nMaxPrintout_ = ps.getUntrackedParameter<int>("nMaxPrintout",1);
17 
18  hitProducer_ = ps.getParameter<std::string>("hitProducer");
19  hitCollection_ = ps.getParameter<std::string>("hitCollection");
20  clusterCollection_ = ps.getParameter<std::string>("clusterCollection");
21 
22 
23  // configure your algorithm via ParameterSet
24  double energyCut = ps.getUntrackedParameter<double>("energyCut",0.);
25  int nXtalCut = ps.getUntrackedParameter<int>("nXtalCut",-1);
26 
27  algo_ = new ExampleClusterAlgo(energyCut,nXtalCut);
28 
29 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ExampleClusterAlgo * algo_
ExampleClusterProducer::~ExampleClusterProducer ( )

Definition at line 31 of file ExampleClusterProducer.cc.

References algo_.

31  {
32  delete algo_;
33 }
ExampleClusterAlgo * algo_

Member Function Documentation

bool ExampleClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 41 of file ExampleClusterProducer.h.

References nEvt_, and nMaxPrintout_.

void ExampleClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 37 of file ExampleClusterProducer.cc.

References algo_, clusterCollection_, edm::Event::getByLabel(), hitCollection_, hitProducer_, ExampleClusterAlgo::makeClusters(), edm::Event::put(), and HI_PhotonSkim_cff::rechits.

37  {
38 
39  using namespace edm;
40 
41  // handle to the product
43 
44  // fetch the product
45  evt.getByLabel( hitProducer_, hitCollection_, pRecHits);
46  if (!pRecHits.isValid()) {
47  edm::LogError("ExampleClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ;
48  }
49 
50  // pointer to the object in the product
51  const EcalRecHitCollection* rechits = pRecHits.product();
52  edm::LogInfo("ExampleClusterProducerInfo") << "total # calibrated rechits: " << rechits->size() ;
53 
54  // output collection of basic clusters
55  // reco::BasicClusterCollection defined in BasicClusterFwd.h
56 
57  // make the clusters by passing rechits to the agorithm
58  std::auto_ptr< reco::BasicClusterCollection >
60 
61  // put the product in the event
62  evt.put( clusters, clusterCollection_ );
63 }
ExampleClusterAlgo * algo_
reco::BasicClusterCollection makeClusters(const EcalRecHitCollection &rechits)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects

Member Data Documentation

ExampleClusterAlgo* ExampleClusterProducer::algo_
private
std::string ExampleClusterProducer::clusterCollection_
private

Definition at line 36 of file ExampleClusterProducer.h.

Referenced by ExampleClusterProducer(), and produce().

std::string ExampleClusterProducer::hitCollection_
private

Definition at line 35 of file ExampleClusterProducer.h.

Referenced by ExampleClusterProducer(), and produce().

std::string ExampleClusterProducer::hitProducer_
private

Definition at line 34 of file ExampleClusterProducer.h.

Referenced by ExampleClusterProducer(), and produce().

int ExampleClusterProducer::nEvt_
private

Definition at line 39 of file ExampleClusterProducer.h.

Referenced by counterExceeded().

int ExampleClusterProducer::nMaxPrintout_
private

Definition at line 38 of file ExampleClusterProducer.h.

Referenced by counterExceeded(), and ExampleClusterProducer().