LDMX Software
trigscint::TrigScintFirmwareHitProducer Class Reference

Public Member Functions

 TrigScintFirmwareHitProducer (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &ps) override
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
void produce (framework::Event &event) override
 Process the event and put new data products into it.
 
- Public Member Functions inherited from framework::Producer
 Producer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for a Producer is calling produce.
 
- 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 beforeNewRun (ldmx::RunHeader &run_header)
 Callback for Producers to add parameters to the run header before conditions are initialized.
 
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.
 
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.
 
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 input_collection_
 add a hit at index idx to a cluster
 
std::string input_pass_name_
 Name of the pass that the input collection is on (empty string means take any pass)
 
std::string output_collection_
 Name of the output collection that will be used to stored the digitized trigger scintillator hits.
 
double gain_ {1e6}
 SiPM gain.
 
double pedestal_ {6.0}
 QIE pedestal.
 
double mev_per_mip_ {1.40}
 Total MeV per MIP.
 
double pe_per_mip_ {13.5}
 Total number of photoelectrons per MIP.
 
int sample_of_interest_ {2}
 Total number of photoelectrons per MIP.
 
std::string test_collection_
 
bool do_test_ {true}
 

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 40 of file TrigScintFirmwareHitProducer.h.

Constructor & Destructor Documentation

◆ TrigScintFirmwareHitProducer()

trigscint::TrigScintFirmwareHitProducer::TrigScintFirmwareHitProducer ( const std::string & name,
framework::Process & process )
inline

Definition at line 42 of file TrigScintFirmwareHitProducer.h.

44 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

Member Function Documentation

◆ configure()

void trigscint::TrigScintFirmwareHitProducer::configure ( framework::config::Parameters & parameters)
overridevirtual

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 12 of file TrigScintFirmwareHitProducer.cxx.

13 {
14 pedestal_ = ps.get<double>("pedestal");
15 gain_ = ps.get<double>("gain");
16 mev_per_mip_ = ps.get<double>("mev_per_mip");
17 pe_per_mip_ = ps.get<double>("pe_per_mip");
18 input_collection_ = ps.get<std::string>("input_collection");
19 test_collection_ = ps.get<std::string>("test_collection");
20 input_pass_name_ = ps.get<std::string>("input_pass_name");
21 output_collection_ = ps.get<std::string>("output_collection");
22 sample_of_interest_ = ps.get<int>("sample_of_interest");
23 ldmx_log(debug) << "In TrigScintFirmwareHitProducer: configure done!";
24 ldmx_log(debug) << "\nPedestal: " << pedestal_ << "\nGain: " << gain_
25 << "\nMEV per MIP: " << mev_per_mip_
26 << "\nPE per MIP: " << pe_per_mip_
27 << "\ninput collection: " << input_collection_
28 << "\ntest collection: " << test_collection_
29 << "\nAre we testing: " << do_test_
30 << "\nInput pass name: " << input_pass_name_
31 << "\nOutput collection: " << output_collection_;
32 return;
33}
std::string output_collection_
Name of the output collection that will be used to stored the digitized trigger scintillator hits.
int sample_of_interest_
Total number of photoelectrons per MIP.
std::string input_collection_
add a hit at index idx to a cluster
std::string input_pass_name_
Name of the pass that the input collection is on (empty string means take any pass)
double pe_per_mip_
Total number of photoelectrons per MIP.

References gain_, framework::config::Parameters::get(), input_collection_, input_pass_name_, mev_per_mip_, output_collection_, pe_per_mip_, pedestal_, and sample_of_interest_.

◆ produce()

void trigscint::TrigScintFirmwareHitProducer::produce ( framework::Event & event)
overridevirtual

Process the event and put new data products into it.

Parameters
eventThe Event to process.

Implements framework::Producer.

Definition at line 35 of file TrigScintFirmwareHitProducer.cxx.

