LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
FileStatsCollector.h
Go to the documentation of this file.
1 #ifndef art_Framework_IO_FileStatsCollector_h
2 #define art_Framework_IO_FileStatsCollector_h
3 
4 //===============================================================
5 // The FileStatsCollector stores only the information required to
6 // assemble the final name of the file. It does not assemble the
7 // filename itself--that is the role of the PostCloseFileRenamer.
8 //===============================================================
9 
10 #include "boost/date_time/posix_time/posix_time_types.hpp"
12 
13 #include <cstddef> // For std::size_t.
14 #include <set>
15 #include <string>
16 #include <vector>
17 
18 namespace art {
19  class FileStatsCollector;
20 }
21 
23 public:
24  FileStatsCollector(std::string const& moduleLabel,
25  std::string const& processName);
26 
27  void recordFileOpen();
28  void recordInputFile(std::string const& inputFileName);
29  void recordEvent(EventID const& id);
30  void recordRun(RunID const& id);
31  void recordSubRun(SubRunID const& id);
32  void recordFileClose();
33 
34  std::string const& moduleLabel() const;
35  std::string const& processName() const;
36  boost::posix_time::ptime outputFileOpenTime() const;
37  boost::posix_time::ptime outputFileCloseTime() const;
38  SubRunID const& lowestSubRunID() const;
39  SubRunID const& highestSubRunID() const;
40  EventID const& lowestEventID() const;
41  EventID const& highestEventID() const;
42  std::string const& lastOpenedInputFile() const;
43  std::vector<std::string> parents(bool want_basename = true) const;
44  bool fileCloseRecorded() const;
45  std::size_t eventsThisFile() const;
46  std::set<SubRunID> const& seenSubRuns() const;
47 
48 private:
49  void resetStatistics_(); // Does not rename.
50 
51  std::string const moduleLabel_;
52  std::string const processName_;
57  boost::posix_time::ptime fo_{};
58  boost::posix_time::ptime fc_{};
59  bool fileCloseRecorded_{false};
60  std::string lastOpenedInputFile_{};
61  std::vector<std::string> inputFilesSeen_{};
62  std::size_t nEvents_{};
63  std::set<SubRunID> subRunsSeen_{};
64 };
65 
66 inline std::string const&
68 {
69  return moduleLabel_;
70 }
71 
72 inline std::string const&
74 {
75  return processName_;
76 }
77 
78 inline boost::posix_time::ptime
80 {
81  return fo_;
82 }
83 
84 inline boost::posix_time::ptime
86 {
87  return fc_;
88 }
89 
90 inline art::SubRunID const&
92 {
93  return lowestSubRun_;
94 }
95 
96 inline art::SubRunID const&
98 {
99  return highestSubRun_;
100 }
101 
102 inline art::EventID const&
104 {
105  return lowestEventIDSeen_;
106 }
107 
108 inline art::EventID const&
110 {
111  return highestEventIDSeen_;
112 }
113 
114 inline std::string const&
116 {
117  return lastOpenedInputFile_;
118 }
119 
120 inline bool
122 {
123  return fileCloseRecorded_;
124 }
125 
126 inline std::size_t
128 {
129  return nEvents_;
130 }
131 
132 inline std::set<art::SubRunID> const&
134 {
135  return subRunsSeen_;
136 }
137 
138 #endif /* art_Framework_IO_FileStatsCollector_h */
139 
140 // Local Variables:
141 // mode: c++
142 // End:
std::string const & processName() const
FileStatsCollector(std::string const &moduleLabel, std::string const &processName)
SubRunID const & lowestSubRunID() const
std::string const & moduleLabel() const
boost::posix_time::ptime fo_
void recordRun(RunID const &id)
void recordEvent(EventID const &id)
std::vector< std::string > inputFilesSeen_
std::string const moduleLabel_
boost::posix_time::ptime fc_
std::vector< std::string > parents(bool want_basename=true) const
void recordSubRun(SubRunID const &id)
boost::posix_time::ptime outputFileOpenTime() const
void recordInputFile(std::string const &inputFileName)
SubRunID const & highestSubRunID() const
EventID const & highestEventID() const
std::string const & lastOpenedInputFile() const
std::string const processName_
HLT enums.
std::set< SubRunID > const & seenSubRuns() const
std::size_t eventsThisFile() const
EventID const & lowestEventID() const
boost::posix_time::ptime outputFileCloseTime() const
std::set< SubRunID > subRunsSeen_