CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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, std::string const &moduleLabel)
 

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::FastMonitor
jsonMonitor_
 
jsoncollector::StringJ mergeType_
 
jsoncollector::DataPointDefinition outJsonDef_
 
jsoncollector::IntJ processed_
 
jsoncollector::IntJ retCodeMask_
 
edm::StreamerOutputModuleCommon streamerCommon_
 
jsoncollector::StringJ transferDestination_
 

Detailed Description

Definition at line 47 of file EvFOutputModule.h.

Constructor & Destructor Documentation

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

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(), contentValuesCheck::ss, edm_modernize_messagelogger::stat, AlCaHLTBitMon_QueryRunRegistry::string, jsoncollector::DataPointDefinition::SUM, transferDestination_, and jsoncollector::FileIO::writeStringToFile().

30  : streamerCommon_(ps, selections, moduleLabel),
31  processed_(0),
32  accepted_(0),
33  errorEvents_(0),
34  retCodeMask_(0),
35  filelist_(),
36  filesize_(0),
37  inputFiles_(),
38  fileAdler32_(1),
39  hltErrorEvents_(0) {
42 
43  std::string baseRunDir = edm::Service<evf::EvFDaqDirector>()->baseRunDir();
44  LogDebug("EvFOutputModule") << "writing .dat files to -: " << baseRunDir;
45 
46  edm::Service<evf::EvFDaqDirector>()->createRunOpendirMaybe();
47 
48  processed_.setName("Processed");
49  accepted_.setName("Accepted");
50  errorEvents_.setName("ErrorEvents");
51  retCodeMask_.setName("ReturnCodeMask");
52  filelist_.setName("Filelist");
53  filesize_.setName("Filesize");
54  inputFiles_.setName("InputFiles");
55  fileAdler32_.setName("FileAdler32");
56  transferDestination_.setName("TransferDestination");
57  mergeType_.setName("MergeType");
58  hltErrorEvents_.setName("HLTErrorEvents");
59 
69  outJsonDef_.addLegendItem("TransferDestination", "string", jsoncollector::DataPointDefinition::SAME);
72 
73  std::stringstream tmpss, ss;
74  tmpss << baseRunDir << "/open/"
75  << "output_" << getpid() << ".jsd";
76  ss << baseRunDir << "/"
77  << "output_" << getpid() << ".jsd";
78  std::string outTmpJsonDefName = tmpss.str();
79  std::string outJsonDefName = ss.str();
80 
81  edm::Service<evf::EvFDaqDirector>()->lockInitLock();
82  struct stat fstat;
83  if (stat(outJsonDefName.c_str(), &fstat) != 0) { //file does not exist
84  LogDebug("EvFOutputModule") << "writing output definition file -: " << outJsonDefName;
87  jsoncollector::FileIO::writeStringToFile(outTmpJsonDefName, content);
88  std::filesystem::rename(outTmpJsonDefName, outJsonDefName);
89  }
90  edm::Service<evf::EvFDaqDirector>()->unlockInitLock();
91 
93  jsonMonitor_->setDefPath(outJsonDefName);
94  jsonMonitor_->registerGlobalMonitorable(&processed_, false);
95  jsonMonitor_->registerGlobalMonitorable(&accepted_, false);
96  jsonMonitor_->registerGlobalMonitorable(&errorEvents_, false);
97  jsonMonitor_->registerGlobalMonitorable(&retCodeMask_, false);
98  jsonMonitor_->registerGlobalMonitorable(&filelist_, false);
99  jsonMonitor_->registerGlobalMonitorable(&filesize_, false);
100  jsonMonitor_->registerGlobalMonitorable(&inputFiles_, false);
101  jsonMonitor_->registerGlobalMonitorable(&fileAdler32_, false);
102  jsonMonitor_->registerGlobalMonitorable(&transferDestination_, false);
103  jsonMonitor_->registerGlobalMonitorable(&mergeType_, false);
104  jsonMonitor_->registerGlobalMonitorable(&hltErrorEvents_, false);
105  jsonMonitor_->commit(nullptr);
106  }
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_
#define LogDebug(id)

Member Data Documentation

jsoncollector::IntJ evf::EvFOutputJSONWriter::accepted_

Definition at line 57 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::errorEvents_

Definition at line 58 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::fileAdler32_

Definition at line 63 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::StringJ evf::EvFOutputJSONWriter::filelist_

Definition at line 60 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::filesize_

Definition at line 61 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::hltErrorEvents_

Definition at line 66 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::StringJ evf::EvFOutputJSONWriter::inputFiles_

Definition at line 62 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

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

Definition at line 67 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::StringJ evf::EvFOutputJSONWriter::mergeType_

Definition at line 65 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::DataPointDefinition evf::EvFOutputJSONWriter::outJsonDef_

Definition at line 68 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::processed_

Definition at line 56 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::retCodeMask_

Definition at line 59 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

edm::StreamerOutputModuleCommon evf::EvFOutputJSONWriter::streamerCommon_

Definition at line 54 of file EvFOutputModule.h.

jsoncollector::StringJ evf::EvFOutputJSONWriter::transferDestination_

Definition at line 64 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().