19 #include <openssl/md5.h> 20 #include <boost/property_tree/json_parser.hpp> 21 #include <boost/filesystem.hpp> 22 #include <boost/format.hpp> 47 namespace bpt = boost::property_tree;
62 boost::filesystem::create_directories(runDir);
64 jsonFilePathName = baseName +
".jsn";
65 openJsonFilePathName = jsonFilePathName +
".open";
67 histoFilePathName = baseName +
".pb";
68 openHistoFilePathName = histoFilePathName +
".open";
81 store->savePB(openHistoFilePathName,
"",
82 store->mtEnabled() ? fp.
run_ : 0,
86 ::rename(openHistoFilePathName.c_str(), histoFilePathName.c_str());
91 write_json(openJsonFilePathName, pt);
92 ::rename(openJsonFilePathName.c_str(), jsonFilePathName.c_str());
99 boost::property_tree::ptree
102 namespace bpt = boost::property_tree;
103 namespace bfs = boost::filesystem;
109 hostnameReturn = gethostname(host ,
sizeof(host));
110 if (hostnameReturn == -1)
112 <<
"Internal error, cannot get host name";
115 std::ostringstream oss_pid;
122 struct stat dataFileStat;
123 dataFileStat.st_size=0;
125 if (
stat(dataFilePathName.c_str(), &dataFileStat) != 0)
127 <<
"Internal error, cannot get data file: " 130 dataFileName =
bfs::path(dataFilePathName).filename().string();
134 bpt::ptree processedEvents, acceptedEvents, errorEvents, bitmask, fileList, fileSize,
inputFiles, fileAdler32, transferDestination, mergeType, hltErrorEvents;
136 processedEvents.put(
"", nProcessed);
137 acceptedEvents.put(
"", nProcessed);
139 errorEvents.put(
"", 0);
141 fileList.put(
"", dataFileName);
142 fileSize.put(
"", dataFileStat.st_size);
143 inputFiles.put(
"",
"");
144 fileAdler32.put(
"", -1);
145 transferDestination.put(
"", transferDestinationStr);
146 mergeType.put(
"", mergeTypeStr);
147 hltErrorEvents.put(
"", 0);
149 data.push_back(std::make_pair(
"", processedEvents));
150 data.push_back(std::make_pair(
"", acceptedEvents));
151 data.push_back(std::make_pair(
"", errorEvents));
152 data.push_back(std::make_pair(
"", bitmask));
153 data.push_back(std::make_pair(
"", fileList));
154 data.push_back(std::make_pair(
"", fileSize));
155 data.push_back(std::make_pair(
"", inputFiles));
156 data.push_back(std::make_pair(
"", fileAdler32));
157 data.push_back(std::make_pair(
"", transferDestination));
158 data.push_back(std::make_pair(
"", mergeType));
159 data.push_back(std::make_pair(
"", hltErrorEvents));
161 pt.add_child(
"data", data);
163 if (fms ==
nullptr) {
164 pt.put(
"definition",
"/fakeDefinition.jsn");
169 pt.put(
"definition", outJsonDefName.string());
173 sprintf(sourceInfo,
"%s_%d", host, pid);
174 pt.put(
"source", sourceInfo);
184 desc.
setComment(
"Saves histograms from DQM store, HLT->pb workflow.");
186 desc.
addUntracked<
bool>(
"fakeFilterUnitMode",
false)->setComment(
187 "If set, EvFDaqDirector is emulated and not used.");
190 "Label of the stream.");
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)
void initRun() const override
#define DEFINE_FWK_MODULE(type)
DQMFileSaverPB(const edm::ParameterSet &ps)
void saveRun(const FileParameters &fp) const override
void saveLumi(const FileParameters &fp) const override
~DQMFileSaverPB() override
void setComment(std::string const &value)
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
format
Some error handling for the usage.
char data[epos_bytes_allocation]
static void fillDescription(edm::ParameterSetDescription &d)
static boost::property_tree::ptree fillJson(int run, int lumi, const std::string &dataFilePathName, const std::string &transferDestinationStr, const std::string &mergeTypeStr, evf::FastMonitoringService *fms)