DQMServices
StreamerIO
plugins
JsonWritingTimeoutPoolOutputModule.cc
Go to the documentation of this file.
1
#include <filesystem>
2
3
#include <fmt/printf.h>
4
#include <boost/property_tree/json_parser.hpp>
5
#include <boost/property_tree/ptree.hpp>
6
7
#include "
DQMServices/Components/interface/fillJson.h
"
8
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
9
#include "
JsonWritingTimeoutPoolOutputModule.h
"
10
11
namespace
dqmservices
{
12
13
JsonWritingTimeoutPoolOutputModule::JsonWritingTimeoutPoolOutputModule
(
edm::ParameterSet
const
& ps)
14
:
edm
::
one
::
OutputModuleBase
::
OutputModuleBase
(ps),
edm
::TimeoutPoolOutputModule(ps) {
15
runNumber_
= ps.
getUntrackedParameter
<uint32_t>(
"runNumber"
);
16
outputPath_
= ps.
getUntrackedParameter
<
std::string
>(
"outputPath"
);
17
streamLabel_
= ps.
getUntrackedParameter
<
std::string
>(
"streamLabel"
);
18
19
sequence_
= 0;
20
}
21
22
std::pair<std::string, std::string>
JsonWritingTimeoutPoolOutputModule::physicalAndLogicalNameForNewFile
() {
23
sequence_
++;
24
25
std::string
base
= fmt::sprintf(
"run%06d_ls%04d_%s"
,
runNumber_
,
sequence_
,
streamLabel_
);
26
27
std::filesystem::path
p
(
outputPath_
);
28
29
currentFileName_
= (
p
/
base
).
string
() +
".root"
;
30
currentJsonName_
= (
p
/
base
).
string
() +
".jsn"
;
31
32
return
std::make_pair(
currentFileName_
,
currentFileName_
);
33
}
34
35
void
JsonWritingTimeoutPoolOutputModule::doExtrasAfterCloseFile
() {
36
std::string
json_tmp_ =
currentJsonName_
+
".open"
;
37
std::string
transferDest =
""
;
38
std::string
mergeType =
"ROOT"
;
39
auto
pt
=
dqmfilesaver::fillJson
(
runNumber_
,
sequence_
,
currentFileName_
, transferDest, mergeType,
nullptr
);
40
write_json(json_tmp_,
pt
);
41
rename
(json_tmp_.c_str(),
currentJsonName_
.c_str());
42
}
43
44
void
JsonWritingTimeoutPoolOutputModule::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
45
edm::ParameterSetDescription
desc
;
46
TimeoutPoolOutputModule::fillDescription(
desc
);
47
48
desc
.setComment(
49
"Almost same as TimeoutPoolOutputModule, but the output files names "
50
"follow the FFF naming convention. Additionally a json 'description' "
51
"file is emitted for every .root file written."
);
52
53
desc
.addUntracked<uint32_t>(
"runNumber"
, 0)
54
->setComment(
55
"The run number, only used for file prefix: "
56
"'run000001_lumi0000_...'."
);
57
58
desc
.addUntracked<
std::string
>(
"outputPath"
,
"./"
)
59
->setComment(
60
"Output path for the root and json files, usually the run "
61
"directory."
);
62
63
desc
.addUntracked<
std::string
>(
"streamLabel"
,
"streamEvDOutput"
)->setComment(
"Stream label, used for file suffix."
);
64
65
descriptions.
add
(
"jsonWriting"
,
desc
);
66
}
67
68
}
// namespace dqmservices
69
70
#include "
FWCore/Framework/interface/MakerMacros.h
"
71
using
dqmservices::JsonWritingTimeoutPoolOutputModule
;
72
DEFINE_FWK_MODULE
(
JsonWritingTimeoutPoolOutputModule
);
ConfigurationDescriptions.h
SiPixelPI::one
Definition:
SiPixelPayloadInspectorHelper.h:39
dqmservices::JsonWritingTimeoutPoolOutputModule::JsonWritingTimeoutPoolOutputModule
JsonWritingTimeoutPoolOutputModule(edm::ParameterSet const &ps)
Definition:
JsonWritingTimeoutPoolOutputModule.cc:13
dqmservices
Definition:
DQMFileIterator.cc:18
dqmservices::JsonWritingTimeoutPoolOutputModule::outputPath_
std::string outputPath_
Definition:
JsonWritingTimeoutPoolOutputModule.h:26
DiDispStaMuonMonitor_cfi.pt
pt
Definition:
DiDispStaMuonMonitor_cfi.py:39
dqmservices::JsonWritingTimeoutPoolOutputModule::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition:
JsonWritingTimeoutPoolOutputModule.cc:44
edm
HLT enums.
Definition:
AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
fillJson.h
JsonWritingTimeoutPoolOutputModule.h
dqmservices::JsonWritingTimeoutPoolOutputModule::physicalAndLogicalNameForNewFile
std::pair< std::string, std::string > physicalAndLogicalNameForNewFile() override
Definition:
JsonWritingTimeoutPoolOutputModule.cc:22
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
rename
Definition:
rename.py:1
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
dqmservices::JsonWritingTimeoutPoolOutputModule::currentJsonName_
std::string currentJsonName_
Definition:
JsonWritingTimeoutPoolOutputModule.h:29
dqmservices::JsonWritingTimeoutPoolOutputModule::doExtrasAfterCloseFile
void doExtrasAfterCloseFile() override
Definition:
JsonWritingTimeoutPoolOutputModule.cc:35
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
OutputModuleBase
dqmfilesaver::fillJson
boost::property_tree::ptree fillJson(int run, int lumi, const std::string &dataFilePathName, const std::string &transferDestinationStr, const std::string &mergeTypeStr, evf::FastMonitoringService *fms)
Definition:
fillJson.cc:29
edm::ParameterSet
Definition:
ParameterSet.h:47
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
dqmservices::JsonWritingTimeoutPoolOutputModule::currentFileName_
std::string currentFileName_
Definition:
JsonWritingTimeoutPoolOutputModule.h:28
castor_dqm_sourceclient_file_cfg.path
path
Definition:
castor_dqm_sourceclient_file_cfg.py:37
dqmservices::JsonWritingTimeoutPoolOutputModule
Definition:
JsonWritingTimeoutPoolOutputModule.h:11
newFWLiteAna.base
base
Definition:
newFWLiteAna.py:92
dqmservices::JsonWritingTimeoutPoolOutputModule::streamLabel_
std::string streamLabel_
Definition:
JsonWritingTimeoutPoolOutputModule.h:25
dqmservices::JsonWritingTimeoutPoolOutputModule::runNumber_
uint32_t runNumber_
Definition:
JsonWritingTimeoutPoolOutputModule.h:24
dqmservices::JsonWritingTimeoutPoolOutputModule::sequence_
uint32_t sequence_
Definition:
JsonWritingTimeoutPoolOutputModule.h:23
Generated for CMSSW Reference Manual by
1.8.16