CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalTBH2TDCRecInfoProducer Class Reference

#include <EcalTBH2TDCRecInfoProducer.h>

Inheritance diagram for EcalTBH2TDCRecInfoProducer:
edm::stream::EDProducer<>

Public Member Functions

 EcalTBH2TDCRecInfoProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &es) override
 
 ~EcalTBH2TDCRecInfoProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 15 of file EcalTBH2TDCRecInfoProducer.h.

Constructor & Destructor Documentation

◆ EcalTBH2TDCRecInfoProducer()

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_.

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

◆ ~EcalTBH2TDCRecInfoProducer()

EcalTBH2TDCRecInfoProducer::~EcalTBH2TDCRecInfoProducer ( )
override

Definition at line 36 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_.

36  {
37  if (algo_)
38  delete algo_;
39 }

Member Function Documentation

◆ produce()

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

Definition at line 41 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_, MillePedeFileConverter_cfg::e, edm::HandleBase::isValid(), edm::Handle< T >::product(), rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBH2TDCRecInfoAlgo::reconstruct(), convertSQLiteXML::runNumber, triggerDataCollection_, triggerDataProducer_, and HcalTBTriggerData::wasBeamTrigger().

41  {
42  int runNumber = e.id().run();
43  // Get input
44  edm::Handle<HcalTBTiming> ecalRawTDC;
45  const HcalTBTiming* ecalTDCRawInfo = nullptr;
46 
47  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
48  e.getByLabel(rawInfoProducer_, ecalRawTDC);
49  if (ecalRawTDC.isValid()) {
50  ecalTDCRawInfo = ecalRawTDC.product();
51  }
52 
53  if (!ecalTDCRawInfo) {
54  edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str();
55  return;
56  }
57 
58  // Get input
60  const HcalTBTriggerData* h2TriggerData = nullptr;
61  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
62  e.getByLabel(triggerDataProducer_, triggerData);
63  if (triggerData.isValid()) {
64  h2TriggerData = triggerData.product();
65  }
66 
67  if (!h2TriggerData) {
68  edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << triggerDataCollection_.c_str();
69  return;
70  }
71 
72  if (!h2TriggerData->wasBeamTrigger()) {
73  e.put(std::make_unique<EcalTBTDCRecInfo>(0.5), recInfoCollection_);
74  } else {
75  e.put(std::make_unique<EcalTBTDCRecInfo>(algo_->reconstruct(runNumber, *ecalRawTDC)), recInfoCollection_);
76  }
77 }
T const * product() const
Definition: Handle.h:70
EcalTBTDCRecInfo reconstruct(const int &runNumber, const HcalTBTiming &TDCRawInfo) const
Log< level::Error, false > LogError
bool isValid() const
Definition: HandleBase.h:70
bool wasBeamTrigger() const
returns true if this trigger came from beam data

Member Data Documentation

◆ algo_

EcalTBH2TDCRecInfoAlgo* EcalTBH2TDCRecInfoProducer::algo_
private

◆ rawInfoCollection_

std::string EcalTBH2TDCRecInfoProducer::rawInfoCollection_
private

Definition at line 23 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

◆ rawInfoProducer_

std::string EcalTBH2TDCRecInfoProducer::rawInfoProducer_
private

Definition at line 22 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

◆ recInfoCollection_

std::string EcalTBH2TDCRecInfoProducer::recInfoCollection_
private

Definition at line 26 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

◆ triggerDataCollection_

std::string EcalTBH2TDCRecInfoProducer::triggerDataCollection_
private

Definition at line 25 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

◆ triggerDataProducer_

std::string EcalTBH2TDCRecInfoProducer::triggerDataProducer_
private

Definition at line 24 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().