1 #ifndef IOPool_Streamer_RecoEventOutputModuleForFU_h
2 #define IOPool_Streamer_RecoEventOutputModuleForFU_h
11 #include "boost/filesystem.hpp"
21 template<
typename Consumer>
38 virtual void start()
const;
39 virtual void stop()
const;
47 std::auto_ptr<Consumer>
c_;
65 template<
typename Consumer>
67 edm::StreamerOutputModuleBase(ps),
69 stream_label_(ps.getParameter<std::
string>(
"@module_label")),
77 outBuf_(new unsigned
char[1024*1024])
80 LogDebug(
"RecoEventOutputModuleForFU") <<
"writing .dat files to -: " << baseRunDir;
102 std::stringstream tmpss,
ss;
103 tmpss << baseRunDir <<
"/open/" <<
"output_" << getpid() <<
".jsd";
104 ss << baseRunDir <<
"/" <<
"output_" << getpid() <<
".jsd";
110 if (stat (outJsonDefName.c_str(), &fstat) != 0) {
111 LogDebug(
"RecoEventOutputModuleForFU") <<
"writing output definition file -: " << outJsonDefName;
114 FileIO::writeStringToFile(outTmpJsonDefName, content);
115 boost::filesystem::rename(outTmpJsonDefName,outJsonDefName);
131 template<
typename Consumer>
134 template<
typename Consumer>
139 edm::LogInfo(
"RecoEventOutputModuleForFU") <<
"start() method, initializing streams. init stream -: "
141 c_->setInitMessageFile(initFileName);
145 template<
typename Consumer>
152 template<
typename Consumer>
156 c_->doOutputHeader(init_message);
159 template<
typename Consumer>
163 c_->doOutputEvent(msg);
166 template<
typename Consumer>
171 Consumer::fillDescription(desc);
172 descriptions.
add(
"streamerOutput", desc);
175 template<
typename Consumer>
180 c_->setOutputFile(openDatFilePath_.string());
181 filelist_ = openDatFilePath_.filename().string();
184 template<
typename Consumer>
189 c_->closeOutputFile();
190 processed_.value() = fms_->getEventsProcessedForLumi(ls.
luminosityBlock());
191 if(processed_.value()!=0){
196 FILE *
src = fopen(openDatFilePath_.string().c_str(),
"r");
199 stat(openDatFilePath_.string().c_str(), &istat);
201 while (readInput<istat.st_size) {
202 unsigned long toRead= readInput+1024*1024 < istat.st_size ? 1024*1024 : istat.st_size-readInput;
203 fread(outBuf_,toRead,1,src);
204 fwrite(outBuf_,toRead,1,des);
219 remove(openDatFilePath_.string().c_str());
223 if(processed_.value()!=0){
227 jsonMonitor_->outputFullJSON(outputJsonNameStream,ls.
luminosityBlock());
231 accepted_.value() = 0;
void addLegendItem(std::string const &name, std::string const &type, std::string const &operation)
virtual void stop() const
static void fillDescription(ParameterSetDescription &desc)
virtual void doOutputEvent(EventMsgBuilder const &msg) const
virtual void doOutputHeader(InitMsgBuilder const &init_message) const
virtual void beginLuminosityBlock(edm::LuminosityBlockPrincipal const &, edm::ModuleCallingContext const *)
virtual ~RecoEventOutputModuleForFU()
RecoEventOutputModuleForFU(edm::ParameterSet const &ps)
LuminosityBlockNumber_t luminosityBlock() const
tuple path
else: Piece not in the list, fine.
boost::shared_ptr< FastMonitor > jsonMonitor_
virtual void setName(std::string name)
evf::FastMonitoringService * fms_
DataPointDefinition outJsonDef_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::string stream_label_
std::auto_ptr< Consumer > c_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::pair< Binary, Binary > serialize(const T &payload, bool packingOnly=false)
virtual void start() const
void setDefaultGroup(std::string const &group)
boost::filesystem::path openDatFilePath_
virtual void endLuminosityBlock(edm::LuminosityBlockPrincipal const &, edm::ModuleCallingContext const *)