LDMX Software
DumpFileWriter.cxx
2
4#include "Recon/Event/HgcrocTrigDigi.h"
5#include "Trigger/DiscreteInputs.h"
6#include "Trigger/TrigUtilities.h"
7
8namespace trigger {
9
11 ecal_trig_digis_passname_ = ps.get<std::string>("ecal_trig_digis_passname");
12 ecal_trig_digis_event_passname_ =
13 ps.get<std::string>("ecal_trig_digis_event_passname");
14}
15
17 if (!event.exists("ecalTrigDigis", ecal_trig_digis_event_passname_)) return;
18 auto ecal_trig_digis{event.getObject<ldmx::HgcrocTrigDigiCollection>(
19 "ecalTrigDigis", ecal_trig_digis_passname_)};
20
21 // clear event to write
22 my_event_.event_ = evt_no_;
23 my_event_.ecal_tps_.clear();
24
25 for (const auto& trig_digi : ecal_trig_digis) {
26 // HgcrocTrigDigi
27
28 ldmx::EcalTriggerID tid(trig_digi.getId() /*raw value*/);
29 // compressed ECal digis are 8xADCs (HCal will be 4x)
30 EcalTpToE cvt;
31 float e = cvt.calc(trig_digi.linearPrimitive(), tid.layer());
32
34 // tp.fill( trigDigi.getId(), trigDigi.getPrimitive() );
35 // store complete information for firmware studies
36 tp.fill(trig_digi.getId(), trig_digi.getPrimitive(), tid.layer(),
37 tid.module(), tid.triggercell(), int(e));
38 my_event_.ecal_tps_.push_back(tp);
39 }
40
41 my_event_.writeToFile(file_);
42 evt_no_++;
43}
44
46 ldmx_log(debug) << "Process starts!";
47
48 file_ = fopen(dump_file_name_.c_str(), "wb");
49
50 return;
51}
52
54 ldmx_log(debug) << "Process ends!";
55
56 fclose(file_);
57
58 return;
59}
60
61} // namespace trigger
62
Write objects to a file for standalone.
Class that defines an ECal trigger cell detector ID.
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Implements an event buffer system for storing event data.
Definition Event.h:40
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:107
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:75
Extension of DetectorID providing access to ECal trigger cell information.
int layer() const
Get the value of the layer field from the ID.
int module() const
Get the value of the module field from the ID.
int triggercell() const
Get the value of the trigger cell field from the ID.
virtual void configure(framework::config::Parameters &ps)
Callback for the EventProcessor to configure itself from the given set of parameters.
virtual void onProcessEnd()
Callback for the EventProcessor to take any necessary action when the processing of events finishes,...
virtual void onProcessStart()
Callback for the EventProcessor to take any necessary action when the processing of events starts,...
virtual void analyze(const framework::Event &event)
Process the event and make histograms or summaries.