1010
1111#include " FT0Simulation/Digitizer.h"
1212#include " FT0Simulation/DigitizationConstants.h"
13+ #include " FT0Simulation/DigitizationParameters.h"
1314#include " SimulationDataFormat/MCTruthContainer.h"
1415#include < CommonDataFormat/InteractionRecord.h>
1516
2223#include < optional>
2324
2425using namespace o2 ::ft0;
25- // using o2::ft0::Geometry;
2626
2727ClassImp (Digitizer);
2828
@@ -90,22 +90,22 @@ Digitizer::CFDOutput Digitizer::get_time(const std::vector<float>& times, float
9090 };
9191 auto const min_time = std::max (deadTime, *std::min_element (std::begin (times),
9292 std::end (times)));
93- CFDOutput result{std::nullopt , -0 .5f * mParameters .bunchWidth };
93+ CFDOutput result{std::nullopt , -0 .5f * mParameters .mBunchWidth };
9494 bool is_positive = true ;
9595
9696 // reset the chache
9797 std::fill_n (std::begin (mSignalCache ), std::size (mSignalCache ), -1 .0f );
9898
9999 // we need double precision for time in order to match previous behaviour
100- for (double time = min_time; time < 0.5 * mParameters .bunchWidth ; time += DP::SIGNAL_CACHE_DT) {
100+ for (double time = min_time; time < 0.5 * mParameters .mBunchWidth ; time += DP::SIGNAL_CACHE_DT) {
101101 float const val = value_at (time);
102- int const index = std::lround ((time + 0.5 * mParameters .bunchWidth ) / DP::SIGNAL_CACHE_DT);
102+ int const index = std::lround ((time + 0.5 * mParameters .mBunchWidth ) / DP::SIGNAL_CACHE_DT);
103103 if (index >= 0 && index < mSignalCache .size ()) { // save the value for later use
104104 mSignalCache [index] = val;
105105 }
106106 // look up the time-shifted signal value from the past
107107 float val_prev = 0 .0f ;
108- int const index_prev = std::lround ((time - mParameters .mCFDShiftPos + 0 .5f * mParameters .bunchWidth ) / DP::SIGNAL_CACHE_DT);
108+ int const index_prev = std::lround ((time - mParameters .mCFDShiftPos + 0 .5f * mParameters .mBunchWidth ) / DP::SIGNAL_CACHE_DT);
109109 val_prev = ((index_prev < 0 || index_prev >= mSignalCache .size () || mSignalCache [index_prev] < 0 .0f )
110110 ? value_at (time - mParameters .mCFDShiftPos ) // was not computed before
111111 : mSignalCache [index_prev]); // is available in the cache
@@ -167,8 +167,8 @@ void Digitizer::process(const std::vector<o2::ft0::HitType>* hits,
167167 }
168168
169169 Int_t hit_ch = hit.GetDetectorID ();
170- Bool_t is_A_side = (hit_ch < 4 * mParameters . nCellsA );
171- Float_t time_compensate = is_A_side ? mParameters .A_side_cable_cmps : mParameters .C_side_cable_cmps ;
170+ Bool_t is_A_side = (hit_ch < 4 * mGeometry . NCellsA );
171+ Float_t time_compensate = is_A_side ? mParameters .mA_side_cable_cmps : mParameters .mC_side_cable_cmps ;
172172 Double_t hit_time = hit.GetTime () - time_compensate;
173173 if (hit_time > 250 ) {
174174 continue ; // not collect very slow particles
@@ -224,20 +224,20 @@ void Digitizer::storeBC(BCCache& bc,
224224 if (!cfd.particle ) {
225225 continue ;
226226 }
227- int smeared_time = 1000 . * (*cfd.particle - mParameters .mCfdShift ) * mParameters .ChannelWidthInverse ;
227+ int smeared_time = 1000 . * (*cfd.particle - mParameters .mCfdShift ) * mParameters .mChannelWidthInverse ;
228228 bool is_time_in_signal_gate = (smeared_time > -mParameters .mTime_trg_gate && smeared_time < mParameters .mTime_trg_gate );
229- float charge = measure_amplitude (channel_times) * mParameters .charge2amp ;
230- float amp = is_time_in_signal_gate ? mParameters .mV_2_Nchannels * charge : 0 ;
229+ float charge = measure_amplitude (channel_times) * mParameters .mCharge2amp ;
230+ float amp = is_time_in_signal_gate ? mParameters .mMV_2_Nchannels * charge : 0 ;
231231 if (amp > 4095 ) {
232232 amp = 4095 ;
233233 }
234- LOG (DEBUG ) << mEventID << " bc " << firstBCinDeque.bc << " orbit " << firstBCinDeque.orbit << " , ipmt " << ipmt << " , smeared_time " << smeared_time << " nStored " << nStored;
234+ LOG (INFO ) << mEventID << " bc " << firstBCinDeque.bc << " orbit " << firstBCinDeque.orbit << " , ipmt " << ipmt << " , smeared_time " << smeared_time << " nStored " << nStored;
235235 digitsCh.emplace_back (ipmt, smeared_time, int (amp), chain);
236236 nStored++;
237237
238238 // fill triggers
239239
240- Bool_t is_A_side = (ipmt <= 4 * mParameters . nCellsA );
240+ Bool_t is_A_side = (ipmt <= 4 * mGeometry . NCellsA );
241241 if (!is_time_in_signal_gate) {
242242 continue ;
243243 }
@@ -322,7 +322,7 @@ void Digitizer::initParameters()
322322 auto const sinc = [](double x) { x *= TMath::Pi (); return (std::abs (x) < 1e-12 ) ? 1.0 : std::sin (x) / x; };
323323
324324 // number of noise samples in one BC
325- mNumNoiseSamples = std::ceil (mParameters .bunchWidth / mParameters .mNoisePeriod );
325+ mNumNoiseSamples = std::ceil (mParameters .mBunchWidth / mParameters .mNoisePeriod );
326326 mNoiseSamples .resize (mNumNoiseSamples );
327327
328328 // set up tables with sinc function values (times noiseVar)
@@ -332,23 +332,24 @@ void Digitizer::initParameters()
332332 // we make a table of sinc values between -num_noise_samples and 2*num_noise_samples
333333 mSincTable [i].resize (3 * mNumNoiseSamples );
334334 for (int j = -mNumNoiseSamples ; j < 2 * mNumNoiseSamples ; ++j) {
335- mSincTable [i][mNumNoiseSamples + j] = mParameters .mNoiseVar * sinc ((time + 0 .5f * mParameters .bunchWidth ) / mParameters .mNoisePeriod - j);
335+ mSincTable [i][mNumNoiseSamples + j] = mParameters .mNoiseVar * sinc ((time + 0 .5f * mParameters .mBunchWidth ) / mParameters .mNoisePeriod - j);
336336 }
337337 }
338338 // set up the lookup table for the signal form
339339 for (size_t i = 0 ; i < DP::SIGNAL_TABLE_SIZE; ++i) {
340- float const x = float (i) / float (DP::SIGNAL_TABLE_SIZE) * mParameters .bunchWidth ;
340+ float const x = float (i) / float (DP::SIGNAL_TABLE_SIZE) * mParameters .mBunchWidth ;
341341 mSignalTable [i] = signalForm_i (x);
342342 }
343343
344344 // cache for signal time series used by the CFD -BC/2 .. +3BC/2
345- mSignalCache .resize (std::lround (mParameters .bunchWidth / DP::SIGNAL_CACHE_DT));
345+ mSignalCache .resize (std::lround (mParameters .mBunchWidth / DP::SIGNAL_CACHE_DT));
346346}
347347// _______________________________________________________________________
348348void Digitizer::init ()
349349{
350350 LOG (INFO) << " @@@ Digitizer::init " << std::endl;
351351 mDeadTimes .fill ({InteractionRecord (0 ), -100 .});
352+ printParameters ();
352353}
353354// _______________________________________________________________________
354355void Digitizer::finish ()
@@ -364,5 +365,7 @@ void Digitizer::printParameters() const
364365 << mParameters .mCfdShift << " CFD distance between 0.3 of max amplitude to max \n "
365366 << mParameters .mCFDShiftPos << " MIP -> mV " << mParameters .mMip_in_V << " Pe in MIP \n "
366367 << mParameters .mPe_in_mip << " noise level " << mParameters .mNoiseVar << " noise frequency \n "
367- << mParameters .mNoisePeriod << std::endl ;
368+ << mParameters .mNoisePeriod << " mMCPs " << mParameters . mMCPs ;
368369}
370+
371+ O2ParamImpl (DigitizationParameters);
0 commit comments