@@ -6,19 +6,17 @@ TrigScintDigiProducer::TrigScintDigiProducer(const std::string &name,
66 framework::Process &process)
77 : Producer(name, process) {}
88
9- void TrigScintDigiProducer::configure (
10- framework::config::Parameters ¶meters) {
9+ void TrigScintDigiProducer::configure (framework::config::Parameters &ps) {
1110 // Configure this instance of the producer
12- strips_per_array_ = parameters.get <int >(" number_of_strips" );
13- number_of_arrays_ = parameters.get <int >(" number_of_arrays" );
14- mean_noise_ = parameters.get <double >(" mean_noise" );
15- mev_per_mip_ = parameters.get <double >(" mev_per_mip" );
16- pe_per_mip_ = parameters.get <double >(" pe_per_mip" );
17- input_collection_ = parameters.get <std::string>(" input_collection" );
18- input_pass_name_ = parameters.get <std::string>(" input_pass_name" );
19- output_collection_ = parameters.get <std::string>(" output_collection" );
20- sim_particles_passname_ =
21- parameters.get <std::string>(" sim_particles_passname" );
11+ strips_per_array_ = ps.get <int >(" number_of_strips" );
12+ number_of_arrays_ = ps.get <int >(" number_of_arrays" );
13+ mean_noise_ = ps.get <double >(" mean_noise" );
14+ mev_per_mip_ = ps.get <double >(" mev_per_mip" );
15+ pe_per_mip_ = ps.get <double >(" pe_per_mip" );
16+ input_collection_ = ps.get <std::string>(" input_collection" );
17+ input_pass_name_ = ps.get <std::string>(" input_pass_name" );
18+ output_collection_ = ps.get <std::string>(" output_collection" );
19+ sim_particles_passname_ = ps.get <std::string>(" sim_particles_passname" );
2220}
2321
2422void TrigScintDigiProducer::onNewRun (const ldmx::RunHeader &) {
@@ -46,7 +44,7 @@ ldmx::TrigScintID TrigScintDigiProducer::generateRandomID(int module) {
4644}
4745
4846void TrigScintDigiProducer::produce (framework::Event &event) {
49- std::map<ldmx::TrigScintID, int > cell_p_es , cell_min_p_es;
47+ std::map<ldmx::TrigScintID, int > cell_pes , cell_min_p_es;
5048 std::map<ldmx::TrigScintID, float > xpos, ypos, zpos, edep, time, beam_frac;
5149 std::set<ldmx::TrigScintID> noise_hit_i_ds;
5250
@@ -73,7 +71,7 @@ void TrigScintDigiProducer::produce(framework::Event &event) {
7371 for (int i = 0 ; i < sim_hit.getNumberOfContribs (); i++) {
7472 auto contrib = sim_hit.getContrib (i);
7573
76- ldmx_log (trace) << " contrib " << i << " trackID: " << contrib.trackID
74+ ldmx_log (trace) << " Contrib " << i << " trackID: " << contrib.trackID
7775 << " pdgID: " << contrib.pdgCode
7876 << " edep: " << contrib.edep ;
7977 ldmx_log (trace) << " \t particle id: "
@@ -128,21 +126,26 @@ void TrigScintDigiProducer::produce(framework::Event &event) {
128126 xpos[id] = xpos[id] / edep[id];
129127 ypos[id] = ypos[id] / edep[id];
130128 zpos[id] = zpos[id] / edep[id];
129+ // mean number of photoelectrons produced for the given deposited energy
131130 double mean_pe = dep_energy / mev_per_mip_ * pe_per_mip_;
132131 std::poisson_distribution<int > poisson_dist (mean_pe + mean_noise_);
133- cell_p_es[id] = poisson_dist (rng_);
132+ cell_pes[id] = poisson_dist (rng_);
133+ // energy corresponding to the number of PEs observed
134+ // the minimum number of PEs is the mean number of PEs minus the noise
135+ double energy_per_pe = mev_per_mip_ / pe_per_mip_;
136+ double cell_energy = energy_per_pe * cell_pes[id];
134137
135138 // If a cell has a PE count above threshold, persit the hit.
136139 // Thresholds are introduced (and configurable) in clustering.
137140 // the cell PE >=1 suppresses artifical noise that is below one light
138141 // quantum in the SiPM and unphysical.
139- if (cell_p_es [id] >= 1 ) {
142+ if (cell_pes [id] >= 1 ) {
140143 ldmx::TrigScintHit hit;
141144 hit.setID (id.raw ());
142- hit.setPE (cell_p_es [id]);
145+ hit.setPE (cell_pes [id]);
143146 hit.setMinPE (cell_min_p_es[id]);
144- hit.setAmplitude (cell_p_es [id]);
145- hit.setEnergy (dep_energy );
147+ hit.setAmplitude (cell_pes [id]);
148+ hit.setEnergy (cell_energy );
146149 hit.setTime (time[id]);
147150 hit.setXPos (xpos[id]);
148151 hit.setYPos (ypos[id]);
@@ -155,11 +158,11 @@ void TrigScintDigiProducer::produce(framework::Event &event) {
155158 trig_scint_hits.push_back (hit);
156159 }
157160
158- ldmx_log (trace ) << " ID = " << id.raw () << " Edep: " << edep[id]
159- << " numPEs: " << cell_p_es [id] << " time: " << time[id]
161+ ldmx_log (debug ) << " ID = " << id.raw () << " Edep: " << edep[id]
162+ << " numPEs: " << cell_pes [id] << " time: " << time[id]
160163 << " z: " << zpos[id] << " \t X: " << xpos[id]
161164 << " Y: " << ypos[id] << " Z: " << zpos[id];
162- }
165+ } // end of loop over detIDs
163166
164167 // ------------------------------- Noise simulation -----------------------//
165168 // ------------------------------------------------------------------------//
0 commit comments