CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EvFDaqDirector.h
Go to the documentation of this file.
1 #ifndef EVENTFILTER_UTILTIES_PLUGINS_EVFDAQDIRECTOR
2 #define EVENTFILTER_UTILTIES_PLUGINS_EVFDAQDIRECTOR
3 
7 
8 #include "DirManager.h"
9 
10 //std headers
11 #include <string>
12 #include <sstream>
13 #include <iomanip>
14 #include <vector>
15 
16 //system headers
17 //#include <sys/types.h>
18 #include <sys/stat.h>
19 #include <fcntl.h>
20 #include <errno.h>
21 #include <string.h>
22 #include <stdio.h>
23 
24 namespace evf{
26  {
27  public:
28 
29  explicit EvFDaqDirector( const edm::ParameterSet &pset, edm::ActivityRegistry& reg );
31  void preBeginRun(edm::RunID const& id, edm::Timestamp const& ts);
32  void postEndRun(edm::Run const& run, edm::EventSetup const& es);
39 
43  unsigned int findHighestRun(){return dirManager_.findHighestRun();}
44  std::string getRawFilePath(const unsigned int ls, const unsigned int index) const;
45  std::string getOpenRawFilePath(const unsigned int ls, const unsigned int index) const;
46  std::string getOpenDatFilePath(const unsigned int ls, std::string const& stream) const;
47  std::string getOutputJsonFilePath(const unsigned int ls, std::string const& stream) const;
48  std::string getMergedDatFilePath(const unsigned int ls, std::string const& stream) const;
49  std::string getInitFilePath(std::string const& stream) const;
50  std::string getEoLSFilePathOnBU(const unsigned int ls) const;
51  std::string getEoLSFilePathOnFU(const unsigned int ls) const;
53  std::string getPathForFU() const;
54  void removeFile(unsigned int ls, unsigned int index);
55  void removeFile(std::string );
56  void updateBuLock(unsigned int ls);
57  int readBuLock();
58  // DEPRECATED
59  //int updateFuLock(unsigned int &ls);
60  bool updateFuLock(unsigned int& ls, std::string& nextFile, bool& eorSeen);
61  void writeLsStatisticsBU(unsigned int, unsigned int, unsigned long long, long long);
62  void writeLsStatisticsFU(unsigned int ls, unsigned int events, timeval completion_time){}
63  void writeDiskAndThrottleStat(double, int, int);
65  unsigned int getRunNumber() const { return run_; }
66  unsigned int getJumpLS() const { return jumpLS_; }
67  unsigned int getJumpIndex() const { return jumpIndex_; }
70  FILE * maybeCreateAndLockFileHeadForStream(unsigned int ls, std::string &stream);
72 
73  private:
74  bool bulock();
75  bool fulock();
76  // DEPRECATED
77  // bool copyRunDirToSlaves();
78  // This functionality is for emulator running only
79  bool mkFuRunDir();
80  // This functionality is for emulator running only
81  bool createOutputDirectory();
82  bool bumpFile(unsigned int& ls, unsigned int& index, std::string& nextFile);
83  bool findHighestActiveLS(unsigned int& startingLS) const;
84  void openFULockfileStream(std::string& fuLockFilePath, bool create);
85  std::string inputFileNameStem(const unsigned int ls, const unsigned int index) const;
86  std::string outputFileNameStem(const unsigned int ls, std::string const& stream) const;
87  std::string mergedFileNameStem(const unsigned int ls, std::string const& stream) const;
88  std::string initFileName(std::string const& stream) const;
89  std::string eolsFileName(const unsigned int ls) const;
90  std::string eorFileName() const;
91 
98  unsigned int run_;
99 
105 
110 
117 
119 
120  unsigned long previousFileSize_;
121  unsigned int jumpLS_, jumpIndex_;
122 
123  struct flock bu_w_flk;
124  struct flock bu_r_flk;
125  struct flock bu_w_fulk;
126  struct flock bu_r_fulk;
127  struct flock fu_rw_flk;
128  struct flock fu_rw_fulk;
129  struct flock data_rw_flk;
130  struct flock data_rw_fulk;
131  };
132 }
133 
134 #endif
135 
struct flock bu_w_fulk
unsigned int getJumpIndex() const
struct flock fu_rw_flk
std::string run_string_
void postEndRun(edm::Run const &run, edm::EventSetup const &es)
std::string outputFileNameStem(const unsigned int ls, std::string const &stream) const
void openFULockfileStream(std::string &fuLockFilePath, bool create)
std::string getInitFilePath(std::string const &stream) const
unsigned int findHighestRun()
Definition: DirManager.cc:7
std::string & baseDir()
struct flock bu_r_fulk
std::string getRawFilePath(const unsigned int ls, const unsigned int index) const
std::string getOpenRawFilePath(const unsigned int ls, const unsigned int index) const
struct flock data_rw_flk
std::string & buBaseDir()
unsigned int findHighestRun()
std::string eolsFileName(const unsigned int ls) const
std::string getEoLSFilePathOnBU(const unsigned int ls) const
std::string getEoRFilePath() const
std::string findHighestRunDirStem()
unsigned long previousFileSize_
std::string sm_base_dir_
unsigned int jumpIndex_
std::string getPathForFU() const
std::string monitor_base_dir_
struct flock fu_rw_fulk
std::string & smBaseDir()
EvFDaqDirector(const edm::ParameterSet &pset, edm::ActivityRegistry &reg)
std::string getMergedDatFilePath(const unsigned int ls, std::string const &stream) const
std::string & fuBaseDir()
bool updateFuLock(unsigned int &ls, std::string &nextFile, bool &eorSeen)
std::string getOpenDatFilePath(const unsigned int ls, std::string const &stream) const
std::string inputFileNameStem(const unsigned int ls, const unsigned int index) const
FILE * maybeCreateAndLockFileHeadForStream(unsigned int ls, std::string &stream)
std::string findHighestRunDir()
bool findHighestActiveLS(unsigned int &startingLS) const
std::string & monitorBaseDir()
std::string bu_base_dir_
std::string findCurrentRunDir()
void removeFile(unsigned int ls, unsigned int index)
void preBeginRun(edm::RunID const &id, edm::Timestamp const &ts)
void updateBuLock(unsigned int ls)
bool getTestModeNoBuilderUnit()
std::string getOutputJsonFilePath(const unsigned int ls, std::string const &stream) const
void writeLsStatisticsFU(unsigned int ls, unsigned int events, timeval completion_time)
struct flock bu_w_flk
std::string bu_run_dir_
std::string eorFileName() const
bool bumpFile(unsigned int &ls, unsigned int &index, std::string &nextFile)
std::string base_dir_
std::string findHighestRunDir()
Definition: DirManager.cc:20
std::string findRunDir(unsigned int)
Definition: DirManager.cc:37
tuple events
Definition: patZpeak.py:19
unsigned int getRunNumber() const
void writeDiskAndThrottleStat(double, int, int)
unsigned int jumpLS_
std::string getEoLSFilePathOnFU(const unsigned int ls) const
std::string getJumpFilePath() const
struct flock data_rw_fulk
unsigned int getJumpLS() const
std::string & buBaseOpenDir()
SurfaceDeformation * create(int type, const std::vector< double > &params)
struct flock bu_r_flk
std::string mergedFileNameStem(const unsigned int ls, std::string const &stream) const
void writeLsStatisticsBU(unsigned int, unsigned int, unsigned long long, long long)
Definition: Run.h:41
std::string bu_run_open_dir_
std::string initFileName(std::string const &stream) const