LDMX Software
Process.cxx
Go to the documentation of this file.
1
6#include "Framework/Process.h"
7
8#include <dlfcn.h>
9
10#include <iostream>
11#include <memory>
12#include <set>
13
14#include "Framework/Event.h"
15#include "Framework/EventFile.h"
17#include "Framework/Exception/Exception.h"
18#include "Framework/Logger.h"
19#include "Framework/NtupleManager.h"
20#include "Framework/RunHeader.h"
21#include "TFile.h"
22#include "TROOT.h"
23
24// Preemption flag that can be set by signal handlers
25// NOLINTNEXTLINE(readability-identifier-naming)
26volatile std::sig_atomic_t preemption_received_ = 0;
27
28namespace framework {
29
31 : conditions_{*this} {
32 config_ = configuration;
33
34 pass_name_ = configuration.get<std::string>("pass_name", "");
35 histo_filename_ = configuration.get<std::string>("histogram_file", "");
36
37 max_tries_ = configuration.get<int>("max_tries_per_event", 1);
38 event_limit_ = configuration.get<int>("max_events", -1);
39 min_events_ = configuration.get<int>("min_events", -1);
40 total_events_ = configuration.get<int>("total_events", -1);
41 log_frequency_ = configuration.get<int>("log_frequency", -1);
42 compression_setting_ = configuration.get<int>("compression_setting", 9);
44 configuration.get<bool>("skip_corrupted_input_files", false);
46 configuration.get<bool>("allow_incomplete_input_files", false);
47
48 input_files_ = configuration.get<std::vector<std::string>>("input_files", {});
50 configuration.get<std::vector<std::string>>("output_files", {});
51 drop_keep_rules_ = configuration.get<std::vector<std::string>>("keep", {});
52
53 event_header_ = 0;
54
55 // set up the logging for this run
56 logging::open(configuration.get<framework::config::Parameters>("logger", {}));
57
58 auto run{configuration.get<int>("run", -1)};
59 if (run > 0) run_for_generation_ = run;
60
61 auto libs{configuration.get<std::vector<std::string>>("libraries", {})};
62 std::set<std::string> libraries_loaded;
63 for (const auto& lib : libs) {
64 if (libraries_loaded.find(lib) != libraries_loaded.end()) {
65 continue;
66 }
67
68 void* handle = dlopen(lib.c_str(), RTLD_NOW);
69 if (handle == nullptr) {
70 EXCEPTION_RAISE("LibraryLoadFailure",
71 "Error loading library '" + lib + "':" + dlerror());
72 }
73
74 libraries_loaded.insert(lib);
75 }
76
78 configuration.get<bool>("skim_default_is_keep", true));
79 auto skim_rules{
80 configuration.get<std::vector<std::string>>("skim_rules", {})};
81 for (size_t i = 0; i < skim_rules.size(); i += 2) {
82 storage_controller_.addRule(skim_rules[i], skim_rules[i + 1]);
83 }
84
85 auto sequence{configuration.get<std::vector<framework::config::Parameters>>(
86 "sequence", {})};
87 if (sequence.empty() && configuration.get<bool>("testing_mode", false)) {
88 EXCEPTION_RAISE(
89 "NoSeq",
90 "No sequence has been defined. What should I be doing?\nUse "
91 "p.sequence to tell me what processors to run.");
92 }
93 for (auto proc : sequence) {
94 auto class_name{proc.get<std::string>("class_name")};
95 auto instance_name{proc.get<std::string>("instance_name")};
96 auto ep{
97 EventProcessor::Factory::get().make(class_name, instance_name, *this)};
98 if (not ep) {
99 EXCEPTION_RAISE("UnableToCreate",
100 "The EventProcessor Factory was unable to create " +
101 instance_name + " of type " + class_name +
102 ". Did you inherit from framework::Producer or "
103 "framework::Analyzer? "
104 "Did you DECLARE_PRODUCER or DECLARE_ANALYZER in the "
105 "implementation (.cxx) file? "
106 "Did you use the class's full name (including "
107 "namespaces) in the Python configuration class? "
108 "Does the Python configuration class reference the "
109 "correct library it is a part of?");
110 }
111 auto histograms{
112 proc.get<std::vector<framework::config::Parameters>>("histograms", {})};
113 if (!histograms.empty()) {
114 ep.value()->getHistoDirectory();
115 ep.value()->createHistograms(histograms);
116 }
117 ep.value()->configure(proc);
118 sequence_.push_back(ep.value());
119 }
120
121 auto conditions_object_providers{
122 configuration.get<std::vector<framework::config::Parameters>>(
123 "conditions_object_providers", {})};
124 for (auto cop : conditions_object_providers) {
125 auto class_name{cop.get<std::string>("class_name")};
126 auto object_name{cop.get<std::string>("object_name")};
127 auto tag_name{cop.get<std::string>("tag_name")};
128 conditions_.createConditionsObjectProvider(class_name, object_name,
129 tag_name, cop);
130 }
131
132 bool log_performance = configuration.get<bool>("log_performance", false);
133 if (log_performance) {
134 std::vector<std::string> names{sequence_.size()};
135 for (std::size_t i{0}; i < sequence_.size(); i++) {
136 names[i] = sequence_[i]->getName();
137 }
139 new performance::Tracker(makeHistoDirectory("performance"), names);
140 }
141}
142
144 // need to delete the performance object so that it is
145 // written before we close the histogram file below
146 if (performance_) delete performance_;
147 for (EventProcessor* ep : sequence_) {
148 delete ep;
149 }
150 if (histo_t_file_) {
151 histo_t_file_->Write();
152 delete histo_t_file_;
153 histo_t_file_ = 0;
154 }
155}
156
159
160 // Counter to keep track of the number of events that have been
161 // procesed
162 auto n_events_processed{0};
163
164 // make sure the ntuple manager is in a blank state
166
167 // event bus for this process
168 Event the_event(pass_name_);
169 // the EventHeader object is created with the event bus as
170 // one of its members, we obtain a pointer for the header
171 // here so we can share it with the conditions system
172 event_header_ = the_event.getEventHeaderPtr();
174
175 // Start by notifying everyone that modules processing is beginning
176 std::size_t i_proc{0};
177 if (performance_)
178 performance_->start(performance::Callback::onProcessStart, 0);
180 for (auto proc : sequence_) {
181 i_proc++;
182 if (performance_)
183 performance_->start(performance::Callback::onProcessStart, i_proc);
184 proc->onProcessStart();
185 if (performance_)
186 performance_->stop(performance::Callback::onProcessStart, i_proc);
187 }
188 if (performance_)
189 performance_->stop(performance::Callback::onProcessStart, 0);
190
191 // If we have no input files, but do have an event number, run for
192 // that number of events and generate an output file.
193 if (input_files_.empty() && event_limit_ > 0) {
194 if (output_files_.empty()) {
195 EXCEPTION_RAISE("InvalidConfig",
196 "No input files or output files were given.");
197 } else if (output_files_.size() > 1) {
198 ldmx_log(warn) << "Several output files given with no input files. "
199 << "Only the first output file '" << output_files_.at(0)
200 << "' will be used.";
201 }
202 std::string output_file_name = output_files_.at(0);
203
204 // Configure the event file to create an output file with no parent. This
205 // requires setting the parameters isOutputFile and isSingleOutput to true.
206 EventFile out_file(config_, output_file_name, nullptr, true, true, false);
207 onFileOpen(out_file);
208 out_file.setupEvent(&the_event);
209
210 for (auto rule : drop_keep_rules_) out_file.addDrop(rule);
211
212 auto run_header = std::make_shared<ldmx::RunHeader>(run_for_generation_);
213 run_header->setRunStart(std::time(nullptr)); // set run starting
214 run_header_ = run_header.get(); // give handle to run header to process
215 out_file.writeRunHeader(run_header); // add run header to file
216
217 newRun(*run_header, &out_file);
218
219 int total_tries = 0; // total number of tries for entire run
220 int num_tries = 0; // number of tries for the current event number
221 int event_limit = event_limit_;
222 if (total_events_ > 0) {
223 // Have a warning at the first event
224 if (num_tries == 0)
225 ldmx_log(warn) << "The total_events was set, so max_events and "
226 "max_tries_per_event will be ignored!";
227 event_limit = total_events_;
228 }
229 while (n_events_processed < event_limit) {
230 // Check for preemption before processing each event
231 if (preemption_received_) {
232 ldmx_log(fatal)
233 << "Preemption signal received, stopping event generation";
234 break;
235 }
236
237 total_tries++;
238 num_tries++;
239
240 ldmx::EventHeader& eh = the_event.getEventHeader();
242 eh.setEventNumber(n_events_processed + 1);
243 eh.setTimestamp(TTimeStamp());
244
245 // reset the storage controller state
248
249 bool completed = process(n_events_processed, num_tries, the_event);
250
251 out_file.nextEvent(storage_controller_.keepEvent(completed));
252
253 // reset try counter only on successfully completed events
254 if (completed) num_tries = 0;
255
256 // we use modulo here insetad of >= because we want to carry
257 // the number of tries across the number of events processed boundary
258 // total_events_ is set let's not exit until that's reached
259 if (completed or (total_events_ < 0 and num_tries % max_tries_ == 0)) {
260 n_events_processed++; // increment events made
261 NtupleManager::getInstance().fill(); // fill ntuples
262 }
263
265 }
266
267 onFileClose(out_file);
268
269 run_header->setRunEnd(std::time(nullptr));
270 run_header->setNumTries(total_tries);
271 out_file.writeRunTree(not preemption_received_);
272
273 // Give a warning that this filter has very low efficiency
274 if (n_events_processed < total_tries / 10000) { // integer division is okay
275 ldmx_log(warn)
276 << "Less than 1 event out of every 10k events tried was accepted!";
277 ldmx_log(warn)
278 << "This could be an issue with your filtering and biasing procedure "
279 "since this is incredibly inefficient.";
280 }
281
282 } else {
283 // there are input files
284
285 EventFile* out_file(0);
286
287 bool single_output = false;
288 if (output_files_.size() == 1) {
289 single_output = true;
290 } else if (!output_files_.empty() and
291 output_files_.size() != input_files_.size()) {
292 EXCEPTION_RAISE("Process",
293 "Unable to handle case of different number of input and "
294 "output files (other than zero/one ouput file).");
295 }
296
297 // next, loop through the files
298 int ifile = 0;
299 int was_run = -1;
300 for (auto infilename : input_files_) {
301 EventFile in_file(config_, infilename);
302 if (in_file.isCorrupted()) {
304 ldmx_log(warn) << "Input file '" << infilename
305 << "' was found to be corrupted. Skipping.";
306 continue;
307 } else {
308 EXCEPTION_RAISE(
309 "BadCode",
310 "We should never get here. "
311 "EventFile is corrupted but we aren't skipping corrupted inputs. "
312 "EventFile should be throwing its own exceptions in this case.");
313 }
314 }
315
316 auto incomplete_runs{in_file.getIncompleteRuns()};
317 if (not incomplete_runs.empty()) {
318 std::string run_list;
319 for (int run : incomplete_runs) {
320 if (not run_list.empty()) run_list += ", ";
321 run_list += std::to_string(run);
322 }
324 ldmx_log(warn) << "Input file '" << infilename << "' holds run(s) "
325 << run_list
326 << " that were never finished, so events are missing. "
327 "Processing it anyway because "
328 "'allow_incomplete_input_files' is set.";
329 } else {
330 EXCEPTION_RAISE(
331 "IncompleteInput",
332 "Input file '" + infilename + "' holds run(s) " + run_list +
333 " that were never finished, so events are missing from the "
334 "end of them. Set 'allow_incomplete_input_files' on the "
335 "Process to read it anyway, but know that the sample it "
336 "gives you is biased.");
337 }
338 }
339
340 ldmx_log(info) << "Opening file " << infilename;
341 onFileOpen(in_file);
342
343 // configure event file that will be iterated over
344 EventFile* master_file;
345 if (!output_files_.empty()) {
346 // setup new output file if either
347 // 1) we are not in single output mode
348 // 2) this is the first input file
349 if (!single_output or ifile == 0) {
350 // setup new output file
351 out_file = new EventFile(config_, output_files_[ifile], &in_file,
352 single_output);
353 ifile++;
354
355 // setup theEvent we will iterate over
356 if (out_file) {
357 out_file->setupEvent(&the_event);
358 master_file = out_file;
359 } else {
360 EXCEPTION_RAISE("Process", "Unable to construct output file for " +
361 output_files_[ifile]);
362 }
363
364 for (auto rule : drop_keep_rules_) out_file->addDrop(rule);
365
366 } else {
367 // all other input files
368 out_file->updateParent(&in_file);
369 master_file = out_file;
370
371 } // check if in singleOutput mode
372
373 } else {
374 // empty output file list, use inputFile as master file
375 in_file.setupEvent(&the_event);
376 master_file = &in_file;
377 }
378
379 // In case we'd like to skip up to the event of min_events_
380 while (n_events_processed < (min_events_ - 1) &&
381 master_file->nextEvent(false)) {
382 n_events_processed++;
383 }
384
385 bool event_completed = true;
386 while (!preemption_received_ &&
387 master_file->nextEvent(
388 storage_controller_.keepEvent(event_completed)) &&
389 ((event_limit_ < 0) || (n_events_processed < event_limit_))) {
390 // clean up for storage control calculation
393
394 // notify for new run if necessary
395 if (the_event.getEventHeader().getRun() != was_run) {
396 was_run = the_event.getEventHeader().getRun();
397 ldmx::RunHeader* rh{master_file->getRunHeaderPtr(was_run)};
398 if (rh != nullptr) {
399 run_header_ = rh;
400 ldmx_log(info) << "Got new run header from '"
401 << master_file->getFileName() << "'";
402 newRun(*run_header_, out_file);
403 } else {
404 // no header means no newRun, so conditions stay uninitialised
405 EXCEPTION_RAISE(
406 "MissingRunHeader",
407 "Run header for run " + std::to_string(was_run) +
408 " was not found in '" + master_file->getFileName() +
409 "'. Conditions cannot be initialised without it.");
410 }
411 }
412
413 event_completed = process(n_events_processed, 1, the_event);
414
415 if (event_completed) NtupleManager::getInstance().fill();
417
418 n_events_processed++;
419 } // loop through events
420
421 if (preemption_received_) {
422 ldmx_log(fatal) << "Preemption signal received, stopping event "
423 "processing and closing files";
424 }
425
426 bool leave_early{false};
427 if (event_limit_ > 0 && n_events_processed == event_limit_) {
428 ldmx_log(info) << "Reached event limit of " << event_limit_
429 << " events";
430 leave_early = true;
431 }
432
433 if (event_limit_ == 0 && n_events_processed > event_limit_) {
434 ldmx_log(warn) << "Processing interrupted";
435 leave_early = true;
436 }
437
438 ldmx_log(info) << "Closing file " << infilename;
439 onFileClose(in_file);
440
441 // Reset the event in case of multiple input files
442 the_event.onEndOfFile();
443
444 if (out_file and !single_output) {
445 out_file->writeRunTree(not preemption_received_);
446 delete out_file;
447 out_file = nullptr;
448 }
449
450 if (leave_early) {
451 break;
452 }
453 } // loop through input files
454
455 if (out_file) {
456 // close outFile
457 // outFile would survive to here in single output mode
458 out_file->writeRunTree(not preemption_received_);
459 delete out_file;
460 out_file = nullptr;
461 }
462
463 } // are there input files? if-else tree
464
465 // finally, notify everyone that we are stopping
466 if (performance_) performance_->start(performance::Callback::onProcessEnd, 0);
467 i_proc = 0;
468 for (auto proc : sequence_) {
469 i_proc++;
470 if (performance_)
471 performance_->start(performance::Callback::onProcessEnd, i_proc);
472 proc->onProcessEnd();
473 if (performance_)
474 performance_->stop(performance::Callback::onProcessEnd, i_proc);
475 }
476 if (performance_) performance_->stop(performance::Callback::onProcessEnd, 0);
477
478 // we're done so let's close up the logging
479 logging::close();
481}
482
486
487TDirectory* Process::makeHistoDirectory(const std::string& dirName) {
488 auto owner{openHistoFile()};
489 TDirectory* child = owner->mkdir((char*)dirName.c_str());
490 if (child) child->cd();
491 return child;
492}
493
495 TDirectory* owner{nullptr};
496
497 if (histo_filename_.empty()) {
498 // trying to write histograms/ntuples but no file defined
499 EXCEPTION_RAISE(
500 "NoHistFileName",
501 "You did not provide the necessary histogram file name to "
502 "put your histograms (or performance data) in.\n Provide this "
503 "name in the python configuration with 'p.histogramFile = "
504 "\"myHistFile.root\"' where p is the Process object.");
505 } else if (histo_t_file_ == nullptr) {
506 histo_t_file_ = new TFile(histo_filename_.c_str(), "RECREATE");
507 owner = histo_t_file_;
508 } else {
509 owner = histo_t_file_;
510 }
511 owner->cd();
512
513 return owner;
514}
515
517 // Producers are allowed to put parameters into
518 // the run header through 'beforeNewRun' method
519
520 // Put the version into the rh string param
521 header.setStringParameter("Pass = " + pass_name_ + ", version",
522 LDMXSW_VERSION);
523 if (performance_) performance_->start(performance::Callback::beforeNewRun, 0);
524 std::size_t i_proc{0};
525 for (auto proc : sequence_) {
526 i_proc++;
527 if (performance_)
528 performance_->start(performance::Callback::beforeNewRun, i_proc);
529 proc->beforeNewRun(header);
530 if (performance_)
531 performance_->stop(performance::Callback::beforeNewRun, i_proc);
532 }
533 if (performance_) performance_->stop(performance::Callback::beforeNewRun, 0);
534 // now run header has been modified by Producers,
535 // it is valid to read from for everyone else in 'onNewRun'
536 // header is final, so write it now in case we are killed
537 if (out) out->writeRunTree();
538 if (performance_) performance_->start(performance::Callback::onNewRun, 0);
539 conditions_.onNewRun(header);
540 i_proc = 0;
541 for (auto proc : sequence_) {
542 i_proc++;
543 if (performance_)
544 performance_->start(performance::Callback::onNewRun, i_proc);
545 proc->onNewRun(header);
546 if (performance_)
547 performance_->stop(performance::Callback::onNewRun, i_proc);
548 }
549 if (performance_) performance_->stop(performance::Callback::onNewRun, 0);
550 ldmx_log(info) << header;
551}
552
553bool Process::process(int n, int n_try, Event& event) const {
554 if ((log_frequency_ != -1) && ((n + 1) % log_frequency_ == 0) &&
555 (n_try < 2)) {
556 // only printout event counter if we've enabled log frequency, the event
557 // matches the frequency and we are on the first try
558 TTimeStamp t;
559 ldmx_log(info) << "Processing " << n + 1 << " Run "
560 << event.getEventHeader().getRun() << " Event "
561 << event.getEventHeader().getEventNumber() << " ("
562 << t.AsString("lc") << ")";
563 }
564
565 if (performance_) performance_->start(performance::Callback::process, 0);
566 std::size_t i_proc{0};
567 try {
568 for (auto proc : sequence_) {
569 i_proc++;
570 if (performance_)
571 performance_->start(performance::Callback::process, i_proc);
572 proc->process(event);
573 if (performance_)
574 performance_->stop(performance::Callback::process, i_proc);
575 }
576 } catch (AbortEventException&) {
577 if (performance_) {
578 performance_->stop(performance::Callback::process, i_proc);
579 performance_->stop(performance::Callback::process, 0);
580 performance_->endEvent(false);
581 }
582 return false;
583 }
584 if (performance_) {
585 performance_->stop(performance::Callback::process, 0);
586 performance_->endEvent(true);
587 }
588 return true;
589}
590
592 if (performance_) performance_->start(performance::Callback::onFileOpen, 0);
593 std::size_t i_proc{0};
594 for (auto proc : sequence_) {
595 i_proc++;
596 if (performance_)
597 performance_->start(performance::Callback::onFileOpen, i_proc);
598 proc->onFileOpen(file);
599 if (performance_)
600 performance_->stop(performance::Callback::onFileOpen, i_proc);
601 }
602 if (performance_) performance_->stop(performance::Callback::onFileOpen, 0);
603}
604
606 if (performance_) performance_->start(performance::Callback::onFileClose, 0);
607 std::size_t i_proc{0};
608 for (auto proc : sequence_) {
609 i_proc++;
610 if (performance_)
611 performance_->start(performance::Callback::onFileClose, i_proc);
612 proc->onFileClose(file);
613 if (performance_)
614 performance_->stop(performance::Callback::onFileClose, i_proc);
615 }
616 if (performance_) performance_->stop(performance::Callback::onFileClose, 0);
617}
618
619} // namespace framework
Base classes for all user event processing components to extend.
Class implementing an event buffer system for storing event data.
Class which represents the process under execution.
Specific exception used to abort an event.
void onProcessStart()
Calls onProcessStart for all ConditionsObjectProviders.
void onNewRun(ldmx::RunHeader &)
Calls onNewRun for all ConditionsObjectProviders.
void createConditionsObjectProvider(const std::string &classname, const std::string &instancename, const std::string &tagname, const framework::config::Parameters &params)
Create a ConditionsObjectProvider given the information.
This class manages all ROOT file input/output operations.
Definition EventFile.h:28
void updateParent(EventFile *parent)
Change pointer to different parent file.
const std::string & getFileName()
Definition EventFile.h:261
void addDrop(const std::string &rule)
Add a rule for dropping collections from the output.
void setupEvent(Event *evt)
Set an Event object containing the event data to work with this file.
void writeRunHeader(std::shared_ptr< ldmx::RunHeader > runHeader)
Write the run header into the run map.
bool nextEvent(bool storeCurrentEvent=true)
Prepare the next event.
void writeRunTree(bool completed=false)
Write the map of run headers to the file as a TTree of RunHeader.
ldmx::RunHeader * getRunHeaderPtr(int runNumber)
Update the RunHeader for a given run, if it exists in the input file.
std::vector< int > getIncompleteRuns() const
The runs in this file whose writer did not close cleanly.
bool isCorrupted() const
Check if the file we have is corrupted.
Base class for all event processing components.
Implements an event buffer system for storing event data.
Definition Event.h:42
int getEventNumber() const
Get the event number.
Definition Event.h:81
void onEndOfFile()
Perform end of file action.
Definition Event.cxx:186
ldmx::EventHeader & getEventHeader()
Get the event header.
Definition Event.h:59
const ldmx::EventHeader * getEventHeaderPtr()
Get the event header as a pointer.
Definition Event.h:75
void clear()
Reset all of the variables to their limits.
static NtupleManager & getInstance()
void reset()
Reset NtupleManager to blank state.
int log_frequency_
The frequency with which event info is printed.
Definition Process.h:173
bool skip_corrupted_input_files_
allow the Process to skip input files that are corrupted
Definition Process.h:181
std::string histo_filename_
Filename for histograms and other user products.
Definition Process.h:223
int max_tries_
Maximum number of attempts to make before giving up on an event.
Definition Process.h:176
int run_for_generation_
Run number to use if generating events.
Definition Process.h:220
int compression_setting_
Compression setting to pass to output files.
Definition Process.h:214
void run()
Run the process.
Definition Process.cxx:157
int event_limit_
Limit on events to process.
Definition Process.h:162
std::string pass_name_
Processing pass name.
Definition Process.h:159
TFile * histo_t_file_
TFile for histograms and other user products.
Definition Process.h:232
bool allow_incomplete_input_files_
allow the Process to read input files whose runs never finished
Definition Process.h:189
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:170
~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:195
std::vector< std::string > drop_keep_rules_
Set of drop/keep rules.
Definition Process.h:217
ldmx::RunHeader * run_header_
Pointer to the current RunHeader, used for Conditions information.
Definition Process.h:229
TDirectory * makeHistoDirectory(const std::string &dirName)
Construct a TDirectory* for the given module.
Definition Process.cxx:487
performance::Tracker * performance_
class with calls backs to track performance measurements of software
Definition Process.h:235
int min_events_
When reading a file in, what's the first event to read.
Definition Process.h:165
StorageControl storage_controller_
Storage controller.
Definition Process.h:192
std::vector< std::string > output_files_
List of output file names.
Definition Process.h:205
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:202
const ldmx::EventHeader * event_header_
Pointer to the current EventHeader, used for Conditions information.
Definition Process.h:226
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:198
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:156
void setDefaultKeep(bool keep)
Set the default state.
bool keepEvent(bool event_completed) const
Determine if the current event should be kept, based on the defined rules.
void addRule(const std::string &processor_pat, const std::string &purpose_pat)
Add a listening rule.
void resetEventState()
Reset the event-by-event state.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
static void set(int n)
set the event number in the current Formatter
Definition Logger.cxx:158
Class to interface between framework::Process and various measurements that can eventually be written...
Definition Tracker.h:20
void start(Callback cb, std::size_t i_proc)
start the timer for a specific callback and specific processor
Definition Tracker.cxx:90
void absoluteStop()
literally last line of Process::run (if run compeletes without error)
Definition Tracker.cxx:88
void endEvent(bool completed)
inform us that we finished an event (and whether it was completed or not)
Definition Tracker.cxx:98
void stop(Callback cb, std::size_t i_proc)
stop the timer for a specific callback and specific processor
Definition Tracker.cxx:94
void absoluteStart()
literally first line of Process::run
Definition Tracker.cxx:86
Provides header information an event such as event number and timestamp.
Definition EventHeader.h:44
int getRun() const
Return the run number.
Definition EventHeader.h:84
void setEventNumber(int eventNumber)
Set the event number.
void setRun(int run)
Set the run number.
void setTimestamp(const TTimeStamp &timestamp)
Set the timestamp.
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:67
void setStringParameter(const std::string &name, std::string value)
Set a string parameter value.
Definition RunHeader.h:260
All classes in the ldmx-sw project use this namespace.