CMS 3D CMS Logo

EcalTBH2TDCRecInfoProducer.cc
Go to the documentation of this file.
9 
11 
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 }
35 
37  if (algo_)
38  delete algo_;
39 }
40 
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 }
diffTwoXMLs.ranges
string ranges
Definition: diffTwoXMLs.py:79
Handle.h
MessageLogger.h
EcalTBH2TDCRecInfoProducer::~EcalTBH2TDCRecInfoProducer
~EcalTBH2TDCRecInfoProducer() override
Definition: EcalTBH2TDCRecInfoProducer.cc:36
EcalTBH2TDCRecInfoAlgo
Definition: EcalTBH2TDCRecInfoAlgo.h:10
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
HcalTBTiming.h
Ecal2004TBTDCRanges_v1_cff.tdcRanges
tdcRanges
Definition: Ecal2004TBTDCRanges_v1_cff.py:3
EcalTBH2TDCRecInfoProducer::EcalTBH2TDCRecInfoProducer
EcalTBH2TDCRecInfoProducer(const edm::ParameterSet &ps)
Definition: EcalTBH2TDCRecInfoProducer.cc:12
HcalTBTriggerData.h
EcalTBH2TDCRecInfoProducer::triggerDataProducer_
std::string triggerDataProducer_
Definition: EcalTBH2TDCRecInfoProducer.h:24
EcalTBH2TDCRecInfoProducer::recInfoCollection_
std::string recInfoCollection_
Definition: EcalTBH2TDCRecInfoProducer.h:26
edm::Handle
Definition: AssociativeIterator.h:50
EcalTBH2TDCRecInfoProducer::produce
void produce(edm::Event &e, const edm::EventSetup &es) override
Definition: EcalTBH2TDCRecInfoProducer.cc:41
convertSQLiteXML.runNumber
runNumber
Definition: convertSQLiteXML.py:91
EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges::runRanges
std::pair< int, int > runRanges
Definition: EcalTBH2TDCRecInfoAlgo.h:15
HcalTBTiming
Definition: HcalTBTiming.h:17
EcalTBH2TDCRecInfoProducer::rawInfoProducer_
std::string rawInfoProducer_
Definition: EcalTBH2TDCRecInfoProducer.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
HcalTBTriggerData
Definition: HcalTBTriggerData.h:17
EcalTBH2TDCRecInfoProducer.h
EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges
Definition: EcalTBH2TDCRecInfoAlgo.h:14
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EcalTBH2TDCRecInfoProducer::triggerDataCollection_
std::string triggerDataCollection_
Definition: EcalTBH2TDCRecInfoProducer.h:25
EcalTBH2TDCRecInfoProducer::algo_
EcalTBH2TDCRecInfoAlgo * algo_
Definition: EcalTBH2TDCRecInfoProducer.h:28
EcalTBTDCRecInfo.h
EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges::tdcZero
double tdcZero
Definition: EcalTBH2TDCRecInfoAlgo.h:16
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalTBH2TDCRecInfoAlgo::reconstruct
EcalTBTDCRecInfo reconstruct(const int &runNumber, const HcalTBTiming &TDCRawInfo) const
Definition: EcalTBH2TDCRecInfoAlgo.cc:11
EcalTBH2TDCRecInfoProducer::rawInfoCollection_
std::string rawInfoCollection_
Definition: EcalTBH2TDCRecInfoProducer.h:23
HcalTBTriggerData::wasBeamTrigger
bool wasBeamTrigger() const
returns true if this trigger came from beam data
Definition: HcalTBTriggerData.h:73
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
EDCollection.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37