LDMX Software
Public Member Functions | Private Attributes | List of all members
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 beforeNewRun (ldmx::RunHeader &header)
 Handle allowing producers to modify run headers before the run begins.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 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 inputCollection_
 add a hit at index idx to a cluster
 
std::string inputPassName_
 Name of the pass that the input collection is on (empty string means take any pass)
 
std::string outputCollection_
 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 mevPerMip_ {1.40}
 Total MeV per MIP.
 
double pePerMip_ {13.5}
 Total number of photoelectrons per MIP.
 
int sample_of_interest_ {2}
 Total number of photoelectrons per MIP.
 
std::string testCollection_
 
bool doTest_ {true}
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Producer
static const int CLASSTYPE {1}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 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.

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

References gain_, framework::config::Parameters::getParameter(), inputCollection_, inputPassName_, mevPerMip_, outputCollection_, pedestal_, pePerMip_, 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 hitproducer_hw, 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 // hitproducer_hw in hitproducer_hw
41 const auto rechits{
42 event.getCollection<ldmx::TrigScintHit>(testCollection_, inputPassName_)};
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 outHit[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 hitproducer_hw(FIFO, outHit, Peds);
68 std::vector<ldmx::TrigScintHit> trigScintHits;
69 for (int i = 0; i < NHITS; i++) {
70 if (outHit[i].Amp >= 3) {
71 ldmx_log(debug) << "Firmware barID: " << outHit[i].bID
72 << ", PE Number: " << outHit[i].Amp;
74 hit.setModuleID(outHit[i].mID);
75 hit.setBarID(outHit[i].bID);
76 hit.setTime(outHit[i].Time);
77 hit.setPE(outHit[i].Amp);
78 trigScintHits.push_back(hit);
79 }
80 }
81 event.add(outputCollection_, trigScintHits);
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 inputCollection_, inputPassName_, outputCollection_, ldmx::TrigScintHit::setBarID(), ldmx::TrigScintHit::setModuleID(), ldmx::TrigScintHit::setPE(), and ldmx::CalorimeterHit::setTime().

Member Data Documentation

◆ doTest_

bool trigscint::TrigScintFirmwareHitProducer::doTest_ {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().

◆ inputCollection_

std::string trigscint::TrigScintFirmwareHitProducer::inputCollection_
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().

◆ inputPassName_

std::string trigscint::TrigScintFirmwareHitProducer::inputPassName_
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().

◆ mevPerMip_

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

Total MeV per MIP.

Definition at line 73 of file TrigScintFirmwareHitProducer.h.

73{1.40};

Referenced by configure().

◆ outputCollection_

std::string trigscint::TrigScintFirmwareHitProducer::outputCollection_
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().

◆ pedestal_

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

QIE pedestal.

Definition at line 70 of file TrigScintFirmwareHitProducer.h.

70{6.0};

Referenced by configure().

◆ pePerMip_

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

Total number of photoelectrons per MIP.

Definition at line 76 of file TrigScintFirmwareHitProducer.h.

76{13.5};

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().

◆ testCollection_

std::string trigscint::TrigScintFirmwareHitProducer::testCollection_
private

Definition at line 81 of file TrigScintFirmwareHitProducer.h.


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