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

#include <EcalTBH2TDCRecInfoProducer.h>

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

Public Member Functions

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

EcalTBH2TDCRecInfoAlgoalgo_
 
std::string rawInfoCollection_
 
std::string rawInfoProducer_
 
std::string recInfoCollection_
 
std::string triggerDataCollection_
 
std::string triggerDataProducer_
 

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 EcalTBH2TDCRecInfoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_, edm::ParameterSet::getParameter(), diffTwoXMLs::ranges, rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges::runRanges, Ecal2004TBTDCRanges_v1_cff::tdcRanges, EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges::tdcZero, triggerDataCollection_, and triggerDataProducer_.

14 {
15  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
16  rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer");
17  triggerDataCollection_ = ps.getParameter<std::string>("triggerDataCollection");
18  triggerDataProducer_ = ps.getParameter<std::string>("triggerDataProducer");
19  recInfoCollection_ = ps.getParameter<std::string>("recInfoCollection");
20 
21 
22  std::vector<EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges> tdcRanges;
23 
24  typedef std::vector< edm::ParameterSet > Parameters;
25  Parameters ranges=ps.getParameter<Parameters>("tdcZeros");
26  for(Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges)
27  {
29  aRange.runRanges.first = itRanges->getParameter<int>("startRun");
30  aRange.runRanges.second = itRanges->getParameter<int>("endRun");
31  aRange.tdcZero = itRanges->getParameter< double >("tdcZero");
32  tdcRanges.push_back(aRange);
33  }
34 
35  produces<EcalTBTDCRecInfo>(recInfoCollection_);
36 
37  algo_ = new EcalTBH2TDCRecInfoAlgo(tdcRanges);
38 }
T getParameter(std::string const &) const
vector< ParameterSet > Parameters
string ranges
Definition: diffTwoXMLs.py:78
EcalTBH2TDCRecInfoProducer::~EcalTBH2TDCRecInfoProducer ( )
virtual

Definition at line 40 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_.

41 {
42  if (algo_)
43  delete algo_;
44 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 46 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_, edm::Event::getByLabel(), edm::EventBase::id(), edm::HandleBase::isValid(), edm::Handle< T >::product(), edm::Event::put(), rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBH2TDCRecInfoAlgo::reconstruct(), edm::EventID::run(), convertSQLiteXML::runNumber, triggerDataCollection_, triggerDataProducer_, and HcalTBTriggerData::wasBeamTrigger().

47 {
48  int runNumber = e.id().run();
49  // Get input
50  edm::Handle<HcalTBTiming> ecalRawTDC;
51  const HcalTBTiming* ecalTDCRawInfo = 0;
52 
53  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
54  e.getByLabel( rawInfoProducer_, ecalRawTDC);
55  if (ecalRawTDC.isValid()) {
56  ecalTDCRawInfo = ecalRawTDC.product();
57  }
58 
59 
60  if (! ecalTDCRawInfo )
61  {
62  edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
63  return;
64  }
65 
66 
67  // Get input
68  edm::Handle<HcalTBTriggerData> triggerData;
69  const HcalTBTriggerData* h2TriggerData = 0;
70  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
71  e.getByLabel(triggerDataProducer_, triggerData);
72  if (triggerData.isValid()) {
73  h2TriggerData = triggerData.product();
74  }
75 
76  if (! h2TriggerData )
77  {
78  edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << triggerDataCollection_.c_str();
79  return;
80  }
81 
82 
83  if (!h2TriggerData->wasBeamTrigger())
84  {
85  std::auto_ptr<EcalTBTDCRecInfo> recInfo(new EcalTBTDCRecInfo(0.5));
86  e.put(recInfo,recInfoCollection_);
87  }
88  else
89  {
90  std::auto_ptr<EcalTBTDCRecInfo> recInfo(new EcalTBTDCRecInfo(algo_->reconstruct(runNumber,*ecalRawTDC)));
91  e.put(recInfo,recInfoCollection_);
92  }
93 
94 
95 }
RunNumber_t run() const
Definition: EventID.h:42
EcalTBTDCRecInfo reconstruct(const int &runNumber, const HcalTBTiming &TDCRawInfo) 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
edm::EventID id() const
Definition: EventBase.h:56
bool wasBeamTrigger() const
returns true if this trigger came from beam data

Member Data Documentation

EcalTBH2TDCRecInfoAlgo* EcalTBH2TDCRecInfoProducer::algo_
private
std::string EcalTBH2TDCRecInfoProducer::rawInfoCollection_
private

Definition at line 26 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

std::string EcalTBH2TDCRecInfoProducer::rawInfoProducer_
private

Definition at line 25 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

std::string EcalTBH2TDCRecInfoProducer::recInfoCollection_
private

Definition at line 29 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

std::string EcalTBH2TDCRecInfoProducer::triggerDataCollection_
private

Definition at line 28 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

std::string EcalTBH2TDCRecInfoProducer::triggerDataProducer_
private

Definition at line 27 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().