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::EDConsumerBase 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 ()
 
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 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
 
- 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 15 of file EcalTBH2TDCRecInfoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file EcalTBH2TDCRecInfoProducer.cc.

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

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

Definition at line 39 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_.

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

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 45 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().

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