20 #include <boost/filesystem/fstream.hpp>
28 microSleep_(ps.getUntrackedParameter<int>(
"microSleep", 0))
88 struct sigaction sigIntHandler;
90 sigemptyset(&sigIntHandler.sa_mask);
91 sigIntHandler.sa_flags = 0;
92 sigaction(SIGINT, &sigIntHandler,
NULL);
112 if((
unsigned)retval!= msg.
size()){
114 <<
"Error writing FED Raw Data event data to "
115 <<
fileName_ <<
". Possibly the output disk "
116 <<
"is full?" << std::endl;
130 throw cms::Exception(
"RawEventFileWriterForBU",
"doOutputEventFragment")
131 <<
"Unsupported output mode ";
181 outfd_ = open(
fileName_.c_str(), O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
185 <<
"Error opening FED Raw Data event output file: " << name
186 <<
": " << strerror(errno) <<
"\n";
200 std::stringstream
ss;
202 mkdir(ss.str().c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
213 if (stat (rawJSDName.c_str(), &fstat) != 0) {
216 FileIO::writeStringToFile(rawJSDName, content);
219 if (stat (eolJSDName.c_str(), &fstat) != 0) {
222 FileIO::writeStringToFile(eolJSDName, content);
225 if (stat (eorJSDName.c_str(), &fstat) != 0) {
228 FileIO::writeStringToFile(eorJSDName, content);
239 std::stringstream
ss;
249 rename(path.c_str(),(
destinationDir_+path.substr(path.rfind(
"/"))).c_str());
258 edm::LogInfo(
"RawEventFileWriterForBU") <<
"Wrote JSON input file: " << path
270 std::ostringstream ostr;
306 printf(
"Caught signal %d. Writing EOR file!\n",s);
324 run_=atoi(run.c_str());
325 std::stringstream
ss;
326 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)