35 {
36 // This processor takes in TS QIE digis and outputs a rec hit collection. It
37 // does so using hitproducerHw, which is a validated piece of HLS code whose
38 // purpose is to emulate existing reconstruction software in firmware for
39 // triggering. I will more fully explain the operation and choices made in
40 // hitproducerHw in hitproducerHw
41 const auto rechits{event.getCollection<ldmx::TrigScintHit>(test_collection_,
43 for (const auto &hit : rechits) {
44 ldmx_log(debug) << "Analysis barID: " << hit.getBarID()
45 << ", PE Number: " << hit.getPE();
46 }
47 const auto digis{event.getCollection<trigscint::TrigScintQIEDigis>(
49 Hit out_hit[NHITS];
50 ap_uint<14> fifo[NCHAN][NTIMES];
51 ap_uint<8> peds[NCHAN];
52 for (int i = 0; i < NCHAN; i++) {
53 peds[i] = 0;
54 fifo[i][0] = (peds[i] << 6) + 63;
55 fifo[i][1] = (peds[i] << 6) + 63;
56 fifo[i][2] = (peds[i] << 6) + 63;
57 fifo[i][3] = (peds[i] << 6) + 63;
58 fifo[i][4] = (peds[i] << 6) + 63;
59 }
60 for (const auto &digi : digis) {
61 std::vector<int> adcs = digi.getADC();
62 std::vector<int> tdcs = digi.getTDC();
63 for (int i = 0; i < NTIMES; i++) {
64 fifo[digi.getChanID()][i] = (ap_uint<14>)((adcs[i] << 6) + (tdcs[i]));
65 }
66 }
67 hitproducerHw(fifo, out_hit, peds);
68 std::vector<ldmx::TrigScintHit> trig_scint_hits;
69 for (int i = 0; i < NHITS; i++) {
70 if (out_hit[i].amp_ >= 3) {
71 ldmx_log(debug) << "Firmware barID: " << out_hit[i].b_id_
72 << ", PE Number: " << out_hit[i].amp_;
74 hit.setModuleID(out_hit[i].m_id_);
75 hit.setBarID(out_hit[i].b_id_);
76 hit.setTime(out_hit[i].time_);
77 hit.setPE(out_hit[i].amp_);
78 trig_scint_hits.push_back(hit);
79 }
80 }
81 event.add(output_collection_, trig_scint_hits);
82 return;
83}
void setTime(float time)
Set the time of the hit [ns].
void setPE(const float PE)
Set hit pe.
void setBarID(const int barID)
Set hit bar ID.
void setModuleID(const int moduleID)
Set hit module ID.
class for storing QIE output
Definition objdef.h:49
Unsigned Arbitrary Precision Type.
Definition ap_int.h:166

References input_collection_, input_pass_name_, output_collection_, ldmx::TrigScintHit::setBarID(), ldmx::TrigScintHit::setModuleID(), ldmx::TrigScintHit::setPE(), and ldmx::CalorimeterHit::setTime().

Member Data Documentation

◆ do_test_

bool trigscint::TrigScintFirmwareHitProducer::do_test_ {true}
private

Definition at line 83 of file TrigScintFirmwareHitProducer.h.

83{true};

◆ gain_

double trigscint::TrigScintFirmwareHitProducer::gain_ {1e6}
private

SiPM gain.

Definition at line 67 of file TrigScintFirmwareHitProducer.h.

67{1e6};

Referenced by configure().

◆ input_collection_

std::string trigscint::TrigScintFirmwareHitProducer::input_collection_
private

add a hit at index idx to a cluster

Name of the input collection containing the sim hits

Definition at line 56 of file TrigScintFirmwareHitProducer.h.

Referenced by configure(), and produce().

◆ input_pass_name_

std::string trigscint::TrigScintFirmwareHitProducer::input_pass_name_
private

Name of the pass that the input collection is on (empty string means take any pass)

Definition at line 60 of file TrigScintFirmwareHitProducer.h.

Referenced by configure(), and produce().

◆ mev_per_mip_

double trigscint::TrigScintFirmwareHitProducer::mev_per_mip_ {1.40}
private

Total MeV per MIP.

Definition at line 73 of file TrigScintFirmwareHitProducer.h.

73{1.40};

Referenced by configure().

◆ output_collection_

std::string trigscint::TrigScintFirmwareHitProducer::output_collection_
private

Name of the output collection that will be used to stored the digitized trigger scintillator hits.

Definition at line 64 of file TrigScintFirmwareHitProducer.h.

Referenced by configure(), and produce().

◆ pe_per_mip_

double trigscint::TrigScintFirmwareHitProducer::pe_per_mip_ {13.5}
private

Total number of photoelectrons per MIP.

Definition at line 76 of file TrigScintFirmwareHitProducer.h.

76{13.5};

Referenced by configure().

◆ pedestal_

double trigscint::TrigScintFirmwareHitProducer::pedestal_ {6.0}
private

QIE pedestal.

Definition at line 70 of file TrigScintFirmwareHitProducer.h.

70{6.0};

Referenced by configure().

◆ sample_of_interest_

int trigscint::TrigScintFirmwareHitProducer::sample_of_interest_ {2}
private

Total number of photoelectrons per MIP.

Definition at line 79 of file TrigScintFirmwareHitProducer.h.

79{2};

Referenced by configure().

◆ test_collection_

std::string trigscint::TrigScintFirmwareHitProducer::test_collection_
private

Definition at line 81 of file TrigScintFirmwareHitProducer.h.


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