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 46 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, Skims_PA_cff::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, hgcalPlots::stat, AlCaHLTBitMon_QueryRunRegistry::string, jsoncollector::DataPointDefinition::SUM, transferDestination_, and jsoncollector::FileIO::writeStringToFile().

30  processed_(0),
31  accepted_(0),
32  errorEvents_(0),
33  retCodeMask_(0),
34  filelist_(),
35  filesize_(0),
36  inputFiles_(),
37  fileAdler32_(1),
38  hltErrorEvents_(0) {
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 
68  outJsonDef_.addLegendItem("TransferDestination", "string", jsoncollector::DataPointDefinition::SAME);
71 
72  std::stringstream tmpss, ss;
73  tmpss << baseRunDir << "/open/"
74  << "output_" << getpid() << ".jsd";
75  ss << baseRunDir << "/"
76  << "output_" << getpid() << ".jsd";
77  std::string outTmpJsonDefName = tmpss.str();
78  std::string outJsonDefName = ss.str();
79 
80  edm::Service<evf::EvFDaqDirector>()->lockInitLock();
81  struct stat fstat;
82  if (stat(outJsonDefName.c_str(), &fstat) != 0) { //file does not exist
83  LogDebug("EvFOutputModule") << "writing output definition file -: " << outJsonDefName;
86  jsoncollector::FileIO::writeStringToFile(outTmpJsonDefName, content);
87  boost::filesystem::rename(outTmpJsonDefName, outJsonDefName);
88  }
89  edm::Service<evf::EvFDaqDirector>()->unlockInitLock();
90 
92  jsonMonitor_->setDefPath(outJsonDefName);
93  jsonMonitor_->registerGlobalMonitorable(&processed_, false);
94  jsonMonitor_->registerGlobalMonitorable(&accepted_, false);
95  jsonMonitor_->registerGlobalMonitorable(&errorEvents_, false);
96  jsonMonitor_->registerGlobalMonitorable(&retCodeMask_, false);
97  jsonMonitor_->registerGlobalMonitorable(&filelist_, false);
98  jsonMonitor_->registerGlobalMonitorable(&filesize_, false);
99  jsonMonitor_->registerGlobalMonitorable(&inputFiles_, false);
100  jsonMonitor_->registerGlobalMonitorable(&fileAdler32_, false);
101  jsonMonitor_->registerGlobalMonitorable(&transferDestination_, false);
102  jsonMonitor_->registerGlobalMonitorable(&mergeType_, false);
103  jsonMonitor_->registerGlobalMonitorable(&hltErrorEvents_, false);
104  jsonMonitor_->commit(nullptr);
105  }
#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 55 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::errorEvents_

Definition at line 56 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::fileAdler32_

Definition at line 61 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::StringJ evf::EvFOutputJSONWriter::filelist_

Definition at line 58 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::filesize_

Definition at line 59 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::hltErrorEvents_

Definition at line 64 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::StringJ evf::EvFOutputJSONWriter::inputFiles_

Definition at line 60 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

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

Definition at line 65 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::StringJ evf::EvFOutputJSONWriter::mergeType_

Definition at line 63 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::DataPointDefinition evf::EvFOutputJSONWriter::outJsonDef_

Definition at line 66 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::processed_

Definition at line 54 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

jsoncollector::IntJ evf::EvFOutputJSONWriter::retCodeMask_

Definition at line 57 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().

edm::StreamerOutputModuleCommon evf::EvFOutputJSONWriter::streamerCommon_

Definition at line 52 of file EvFOutputModule.h.

jsoncollector::StringJ evf::EvFOutputJSONWriter::transferDestination_

Definition at line 62 of file EvFOutputModule.h.

Referenced by EvFOutputJSONWriter().