20 #include <boost/filesystem/fstream.hpp>
22 using namespace jsoncollector;
31 microSleep_(ps.getUntrackedParameter<int>(
"microSleep", 0))
91 struct sigaction sigIntHandler;
93 sigemptyset(&sigIntHandler.sa_mask);
94 sigIntHandler.sa_flags = 0;
95 sigaction(SIGINT, &sigIntHandler,
NULL);
115 if((
unsigned)retval!= msg.
size()){
117 <<
"Error writing FED Raw Data event data to "
118 <<
fileName_ <<
". Possibly the output disk "
119 <<
"is full?" << std::endl;
133 throw cms::Exception(
"RawEventFileWriterForBU",
"doOutputEventFragment")
134 <<
"Unsupported output mode ";
184 outfd_ = open(
fileName_.c_str(), O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
188 <<
"Error opening FED Raw Data event output file: " << name
189 <<
": " << strerror(errno) <<
"\n";
203 std::stringstream
ss;
205 mkdir(ss.str().c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
216 if (stat (rawJSDName.c_str(), &fstat) != 0) {
219 FileIO::writeStringToFile(rawJSDName, content);
222 if (stat (eolJSDName.c_str(), &fstat) != 0) {
225 FileIO::writeStringToFile(eolJSDName, content);
228 if (stat (eorJSDName.c_str(), &fstat) != 0) {
231 FileIO::writeStringToFile(eorJSDName, content);
242 std::stringstream
ss;
252 rename(path.c_str(),(
destinationDir_+path.substr(path.rfind(
"/"))).c_str());
261 edm::LogInfo(
"RawEventFileWriterForBU") <<
"Wrote JSON input file: " << path
273 std::ostringstream ostr;
309 printf(
"Caught signal %d. Writing EOR file!\n",s);
327 run_=atoi(run.c_str());
328 std::stringstream
ss;
329 ss <<
"run" << std::setfill(
'0') << std::setw(6) <<
run_;
void addLegendItem(std::string const &name, std::string const &type, std::string const &operation)
jsoncollector::FastMonitor * fileMon_
void initialize(std::string const &destinationDir, std::string const &name, int ls)
void setDefPath(std::string const &dpath)
jsoncollector::IntJ perLumiLostEventCount_
std::pair< Binary, Binary > serialize(const T &payload)
jsoncollector::IntJ perFileEventCount_
jsoncollector::DataPointDefinition eolJsonDef_
jsoncollector::IntJ perRunLumiCount_
jsoncollector::IntJ perRunLastLumi_
jsoncollector::DataPointDefinition eorJsonDef_
jsoncollector::IntJ perLumiFileCount_
jsoncollector::IntJ perRunEventCount_
void doOutputEventFragment(unsigned char *dataPtr, unsigned long dataSize)
void registerGlobalMonitorable(JsonMonitorable *newMonitorable, bool NAifZeroUpdates, unsigned int *nBins=nullptr)
~RawEventFileWriterForBU()
uint8 * startAddress() const
jsoncollector::IntJ perLumiEventCount_
virtual void setName(std::string name)
jsoncollector::IntJ perLumiSize_
static void staticHandler(int s)
jsoncollector::FastMonitor * runMon_
jsoncollector::IntJ perRunFileCount_
RawEventFileWriterForBU(edm::ParameterSet const &ps)
void finishFileWrite(int ls)
void commit(std::vector< unsigned int > *streamLumisPtr)
jsoncollector::DataPointDefinition rawJsonDef_
static RawEventFileWriterForBU * instance
jsoncollector::IntJ perLumiTotalEventCount_
void snap(unsigned int ls)
jsoncollector::IntJ perFileSize_
std::string destinationDir_
void setDefaultGroup(std::string const &group)
void makeRunPrefix(std::string const &destinationDir)
static std::string const source
void doOutputEvent(FRDEventMsgView const &msg)
jsoncollector::FastMonitor * lumiMon_
void discardCollected(unsigned int forLumi)
bool outputFullJSON(std::string const &path, unsigned int lumi)