11 #include "CoreUtils/ServiceUtil.h" 24 fDetProp = gar::providerFrom<detinfo::DetectorPropertiesService>();
30 CLHEP::RandGauss GaussRand(
fEngine);
35 long inoise = lrint(noisevecdbl[i]);
36 if (inoise > 32767) inoise = 32767;
37 if (inoise < -32767) inoise = -32767;
55 std::vector<float>
const& electrons,
60 std::vector< short> adcs(numTicks, 0);
65 if(adcs.size() != electrons.size()){
67 <<
"The vectors for adc and electrons have different sizes, no idea " 68 <<
"how to handle that, bail";
71 for(
size_t e = 0;
e < electrons.size(); ++
e){
95 todrop = (retblocks == 0);
121 auto geo = gar::providerFrom<geo::GeometryGAr>();
125 for(
auto const& dig : digits) channels.insert(dig.Channel());
129 for(
unsigned int c = 0;
c <
geo->NChannels(); ++
c){
132 if(channels.count(
c) > 0)
continue;
148 if (retblocks) digits.emplace_back(
c, numTicks, adcs, cflag, 0);
163 CLHEP::RandFlat FlatRand(
fEngine);
164 double xnvi = ((double)
fNoiseVec.size() - 1) * FlatRand.fire();
165 if (xnvi < 0) xnvi = 0;
166 size_t i = (size_t ) xnvi;
172 for (
size_t j=0; j<adcs.size(); ++j)
196 return (
short)(tmpadc);
void AddNoiseToADCs(std::vector< short > &adcs)
const detinfo::DetectorProperties * fDetProp
detector properties
float fNoiseAmplitude
noise amplitdue
enum gar::raw::_compress Compress_t
std::vector< short > fNoiseVec
unsigned int fZSTicksBefore
for ZS Compression, # samples before
TPCReadoutSimStandardAlg(CLHEP::HepRandomEngine &engine, fhicl::ParameterSet const &pset)
unsigned int fZSTicksAfter
for ZS Compression, # samples after
Zero Suppression algorithm.
T get(std::string const &key) const
void CreateNoiseDigits(std::vector< raw::RawDigit > &digits)
virtual double ElectronsToADC() const =0
int fZSThreshold
for ZS Compression, threshold (upwards)
General GArSoft Utilities.
int fNoiseVecSize
how much noise to pre-generate
bool fAddNoise
flag to add noise or not
int fCompressType
Switch to compress raw digits.
int fNoiseSpectrum
0: Gaussian white noise; more to come
CLHEP::HepRandomEngine & fEngine
random number engine
int fADCSaturation
limit of the ADC
void reconfigure(fhicl::ParameterSet const &pset)
short ElectronsToADCs(float electrons)
virtual ~TPCReadoutSimStandardAlg()
LArSoft geometry interface.
void Compress(gar::raw::ADCvector_t &adc, gar::raw::Compress_t compress)
In-place compression of raw data buffer.
raw::RawDigit CreateRawDigit(unsigned int channel, std::vector< float > const &electrons, bool &todrop)
virtual unsigned int NumberTimeSamples() const =0
Collection of charge vs time digitized from a single readout channel.
cet::coded_exception< error, detail::translate > exception
int fPedestal
Raw Digit Pedestal.