CMS 3D CMS Logo

HcalTimeSlewEP.cc
Go to the documentation of this file.
1 #include "HcalTimeSlewEP.h"
7 
8 #include <string>
9 #include <vector>
10 #include <map>
11 #include <iostream>
12 
14  setWhatProduced(this);
15  findingRecord<HcalTimeSlewRecord>();
16 
17  //Two pset sets for M2/Simulation and M3
18  std::vector<edm::ParameterSet> p_TimeSlewM2 =
19  pset.getParameter<std::vector<edm::ParameterSet>>("timeSlewParametersM2");
20  std::vector<edm::ParameterSet> p_TimeSlewM3 =
21  pset.getParameter<std::vector<edm::ParameterSet>>("timeSlewParametersM3");
22 
23  //loop over the VPSets
24  for (const auto& p_timeslew : p_TimeSlewM2) {
25  m2parameters_.push_back({static_cast<float>(p_timeslew.getParameter<double>("tzero")),
26  static_cast<float>(p_timeslew.getParameter<double>("slope")),
27  static_cast<float>(p_timeslew.getParameter<double>("tmax"))});
28  }
29 
30  for (const auto& p_timeslew : p_TimeSlewM3) {
31  m3parameters_.push_back({p_timeslew.getParameter<double>("cap"),
32  p_timeslew.getParameter<double>("tspar0"),
33  p_timeslew.getParameter<double>("tspar1"),
34  p_timeslew.getParameter<double>("tspar2"),
35  p_timeslew.getParameter<double>("tspar0_siPM"),
36  p_timeslew.getParameter<double>("tspar1_siPM"),
37  p_timeslew.getParameter<double>("tspar2_siPM")});
38  }
39 }
40 
42 
44  const edm::IOVSyncValue& iTime,
45  edm::ValidityInterval& oInterval) {
47 }
48 
51 
53  desc_M2.add<double>("tzero");
54  desc_M2.add<double>("slope");
55  desc_M2.add<double>("tmax");
56  std::vector<edm::ParameterSet> default_M2(1);
57  desc.addVPSet("timeSlewParametersM2", desc_M2, default_M2);
58 
60  desc_M3.add<double>("cap");
61  desc_M3.add<double>("tspar0");
62  desc_M3.add<double>("tspar1");
63  desc_M3.add<double>("tspar2");
64  desc_M3.add<double>("tspar0_siPM");
65  desc_M3.add<double>("tspar1_siPM");
66  desc_M3.add<double>("tspar2_siPM");
67  std::vector<edm::ParameterSet> default_M3(1);
68  desc.addVPSet("timeSlewParametersM3", desc_M3, default_M3);
69 
70  descriptions.addDefault(desc);
71 }
72 
73 // ------------ method called to produce the data ------------
75  ReturnType hcalTimeSlew = std::make_unique<HcalTimeSlew>();
76 
77  //loop over the VPSets
78  for (const auto& p : m2parameters_) {
79  hcalTimeSlew->addM2ParameterSet(p.t0, p.m, p.tmaximum);
80  }
81 
82  for (const auto& p : m3parameters_) {
83  hcalTimeSlew->addM3ParameterSet(p.cap, p.tspar0, p.tspar1, p.tspar2, p.tspar0_siPM, p.tspar1_siPM, p.tspar2_siPM);
84  }
85 
86  return hcalTimeSlew;
87 }
88 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
ReturnType produce(const HcalTimeSlewRecord &)
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< M3Parameters > m3parameters_
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
~HcalTimeSlewEP() override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
std::vector< M2Parameters > m2parameters_
HcalTimeSlewEP(const edm::ParameterSet &)
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
std::unique_ptr< HcalTimeSlew > ReturnType