20 printf(
"Caught signal %d. Writing EOR file!\n",s);
26 FileIO::writeStringToFile(path, output);
31 FileIO::writeStringToFile(path, output);
37 jsonDefLocation_(ps.getUntrackedParameter<
string>(
"jsonDefLocation",
"")),
39 microSleep_(ps.getUntrackedParameter<int>(
"microSleep", 0))
47 vector<JsonMonitorable*> lumiMonParams;
58 vector<JsonMonitorable*> fileMonParams;
65 struct sigaction sigIntHandler;
67 sigemptyset(&sigIntHandler.sa_mask);
68 sigIntHandler.sa_flags = 0;
69 sigaction(SIGINT, &sigIntHandler,
NULL);
93 if((
unsigned)retval!= msg.
size()){
95 <<
"Error writing FED Raw Data event data to "
96 <<
fileName_ <<
". Possibly the output disk "
97 <<
"is full?" << std::endl;
122 <<
"Error writing FED Raw Data event data to "
123 <<
fileName_ <<
". Possibly the output disk "
124 <<
"is full?" << std::endl;
129 unsigned long dataSize)
131 ost_->write((
const char*) dataPtr, dataSize);
133 throw cms::Exception(
"RawEventFileWriterForBU",
"doOutputEventFragment")
134 <<
"Error writing FED Raw Data event data to "
135 <<
fileName_ <<
". Possibly the output disk "
136 <<
"is full?" << std::endl;
141 throw cms::Exception(
"RawEventFileWriterForBU",
"doOutputEventFragment")
142 <<
"Error writing FED Raw Data event data to "
143 <<
fileName_ <<
". Possibly the output disk "
144 <<
"is full?" << std::endl;
162 <<
"Error opening FED Raw Data event output file: " << name
163 <<
": " << strerror(errno) <<
"\n";
168 if (!oldFileName.empty()) {
175 std::stringstream ss;
176 ss <<
destinationDir_ <<
"/" << oldFileName.substr(oldFileName.rfind(
"/") + 1, oldFileName.size() - oldFileName.rfind(
"/") - 5) <<
".jsn";
177 string path = ss.str();
178 FileIO::writeStringToFile(path, output);
180 int fretval = rename(oldFileName.c_str(),(
destinationDir_+oldFileName.substr(oldFileName.rfind(
"/"))).c_str());
183 <<
" status " << fretval <<
" errno " << strerror(errno);
185 edm::LogInfo(
"RawEventFileWriterForBU") <<
"Wrote JSON input file: " << path
193 if (!
ost_->is_open()) {
195 <<
"Error opening FED Raw Data event output file: " << name <<
"\n";
209 std::ostringstream ostr;
210 ostr <<
destinationDir_ <<
"/EoLS_" << std::setfill(
'0') << std::setw(4) << ls <<
".jsn";
211 int outfd_ = open(ostr.str().c_str(), O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
212 if(outfd_!=0){close(outfd_); outfd_=0;}
218 string path = ostr.str();
219 FileIO::writeStringToFile(path, output);
void initialize(std::string const &destinationDir, std::string const &name, int ls)
DataPointMonitor * perFileMon_
void doOutputEventFragment(unsigned char *dataPtr, unsigned long dataSize)
~RawEventFileWriterForBU()
uint8 * startAddress() const
void setName(string name)
std::auto_ptr< std::ofstream > ost_
static void staticHandler(int s)
RawEventFileWriterForBU(edm::ParameterSet const &ps)
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
DataPointMonitor * lumiMon_
static RawEventFileWriterForBU * instance
Binary serialize(const T &payload, bool packingOnly=false)
std::string destinationDir_
void doOutputEvent(FRDEventMsgView const &msg)
void snap(DataPoint &outputDataPoint)