CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
evf::EvFOutputJSONWriter Class Reference

#include <EvFOutputModule.h>

Public Member Functions

 EvFOutputJSONWriter (edm::ParameterSet const &ps, edm::SelectedProducts const *selections, std::string const &streamLabel)
 

Public Attributes

jsoncollector::IntJ accepted_
 
jsoncollector::IntJ errorEvents_
 
jsoncollector::IntJ fileAdler32_
 
jsoncollector::StringJ filelist_
 
jsoncollector::IntJ filesize_
 
jsoncollector::IntJ hltErrorEvents_
 
jsoncollector::StringJ inputFiles_
 
std::shared_ptr< jsoncollector::FastMonitorjsonMonitor_
 
jsoncollector::StringJ mergeType_
 
jsoncollector::DataPointDefinition outJsonDef_
 
jsoncollector::IntJ processed_
 
jsoncollector::IntJ retCodeMask_
 
edm::StreamerOutputModuleCommon streamerCommon_
 
jsoncollector::StringJ transferDestination_
 

Detailed Description

Definition at line 59 of file EvFOutputModule.h.

Constructor & Destructor Documentation

evf::EvFOutputJSONWriter::EvFOutputJSONWriter ( edm::ParameterSet const &  ps,
edm::SelectedProducts const *  selections,
std::string const &  streamLabel 
)

Definition at line 26 of file EvFOutputModule.cc.

References accepted_, jsoncollector::DataPointDefinition::addLegendItem(), jsoncollector::DataPointDefinition::ADLER32, jsoncollector::DataPointDefinition::BINARYOR, jsoncollector::DataPointDefinition::CAT, ws_sso_content_reader::content, errorEvents_, fileAdler32_, filelist_, filesize_, hltErrorEvents_, inputFiles_, jsonMonitor_, LogDebug, jsoncollector::DataPointDefinition::MERGE, mergeType_, evf::MergeTypeDAT, outJsonDef_, processed_, retCodeMask_, jsoncollector::DataPointDefinition::SAME, jsoncollector::JSONSerializer::serialize(), jsoncollector::DataPointDefinition::setDefaultGroup(), jsoncollector::JsonMonitorable::setName(), AlCaHLTBitMon_QueryRunRegistry::string, jsoncollector::DataPointDefinition::SUM, transferDestination_, and jsoncollector::FileIO::writeStringToFile().

