19 #include <openssl/md5.h>
20 #include <boost/property_tree/json_parser.hpp>
21 #include <boost/filesystem.hpp>
22 #include <boost/format.hpp>
45 namespace bpt = boost::property_tree;
60 boost::filesystem::create_directories(runDir);
62 jsonFilePathName = baseName +
".jsn";
63 openJsonFilePathName = jsonFilePathName +
".open";
65 histoFilePathName = baseName +
".pb";
66 openHistoFilePathName = histoFilePathName +
".open";
79 store->savePB(openHistoFilePathName,
"",
80 store->mtEnabled() ? fp.
run_ : 0,
85 ::rename(openHistoFilePathName.c_str(), histoFilePathName.c_str());
90 write_json(openJsonFilePathName, pt);
91 ::rename(openJsonFilePathName.c_str(), jsonFilePathName.c_str());
98 boost::property_tree::ptree
101 namespace bpt = boost::property_tree;
102 namespace bfs = boost::filesystem;
108 hostnameReturn = gethostname(host ,
sizeof(host));
109 if (hostnameReturn == -1)
111 <<
"Internal error, cannot get host name";
114 std::ostringstream oss_pid;
121 struct stat dataFileStat;
122 dataFileStat.st_size=0;
124 if (stat(dataFilePathName.c_str(), &dataFileStat) != 0)
126 <<
"Internal error, cannot get data file: "
129 dataFileName =
bfs::path(dataFilePathName).filename().string();
133 bpt::ptree processedEvents, acceptedEvents, errorEvents, bitmask, fileList, fileSize,
inputFiles, fileAdler32, transferDestination;
135 processedEvents.put(
"", nProcessed);
136 acceptedEvents.put(
"", nProcessed);
138 errorEvents.put(
"", 0);
140 fileList.put(
"", dataFileName);
141 fileSize.put(
"", dataFileStat.st_size);
142 inputFiles.put(
"",
"");
143 fileAdler32.put(
"", -1);
144 transferDestination.put(
"", transferDestinationStr);
146 data.push_back(std::make_pair(
"", processedEvents));
147 data.push_back(std::make_pair(
"", acceptedEvents));
148 data.push_back(std::make_pair(
"", errorEvents));
149 data.push_back(std::make_pair(
"", bitmask));
150 data.push_back(std::make_pair(
"", fileList));
151 data.push_back(std::make_pair(
"", fileSize));
152 data.push_back(std::make_pair(
"", inputFiles));
153 data.push_back(std::make_pair(
"", fileAdler32));
154 data.push_back(std::make_pair(
"", transferDestination));
156 pt.add_child(
"data", data);
158 if (fms ==
nullptr) {
159 pt.put(
"definition",
"/fakeDefinition.jsn");
164 pt.put(
"definition", outJsonDefName.string());
168 sprintf(sourceInfo,
"%s_%d", host, pid);
169 pt.put(
"source", sourceInfo);
179 desc.
setComment(
"Saves histograms from DQM store, HLT->pb workflow.");
181 desc.
addUntracked<
bool>(
"fakeFilterUnitMode",
false)->setComment(
182 "If set, EvFDaqDirector is emulated and not used.");
185 "Label of the stream.");
188 descriptions.
add(
"saver", desc);
T getUntrackedParameter(std::string const &, T const &) const
unsigned int getEventsProcessedForLumi(unsigned int lumi, bool *abortFlag=0)
std::string transferDestination_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
DQMFileSaverPB(const edm::ParameterSet &ps)
string format
Some error handling for the usage.
void setComment(std::string const &value)
virtual void initRun() const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static boost::property_tree::ptree fillJson(int run, int lumi, const std::string &dataFilePathName, const std::string transferDestinationStr, evf::FastMonitoringService *fms)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void saveLumi(const FileParameters &fp) const override
char data[epos_bytes_allocation]
virtual void saveRun(const FileParameters &fp) const override
static void fillDescription(edm::ParameterSetDescription &d)