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

#include <EcalTBTDCRecInfoProducer.h>

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

Public Member Functions

 EcalTBTDCRecInfoProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &es)
 
virtual ~EcalTBTDCRecInfoProducer ()
 
- 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

EcalTBTDCRecInfoAlgoalgo_
 
std::string eventHeaderCollection_
 
std::string eventHeaderProducer_
 
std::string rawInfoCollection_
 
std::string rawInfoProducer_
 
std::string recInfoCollection_
 
bool use2004OffsetConvention_
 

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)
 
- 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 16 of file EcalTBTDCRecInfoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file EcalTBTDCRecInfoProducer.cc.

References algo_, eventHeaderCollection_, eventHeaderProducer_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), runregparse::ranges, rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::runRanges, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMax, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMin, Ecal2004TBTDCRanges_v1_cff::tdcRanges, and use2004OffsetConvention_.

13 {
14  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
15  rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer");
16  eventHeaderCollection_ = ps.getParameter<std::string>("eventHeaderCollection");
17  eventHeaderProducer_ = ps.getParameter<std::string>("eventHeaderProducer");
18  recInfoCollection_ = ps.getParameter<std::string>("recInfoCollection");
19 
20 // std::vector<double> planeShift_def;
21 // planeShift_def.push_back( -0.333 );
22 // planeShift_def.push_back( -0.333 );
23 // planeShift_def.push_back( -0.333 );
24 // planeShift_def.push_back( -0.333 );
25 
26 
27 // std::vector<double> zPosition_def;
28 // zPosition_def.push_back( -0.333 );
29 // zPosition_def.push_back( -0.333 );
30 // zPosition_def.push_back( -0.333 );
31 // zPosition_def.push_back( -0.333 );
32  std::vector<EcalTBTDCRecInfoAlgo::EcalTBTDCRanges> tdcRanges;
33 
34  typedef std::vector< edm::ParameterSet > Parameters;
35  Parameters ranges=ps.getParameter<Parameters>("tdcRanges");
36  for(Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges)
37  {
39  aRange.runRanges.first = itRanges->getParameter<int>("startRun");
40  aRange.runRanges.second = itRanges->getParameter<int>("endRun");
41  aRange.tdcMin = itRanges->getParameter< std::vector<double> >("tdcMin");
42  aRange.tdcMax = itRanges->getParameter< std::vector<double> >("tdcMax");
43  tdcRanges.push_back(aRange);
44  }
45 
46  use2004OffsetConvention_ = ps.getUntrackedParameter< bool >("use2004OffsetConvention",false);
47 
48  produces<EcalTBTDCRecInfo>(recInfoCollection_);
49 
50  algo_ = new EcalTBTDCRecInfoAlgo(tdcRanges);
51 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EcalTBTDCRecInfoAlgo * algo_
std::vector< AlignmentParameters * > Parameters
Definition: Utilities.h:29
EcalTBTDCRecInfoProducer::~EcalTBTDCRecInfoProducer ( )
virtual

Definition at line 53 of file EcalTBTDCRecInfoProducer.cc.

References algo_.

53  {
54  if (algo_)
55  delete algo_;
56 }
EcalTBTDCRecInfoAlgo * algo_

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 58 of file EcalTBTDCRecInfoProducer.cc.

References algo_, ExpressReco_HICollisions_FallBack::EcalTBTDCRecInfo, eventHeaderCollection_, eventHeaderProducer_, edm::Event::getByLabel(), edm::HandleBase::isValid(), edm::Handle< T >::product(), edm::Event::put(), rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBTDCRecInfoAlgo::reconstruct(), and use2004OffsetConvention_.

59 {
60  // Get input
62  const EcalTBTDCRawInfo* ecalTDCRawInfo = 0;
63 
64  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
65  e.getByLabel( rawInfoProducer_, ecalRawTDC);
66  if (ecalRawTDC.isValid()) {
67  ecalTDCRawInfo = ecalRawTDC.product();
68  }
69 
70  if (! ecalTDCRawInfo )
71  {
72  edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
73  return;
74  }
75 
76  if ( (*ecalTDCRawInfo).size() < 1 )
77  {
78  edm::LogError("EcalTBTDcRecInfoError") << "Less than one TDC good channel found. Aborting" << rawInfoCollection_.c_str() ;
79  return;
80  }
81  // Get input
82  edm::Handle<EcalTBEventHeader> tbEventHeader;
83  const EcalTBEventHeader* ecalEventHeader = 0;
84  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
85  e.getByLabel( eventHeaderProducer_, tbEventHeader);
86  if (tbEventHeader.isValid()) {
87  ecalEventHeader = tbEventHeader.product();
88  }
89 
90  if (! ecalEventHeader )
91  {
92  edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << eventHeaderCollection_.c_str();
93  return;
94  }
95 
96  // Create empty output
97  std::auto_ptr<EcalTBTDCRecInfo> recInfo(new EcalTBTDCRecInfo(algo_->reconstruct(*ecalRawTDC,*tbEventHeader,use2004OffsetConvention_)));
98 
99  e.put(recInfo,recInfoCollection_);
100 }
EcalTBTDCRecInfo reconstruct(const EcalTBTDCRawInfo &TDCRawInfo, const EcalTBEventHeader &eventHeader, bool use2004OffsetConvention) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
EcalTBTDCRecInfoAlgo * algo_
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
T const * product() const
Definition: Handle.h:74

Member Data Documentation

EcalTBTDCRecInfoAlgo* EcalTBTDCRecInfoProducer::algo_
private
std::string EcalTBTDCRecInfoProducer::eventHeaderCollection_
private

Definition at line 29 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

std::string EcalTBTDCRecInfoProducer::eventHeaderProducer_
private

Definition at line 28 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

std::string EcalTBTDCRecInfoProducer::rawInfoCollection_
private

Definition at line 27 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

std::string EcalTBTDCRecInfoProducer::rawInfoProducer_
private

Definition at line 26 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

std::string EcalTBTDCRecInfoProducer::recInfoCollection_
private

Definition at line 30 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

bool EcalTBTDCRecInfoProducer::use2004OffsetConvention_
private

Definition at line 31 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().