26  :
28  processed_(0),
29  accepted_(0),
30  errorEvents_(0),
31  retCodeMask_(0),
32  filelist_(),
33  filesize_(0),
34  inputFiles_(),
35  fileAdler32_(1),
37  {
38 
39  transferDestination_ = edm::Service<evf::EvFDaqDirector>()->getStreamDestinations(streamLabel);
40  mergeType_ = edm::Service<evf::EvFDaqDirector>()->getStreamMergeType(streamLabel,evf::MergeTypeDAT);
41 
42  std::string baseRunDir = edm::Service<evf::EvFDaqDirector>()->baseRunDir();
43  LogDebug("EvFOutputModule") << "writing .dat files to -: " << baseRunDir;
44 
45  edm::Service<evf::EvFDaqDirector>()->createRunOpendirMaybe();
46 
47  processed_.setName("Processed");
48  accepted_.setName("Accepted");
49  errorEvents_.setName("ErrorEvents");
50  retCodeMask_.setName("ReturnCodeMask");
51  filelist_.setName("Filelist");
52  filesize_.setName("Filesize");
53  inputFiles_.setName("InputFiles");
54  fileAdler32_.setName("FileAdler32");
55  transferDestination_.setName("TransferDestination");
56  mergeType_.setName("MergeType");
57  hltErrorEvents_.setName("HLTErrorEvents");
58 
71 
72  std::stringstream tmpss,ss;
73  tmpss << baseRunDir << "/open/" << "output_" << getpid() << ".jsd";
74  ss << baseRunDir << "/" << "output_" << getpid() << ".jsd";
75  std::string outTmpJsonDefName = tmpss.str();
76  std::string outJsonDefName = ss.str();
77 
78  edm::Service<evf::EvFDaqDirector>()->lockInitLock();
79  struct stat fstat;
80  if (stat (outJsonDefName.c_str(), &fstat) != 0) { //file does not exist
81  LogDebug("EvFOutputModule") << "writing output definition file -: " << outJsonDefName;
84  jsoncollector::FileIO::writeStringToFile(outTmpJsonDefName, content);
85  boost::filesystem::rename(outTmpJsonDefName,outJsonDefName);
86  }
87  edm::Service<evf::EvFDaqDirector>()->unlockInitLock();
88 
90  jsonMonitor_->setDefPath(outJsonDefName);
91  jsonMonitor_->registerGlobalMonitorable(&processed_,false);
92  jsonMonitor_->registerGlobalMonitorable(&accepted_,false);
93  jsonMonitor_->registerGlobalMonitorable(&errorEvents_,false);
94  jsonMonitor_->registerGlobalMonitorable(&retCodeMask_,false);
95  jsonMonitor_->registerGlobalMonitorable(&filelist_,false);
96  jsonMonitor_->registerGlobalMonitorable(&filesize_,false);
97  jsonMonitor_->registerGlobalMonitorable(&inputFiles_,false);
98  jsonMonitor_->registerGlobalMonitorable(&fileAdler32_,false);
99  jsonMonitor_->registerGlobalMonitorable(&transferDestination_,false);
100  jsonMonitor_->registerGlobalMonitorable(&mergeType_,false);
101  jsonMonitor_->registerGlobalMonitorable(&hltErrorEvents_,false);
102  jsonMonitor_->commit(nullptr);
103  }
#define LogDebug(id)
void addLegendItem(std::string const &name, std::string const &type, std::string const &operation)
edm::StreamerOutputModuleCommon streamerCommon_
jsoncollector::IntJ fileAdler32_
static bool serialize(JsonSerializable *pObj, std::string &output)
jsoncollector::DataPointDefinition outJsonDef_
jsoncollector::IntJ hltErrorEvents_
jsoncollector::StringJ inputFiles_
jsoncollector::IntJ retCodeMask_
virtual void setName(std::string name)
static void writeStringToFile(std::string const &filename, std::string &content)
Definition: FileIO.cc:21
jsoncollector::IntJ processed_
jsoncollector::IntJ filesize_
jsoncollector::StringJ filelist_
jsoncollector::StringJ transferDestination_
std::shared_ptr< jsoncollector::FastMonitor > jsonMonitor_
void setDefaultGroup(std::string const &group)
jsoncollector::IntJ accepted_
jsoncollector::StringJ mergeType_
jsoncollector::IntJ errorEvents_

Member Data Documentation

jsoncollector::IntJ evf::EvFOutputJSONWriter::accepted_

Definition at line 66 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::errorEvents_

Definition at line 67 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::fileAdler32_

Definition at line 72 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::StringJ evf::EvFOutputJSONWriter::filelist_

Definition at line 69 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::filesize_

Definition at line 70 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::hltErrorEvents_

Definition at line 75 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::StringJ evf::EvFOutputJSONWriter::inputFiles_

Definition at line 71 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

std::shared_ptr<jsoncollector::FastMonitor> evf::EvFOutputJSONWriter::jsonMonitor_

Definition at line 76 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::StringJ evf::EvFOutputJSONWriter::mergeType_

Definition at line 74 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::DataPointDefinition evf::EvFOutputJSONWriter::outJsonDef_

Definition at line 77 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::processed_

Definition at line 65 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::retCodeMask_

Definition at line 68 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

edm::StreamerOutputModuleCommon evf::EvFOutputJSONWriter::streamerCommon_

Definition at line 63 of file EvFOutputModule.h.

jsoncollector::StringJ evf::EvFOutputJSONWriter::transferDestination_

Definition at line 73 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().