20 #include <boost/filesystem/fstream.hpp>
28 microSleep_(ps.getUntrackedParameter<int>(
"microSleep", 0))
84 struct sigaction sigIntHandler;
86 sigemptyset(&sigIntHandler.sa_mask);
87 sigIntHandler.sa_flags = 0;
88 sigaction(SIGINT, &sigIntHandler,
NULL);
108 if((
unsigned)retval!= msg.
size()){
110 <<
"Error writing FED Raw Data event data to "
111 <<
fileName_ <<
". Possibly the output disk "
112 <<
"is full?" << std::endl;
125 throw cms::Exception(
"RawEventFileWriterForBU",
"doOutputEventFragment")
126 <<
"Unsupported output mode ";
176 outfd_ = open(
fileName_.c_str(), O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
180 <<
"Error opening FED Raw Data event output file: " << name
181 <<
": " << strerror(errno) <<
"\n";
194 std::stringstream
ss;
196 mkdir(ss.str().c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
207 if (stat (rawJSDName.c_str(), &fstat) != 0) {
210 FileIO::writeStringToFile(rawJSDName, content);
213 if (stat (eolJSDName.c_str(), &fstat) != 0) {
216 FileIO::writeStringToFile(eolJSDName, content);
219 if (stat (eorJSDName.c_str(), &fstat) != 0) {
222 FileIO::writeStringToFile(eorJSDName, content);
233 std::stringstream
ss;
243 rename(path.c_str(),(
destinationDir_+path.substr(path.rfind(
"/"))).c_str());
251 edm::LogInfo(
"RawEventFileWriterForBU") <<
"Wrote JSON input file: " << path
262 std::ostringstream ostr;
297 printf(
"Caught signal %d. Writing EOR file!\n",s);
315 run_=atoi(run.c_str());
316 std::stringstream
ss;
317 ss <<
"run" << std::setfill(
'0') << std::setw(6) <<
run_;
void addLegendItem(std::string const &name, std::string const &type, std::string const &operation)
void initialize(std::string const &destinationDir, std::string const &name, int ls)
void setDefPath(std::string const &dpath)
IntJ perLumiLostEventCount_
bool outputFullJSON(std::string const &path, unsigned int lumi, bool log=true)
IntJ perLumiTotalEventCount_
DataPointDefinition rawJsonDef_
void doOutputEventFragment(unsigned char *dataPtr, unsigned long dataSize)
void registerGlobalMonitorable(JsonMonitorable *newMonitorable, bool NAifZeroUpdates, unsigned int *nBins=nullptr)
DataPointDefinition eorJsonDef_
~RawEventFileWriterForBU()
uint8 * startAddress() const
tuple path
else: Piece not in the list, fine.
virtual void setName(std::string name)
static void staticHandler(int s)
RawEventFileWriterForBU(edm::ParameterSet const &ps)
void finishFileWrite(int ls)
void commit(std::vector< unsigned int > *streamLumisPtr)
std::pair< Binary, Binary > serialize(const T &payload, bool packingOnly=false)
static RawEventFileWriterForBU * instance
void snap(unsigned int ls)
std::string destinationDir_
void setDefaultGroup(std::string const &group)
void makeRunPrefix(std::string const &destinationDir)
DataPointDefinition eolJsonDef_
static std::string const source
void doOutputEvent(FRDEventMsgView const &msg)
void discardCollected(unsigned int forLumi)