LDMX Software
trigscint::TrigScintRecHitProducer Class Reference

Organizes digis into TrigScintHits, linearizes TDC and ADC info, and converts amplitudes to PEs. More...

#include <TrigScintRecHitProducer.h>

Public Member Functions

 TrigScintRecHitProducer (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &parameters) override
 Callback for the processor 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_
 Name of the input collection containing the sim hits.
 
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.
 

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

Organizes digis into TrigScintHits, linearizes TDC and ADC info, and converts amplitudes to PEs.

Definition at line 41 of file TrigScintRecHitProducer.h.

Constructor & Destructor Documentation

◆ TrigScintRecHitProducer()

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

Definition at line 10 of file TrigScintRecHitProducer.cxx.

12 : 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.

◆ ~TrigScintRecHitProducer()

trigscint::TrigScintRecHitProducer::~TrigScintRecHitProducer ( )

Definition at line 14 of file TrigScintRecHitProducer.cxx.

14{}

Member Function Documentation

◆ configure()

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

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

Parameters
parametersParameterSet for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 16 of file TrigScintRecHitProducer.cxx.

17 {
18 // Configure this instance of the producer
19 pedestal_ = parameters.get<double>("pedestal");
20 gain_ = parameters.get<double>("gain");
21 mev_per_mip_ = parameters.get<double>("mev_per_mip");
22 pe_per_mip_ = parameters.get<double>("pe_per_mip");
23 input_collection_ = parameters.get<std::string>("input_collection");
24 input_pass_name_ = parameters.get<std::string>("input_pass_name");
25 output_collection_ = parameters.get<std::string>("output_collection");
26 sample_of_interest_ = parameters.get<int>("sample_of_interest");
27}
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
double pe_per_mip_
Total number of photoelectrons per MIP.
std::string output_collection_
Name of the output collection that will be used to stored the digitized trigger scintillator hits.
std::string input_pass_name_
Name of the pass that the input collection is on (empty string means take any pass)
std::string input_collection_
Name of the input collection containing the sim hits.
int sample_of_interest_
Total number of photoelectrons per MIP.

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

◆ produce()

void trigscint::TrigScintRecHitProducer::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 29 of file TrigScintRecHitProducer.cxx.

29 {
30 // Initialize QIE object for linearizing ADCs
31 SimQIE qie;
32
33 // Retrieve the collection of QIE digis
34 const auto digis{event.getCollection<trigscint::TrigScintQIEDigis>(
36
37 std::vector<ldmx::TrigScintHit> trig_scint_hits;
38
39 // Loop over digis and process each one
40 for (const auto &digi : digis) {
42 auto adc{digi.getADC()};
43 auto tdc{digi.getTDC()};
44
45 hit.setModuleID(0);
46 hit.setBarID(digi.getChanID());
47 hit.setBeamEfrac(-1.);
48
49 // Set amplitude as the sum of the first two samples
50 hit.setAmplitude(
51 qie.adc2Q(adc[sample_of_interest_]) +
52 qie.adc2Q(adc[sample_of_interest_ + 1])); // femptocoulombs
53
54 // Set time based on TDC value
55 if (tdc[sample_of_interest_] > 49)
56 hit.setTime(-999.);
57 else
58 hit.setTime(tdc[sample_of_interest_] * 0.5);
59
60 float integrated_charge = 0;
61
62 // Integrate pulse over all time samples and subtract pedestal
63 for (const auto &adc_val : adc) {
64 integrated_charge += qie.adc2Q(adc_val);
65 }
66 uint n_samp = adc.size();
67 float ped_subtr_q = integrated_charge - n_samp * pedestal_;
68
69 // Set energy and photoelectrons
70 hit.setEnergy(ped_subtr_q * 6250. / gain_ * mev_per_mip_ /
71 pe_per_mip_); // MeV
72 hit.setPE(ped_subtr_q * 6250. / gain_);
73
74 trig_scint_hits.push_back(hit);
75 }
76
77 // Add the processed hits to the event
78 event.add(output_collection_, trig_scint_hits);
79}
void setTime(float time)
Set the time of the hit [ns].
void setAmplitude(float amplitude)
Set the amplitude of the hit, which is proportional to the signal in the calorimeter cell without sam...
void setEnergy(float energy)
Set the calorimetric energy of the hit, corrected for sampling factors [MeV].
void setPE(const float PE)
Set hit pe.
void setBarID(const int barID)
Set hit bar ID.
void setBeamEfrac(const float beamEfrac)
Set beam energy fraction of hit.
void setModuleID(const int moduleID)
Set hit module ID.
class for storing QIE output

References trigscint::SimQIE::adc2Q(), ldmx::CalorimeterHit::setAmplitude(), ldmx::TrigScintHit::setBarID(), ldmx::TrigScintHit::setBeamEfrac(), ldmx::CalorimeterHit::setEnergy(), ldmx::TrigScintHit::setModuleID(), ldmx::TrigScintHit::setPE(), and ldmx::CalorimeterHit::setTime().

Member Data Documentation

◆ gain_

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

SiPM gain.

Definition at line 70 of file TrigScintRecHitProducer.h.

70{1e6};

◆ input_collection_

std::string trigscint::TrigScintRecHitProducer::input_collection_
private

Name of the input collection containing the sim hits.

Definition at line 59 of file TrigScintRecHitProducer.h.

◆ input_pass_name_

std::string trigscint::TrigScintRecHitProducer::input_pass_name_
private

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

Definition at line 63 of file TrigScintRecHitProducer.h.

◆ mev_per_mip_

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

Total MeV per MIP.

Definition at line 76 of file TrigScintRecHitProducer.h.

76{1.40};

◆ output_collection_

std::string trigscint::TrigScintRecHitProducer::output_collection_
private

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

Definition at line 67 of file TrigScintRecHitProducer.h.

◆ pe_per_mip_

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

Total number of photoelectrons per MIP.

Definition at line 79 of file TrigScintRecHitProducer.h.

79{13.5};

◆ pedestal_

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

QIE pedestal.

Definition at line 73 of file TrigScintRecHitProducer.h.

73{6.0};

◆ sample_of_interest_

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

Total number of photoelectrons per MIP.

Definition at line 82 of file TrigScintRecHitProducer.h.

82{2};

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