LDMX Software
Process.h
Go to the documentation of this file.
1
7#ifndef LDMXSW_FRAMEWORK_PROCESS_H_
8#define LDMXSW_FRAMEWORK_PROCESS_H_
9
10// LDMX
12#include "Framework/Configure/Parameters.h"
13#include "Framework/Exception/Exception.h"
14#include "Framework/Performance/Tracker.h"
15#include "Framework/RunHeader.h"
17
18// STL
19#include <csignal>
20#include <map>
21#include <memory>
22#include <vector>
23
24class TFile;
25class TDirectory;
26
27namespace framework {
28
29class EventProcessor;
30class EventFile;
31class Event;
32
37class Process {
38 public:
43 Process(const framework::config::Parameters &configuration);
44
51 ~Process();
52
57 const std::string &getPassName() const { return pass_name_; }
58
64 int getRunNumber() const;
65
70
74 const ldmx::RunHeader *getRunHeader() const { return run_header_; }
75
80
85 int getLogFrequency() const { return log_frequency_; }
86
90 void run();
91
96
100 TDirectory *makeHistoDirectory(const std::string &dirName);
101
105 TDirectory *openHistoFile();
106
111
116
117 private:
130 bool process(int n, int n_tries, Event &event) const;
131
138 void newRun(ldmx::RunHeader &header);
139
143 void onFileOpen(EventFile &file) const;
144
148 void onFileClose(EventFile &file) const;
149
150 private:
153
155 std::string pass_name_;
156
159
162
167
170
173
178
181
183 std::vector<EventProcessor *> sequence_;
184
187
190 std::vector<std::string> input_files_;
191
193 std::vector<std::string> output_files_;
194
203
205 std::vector<std::string> drop_keep_rules_;
206
209
211 std::string histo_filename_;
212
215
218
220 TFile *histo_t_file_{0};
221
224
226 enableLogging("Process");
227};
228
234typedef std::unique_ptr<Process> ProcessHandle;
235} // namespace framework
236
237#endif
Container and caching class for conditions information.
Definitions related to event storage control from an EventProcessor.
Container and cache for conditions and conditions providers.
Definition Conditions.h:43
This class manages all ROOT file input/output operations.
Definition EventFile.h:26
Implements an event buffer system for storing event data.
Definition Event.h:42
Class which represents the process under execution.
Definition Process.h:37
int log_frequency_
The frequency with which event info is printed.
Definition Process.h:169
std::vector< EventProcessor * > sequence_
Ordered list of EventProcessors to execute.
Definition Process.h:183
bool skip_corrupted_input_files_
allow the Process to skip input files that are corrupted
Definition Process.h:177
std::string histo_filename_
Filename for histograms and other user products.
Definition Process.h:211
int max_tries_
Maximum number of attempts to make before giving up on an event.
Definition Process.h:172
void requestFinish()
Request that the processing finish with this event.
Definition Process.h:95
int run_for_generation_
Run number to use if generating events.
Definition Process.h:208
void setEventHeader(ldmx::EventHeader *h)
Set the pointer to the current event header, used only for tests.
Definition Process.h:115
int compression_setting_
Compression setting to pass to output files.
Definition Process.h:202
void run()
Run the process.
Definition Process.cxx:153
int event_limit_
Limit on events to process.
Definition Process.h:158
std::string pass_name_
Processing pass name.
Definition Process.h:155
void newRun(ldmx::RunHeader &header)
Run through the processors and let them know that we are starting a new run.
Definition Process.cxx:484
TFile * histo_t_file_
TFile for histograms and other user products.
Definition Process.h:220
int getLogFrequency() const
Get the frequency with which the event information is printed.
Definition Process.h:85
const ldmx::RunHeader * getRunHeader() const
Get the pointer to the current run header, if defined.
Definition Process.h:74
TDirectory * openHistoFile()
Open a ROOT TFile to write histograms and TTrees.
Definition Process.cxx:462
int total_events_
Number of events we'd like to produce independetly of the number of tries it would take.
Definition Process.h:166
~Process()
Class Destructor.
Definition Process.cxx:139
void onFileClose(EventFile &file) const
File is begin closed.
Definition Process.cxx:571
std::vector< std::string > drop_keep_rules_
Set of drop/keep rules.
Definition Process.h:205
ldmx::RunHeader * run_header_
Pointer to the current RunHeader, used for Conditions information.
Definition Process.h:217
Conditions & getConditions()
Get a reference to the conditions system.
Definition Process.h:79
TDirectory * makeHistoDirectory(const std::string &dirName)
Construct a TDirectory* for the given module.
Definition Process.cxx:455
const ldmx::EventHeader * getEventHeader() const
Get the pointer to the current event header, if defined.
Definition Process.h:69
performance::Tracker * performance_
class with calls backs to track performance measurements of software
Definition Process.h:223
StorageControl & getStorageController()
Access the storage control unit for this process.
Definition Process.h:110
int min_events_
When reading a file in, what's the first event to read.
Definition Process.h:161
StorageControl storage_controller_
Storage controller.
Definition Process.h:180
std::vector< std::string > output_files_
List of output file names.
Definition Process.h:193
std::vector< std::string > input_files_
List of input files to process.
Definition Process.h:190
const std::string & getPassName() const
Get the processing pass label.
Definition Process.h:57
enableLogging("Process")
Turn on logging for our process.
const ldmx::EventHeader * event_header_
Pointer to the current EventHeader, used for Conditions information.
Definition Process.h:214
bool process(int n, int n_tries, Event &event) const
Process the input event through the sequence of processors.
Definition Process.cxx:519
void onFileOpen(EventFile &file) const
File is being opened.
Definition Process.cxx:557
Conditions conditions_
Set of ConditionsProviders.
Definition Process.h:186
Process(const framework::config::Parameters &configuration)
Class constructor.
Definition Process.cxx:29
int getRunNumber() const
Get the current run number or the run number to be used when initiating new events from the job.
Definition Process.cxx:451
framework::config::Parameters config_
The parameters used to configure this class.
Definition Process.h:152
Class which encapsulates storage control functionality, used by the Process class.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
Class to interface between framework::Process and various measurements that can eventually be written...
Definition Tracker.h:20
Provides header information an event such as event number and timestamp.
Definition EventHeader.h:44
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:57
All classes in the ldmx-sw project use this namespace.
std::unique_ptr< Process > ProcessHandle
A handle to the current process Used to pass a process from ConfigurePython to fire....
Definition Process.h:234