LDMX Software
Public Member Functions | Private Attributes | List of all members
trigscint::TrigScintQIEDigiProducer Class Reference

Class that simulates QIE chip of the trigger scintillator. More...

#include <TrigScintQIEDigiProducer.h>

Public Member Functions

 TrigScintQIEDigiProducer (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
 Method to produce a collection of QIE digis.
 
- 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::unique_ptr< TRandom3 > random_ {nullptr}
 Random number generator.
 
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.
 
int stripsPerArray_ {50}
 Number of strips per array.
 
int numberOfArrays_ {3}
 Number of arrays.
 
double meanNoise_ {0}
 Mean readout noise.
 
double mevPerMip_ {1.40}
 Total MeV per MIP.
 
double pePerMip_ {13.5}
 Total number of photoelectrons per MIP.
 
std::string input_pulse_shape_
 QIE Input pulse shape.
 
std::vector< float > pulse_params_
 QIE Input pulse parameters.
 
float toff_overall_
 Overall input pulse time offset.
 
int maxts_
 no. of time samples analysed by QIE
 
float tdc_thr_
 QIE TDC Current threshold.
 
float pedestal_
 QIE pedestal.
 
float elec_noise_
 QIE electronic noise.
 
float sipm_gain_
 SiPM Gain.
 
float s_freq_
 QIE sampling frequency [in MHz].
 
float zeroSuppCut_ {1.}
 Zero-suppression: discard any integrated pulses with PE < this number.
 
SimQIEsmq_ {nullptr}
 SimQIE pointer.
 

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

Class that simulates QIE chip of the trigger scintillator.

Definition at line 47 of file TrigScintQIEDigiProducer.h.

Constructor & Destructor Documentation

◆ TrigScintQIEDigiProducer()

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

Definition at line 11 of file TrigScintQIEDigiProducer.cxx.

13 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.

Member Function Documentation

◆ configure()

void trigscint::TrigScintQIEDigiProducer::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 15 of file TrigScintQIEDigiProducer.cxx.

16 {
17 // Configure this instance of the producer
18 stripsPerArray_ = parameters.getParameter<int>("number_of_strips");
19 numberOfArrays_ = parameters.getParameter<int>("number_of_arrays");
20 meanNoise_ = parameters.getParameter<double>("mean_noise");
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
28 // QIE specific parameters initialization
29 maxts_ = parameters.getParameter<int>("maxts");
30 toff_overall_ = parameters.getParameter<double>("toff_overall");
32 parameters.getParameter<std::string>("input_pulse_shape");
33 tdc_thr_ = parameters.getParameter<double>("tdc_thr");
34 pedestal_ = parameters.getParameter<double>("pedestal");
35 elec_noise_ = parameters.getParameter<double>("elec_noise");
36 sipm_gain_ = parameters.getParameter<double>("sipm_gain");
37 s_freq_ = parameters.getParameter<double>("qie_sf");
38 zeroSuppCut_ = parameters.getParameter<double>("zeroSupp_in_pe");
39
40 if (input_pulse_shape_ == "Expo") {
41 pulse_params_.clear();
42 pulse_params_.push_back(parameters.getParameter<double>("expo_k"));
43 pulse_params_.push_back(parameters.getParameter<double>("expo_tmax"));
44
45 ldmx_log(debug) << "expo_k =" << pulse_params_[0];
46 ldmx_log(debug) << "expo_tmax =" << pulse_params_[1];
47 }
48
49 // Debug mode: print parameter values.
50 ldmx_log(debug) << "maxts_ =" << maxts_;
51 ldmx_log(debug) << "toff_overall_ =" << toff_overall_;
52 ldmx_log(debug) << "input_pulse_shape_ =" << input_pulse_shape_;
53 ldmx_log(debug) << "tdc_thr =" << tdc_thr_;
54 ldmx_log(debug) << "pedestal =" << pedestal_;
55 ldmx_log(debug) << "elec_noise =" << elec_noise_;
56 ldmx_log(debug) << "sipm_gain =" << sipm_gain_;
57 ldmx_log(debug) << "qie_sf =" << s_freq_;
58 ldmx_log(debug) << "zeroSupp_in_pe =" << zeroSuppCut_;
59 ldmx_log(debug) << "pe_per_mip =" << pePerMip_;
60 ldmx_log(debug) << "mev_per_mip =" << mevPerMip_;
61}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
float zeroSuppCut_
Zero-suppression: discard any integrated pulses with PE < this number.
std::vector< float > pulse_params_
QIE Input pulse parameters.
float toff_overall_
Overall input pulse time offset.
std::string outputCollection_
Name of the output collection that will be used to stored the digitized trigger scintillator hits.
std::string inputPassName_
Name of the pass that the input collection is on (empty string means take any pass)
float tdc_thr_
QIE TDC Current threshold.
float s_freq_
QIE sampling frequency [in MHz].
double pePerMip_
Total number of photoelectrons per MIP.
int maxts_
no. of time samples analysed by QIE
int stripsPerArray_
Number of strips per array.
bool verbose_
Class to set the verbosity level.
std::string inputCollection_
Name of the input collection containing the sim hits.
std::string input_pulse_shape_
QIE Input pulse shape.

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

◆ produce()

void trigscint::TrigScintQIEDigiProducer::produce ( framework::Event event)
overridevirtual

Method to produce a collection of QIE digis.

For each event, the SimHit information is converted to an output format analogous to real QIE output.

Implements framework::Producer.

Definition at line 63 of file TrigScintQIEDigiProducer.cxx.

63 {
64 // Need to handle seeding on the first event
65 if (random_.get() == nullptr) {
66 const auto& rseed = getCondition<framework::RandomNumberSeedService>(
68 const auto& rseed2 = getCondition<framework::RandomNumberSeedService>(
70
71 random_ = std::make_unique<TRandom3>(rseed.getSeed(outputCollection_));
72
73 // Initialize SimQIE instance with
74 // pedestal, electronic noise and the random seed
75 smq_ = new SimQIE(pedestal_, elec_noise_,
76 rseed2.getSeed(outputCollection_ + "SimQIE"));
77
82 }
83
84 // To simulate multiple pulses coming at different times, SiPMS
85 // Initialize with stripsPerArray_ zeros
86 std::vector<float> TrueEdep(stripsPerArray_, 0.);
87
88 // Initialize with stripsPerArray_ nullptrs
89 std::vector<Expo*> ex(stripsPerArray_, nullptr);
90 for (int i = 0; i < stripsPerArray_; i++) {
91 // Set the pulse shape with fixed parameters given by config. file
92 ex[i] = new Expo(pulse_params_[0], pulse_params_[1]);
93 TrueEdep[i] = 0;
94 }
95
96 // loop over sim hits and aggregate energy depositions for each detID
97 const auto simHits{event.getCollection<ldmx::SimCalorimeterHit>(
99
100 for (const auto& simHit : simHits) {
101 ldmx::TrigScintID id(simHit.getID());
102
103 ldmx_log(debug) << "Processing sim hit with bar ID: " << id.bar();
104
105 // Simulating the noise corresponding to uncertainity in
106 // detecting scintillating photons.
107 // Poissonian distribution with mean = mean PEs generated
108 double PulseAmp =
109 random_->Poisson(simHit.getEdep() / mevPerMip_ * pePerMip_);
110
111 // Adding a pulse for every sim hit recorded.
112 // time offset = global offset+simhit time
113 ex[id.bar()]->AddPulse(toff_overall_ + simHit.getTime(), PulseAmp);
114
115 // incrementing true energy deposited in appropriate bar.
116 TrueEdep[id.bar()] += simHit.getEdep();
117 }
118
119 // A container to hold the digitized trigger scintillator hits.
120 std::vector<trigscint::TrigScintQIEDigis> QDigis;
121
122 double TotalNoise = meanNoise_ * maxts_;
123
124 // time period[ns] = 1000/sampling freq.[MHz]
125 double SamplingTime = 1000 / s_freq_;
126
127 // Loop over all the bars available.
128 for (int bar_id = 0; bar_id < stripsPerArray_; bar_id++) {
129 // Dark current simulation
130 // e-hole pairs may be generated at random times in SiPM
131 // due to thermal fluctuations.
132 // Every e- thus generated, mimicks a Photo Electron.
133 // Hence we will creat 1PE pulses for each electron generated.
134 int n_noise_pulses = random_->Poisson(TotalNoise);
135 for (int i = 0; i < n_noise_pulses; i++) {
136 ex[bar_id]->AddPulse(random_->Uniform(0, maxts_ * SamplingTime), 1);
137 }
138
139 // Storing the "good" digis
140 if (smq_->PulseCut(ex[bar_id], zeroSuppCut_)) {
142
143 QIEInfo.setChanID(bar_id);
144 QIEInfo.setADC(smq_->Out_ADC(ex[bar_id]));
145 QIEInfo.setTDC(smq_->Out_TDC(ex[bar_id]));
146 QIEInfo.setCID(smq_->CapID(ex[bar_id]));
147
148 QDigis.push_back(QIEInfo);
149 }
150 }
151 event.add(outputCollection_, QDigis);
152}
static const std::string CONDITIONS_OBJECT_NAME
Conditions object name.
Stores simulated calorimeter hit information.
Class that defines the detector ID of the trigger scintillator.
Definition TrigScintID.h:14
std::vector< int > Out_ADC(QIEInputPulse *pp)
Complete set of ADCs for the pulse.
Definition SimQIE.cxx:88
bool PulseCut(QIEInputPulse *pulse, float cut)
Method to check if the pulse is good to be stored.
Definition SimQIE.cxx:134
void setGain(const float gg=1e+6)
Set gain of SiPM.
Definition SimQIE.h:46
void setNTimeSamples(const int maxts=5)
Set the number of time samples to analyze.
Definition SimQIE.h:60
std::vector< int > CapID(QIEInputPulse *pp)
Complete set of Capacitor IDs for the pulse.
Definition SimQIE.cxx:124
void setFreq(const float sf=40)
Set sampling frequency of QIE.
Definition SimQIE.h:53
void setTDCThreshold(const float thr)
Set current threshold for TDC latch.
Definition SimQIE.h:38
std::vector< int > Out_TDC(QIEInputPulse *pp)
Complete set of TDCs for the pulse.
Definition SimQIE.cxx:113
std::unique_ptr< TRandom3 > random_
Random number generator.
class for storing QIE output
void setCID(const std::vector< int > cid)
Store cids of all time samples.
void setTDC(const std::vector< int > tdc)
Store tdcs of all time samples.
void setChanID(const int chanid)
Store the channel ID.
void setADC(const std::vector< int > adc)
Store adcs of all time samples.

References framework::RandomNumberSeedService::CONDITIONS_OBJECT_NAME, trigscint::TrigScintQIEDigis::setADC(), trigscint::TrigScintQIEDigis::setChanID(), trigscint::TrigScintQIEDigis::setCID(), and trigscint::TrigScintQIEDigis::setTDC().

Member Data Documentation

◆ elec_noise_

float trigscint::TrigScintQIEDigiProducer::elec_noise_
private

QIE electronic noise.

Definition at line 121 of file TrigScintQIEDigiProducer.h.

◆ input_pulse_shape_

std::string trigscint::TrigScintQIEDigiProducer::input_pulse_shape_
private

QIE Input pulse shape.

Definition at line 103 of file TrigScintQIEDigiProducer.h.

◆ inputCollection_

std::string trigscint::TrigScintQIEDigiProducer::inputCollection_
private

Name of the input collection containing the sim hits.

Definition at line 77 of file TrigScintQIEDigiProducer.h.

◆ inputPassName_

std::string trigscint::TrigScintQIEDigiProducer::inputPassName_
private

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

Definition at line 81 of file TrigScintQIEDigiProducer.h.

◆ maxts_

int trigscint::TrigScintQIEDigiProducer::maxts_
private

no. of time samples analysed by QIE

Definition at line 112 of file TrigScintQIEDigiProducer.h.

◆ meanNoise_

double trigscint::TrigScintQIEDigiProducer::meanNoise_ {0}
private

Mean readout noise.

Definition at line 94 of file TrigScintQIEDigiProducer.h.

94{0};

◆ mevPerMip_

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

Total MeV per MIP.

Definition at line 97 of file TrigScintQIEDigiProducer.h.

97{1.40};

◆ numberOfArrays_

int trigscint::TrigScintQIEDigiProducer::numberOfArrays_ {3}
private

Number of arrays.

Definition at line 91 of file TrigScintQIEDigiProducer.h.

91{3};

◆ outputCollection_

std::string trigscint::TrigScintQIEDigiProducer::outputCollection_
private

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

Definition at line 85 of file TrigScintQIEDigiProducer.h.

◆ pedestal_

float trigscint::TrigScintQIEDigiProducer::pedestal_
private

QIE pedestal.

Definition at line 118 of file TrigScintQIEDigiProducer.h.

◆ pePerMip_

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

Total number of photoelectrons per MIP.

Definition at line 100 of file TrigScintQIEDigiProducer.h.

100{13.5};

◆ pulse_params_

std::vector<float> trigscint::TrigScintQIEDigiProducer::pulse_params_
private

QIE Input pulse parameters.

Definition at line 106 of file TrigScintQIEDigiProducer.h.

◆ random_

std::unique_ptr<TRandom3> trigscint::TrigScintQIEDigiProducer::random_ {nullptr}
private

Random number generator.

Definition at line 70 of file TrigScintQIEDigiProducer.h.

70{nullptr};

◆ s_freq_

float trigscint::TrigScintQIEDigiProducer::s_freq_
private

QIE sampling frequency [in MHz].

Definition at line 127 of file TrigScintQIEDigiProducer.h.

◆ sipm_gain_

float trigscint::TrigScintQIEDigiProducer::sipm_gain_
private

SiPM Gain.

Definition at line 124 of file TrigScintQIEDigiProducer.h.

◆ smq_

SimQIE* trigscint::TrigScintQIEDigiProducer::smq_ {nullptr}
private

SimQIE pointer.

Definition at line 133 of file TrigScintQIEDigiProducer.h.

133{nullptr};

◆ stripsPerArray_

int trigscint::TrigScintQIEDigiProducer::stripsPerArray_ {50}
private

Number of strips per array.

Definition at line 88 of file TrigScintQIEDigiProducer.h.

88{50};

◆ tdc_thr_

float trigscint::TrigScintQIEDigiProducer::tdc_thr_
private

QIE TDC Current threshold.

Definition at line 115 of file TrigScintQIEDigiProducer.h.

◆ toff_overall_

float trigscint::TrigScintQIEDigiProducer::toff_overall_
private

Overall input pulse time offset.

Definition at line 109 of file TrigScintQIEDigiProducer.h.

◆ verbose_

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

Class to set the verbosity level.

Definition at line 74 of file TrigScintQIEDigiProducer.h.

74{false};

◆ zeroSuppCut_

float trigscint::TrigScintQIEDigiProducer::zeroSuppCut_ {1.}
private

Zero-suppression: discard any integrated pulses with PE < this number.

Definition at line 130 of file TrigScintQIEDigiProducer.h.

130{1.};

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