35 namespace bpt = boost::property_tree;
36 namespace bfs = boost::filesystem;
42 hostnameReturn = gethostname(
host,
sizeof(
host));
43 if (hostnameReturn == -1)
44 throw cms::Exception(
"fillJson") <<
"Internal error, cannot get host name";
47 std::ostringstream oss_pid;
54 struct stat dataFileStat;
55 dataFileStat.st_size = 0;
57 if (
stat(dataFilePathName.c_str(), &dataFileStat) != 0)
58 throw cms::Exception(
"fillJson") <<
"Internal error, cannot get data file: " << dataFilePathName;
60 dataFileName =
bfs::path(dataFilePathName).filename().string();
64 bpt::ptree processedEvents, acceptedEvents, errorEvents, bitmask, fileList, fileSize,
inputFiles, fileAdler32,
65 transferDestination, mergeType, hltErrorEvents;
67 processedEvents.put(
"", nProcessed);
68 acceptedEvents.put(
"", nProcessed);
70 errorEvents.put(
"", 0);
72 fileList.put(
"", dataFileName);
73 fileSize.put(
"", dataFileStat.st_size);
75 fileAdler32.put(
"", -1);
76 transferDestination.put(
"", transferDestinationStr);
77 mergeType.put(
"", mergeTypeStr);
78 hltErrorEvents.put(
"", 0);
80 data.push_back(std::make_pair(
"", processedEvents));
81 data.push_back(std::make_pair(
"", acceptedEvents));
82 data.push_back(std::make_pair(
"", errorEvents));
83 data.push_back(std::make_pair(
"", bitmask));
84 data.push_back(std::make_pair(
"", fileList));
85 data.push_back(std::make_pair(
"", fileSize));
87 data.push_back(std::make_pair(
"", fileAdler32));
88 data.push_back(std::make_pair(
"", transferDestination));
89 data.push_back(std::make_pair(
"", mergeType));
90 data.push_back(std::make_pair(
"", hltErrorEvents));
92 pt.add_child(
"data",
data);
95 pt.put(
"definition",
"/fakeDefinition.jsn");
101 pt.put(
"definition", outJsonDefName.string());
105 sprintf(sourceInfo,
"%s_%d",
host, pid);
106 pt.put(
"source", sourceInfo);