34 #include "CLHEP/Random/RandFlat.h" 35 #include "CLHEP/Random/RandGaussQ.h" 36 #include "CLHEP/Random/RandPoisson.h" 77 void AddDarkNoise (std::vector<double> &RawWF,
double gain);
79 std::vector<double>& OldPulse,
80 std::vector<double>& NewPulse,
102 produces<std::vector< optdata::ChannelDataGroup> >();
128 CLHEP::HepRandomEngine &engine = rng->
getEngine();
153 std::vector<double> &OldPulse,
154 std::vector<double> &NewPulse,
158 if( (time+NewPulse.size()) > OldPulse.size() && extend )
159 OldPulse.resize(time + NewPulse.size());
160 for(
size_t i = 0; i<NewPulse.size() && (time+i)<OldPulse.size(); ++i)
161 OldPulse[time+i] += NewPulse[i] * factor;
170 unsigned int NumberOfPulses =
fPoissonRandom->fire(MeanDarkPulses);
171 for(
size_t i=0; i!=NumberOfPulses; ++i)
195 chData.reserve(rawWF.size());
199 double thisSample = rawWF[time];
204 if(CLHEP::RandFlat::shoot(1.0) < (thisSample - int(thisSample)))
210 chData.push_back(thisCount);
215 unsigned int nFluc = CLHEP::RandPoisson::shoot(
fPedFlucRate * timeSpan);
216 for(
size_t i=0; i<nFluc; ++i)
220 if( CLHEP::RandFlat::shoot(0.,1.) > 0.5)
227 chData[pulseTime] = amp;
243 std::unique_ptr< std::vector<optdata::ChannelDataGroup > > StoragePtr (
new std::vector<optdata::ChannelDataGroup>);
250 double timeEnd_ns =
fTimeEnd * 1000;
271 std::vector<std::vector<double> > rawWF_HighGain(
fGeom->
NOpChannels(),std::vector<double>(timeSliceWindow,0.0));
272 std::vector<std::vector<double> > rawWF_LowGain(
fGeom->
NOpChannels(),std::vector<double>(timeSliceWindow,0.0));
297 if( Phot.Time > timeBegin_ns && Phot.Time < timeEnd_ns )
317 for(
unsigned short iCh = 0; iCh < rawWF_LowGain.size(); ++iCh){
318 rawWF_LowGain[iCh].resize((timeEnd_ns - timeBegin_ns) * sampleFreq_ns);
319 rawWF_HighGain[iCh].resize((timeEnd_ns - timeBegin_ns) * sampleFreq_ns);
334 rawWFGroup_HighGain.push_back(chData_HighGain);
335 rawWFGroup_LowGain.push_back(chData_LowGain);
338 StoragePtr->push_back(rawWFGroup_HighGain);
339 StoragePtr->push_back(rawWFGroup_LowGain);
341 evt.
put(std::move(StoragePtr));
optdata::ChannelData ApplyDigitization(std::vector< double > const RawWF, optdata::Channel_t const ch) const
optdata::ADC_Count_t fSaturationScale
void produce(art::Event &)
OptDetDigitizer(const fhicl::ParameterSet &)
art::ServiceHandle< geo::Geometry > fGeom
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
ProductID put(std::unique_ptr< PROD > &&product)
base_engine_t & getEngine() const
contains objects relating to OpDet hits
base_engine_t & createEngine(seed_t seed)
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
optdata::ADC_Count_t fPedFlucAmp
An art service to assist in the distribution of guaranteed unique seeds to all engines within an art ...
void AddWaveform(optdata::TimeSlice_t time, std::vector< double > &OldPulse, std::vector< double > &NewPulse, double factor, bool extend=false)
art::ServiceHandle< OpDigiProperties > fOpDigiProperties
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
list_type::const_iterator const_iterator
virtual ~OptDetDigitizer()
CLHEP::RandFlat * fFlatRandom
CLHEP::RandPoisson * fPoissonRandom
std::vector< double > fSinglePEWaveform
std::vector< optdata::ADC_Count_t > fPedMeanArray
Tools and modules for checking out the basics of the Monte Carlo.
void AddDarkNoise(std::vector< double > &RawWF, double gain)
static sim::SimPhotonsCollection GetSimPhotonsCollection(const art::Event &evt, std::string moduleLabel)
art framework interface to geometry description