20 #include <boost/filesystem/fstream.hpp>
28 microSleep_(ps.getUntrackedParameter<int>(
"microSleep", 0))
78 struct sigaction sigIntHandler;
80 sigemptyset(&sigIntHandler.sa_mask);
81 sigIntHandler.sa_flags = 0;
82 sigaction(SIGINT, &sigIntHandler,
NULL);
102 if((
unsigned)retval!= msg.
size()){
104 <<
"Error writing FED Raw Data event data to "
105 <<
fileName_ <<
". Possibly the output disk "
106 <<
"is full?" << std::endl;
122 throw cms::Exception(
"RawEventFileWriterForBU",
"doOutputEventFragment")
123 <<
"Unsupported output mode ";
173 outfd_ = open(
fileName_.c_str(), O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
177 <<
"Error opening FED Raw Data event output file: " << name
178 <<
": " << strerror(errno) <<
"\n";
192 std::stringstream
ss;
194 mkdir(ss.str().c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
205 if (stat (rawJSDName.c_str(), &fstat) != 0) {
208 FileIO::writeStringToFile(rawJSDName, content);
211 if (stat (eolJSDName.c_str(), &fstat) != 0) {
214 FileIO::writeStringToFile(eolJSDName, content);
217 if (stat (eorJSDName.c_str(), &fstat) != 0) {
220 FileIO::writeStringToFile(eorJSDName, content);
231 std::stringstream
ss;
241 rename(path.c_str(),(
destinationDir_+path.substr(path.rfind(
"/"))).c_str());
243 edm::LogInfo(
"RawEventFileWriterForBU") <<
"Wrote JSON input file: " << path
254 std::ostringstream ostr;
277 printf(
"Caught signal %d. Writing EOR file!\n",s);
295 run_=atoi(run.c_str());
296 std::stringstream
ss;
297 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)
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)