CMS 3D CMS Logo

EcalTBTDCRecInfoProducer.cc
Go to the documentation of this file.
8 
10 
12  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
13  rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer");
14  eventHeaderCollection_ = ps.getParameter<std::string>("eventHeaderCollection");
15  eventHeaderProducer_ = ps.getParameter<std::string>("eventHeaderProducer");
16  recInfoCollection_ = ps.getParameter<std::string>("recInfoCollection");
17 
18  // std::vector<double> planeShift_def;
19  // planeShift_def.push_back( -0.333 );
20  // planeShift_def.push_back( -0.333 );
21  // planeShift_def.push_back( -0.333 );
22  // planeShift_def.push_back( -0.333 );
23 
24  // std::vector<double> zPosition_def;
25  // zPosition_def.push_back( -0.333 );
26  // zPosition_def.push_back( -0.333 );
27  // zPosition_def.push_back( -0.333 );
28  // zPosition_def.push_back( -0.333 );
29  std::vector<EcalTBTDCRecInfoAlgo::EcalTBTDCRanges> tdcRanges;
30 
31  typedef std::vector<edm::ParameterSet> Parameters;
32  Parameters ranges = ps.getParameter<Parameters>("tdcRanges");
33  for (Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges) {
35  aRange.runRanges.first = itRanges->getParameter<int>("startRun");
36  aRange.runRanges.second = itRanges->getParameter<int>("endRun");
37  aRange.tdcMin = itRanges->getParameter<std::vector<double> >("tdcMin");
38  aRange.tdcMax = itRanges->getParameter<std::vector<double> >("tdcMax");
39  tdcRanges.push_back(aRange);
40  }
41 
42  use2004OffsetConvention_ = ps.getUntrackedParameter<bool>("use2004OffsetConvention", false);
43 
44  produces<EcalTBTDCRecInfo>(recInfoCollection_);
45 
47 }
48 
50  if (algo_)
51  delete algo_;
52 }
53 
55  // Get input
57  const EcalTBTDCRawInfo* ecalTDCRawInfo = nullptr;
58 
59  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
60  e.getByLabel(rawInfoProducer_, ecalRawTDC);
61  if (ecalRawTDC.isValid()) {
62  ecalTDCRawInfo = ecalRawTDC.product();
63  }
64 
65  if (!ecalTDCRawInfo) {
66  edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str();
67  return;
68  }
69 
70  if ((*ecalTDCRawInfo).size() < 1) {
71  edm::LogError("EcalTBTDcRecInfoError")
72  << "Less than one TDC good channel found. Aborting" << rawInfoCollection_.c_str();
73  return;
74  }
75  // Get input
76  edm::Handle<EcalTBEventHeader> tbEventHeader;
77  const EcalTBEventHeader* ecalEventHeader = nullptr;
78  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
79  e.getByLabel(eventHeaderProducer_, tbEventHeader);
80  if (tbEventHeader.isValid()) {
81  ecalEventHeader = tbEventHeader.product();
82  }
83 
84  if (!ecalEventHeader) {
85  edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << eventHeaderCollection_.c_str();
86  return;
87  }
88 
89  // Create empty output
90 
91  e.put(std::make_unique<EcalTBTDCRecInfo>(algo_->reconstruct(*ecalRawTDC, *tbEventHeader, use2004OffsetConvention_)),
93 }
EcalTBTDCRecInfoProducer::produce
void produce(edm::Event &e, const edm::EventSetup &es) override
Definition: EcalTBTDCRecInfoProducer.cc:54
diffTwoXMLs.ranges
string ranges
Definition: diffTwoXMLs.py:79
Handle.h
EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMin
std::vector< double > tdcMin
Definition: EcalTBTDCRecInfoAlgo.h:16
EcalTBTDCRecInfoProducer::~EcalTBTDCRecInfoProducer
~EcalTBTDCRecInfoProducer() override
Definition: EcalTBTDCRecInfoProducer.cc:49
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
EcalTBTDCRecInfoAlgo::reconstruct
EcalTBTDCRecInfo reconstruct(const EcalTBTDCRawInfo &TDCRawInfo, const EcalTBEventHeader &eventHeader, bool use2004OffsetConvention) const
Definition: EcalTBTDCRecInfoAlgo.cc:10
ESHandle.h
EcalTBTDCRecInfoProducer::EcalTBTDCRecInfoProducer
EcalTBTDCRecInfoProducer(const edm::ParameterSet &ps)
Definition: EcalTBTDCRecInfoProducer.cc:11
Ecal2004TBTDCRanges_v1_cff.tdcRanges
tdcRanges
Definition: Ecal2004TBTDCRanges_v1_cff.py:3
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
EcalTBTDCRecInfoAlgo
Definition: EcalTBTDCRecInfoAlgo.h:10
EcalTBEventHeader
Definition: EcalTBEventHeader.h:14
EcalTBTDCRecInfoProducer::rawInfoCollection_
std::string rawInfoCollection_
Definition: EcalTBTDCRecInfoProducer.h:23
EcalTBTDCRecInfoProducer::recInfoCollection_
std::string recInfoCollection_
Definition: EcalTBTDCRecInfoProducer.h:26
EcalTBTDCRecInfoProducer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMax
std::vector< double > tdcMax
Definition: EcalTBTDCRecInfoAlgo.h:17
EcalTBTDCRawInfo.h
EcalTBTDCRecInfoAlgo::EcalTBTDCRanges
Definition: EcalTBTDCRecInfoAlgo.h:14
EcalTBTDCRawInfo
Definition: EcalTBTDCRawInfo.h:13
EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::runRanges
std::pair< int, int > runRanges
Definition: EcalTBTDCRecInfoAlgo.h:15
EcalTBTDCRecInfoProducer::algo_
EcalTBTDCRecInfoAlgo * algo_
Definition: EcalTBTDCRecInfoProducer.h:29
edm::EventSetup
Definition: EventSetup.h:58
EcalTBTDCRecInfoProducer::rawInfoProducer_
std::string rawInfoProducer_
Definition: EcalTBTDCRecInfoProducer.h:22
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EcalTBTDCRecInfoProducer::use2004OffsetConvention_
bool use2004OffsetConvention_
Definition: EcalTBTDCRecInfoProducer.h:27
EcalTBTDCRecInfo.h
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalTBTDCRecInfoProducer::eventHeaderProducer_
std::string eventHeaderProducer_
Definition: EcalTBTDCRecInfoProducer.h:24
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
EcalTBTDCRecInfoProducer::eventHeaderCollection_
std::string eventHeaderCollection_
Definition: EcalTBTDCRecInfoProducer.h:25
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37