LDMX Software
Public Member Functions | Private Attributes | List of all members
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 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

bool verbose_ {false}
 Class to set the verbosity level.
 
std::string inputCollection_
 Name of the input collection containing the sim hits.
 
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.
 

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

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.

◆ ~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.getParameter<double>("pedestal");
20 gain_ = parameters.getParameter<double>("gain");
21 mevPerMip_ = parameters.getParameter<double>("mev_per_mip");
22 pePerMip_ = parameters.getParameter<double>("pe_per_mip");
23 inputCollection_ = parameters.getParameter<std::string>("input_collection");
24 inputPassName_ = parameters.getParameter<std::string>("input_pass_name");
25 outputCollection_ = parameters.getParameter<std::string>("output_collection");
26 verbose_ = parameters.getParameter<bool>("verbose");
27 sample_of_interest_ = parameters.getParameter<int>("sample_of_interest");
28}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
std::string inputPassName_
Name of the pass that the input collection is on (empty string means take any pass)
double pePerMip_
Total number of photoelectrons per MIP.
std::string inputCollection_
Name of the input collection containing the sim hits.
int sample_of_interest_
Total number of photoelectrons per MIP.
bool verbose_
Class to set the verbosity level.
std::string outputCollection_
Name of the output collection that will be used to stored the digitized trigger scintillator hits.

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

◆ 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 30 of file TrigScintRecHitProducer.cxx.

30 {
31 // initialize QIE object for linearizing ADCs
32 SimQIE qie;
33
34 // Ensure the sample of interest <4
35 /* // this assumes we are in well-behaved simulation land, not test beam
36 wilderness if(sample_of_interest_>3) { ldmx_log(error)<<"sample_of_interest_
37 should be one of 0,1,2,3\n"
38 <<"Currently, sample_of_interest = "<<sample_of_interest_
39 <<"\n";
40 return;
41 }
42 */
43
44 // looper over sim hits and aggregate energy depositions
45 // for each detID
46 const auto digis{event.getCollection<trigscint::TrigScintQIEDigis>(
48
49 std::vector<ldmx::TrigScintHit> trigScintHits;
50 for (const auto &digi : digis) {
52 auto adc{digi.getADC()};
53 auto tdc{digi.getTDC()};
54
55 hit.setModuleID(0);
56 hit.setBarID(digi.getChanID());
57 hit.setBeamEfrac(-1.);
58
59 // leave amplitude as sum of the first two
60 hit.setAmplitude(
61 qie.ADC2Q(adc[sample_of_interest_]) +
62 qie.ADC2Q(adc[sample_of_interest_ + 1])); // femptocoulombs
63
64 if (tdc[sample_of_interest_] > 49)
65 hit.setTime(-999.);
66 else
67 hit.setTime(tdc[sample_of_interest_] * 0.5);
68
69 float integratedCharge = 0;
70 // integrate pulse over all time samples. will subtract pedestal next
71 for (const auto &adcVal : adc) {
72 integratedCharge += qie.ADC2Q(adcVal);
73 }
74 uint nSamp = adc.size();
75 float pedSubtrQ = integratedCharge - nSamp * pedestal_;
76 hit.setEnergy(pedSubtrQ * 6250. / gain_ * mevPerMip_ / pePerMip_); // MeV
77 hit.setPE(pedSubtrQ * 6250. / gain_);
78 trigScintHits.push_back(hit);
79 }
80 // Create the container to hold the
81 // digitized trigger scintillator hits.
82
83 event.add(outputCollection_, trigScintHits);
84}
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 74 of file TrigScintRecHitProducer.h.

74{1e6};

◆ inputCollection_

std::string trigscint::TrigScintRecHitProducer::inputCollection_
private

Name of the input collection containing the sim hits.

Definition at line 63 of file TrigScintRecHitProducer.h.

◆ inputPassName_

std::string trigscint::TrigScintRecHitProducer::inputPassName_
private

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

Definition at line 67 of file TrigScintRecHitProducer.h.

◆ mevPerMip_

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

Total MeV per MIP.

Definition at line 80 of file TrigScintRecHitProducer.h.

80{1.40};

◆ outputCollection_

std::string trigscint::TrigScintRecHitProducer::outputCollection_
private

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

Definition at line 71 of file TrigScintRecHitProducer.h.

◆ pedestal_

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

QIE pedestal.

Definition at line 77 of file TrigScintRecHitProducer.h.

77{6.0};

◆ pePerMip_

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

Total number of photoelectrons per MIP.

Definition at line 83 of file TrigScintRecHitProducer.h.

83{13.5};

◆ sample_of_interest_

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

Total number of photoelectrons per MIP.

Definition at line 86 of file TrigScintRecHitProducer.h.

86{2};

◆ verbose_

bool trigscint::TrigScintRecHitProducer::verbose_ {false}
private

Class to set the verbosity level.

Definition at line 60 of file TrigScintRecHitProducer.h.

60{false};

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