24 #include <unordered_map>
70 m_record(iConfig.getParameter<std::
string>(
"record")),
71 m_tag(iConfig.getParameter<std::
string>(
"tag")),
72 m_value(iConfig.getParameter<double>(
"value")) {}
76 <<
"SiPhase2OuterTrackerLorentzAngleWriter::~SiPhase2OuterTrackerLorentzAngleWriter" << std::endl;
88 <<
"SiPhase2OuterTrackerLorentzAngleWriter::analyze " << std::endl;
92 if (!mydbservice.isAvailable()) {
93 edm::LogWarning(
"SiPhase2OuterTrackerLorentzAngleWriter") <<
"Service is unavailable" << std::endl;
98 unsigned int irun = iEvent.
id().
run();
99 edm::LogVerbatim(
"SiPhase2OuterTrackerLorentzAngleWriter") <<
"Writing on tag : " <<
tag << std::endl;
100 edm::LogVerbatim(
"SiPhase2OuterTrackerLorentzAngleWriter") <<
"Usinng as IOV run : " << irun << std::endl;
103 std::unordered_map<unsigned int, float> detsLAtoDB;
111 <<
" There are " << pDD->detUnits().size() <<
" modules in this geometry." << std::endl;
113 for (
auto const& det_u : pDD->detUnits()) {
114 const DetId detid = det_u->geographicalId();
115 uint32_t rawId = detid.
rawId();
120 LogDebug(
"SiPhase2OuterTrackerLorentzAngleWriter") << rawId <<
" is a " << subid <<
" det" << std::endl;
122 LogDebug(
"SiPhase2OuterTrackerLorentzAngleWriter")
123 <<
"subdetector ID:" << subid <<
" layer:" << tTopo->layer(detid) << std::endl;
130 <<
" There are " << detsLAtoDB.size() <<
" OT Lorentz Angle values assigned" << std::endl;
133 auto lorentzAngle = std::make_unique<SiPhase2OuterTrackerLorentzAngle>();
134 lorentzAngle->putLorentzAngles(detsLAtoDB);
135 edm::LogInfo(
"SiPhase2OuterTrackerLorentzAngleWriter") <<
"currentTime " << mydbservice->currentTime() << std::endl;
136 mydbservice->writeOneIOV(*lorentzAngle, mydbservice->currentTime(),
m_record);
142 desc.
setComment(
"Module to write SiPhase2OuterTrackerLorentzAngle Payloads");
143 desc.
add<
std::string>(
"record",
"SiPhase2OuterTrackerLorentzAngleRcd")->setComment(
"record to write");
144 desc.
add<
std::string>(
"tag",
"SiPhase2OuterTrackerLorentzAngle")->setComment(
"tag to write");
145 desc.
add<
double>(
"value", 0.07)->
setComment(
"value to be put in the payload");
Log< level::Info, true > LogVerbatim
void setComment(std::string const &value)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
#define DEFINE_FWK_MODULE(type)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
constexpr uint32_t rawId() const
get the raw id
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
void analyze(const edm::Event &, const edm::EventSetup &) override
bool getData(T &iHolder) const
void setComment(std::string const &value)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
static constexpr auto TOB
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Log< level::Info, false > LogInfo
SiPhase2OuterTrackerLorentzAngleWriter(const edm::ParameterSet &)
Log< level::Warning, false > LogWarning
static constexpr auto TID
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr Detector det() const
get the detector field from this detid
~SiPhase2OuterTrackerLorentzAngleWriter() override