LDMX Software
trigger::DumpFileWriter Class Reference

Public Types

typedef ap_ufixed< 16, 14 > e_t
 

Public Member Functions

 DumpFileWriter (const std::string &name, framework::Process &process)
 
virtual void configure (framework::config::Parameters &ps)
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
virtual void analyze (const framework::Event &event)
 Process the event and make histograms or summaries.
 
virtual void onProcessStart ()
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
- Public Member Functions inherited from framework::Analyzer
 Analyzer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for an Analyzer is calling analyze.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header) final
 Don't allow Analyzers to add parameters to the run header.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &run_header)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module_.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

std::string dump_file_name_ = "dummy.dump"
 
std::string ecal_trig_digis_passname_
 
std::string ecal_trig_digis_event_passname_
 
EventDump my_event_
 
FILE * file_ = 0
 
unsigned long evt_no_ = 0
 

Additional Inherited Members

- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Definition at line 27 of file DumpFileWriter.h.

Member Typedef Documentation

◆ e_t

Definition at line 40 of file DumpFileWriter.h.

Constructor & Destructor Documentation

◆ DumpFileWriter()

trigger::DumpFileWriter::DumpFileWriter ( const std::string & name,
framework::Process & process )
inline

Definition at line 29 of file DumpFileWriter.h.

Base class for a module which does not produce a data product.
virtual void process(Event &event) final
Processing an event for an Analyzer is calling analyze.

Member Function Documentation

◆ analyze()

void trigger::DumpFileWriter::analyze ( const framework::Event & event)
virtual

Process the event and make histograms or summaries.

Parameters
eventThe Event to analyze

Implements framework::Analyzer.

Definition at line 15 of file DumpFileWriter.cxx.

15 {
16 if (!event.exists("ecalTrigDigis", ecal_trig_digis_event_passname_)) return;
17 auto ecal_trig_digis{event.getObject<ldmx::HgcrocTrigDigiCollection>(
18 "ecalTrigDigis", ecal_trig_digis_passname_)};
19
20 // clear event to write
21 my_event_.event_ = evt_no_;
22 my_event_.ecal_tps_.clear();
23
24 for (const auto& trig_digi : ecal_trig_digis) {
25 // HgcrocTrigDigi
26
27 ldmx::EcalTriggerID tid(trig_digi.getId() /*raw value*/);
28 // compressed ECal digis are 8xADCs (HCal will be 4x)
29 EcalTpToE cvt;
30 float e = cvt.calc(trig_digi.linearPrimitive(), tid.layer());
31
32 ldmx_int::EcalTP tp;
33 // tp.fill( trigDigi.getId(), trigDigi.getPrimitive() );
34 // store complete information for firmware studies
35 tp.fill(trig_digi.getId(), trig_digi.getPrimitive(), tid.layer(),
36 tid.module(), tid.triggercell(), int(e));
37 my_event_.ecal_tps_.push_back(tp);
38 }
39
40 my_event_.writeToFile(file_);
41 evt_no_++;
42}
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.
Definition Event.cxx:92
Extension of DetectorID providing access to ECal trigger cell information.

References framework::Event::exists(), ldmx::EcalTriggerID::layer(), ldmx::EcalTriggerID::module(), and ldmx::EcalTriggerID::triggercell().

◆ configure()

void trigger::DumpFileWriter::configure ( framework::config::Parameters & parameters)
virtual

Callback for the EventProcessor to configure itself from the given set of parameters.

The parameters a processor has access to are the member variables of the python class in the sequence that has className equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 9 of file DumpFileWriter.cxx.

9 {
10 ecal_trig_digis_passname_ = ps.get<std::string>("ecal_trig_digis_passname");
11 ecal_trig_digis_event_passname_ =
12 ps.get<std::string>("ecal_trig_digis_event_passname");
13}

References framework::config::Parameters::get().

◆ onProcessEnd()

void trigger::DumpFileWriter::onProcessEnd ( )
virtual

Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.

Reimplemented from framework::EventProcessor.

Definition at line 52 of file DumpFileWriter.cxx.

52 {
53 ldmx_log(debug) << "Process ends!";
54
55 fclose(file_);
56
57 return;
58}

◆ onProcessStart()

void trigger::DumpFileWriter::onProcessStart ( )
virtual

Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.

Reimplemented from framework::EventProcessor.

Definition at line 44 of file DumpFileWriter.cxx.

44 {
45 ldmx_log(debug) << "Process starts!";
46
47 file_ = fopen(dump_file_name_.c_str(), "wb");
48
49 return;
50}

Member Data Documentation

◆ dump_file_name_

std::string trigger::DumpFileWriter::dump_file_name_ = "dummy.dump"
private

Definition at line 64 of file DumpFileWriter.h.

◆ ecal_trig_digis_event_passname_

std::string trigger::DumpFileWriter::ecal_trig_digis_event_passname_
private

Definition at line 66 of file DumpFileWriter.h.

◆ ecal_trig_digis_passname_

std::string trigger::DumpFileWriter::ecal_trig_digis_passname_
private

Definition at line 65 of file DumpFileWriter.h.

◆ evt_no_

unsigned long trigger::DumpFileWriter::evt_no_ = 0
private

Definition at line 70 of file DumpFileWriter.h.

◆ file_

FILE* trigger::DumpFileWriter::file_ = 0
private

Definition at line 69 of file DumpFileWriter.h.

◆ my_event_

EventDump trigger::DumpFileWriter::my_event_
private

Definition at line 68 of file DumpFileWriter.h.


The documentation for this class was generated from the following files: