57 #include "art_root_io/RootDB/SQLite3Wrapper.h"
58 #include "art_root_io/RootDB/SQLErrMsg.h"
59 #include "art/Framework/Principal/Event.h"
60 #include "art/Framework/Principal/SubRun.h"
61 #include "art/Framework/Services/Registry/ServiceHandle.h"
62 #include "art/Framework/Services/Registry/ServiceDefinitionMacros.h"
63 #include "art/Framework/Services/System/FileCatalogMetadata.h"
64 #include "art/Framework/Services/System/TriggerNamesService.h"
65 #include "art/Utilities/OutputFileInfo.h"
66 #include "cetlib_except/exception.h"
67 #include "messagefacility/MessageLogger/MessageLogger.h"
71 #include "TTimeStamp.h"
79 art::ActivityRegistry& reg):
80 fGenerateTFileMetadata{pset.get<
bool>(
"GenerateTFileMetadata")},
82 fFileStats{
"", art::ServiceHandle<art::TriggerNamesService const>{}->getProcessName()}
101 std::cout <<
"TFileMetadataICARUS postBeginJob() begin" << std::endl;
106 art::ServiceHandle<art::FileCatalogMetadata> artmds;
108 art::FileCatalogMetadata::collection_type artmd;
109 artmds->getMetadata(artmd);
111 for(
auto const & d : artmd)
112 mdmap[d.first] = d.second;
114 std::map<std::string,std::string>::iterator it;
135 std::cout <<
"TFileMetadataICARUS postBeginJob() end" << std::endl;
143 std::cout <<
"TFileMetadataICARUS postOpenInputFile() begin" << std::endl;
148 std::cout <<
"TFileMetadataICARUS postOpenInputFile() end" << std::endl;
155 std::cout <<
"TFileMetadataICARUS postEvent() begin" << std::endl;
156 art::RunNumber_t run = evt.run();
157 art::SubRunNumber_t subrun = evt.subRun();
158 art::EventNumber_t
event = evt.event();
159 art::SubRunID srid = evt.id().subRunID();
173 std::cout <<
"TFileMetadataICARUS postEvent() end" << std::endl;
180 std::cout <<
"TFileMetadataICARUS postBeginSubRun() begin" << std::endl;
181 art::RunNumber_t run = sr.run();
182 art::SubRunNumber_t subrun = sr.subRun();
183 art::SubRunID srid = sr.id();
190 std::cout <<
"TFileMetadataICARUS postBeginSubRun() end" << std::endl;
197 std::cout <<
"TFileMetadataICARUS postCloseInputFile() begin" << std::endl;
200 art::ServiceHandle<icarusutil::FileCatalogMetadataICARUS> paramhandle;
213 char endbuf[80], startbuf[80];
216 strftime(endbuf,
sizeof(endbuf),
"%Y-%m-%dT%H:%M:%S",&tstruct);
218 strftime(startbuf,
sizeof(startbuf),
"%Y-%m-%dT%H:%M:%S",&tstruct);
225 std::ofstream jsonfile;
227 jsonfile<<
"{\n \"application\": {\n \"family\": "<<std::get<0>(
md.
fapplication)<<
",\n \"name\": ";
234 jsonfile<<
"\"group\": "<<
md.
fgroup<<
",\n ";
239 jsonfile<<
"\"parents\": [\n";
241 std::cout<<
"Parent " << c <<
": " << parent << std::endl;
243 size_t n = parent.find_last_of(
'/');
244 size_t f1 = (n == std::string::npos ? 0 : n+1);
245 jsonfile<<
" {\n \"file_name\": \""<<parent.substr(f1)<<
"\"\n }";
247 else jsonfile<<
",\n";
252 jsonfile<<
"\"runs\": [\n";
255 jsonfile<<
" [\n "<<std::get<0>(t)<<
",\n "<<std::get<1>(t)<<
",\n "<<std::get<2>(t)<<
"\n ]";
257 else jsonfile<<
",\n";
270 jsonfile<<
"\"start_time\": \""<<startbuf<<
"\",\n";
271 jsonfile<<
"\"end_time\": \""<<endbuf<<
"\"\n";
280 std::cout <<
"TFileMetadataICARUS postCloseInputFile() end" << std::endl;
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
then if[["$THISISATEST"==1]]
BEGIN_PROLOG could also be cout