LDMX Software
DumpFileWriter.cxx
2
5#include "Recon/Event/HgcrocTrigDigi.h"
6
7namespace trigger {
8
10
12 if (!event.exists("ecalTrigDigis")) return;
13 auto ecalTrigDigis{
14 event.getObject<ldmx::HgcrocTrigDigiCollection>("ecalTrigDigis")};
15
16 // clear event to write
17 myEvent.event = evtNo;
18 myEvent.EcalTPs.clear();
19
20 for (const auto& trigDigi : ecalTrigDigis) {
21 // HgcrocTrigDigi
22
23 ldmx::EcalTriggerID tid(trigDigi.getId() /*raw value*/);
24 // compressed ECal digis are 8xADCs (HCal will be 4x)
25 ecalTpToE cvt;
26 float e = cvt.calc(trigDigi.linearPrimitive(), tid.layer());
27 // float sie = 8 * trigDigi.linearPrimitive() * gain *
28 // mVtoMeV; // in MeV, before layer corrections
29 // float e = (sie / mipSiEnergy * layerWeights.at(tid.layer()) + sie) *
30 // secondOrderEnergyCorrection;
31
33 // tp.fill( trigDigi.getId(), trigDigi.getPrimitive() );
34 tp.fill(trigDigi.getId(), e); // store linearized E
35 myEvent.EcalTPs.push_back(tp);
36 }
37
38 myEvent.writeToFile(file);
39 evtNo++;
40}
41
43 ldmx_log(debug) << "Process starts!";
44
45 file = fopen(dumpFileName.c_str(), "wb");
46
47 return;
48}
49
51 ldmx_log(debug) << "Process ends!";
52
53 fclose(file);
54
55 return;
56}
57
58} // namespace trigger
59
60DECLARE_ANALYZER_NS(trigger, DumpFileWriter);
Write objects to a file for standalone.
Class that translates raw positions of ECal module hits into cells in a hexagonal readout.
#define DECLARE_ANALYZER_NS(NS, CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Class that represents a digitized hit in a calorimeter cell readout by an HGCROC.
Implements an event buffer system for storing event data.
Definition Event.h:41
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
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
Extension of DetectorID providing access to ECal trigger cell information.
int layer() const
Get the value of the layer 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.