CMS 3D CMS Logo

RawEventFileWriterForBU.h
Go to the documentation of this file.
1 #ifndef EVFRAWEVENTFILEWRITERFORBU
2 #define EVFRAWEVENTFILEWRITERFORBU
3 
4 // $Id: RawEventFileWriterForBU.h,v 1.1.2.5 2013/03/28 14:56:53 aspataru Exp $
5 
8 
10 
11 #include <fstream>
12 #include <cstdio>
13 #include <sys/types.h>
14 #include <sys/stat.h>
15 
16 #include "boost/shared_array.hpp"
17 
19 public:
20  explicit RawEventFileWriterForBU(edm::ParameterSet const& ps);
23 
24  void doOutputEvent(FRDEventMsgView const& msg);
25  void doOutputEvent(boost::shared_array<unsigned char>& msg){};
26  void doOutputEventFragment(unsigned char* dataPtr, unsigned long dataSize);
27  //void doFlushFile();
28  uint32 adler32() const { return (adlerb_ << 16) | adlera_; }
29 
30  void start() {}
31  void stop();
32  void initialize(std::string const& destinationDir, std::string const& name, int ls);
33  void endOfLS(int ls);
34  bool sharedMode() const { return false; }
35  void makeRunPrefix(std::string const& destinationDir);
36 
37 private:
38  bool closefd() {
39  if (outfd_ >= 0) {
40  close(outfd_);
41  outfd_ = -1;
42  return true;
43  } else
44  return false;
45  }
46  void finishFileWrite(int ls);
47  void writeJsds();
48  int outfd_ = -1;
49 
50  int run_ = -1;
52 
57 
63 
66 
70 
74  bool writtenJSDs_ = false;
75 
76  std::unique_ptr<std::ofstream> ost_;
79 
81  unsigned int frdFileVersion_;
82 
85 
86  unsigned int lumiOpen_ = 0;
87  unsigned int lumiClosed_ = 0;
88 };
89 #endif
jsoncollector::FastMonitor * fileMon_
void initialize(std::string const &destinationDir, std::string const &name, int ls)
jsoncollector::IntJ perLumiLostEventCount_
std::unique_ptr< std::ofstream > ost_
jsoncollector::IntJ perFileEventCount_
jsoncollector::DataPointDefinition eolJsonDef_
jsoncollector::IntJ perRunLumiCount_
jsoncollector::IntJ perRunLastLumi_
jsoncollector::DataPointDefinition eorJsonDef_
jsoncollector::IntJ perLumiFileCount_
jsoncollector::IntJ perRunEventCount_
void doOutputEventFragment(unsigned char *dataPtr, unsigned long dataSize)
void doOutputEvent(boost::shared_array< unsigned char > &msg)
jsoncollector::IntJ perLumiEventCount_
jsoncollector::IntJ perLumiSize_
jsoncollector::FastMonitor * runMon_
jsoncollector::IntJ perRunFileCount_
RawEventFileWriterForBU(edm::ParameterSet const &ps)
unsigned int uint32
Definition: MsgTools.h:13
jsoncollector::DataPointDefinition rawJsonDef_
def ls(path, rec=False)
Definition: eostools.py:349
tuple msg
Definition: mps_check.py:285
jsoncollector::IntJ perLumiTotalEventCount_
jsoncollector::IntJ perFileSize_
void makeRunPrefix(std::string const &destinationDir)
void doOutputEvent(FRDEventMsgView const &msg)
jsoncollector::FastMonitor * lumiMon_