|
|
Go to the documentation of this file.
11 #include <google/protobuf/io/coded_stream.h>
12 #include <google/protobuf/io/gzip_stream.h>
13 #include <google/protobuf/io/zero_copy_stream_impl.h>
15 #include "TBufferFile.h"
29 produces<std::string, edm::Transition::BeginLuminosityBlock>(
"sourceDataPath");
30 produces<std::string, edm::Transition::BeginLuminosityBlock>(
"sourceJsonPath");
31 produces<DQMToken, edm::Transition::BeginRun>(
"DQMGenerationRecoRun");
32 produces<DQMToken, edm::Transition::BeginLuminosityBlock>(
"DQMGenerationRecoLumi");
48 return InputSource::IsStop;
53 return InputSource::IsStop;
59 return InputSource::IsStop;
64 return InputSource::IsLumi;
82 return std::shared_ptr<edm::RunAuxiliary>(
aux);
91 for (
auto const&
ME : allMEs) {
103 return std::shared_ptr<edm::LuminosityBlockAuxiliary>(
aux);
119 for (
auto const&
ME : allMEs) {
121 if (
ME->getLumiFlag()) {
131 std::unique_ptr<std::string> json_product(
new std::string(jspath));
137 if (!std::filesystem::exists(
path)) {
155 using google::protobuf::io::ArrayInputStream;
156 using google::protobuf::io::CodedInputStream;
157 using google::protobuf::io::FileInputStream;
158 using google::protobuf::io::FileOutputStream;
159 using google::protobuf::io::GzipInputStream;
160 using google::protobuf::io::GzipOutputStream;
163 if ((filedescriptor = ::open(
filename.c_str(), O_RDONLY)) == -1) {
168 FileInputStream
fin(filedescriptor);
170 CodedInputStream input_coded(&
input);
171 input_coded.SetTotalBytesLimit(1024 * 1024 * 1024);
172 if (!dqmstore_message.ParseFromCodedStream(&input_coded)) {
176 ::close(filedescriptor);
178 for (
int i = 0;
i < dqmstore_message.histo_size(); ++
i) {
179 TObject*
obj =
nullptr;
180 dqmstorepb::ROOTFilePB::Histo
const&
h = dqmstore_message.histo(
i);
182 size_t slash =
h.full_pathname().rfind(
'/');
183 size_t dirpos = (
slash == std::string::npos ? 0 :
slash);
184 size_t namepos = (
slash == std::string::npos ? 0 :
slash + 1);
186 dirname.assign(
h.full_pathname(), 0, dirpos);
187 objname.assign(
h.full_pathname(), namepos, std::string::npos);
188 TBufferFile
buf(TBufferFile::kRead,
h.size(), (
void*)
h.streamed_histo().data(), kFALSE);
190 if (
buf.Length() ==
buf.BufferSize()) {
194 void* ptr =
buf.ReadObjectAny(
nullptr);
195 obj = reinterpret_cast<TObject*>(ptr);
199 edm::LogError(
"DQMProtobufReader") <<
"Error reading element:'" <<
h.full_pathname();
205 store->
setScope(MonitorElementData::Scope::LUMI);
207 store->
setScope(MonitorElementData::Scope::RUN);
215 std::regex parseint{
"<.*>i=(.*)</.*>"};
217 bool ok = std::regex_match(expression,
match, parseint);
219 edm::LogError(
"DQMProtobufReader") <<
"Malformed object of type INT: '" << expression <<
"'";
227 std::regex parsefloat{
"<.*>f=(.*)</.*>"};
229 bool ok = std::regex_match(expression,
match, parsefloat);
231 edm::LogError(
"DQMProtobufReader") <<
"Malformed object of type REAL: '" << expression <<
"'";
237 auto value = static_cast<TObjString*>(
obj)->String();
240 auto value = static_cast<TH1F*>(
obj);
243 auto value = static_cast<TH1S*>(
obj);
246 auto value = static_cast<TH1D*>(
obj);
249 auto value = static_cast<TH2F*>(
obj);
252 auto value = static_cast<TH2S*>(
obj);
255 auto value = static_cast<TH2D*>(
obj);
258 auto value = static_cast<TH3F*>(
obj);
261 auto value = static_cast<TProfile*>(
obj);
264 auto value = static_cast<TProfile2D*>(
obj);
280 "Creates runs and lumis and fills the dqmstore from protocol buffer "
284 desc.addUntracked<
bool>(
"skipFirstLumis",
false)
286 "Skip (and ignore the minEventsPerLumi parameter) for the files "
287 "which have been available at the begining of the processing. "
288 "If set to true, the reader will open last available file for "
291 desc.addUntracked<
bool>(
"deleteDatFiles",
false)
293 "Delete data files after they have been closed, in order to "
296 desc.addUntracked<
bool>(
"endOfRunKills",
false)
298 "Kill the processing as soon as the end-of-run file appears, even if "
299 "there are/will be unprocessed lumisections.");
301 desc.addUntracked<
bool>(
"loadFiles",
true)
303 "Tells the source load the data files. If set to false, source will create skeleton lumi transitions.");
306 descriptions.
add(
"source",
desc);
DQMProtobufReader(edm::ParameterSet const &, edm::InputSourceDescription const &)
void logFileAction(const std::string &msg, const std::string &fileName="") const
static const std::string input
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
MonitorElement * book2S(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
static const uint32_t DQM_PROP_TYPE_TH2S
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
std::shared_ptr< edm::LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
void beginLuminosityBlock(edm::LuminosityBlock &lb) override
static const uint32_t DQM_PROP_TYPE_TH2F
edm::InputSource::ItemType getNextItemType() override
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
static const uint32_t DQM_PROP_TYPE_TH1D
static void fillDescription(edm::ParameterSetDescription &d)
LuminosityBlockAuxiliary const & aux() const
std::string get_json_path() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void readEvent_(edm::EventPrincipal &) override
~DQMProtobufReader() override
static const uint32_t DQM_PROP_TYPE_TH3F
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
static const uint32_t DQM_PROP_TYPE_MASK
void setCurrentFolder(std::string const &fullpath) override
MonitorElement * book1S(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
static const uint32_t DQM_PROP_TYPE_TH1F
static const uint32_t DQM_PROP_TYPE_REAL
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
ProcessHistoryID const & processHistoryID() const
std::string get_data_path() const
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
void fillLuminosityBlockPrincipal(ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
volatile std::atomic< bool > shutdown_flag
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
LuminosityBlockNumber_t luminosityBlock() const
DQMFileIterator fiterator_
static const uint32_t DQM_PROP_TYPE_STRING
static const uint32_t DQM_PROP_TYPE_INT
Log< level::Error, false > LogError
static const uint32_t DQM_PROP_TYPE_TH1S
void put(std::unique_ptr< PROD > product)
Put a new product.
std::shared_ptr< edm::RunAuxiliary > readRunAuxiliary_() override
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
static const uint32_t DQM_PROP_TYPE_TPROF
void readLuminosityBlock_(edm::LuminosityBlockPrincipal &lbCache) override
LuminosityBlockID id() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * book3D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, FUNC onbooking=NOOP())
void load(DQMStore *store, std::string filename)
static const uint32_t DQM_PROP_TYPE_TH2D
static const uint32_t DQM_PROP_LUMI
void logLumiState(const LumiEntry &lumi, const std::string &msg)
static void fillDescription(ParameterSetDescription &desc)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void readRun_(edm::RunPrincipal &rpCache) override
static const uint32_t DQM_PROP_TYPE_TPROF2D
DQMFileIterator::LumiEntry currentLumi_