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,
87 ::rename(openHistoFilePathName.c_str(), histoFilePathName.c_str());
92 write_json(openJsonFilePathName, pt);
93 ::rename(openJsonFilePathName.c_str(), jsonFilePathName.c_str());
100 boost::property_tree::ptree
103 namespace bpt = boost::property_tree;
104 namespace bfs = boost::filesystem;
110 hostnameReturn = gethostname(host ,
sizeof(host));
111 if (hostnameReturn == -1)
113 <<
"Internal error, cannot get host name";
116 std::ostringstream oss_pid;
123 struct stat dataFileStat;
124 dataFileStat.st_size=0;
126 if (
stat(dataFilePathName.c_str(), &dataFileStat) != 0)
128 <<
"Internal error, cannot get data file: " 131 dataFileName =
bfs::path(dataFilePathName).filename().string();
135 bpt::ptree processedEvents, acceptedEvents, errorEvents, bitmask, fileList, fileSize,
inputFiles, fileAdler32, transferDestination, mergeType, hltErrorEvents;
137 processedEvents.put(
"", nProcessed);
138 acceptedEvents.put(
"", nProcessed);
140 errorEvents.put(
"", 0);
142 fileList.put(
"", dataFileName);
143 fileSize.put(
"", dataFileStat.st_size);
144 inputFiles.put(
"",
"");
145 fileAdler32.put(
"", -1);
146 transferDestination.put(
"", transferDestinationStr);
147 mergeType.put(
"", mergeTypeStr);
148 hltErrorEvents.put(
"", 0);
150 data.push_back(std::make_pair(
"", processedEvents));
151 data.push_back(std::make_pair(
"", acceptedEvents));
152 data.push_back(std::make_pair(
"", errorEvents));
153 data.push_back(std::make_pair(
"", bitmask));
154 data.push_back(std::make_pair(
"", fileList));
155 data.push_back(std::make_pair(
"", fileSize));
156 data.push_back(std::make_pair(
"", inputFiles));
157 data.push_back(std::make_pair(
"", fileAdler32));
158 data.push_back(std::make_pair(
"", transferDestination));
159 data.push_back(std::make_pair(
"", mergeType));
160 data.push_back(std::make_pair(
"", hltErrorEvents));
162 pt.add_child(
"data", data);
164 if (fms ==
nullptr) {
165 pt.put(
"definition",
"/fakeDefinition.jsn");
170 pt.put(
"definition", outJsonDefName.string());
174 sprintf(sourceInfo,
"%s_%d", host, pid);
175 pt.put(
"source", sourceInfo);
185 desc.
setComment(
"Saves histograms from DQM store, HLT->pb workflow.");
187 desc.
addUntracked<
bool>(
"fakeFilterUnitMode",
false)->setComment(
188 "If set, EvFDaqDirector is emulated and not used.");
191 "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)
virtual void initRun() const override
#define DEFINE_FWK_MODULE(type)
DQMFileSaverPB(const edm::ParameterSet &ps)
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)
virtual void saveRun(const FileParameters &fp) const override
virtual void saveLumi(const FileParameters &fp) const 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)