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"
13 
14 #include <cstddef> // For std::size_t.
15 #include <set>
16 #include <string>
17 #include <vector>
18 
19 namespace art {
20  class FileStatsCollector;
21 }
22 
24 public:
26  std::string const& processName);
27 
28  void recordFileOpen();
30  void recordEvent(EventID const& id);
31  void recordRun(RunID const& id);
32  void recordSubRun(SubRunID const& id);
33  void recordFileClose();
34 
35  std::string const& moduleLabel() const;
36  std::string const& processName() const;
37  boost::posix_time::ptime outputFileOpenTime() const;
38  boost::posix_time::ptime outputFileCloseTime() const;
39  boost::posix_time::ptime lowestRunStartTime() const;
40  boost::posix_time::ptime highestRunStartTime() const;
41  boost::posix_time::ptime lowestSubRunStartTime() const;
42  boost::posix_time::ptime highestSubRunStartTime() const;
43  RunID lowestRunID() const;
44  RunID highestRunID() const;
45  SubRunID const& lowestSubRunID() const;
46  SubRunID const& highestSubRunID() const;
47  EventID const& lowestEventID() const;
48  EventID const& highestEventID() const;
49  std::string const& lastOpenedInputFile() const;
50  std::vector<std::string> parents(bool want_basename = true) const;
51  bool fileCloseRecorded() const;
52  std::size_t eventsThisFile() const;
53  std::set<SubRunID> const& seenSubRuns() const;
54 
55 private:
56  void resetStatistics_(); // Does not rename.
57 
66  boost::posix_time::ptime fo_{};
67  boost::posix_time::ptime fc_{};
68  boost::posix_time::ptime lowestRunStartTime_{};
69  boost::posix_time::ptime highestRunStartTime_{};
70  boost::posix_time::ptime lowestSubRunStartTime_{};
71  boost::posix_time::ptime highestSubRunStartTime_{};
72  bool fileCloseRecorded_{false};
74  std::vector<std::string> inputFilesSeen_{};
75  std::size_t nEvents_{};
76  std::set<SubRunID> subRunsSeen_{};
77 };
78 
79 inline std::string const&
81 {
82  return moduleLabel_;
83 }
84 
85 inline std::string const&
87 {
88  return processName_;
89 }
90 
91 inline boost::posix_time::ptime
93 {
94  return fo_;
95 }
96 
97 inline boost::posix_time::ptime
99 {
100  return fc_;
101 }
102 
103 inline boost::posix_time::ptime
105 {
106  return lowestRunStartTime_;
107 }
108 
109 inline boost::posix_time::ptime
111 {
112  return highestRunStartTime_;
113 }
114 
115 inline boost::posix_time::ptime
117 {
118  return lowestSubRunStartTime_;
119 }
120 
121 inline boost::posix_time::ptime
123 {
125 }
126 
127 inline art::RunID
129 {
130  return lowestRun_;
131 }
132 
133 inline art::RunID
135 {
136  return highestRun_;
137 }
138 
139 inline art::SubRunID const&
141 {
142  return lowestSubRun_;
143 }
144 
145 inline art::SubRunID const&
147 {
148  return highestSubRun_;
149 }
150 
151 inline art::EventID const&
153 {
154  return lowestEventIDSeen_;
155 }
156 
157 inline art::EventID const&
159 {
160  return highestEventIDSeen_;
161 }
162 
163 inline std::string const&
165 {
166  return lastOpenedInputFile_;
167 }
168 
169 inline bool
171 {
172  return fileCloseRecorded_;
173 }
174 
175 inline std::size_t
177 {
178  return nEvents_;
179 }
180 
181 inline std::set<art::SubRunID> const&
183 {
184  return subRunsSeen_;
185 }
186 
187 #endif /* art_Framework_IO_FileStatsCollector_h */
188 
189 // Local Variables:
190 // mode: c++
191 // End:
std::string const & processName() const
std::string inputFileName("cmf_contour_3F_Th23Dmsq32_stat_only_500_uni.root")
FileStatsCollector(std::string const &moduleLabel, std::string const &processName)
SubRunID const & lowestSubRunID() const
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_
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
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_
enum BeamMode string