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"
14 
15 #include <cstddef> // For std::size_t.
16 #include <set>
17 #include <string>
18 #include <vector>
19 
20 namespace art {
21  class FileStatsCollector;
22 }
23 
25 public:
27  std::string const& processName);
28 
29  void recordFileOpen();
30  void recordInputFile(std::string const& inputFileName);
31  void recordEvent(EventID const& id);
32  void recordRun(RunID const& id);
33  void recordSubRun(SubRunID const& id);
34  void recordFileClose();
35 
36  std::string const& moduleLabel() const;
37  std::string const& processName() const;
38  boost::posix_time::ptime outputFileOpenTime() const;
39  boost::posix_time::ptime outputFileCloseTime() const;
40  boost::posix_time::ptime lowestRunStartTime() const;
41  boost::posix_time::ptime highestRunStartTime() const;
42  boost::posix_time::ptime lowestSubRunStartTime() const;
43  boost::posix_time::ptime highestSubRunStartTime() const;
44  RunID lowestRunID() const;
45  RunID highestRunID() const;
46  SubRunID const& lowestSubRunID() const;
47  SubRunID const& highestSubRunID() const;
48  EventID const& lowestEventID() const;
49  EventID const& highestEventID() const;
50  std::string const& lastOpenedInputFile() const;
51  std::vector<std::string> parents(bool want_basename = true) const;
52  bool fileCloseRecorded() const;
53  std::size_t eventsThisFile() const;
54  std::set<SubRunID> const& seenSubRuns() const;
55 
56 private:
57  void resetStatistics_(); // Does not rename.
58 
67  boost::posix_time::ptime fo_{};
68  boost::posix_time::ptime fc_{};
69  boost::posix_time::ptime lowestRunStartTime_{};
70  boost::posix_time::ptime highestRunStartTime_{};
71  boost::posix_time::ptime lowestSubRunStartTime_{};
72  boost::posix_time::ptime highestSubRunStartTime_{};
73  bool fileCloseRecorded_{false};
75  std::vector<std::string> inputFilesSeen_{};
76  std::size_t nEvents_{};
77  std::set<SubRunID> subRunsSeen_{};
78 };
79 
80 inline std::string const&
82 {
83  return moduleLabel_;
84 }
85 
86 inline std::string const&
88 {
89  return processName_;
90 }
91 
92 inline boost::posix_time::ptime
94 {
95  return fo_;
96 }
97 
98 inline boost::posix_time::ptime
100 {
101  return fc_;
102 }
103 
104 inline boost::posix_time::ptime
106 {
107  return lowestRunStartTime_;
108 }
109 
110 inline boost::posix_time::ptime
112 {
113  return highestRunStartTime_;
114 }
115 
116 inline boost::posix_time::ptime
118 {
119  return lowestSubRunStartTime_;
120 }
121 
122 inline boost::posix_time::ptime
124 {
126 }
127 
128 inline art::RunID
130 {
131  return lowestRun_;
132 }
133 
134 inline art::RunID
136 {
137  return highestRun_;
138 }
139 
140 inline art::SubRunID const&
142 {
143  return lowestSubRun_;
144 }
145 
146 inline art::SubRunID const&
148 {
149  return highestSubRun_;
150 }
151 
152 inline art::EventID const&
154 {
155  return lowestEventIDSeen_;
156 }
157 
158 inline art::EventID const&
160 {
161  return highestEventIDSeen_;
162 }
163 
164 inline std::string const&
166 {
167  return lastOpenedInputFile_;
168 }
169 
170 inline bool
172 {
173  return fileCloseRecorded_;
174 }
175 
176 inline std::size_t
178 {
179  return nEvents_;
180 }
181 
182 inline std::set<art::SubRunID> const&
184 {
185  return subRunsSeen_;
186 }
187 
188 #endif /* art_Framework_IO_FileStatsCollector_h */
189 
190 // Local Variables:
191 // mode: c++
192 // End:
std::string const & processName() const
FileStatsCollector(std::string const &moduleLabel, std::string const &processName)
SubRunID const & lowestSubRunID() const
std::string string
Definition: nybbler.cc:12
std::string const & moduleLabel() const
boost::posix_time::ptime fo_
boost::posix_time::ptime lowestRunStartTime() const
void recordRun(RunID const &id)
boost::posix_time::ptime highestRunStartTime_
void recordEvent(EventID const &id)
std::vector< std::string > inputFilesSeen_
boost::posix_time::ptime highestSubRunStartTime_
std::string const moduleLabel_
boost::posix_time::ptime fc_
std::vector< std::string > parents(bool want_basename=true) const
boost::posix_time::ptime lowestSubRunStartTime_
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
boost::posix_time::ptime lowestRunStartTime_
boost::posix_time::ptime highestRunStartTime() const
boost::posix_time::ptime highestSubRunStartTime() const
std::string const & lastOpenedInputFile() const
std::string const processName_
boost::posix_time::ptime lowestSubRunStartTime() const
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_