CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMFileIterator.h
Go to the documentation of this file.
1 #ifndef IOPool_DQMStreamer_DQMFilerIterator_h
2 #define IOPool_DQMStreamer_DQMFilerIterator_h
3 
7 
8 #include "boost/filesystem.hpp"
9 
10 #include <memory>
11 #include <string>
12 #include <queue>
13 #include <iterator>
14 #include <chrono>
15 #include <boost/property_tree/json_parser.hpp>
16 #include <boost/property_tree/ptree.hpp>
17 
18 namespace edm {
19 
21  public:
22  enum JsonType {
25  };
26 
27  struct LumiEntry {
28  int ls;
29 
30  std::size_t n_events;
32 
33  static LumiEntry load_json(const std::string& filename, int lumiNumber, JsonType type);
34  };
35 
36  struct EorEntry {
37  bool loaded = false;
38 
39  std::size_t n_events;
40  std::size_t n_lumi;
42 
43  static EorEntry load_json(const std::string& filename);
44  };
45 
46  enum State {
47  OPEN = 0,
48  EOR_CLOSING = 1, // EoR file found, but lumis are still pending
49  EOR = 2,
50  };
51 
52 
53  DQMFileIterator(ParameterSet const& pset, JsonType t);
55  void initialise(int run, const std::string&, const std::string&);
56 
57  State state();
58 
59  /* methods to iterate the actual files */
60  const LumiEntry& front();
61  void pop();
62  bool hasNext();
63 
66  std::string make_path_data(const LumiEntry& lumi);
67 
68  /* control */
69  void reset();
70  void collect();
71  void update_state();
72 
73  /* misc helpers for input sources */
74  void logFileAction(const std::string& msg,
75  const std::string& fileName = "") const;
76  void delay();
77  void updateWatchdog();
78  unsigned int runNumber() {
79  return runNumber_;
80  };
81 
83 
84  private:
86 
87  unsigned int runNumber_;
90  unsigned int delayMillis_;
91 
93 
97  std::queue<LumiEntry> queue_;
98 
99  std::chrono::high_resolution_clock::time_point last_collect_;
100 };
101 
102 } /* end of namespace */
103 #endif
type
Definition: HCALResponse.h:21
void initialise(int run, const std::string &, const std::string &)
std::string make_path_data(const LumiEntry &lumi)
static LumiEntry load_json(const std::string &filename, int lumiNumber, JsonType type)
std::string make_path_jsn(int lumi)
tuple lumi
Definition: fjr2json.py:35
DQMFileIterator(ParameterSet const &pset, JsonType t)
std::string runInputDir_
std::string make_path_eor()
std::chrono::high_resolution_clock::time_point last_collect_
const LumiEntry & front()
void logFileAction(const std::string &msg, const std::string &fileName="") const
static void fillDescription(ParameterSetDescription &d)
unsigned int runNumber()
unsigned int delayMillis_
std::string streamLabel_
static EorEntry load_json(const std::string &filename)
tuple filename
Definition: lut2db_cfg.py:20
std::queue< LumiEntry > queue_
unsigned int runNumber_