20 #include <sys/types.h>
24 #include "canvas/Utilities/Exception.h"
25 #include "art/Framework/Core/ModuleMacros.h"
26 #include "art/Framework/Core/EDProducer.h"
27 #include "art/Framework/Principal/Event.h"
28 #include "art/Framework/Principal/Handle.h"
29 #include "art/Framework/Services/Registry/ServiceHandle.h"
30 #include "art_root_io/TFileService.h"
31 #include "art_root_io/TFileDirectory.h"
32 #include "fhiclcpp/ParameterSet.h"
33 #include "messagefacility/MessageLogger/MessageLogger.h"
36 #include "nurandom/RandomUtils/NuRandomService.h"
60 #include "CLHEP/Random/RandFlat.h"
61 #include "CLHEP/Random/RandGaussQ.h"
73 explicit SimWireSBND(fhicl::ParameterSet
const& pset);
117 , fPedestalEngine(art::ServiceHandle<rndm::NuRandomService>{}->createEngine(*
this,
"HepJamesRandom",
"pedestal", pset,
"SeedPedestal"))
121 produces< std::vector<raw::RawDigit> >();
124 TString
compression(pset.get< std::string >(
"CompressionType"));
175 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob();
178 noiseserv->InitialiseProducerDeps(
this, p);
189 art::ServiceHandle<art::TFileService>
tfs;
191 fNoiseDist = tfs->make<TH1D>(
"Noise",
";Noise (ADC);", 1000, -10., 10.);
193 art::ServiceHandle<util::LArFFT> fFFT;
197 MF_LOG_DEBUG(
"SimWireSBND") <<
"Warning: FFTSize not a power of 2. "
198 <<
"May cause issues in (de)convolution.\n";
201 mf::LogError(
"SimWireSBND") <<
"Cannot have number of readout samples "
202 <<
"greater than FFTSize!";
214 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
220 art::ServiceHandle<geo::Geometry> geo;
226 std::vector<const sim::SimChannel*> chanHandle;
230 art::ServiceHandle<util::SignalShapingServiceSBND> sss;
236 std::vector<const sim::SimChannel*> channels(geo->Nchannels(),
nullptr);
237 for (
size_t c = 0; c < chanHandle.size(); ++c) {
238 channels.at(chanHandle.at(c)->Channel()) = chanHandle.at(c);
245 std::vector<double> chargeWork(
fNTicks, 0.);
251 std::unique_ptr< std::vector<raw::RawDigit>> digcol(
new std::vector<raw::RawDigit>);
254 unsigned int chan = 0;
255 art::ServiceHandle<util::LArFFT> fFFT;
258 std::map<int, double>::iterator mapIter;
259 for (chan = 0; chan < geo->Nchannels(); chan++) {
261 if (channelStatus.
IsBad(chan))
continue;
265 std::fill(chargeWork.begin(), chargeWork.end(), 0.);
269 for (
int t = 0; t < (int)(chargeWork.size()); ++t) {
271 int tdc = clockData.TPCTick2TDC(t);
274 if ( tdc < 0 )
continue;
276 chargeWork.at(t) = sc->
Charge(tdc);
281 sss->Convolute(clockData, chan, chargeWork);
284 std::vector<float> noisetmp(
fNTicks, 0.);
301 ped_mean += rGaussPed.fire();
306 float chargecontrib = chargeWork.at(i);
307 if (chargecontrib>preamp_sat) chargecontrib=preamp_sat;
309 float adcval = noisetmp.at(i) + chargecontrib + ped_mean;
322 adcvec.at(i) = (
unsigned short)(adcval+0.5);
338 digcol->push_back(rd);
342 evt.put(std::move(digcol));
TString compression(pset.get< std::string >("CompressionType"))
enum raw::_compress Compress_t
Collection of charge vs time digitized from a single readout channel.
float fInductionSat
ADC value of pre-amp saturation for induction plane.
Energy deposited on a readout channel by simulated tracks.
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
std::string fDriftEModuleLabel
module making the ionization electrons
float fCollectionSat
ADC value of pre-amp saturation for collection plane.
Definition of basic raw digits.
bool fGenNoise
if True -> Gen Noise. if False -> Skip noise generation entierly
float fInductionPed
ADC value of baseline for induction plane.
art::ServiceHandle< ChannelNoiseService > noiseserv
createEngine this this reconfigure(pset)
static constexpr float adcsaturation
Service to provide microboone-specific signal shaping for simulation (convolution) and reconstruction...
Signal from induction planes.
double Charge(TDC_t tdc) const
Returns the total number of ionization electrons on this channel in the specified TDC...
enum geo::_plane_sigtype SigType_t
Collect all the RawData header files together.
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
Class providing information about the quality of channels.
size_t fNTicks
number of ticks of the clock
unsigned int fNTimeSamples
number of ADC readout samples in all readout frames (per event)
float fBaselineRMS
ADC value of baseline RMS within each channel.
CLHEP::HepRandomEngine & fPedestalEngine
void reconfigure(fhicl::ParameterSet const &p)
void produce(art::Event &evt)
TH1D * fNoiseDist
distribution of noise counts
void SetPedestal(float ped, float sigma=1.)
Set pedestal and its RMS (the latter is 0 by default)
object containing MC truth information necessary for making RawDigits and doing back tracking ...
Interface for experiment-specific channel quality info provider.
void Compress(std::vector< short > &adc, raw::Compress_t compress)
Compresses a raw data buffer.
art::ServiceHandle< art::TFileService > tfs
Interface for experiment-specific service for channel quality info.
SimWireSBND(fhicl::ParameterSet const &pset)
raw::Compress_t fCompression
compression type to use
std::string fTrigModName
Trigger data product producer name.
Tools and modules for checking out the basics of the Monte Carlo.
art framework interface to geometry description
float fCollectionPed
ADC value of baseline for collection plane.