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/Performance/Tracker.h"
14#include "Framework/RunHeader.h"
16
17// STL
18#include <memory>
19#include <vector>
20
21class TFile;
22class TDirectory;
23
24namespace framework {
25
26class EventProcessor;
27class EventFile;
28class Event;
29
34class Process {
35 public:
40 Process(const framework::config::Parameters& configuration);
41
48 ~Process();
49
54 const std::string& getPassName() const { return pass_name_; }
55
61 int getRunNumber() const;
62
67
71 const ldmx::RunHeader* getRunHeader() const { return run_header_; }
72
77
82 int getLogFrequency() const { return log_frequency_; }
83
87 void run();
88
93
97 TDirectory* makeHistoDirectory(const std::string& dirName);
98
102 TDirectory* openHistoFile();
103
108
113
114 private:
127 bool process(int n, int n_tries, Event& event) const;
128
139 void newRun(ldmx::RunHeader& header, EventFile* out);
140
144 void onFileOpen(EventFile& file) const;
145
149 void onFileClose(EventFile& file) const;
150
151 private:
154
156 std::string pass_name_;
157
160
163
168
171
174
179
187
190
192 std::vector<EventProcessor*> sequence_;
193
196
199 std::vector<std::string> input_files_;
200
202 std::vector<std::string> output_files_;
203
212
214 std::vector<std::string> drop_keep_rules_;
215
218
220 std::string histo_filename_;
221
224
227
229 TFile* histo_t_file_{0};
230
233
235 enableLogging("Process");
236};
237
243typedef std::unique_ptr<Process> ProcessHandle;
244} // namespace framework
245
246#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:40
This class manages all ROOT file input/output operations.
Definition EventFile.h:28
Implements an event buffer system for storing event data.
Definition Event.h:40
Class which represents the process under execution.
Definition Process.h:34
int log_frequency_
The frequency with which event info is printed.
Definition Process.h:170
bool skip_corrupted_input_files_
allow the Process to skip input files that are corrupted
Definition Process.h:178
std::string histo_filename_
Filename for histograms and other user products.
Definition Process.h:220
int max_tries_
Maximum number of attempts to make before giving up on an event.
Definition Process.h:173
void requestFinish()
Request that the processing finish with this event.
Definition Process.h:92
int run_for_generation_
Run number to use if generating events.
Definition Process.h:217
void setEventHeader(ldmx::EventHeader *h)
Set the pointer to the current event header, used only for tests.
Definition Process.h:112
int compression_setting_
Compression setting to pass to output files.
Definition Process.h:211
void run()
Run the process.
Definition Process.cxx:157
int event_limit_
Limit on events to process.
Definition Process.h:159
std::string pass_name_
Processing pass name.
Definition Process.h:156
TFile * histo_t_file_
TFile for histograms and other user products.
Definition Process.h:229
int getLogFrequency() const
Get the frequency with which the event information is printed.
Definition Process.h:82
bool allow_incomplete_input_files_
allow the Process to read input files whose runs never finished
Definition Process.h:186
const ldmx::RunHeader * getRunHeader() const
Get the pointer to the current run header, if defined.
Definition Process.h:71
TDirectory * openHistoFile()
Open a ROOT TFile to write histograms and TTrees.
Definition Process.cxx:494
int total_events_
Number of events we'd like to produce independetly of the number of tries it would take.
Definition Process.h:167
~Process()
Class Destructor.
Definition Process.cxx:143
void onFileClose(EventFile &file) const
File is begin closed.
Definition Process.cxx:605
std::vector< EventProcessor * > sequence_
Ordered list of EventProcessors to execute.
Definition Process.h:192
std::vector< std::string > drop_keep_rules_
Set of drop/keep rules.
Definition Process.h:214
ldmx::RunHeader * run_header_
Pointer to the current RunHeader, used for Conditions information.
Definition Process.h:226
Conditions & getConditions()
Get a reference to the conditions system.
Definition Process.h:76
TDirectory * makeHistoDirectory(const std::string &dirName)
Construct a TDirectory* for the given module.
Definition Process.cxx:487
const ldmx::EventHeader * getEventHeader() const
Get the pointer to the current event header, if defined.
Definition Process.h:66
performance::Tracker * performance_
class with calls backs to track performance measurements of software
Definition Process.h:232
StorageControl & getStorageController()
Access the storage control unit for this process.
Definition Process.h:107
int min_events_
When reading a file in, what's the first event to read.
Definition Process.h:162
StorageControl storage_controller_
Storage controller.
Definition Process.h:189
std::vector< std::string > output_files_
List of output file names.
Definition Process.h:202
void newRun(ldmx::RunHeader &header, EventFile *out)
Run through the processors and let them know that we are starting a new run.
Definition Process.cxx:516
std::vector< std::string > input_files_
List of input files to process.
Definition Process.h:199
const std::string & getPassName() const
Get the processing pass label.
Definition Process.h:54
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:223
bool process(int n, int n_tries, Event &event) const
Process the input event through the sequence of processors.
Definition Process.cxx:553
void onFileOpen(EventFile &file) const
File is being opened.
Definition Process.cxx:591
Conditions conditions_
Set of ConditionsProviders.
Definition Process.h:195
Process(const framework::config::Parameters &configuration)
Class constructor.
Definition Process.cxx:30
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:483
framework::config::Parameters config_
The parameters used to configure this class.
Definition Process.h:153
Class which encapsulates storage control functionality, used by the Process class.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
Class to interface between framework::Process and various measurements that can eventually be written...
Definition Tracker.h:18
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:68
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:243