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 Attributes
EcalTBHodoscopeRecInfoProducer Class Reference

#include <EcalTBHodoscopeRecInfoProducer.h>

Inheritance diagram for EcalTBHodoscopeRecInfoProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 EcalTBHodoscopeRecInfoProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &es)
 
virtual ~EcalTBHodoscopeRecInfoProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

EcalTBHodoscopeRecInfoAlgoalgo_
 
int fitMethod_
 
std::string rawInfoCollection_
 
std::string rawInfoProducer_
 
std::string recInfoCollection_
 

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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 15 of file EcalTBHodoscopeRecInfoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file EcalTBHodoscopeRecInfoProducer.cc.

References algo_, fitMethod_, edm::ParameterSet::getParameter(), rawInfoCollection_, rawInfoProducer_, and recInfoCollection_.

13 {
14  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
15  rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer");
16  recInfoCollection_ = ps.getParameter<std::string>("recInfoCollection");
17  fitMethod_ = ps.getParameter<int>("fitMethod");
18 
19 // std::vector<double> planeShift_def;
20 // planeShift_def.push_back( -0.333 );
21 // planeShift_def.push_back( -0.333 );
22 // planeShift_def.push_back( -0.333 );
23 // planeShift_def.push_back( -0.333 );
24  std::vector<double> planeShift = ps.getParameter< std::vector<double> >("planeShift");
25 
26 // std::vector<double> zPosition_def;
27 // zPosition_def.push_back( -0.333 );
28 // zPosition_def.push_back( -0.333 );
29 // zPosition_def.push_back( -0.333 );
30 // zPosition_def.push_back( -0.333 );
31  std::vector<double> zPosition = ps.getParameter< std::vector<double> >("zPosition");
32 
33  produces<EcalTBHodoscopeRecInfo>(recInfoCollection_);
34 
35  algo_ = new EcalTBHodoscopeRecInfoAlgo(fitMethod_, planeShift, zPosition);
36 }
T getParameter(std::string const &) const
EcalTBHodoscopeRecInfoProducer::~EcalTBHodoscopeRecInfoProducer ( )
virtual

Definition at line 38 of file EcalTBHodoscopeRecInfoProducer.cc.

References algo_.

38  {
39  delete algo_;
40 }

Member Function Documentation

void EcalTBHodoscopeRecInfoProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 42 of file EcalTBHodoscopeRecInfoProducer.cc.

References algo_, edm::Event::getByLabel(), edm::HandleBase::isValid(), edm::Handle< T >::product(), edm::Event::put(), rawInfoCollection_, rawInfoProducer_, recInfoCollection_, and EcalTBHodoscopeRecInfoAlgo::reconstruct().

43 {
44  // Get input
45  edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope;
46  const EcalTBHodoscopeRawInfo* ecalHodoRawInfo = 0;
47  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
48  e.getByLabel( rawInfoProducer_, ecalRawHodoscope);
49  if (ecalRawHodoscope.isValid()) {
50  ecalHodoRawInfo = ecalRawHodoscope.product();
51  }
52 
53  if (! ecalHodoRawInfo )
54  {
55  edm::LogError("EcalTBHodoscopeRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
56  return;
57  }
58 
59  if ( (*ecalHodoRawInfo).planes() != 4 )
60  {
61  edm::LogError("EcalTBHodoscopeRecInfoError") << "Number of planes different from expected " << rawInfoCollection_.c_str() ;
62  return;
63  }
64 
65  // Create empty output
66  std::auto_ptr<EcalTBHodoscopeRecInfo> recInfo(new EcalTBHodoscopeRecInfo(algo_->reconstruct(*ecalRawHodoscope)));
67 
68  e.put(recInfo,recInfoCollection_);
69 }
EcalTBHodoscopeRecInfo reconstruct(const EcalTBHodoscopeRawInfo &hodoscopeRawInfo) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
T const * product() const
Definition: Handle.h:74

Member Data Documentation

EcalTBHodoscopeRecInfoAlgo* EcalTBHodoscopeRecInfoProducer::algo_
private
int EcalTBHodoscopeRecInfoProducer::fitMethod_
private

Definition at line 29 of file EcalTBHodoscopeRecInfoProducer.h.

Referenced by EcalTBHodoscopeRecInfoProducer().

std::string EcalTBHodoscopeRecInfoProducer::rawInfoCollection_
private

Definition at line 26 of file EcalTBHodoscopeRecInfoProducer.h.

Referenced by EcalTBHodoscopeRecInfoProducer(), and produce().

std::string EcalTBHodoscopeRecInfoProducer::rawInfoProducer_
private

Definition at line 25 of file EcalTBHodoscopeRecInfoProducer.h.

Referenced by EcalTBHodoscopeRecInfoProducer(), and produce().

std::string EcalTBHodoscopeRecInfoProducer::recInfoCollection_
private

Definition at line 27 of file EcalTBHodoscopeRecInfoProducer.h.

Referenced by EcalTBHodoscopeRecInfoProducer(), and produce().