56 using std::ostringstream;
93 std::unique_ptr<AdcSimulator>
m_pads;
112 produces< std::vector<raw::RawDigit> >();
122 string myname =
"SimWireDUNE::reconfigure: ";
123 string myprefix = myname +
" ";
137 out << myname <<
"Tools:" <<
endl;
139 out << myname <<
"Accessed services:" <<
endl;
140 out << myname <<
" SimChannel extraction service:" <<
endl;
143 out << myname <<
" Channel noise service:" <<
endl;;
146 out << myname <<
" Channel noise is off.";
150 out << myname <<
" Pedestal addition service:" <<
endl;;
153 out << myname <<
" Pedestal addition is off.";
157 out << myname <<
" ADC distortion service:" <<
endl;;
160 out << myname <<
" ADC distortion is off.";
164 out << myname <<
" ADC suppression service:" <<
endl;
167 out << myname <<
" ADC suppression is off.";
170 out << myname <<
" Compression service:" <<
endl;
173 out << myname <<
" KeepEmptyChannels:" << fKeepEmptyChannels <<
endl;
174 mf::LogInfo(
"SimWireDUNE::reconfigure") << out.str();
190 const string myname =
"SimWireDUNE::produce: ";
196 std::vector<const sim::SimChannel*> chanHandle;
197 std::vector<const sim::SimChannel*> simChannels(
m_pgeo->
Nchannels(),
nullptr);
199 for (
size_t c=0;
c<chanHandle.size(); ++
c ) {
200 simChannels[chanHandle[
c]->Channel()] = chanHandle[
c];
204 std::vector<const raw::RawDigit*> inputDigitsHandle;
205 std::vector<const raw::RawDigit*> inputDigits(
m_pgeo->
Nchannels(),
nullptr);
208 for (
size_t c=0;
c<inputDigitsHandle.size(); ++
c ) {
210 inputDigits[dig->
Channel()] = dig;
216 std::unique_ptr<std::vector<raw::RawDigit>> digcol(
new std::vector<raw::RawDigit>);
221 unsigned int nTickReadout = detProp.ReadOutWindowSize();
231 std::vector<AdcSignal> fChargeWork;
235 fChargeWork.insert(fChargeWork.end(), dig->
ADCs().begin(), dig->
ADCs().end());
251 cout << myname <<
"Signals after noise:" <<
endl;
252 for (
unsigned int itck=0; itck<fChargeWork.size(); ++itck ) {
253 if(fChargeWork[itck] > 0 )
254 cout << myname <<
" " << itck <<
": chg=" << fChargeWork[itck] <<
endl;
266 std::vector<short> adcvec(fChargeWork.size(), 0);
267 const short adcmax = 4095;
268 for (
unsigned int itck=0; itck<fChargeWork.size(); ++itck ) {
271 bool useOldAdc =
false;
276 adc =
m_pads->count(adcin, chan);
284 if ( adcin > 0 ) adc1 = (short) (adcin + 0.5);
285 if ( adc1 > adcmax ) adc1 = adcmax;
288 static int ndump = 1000;
289 if ( ndump && show ) {
290 cout << myname <<
" ADC: " << adc1 <<
" --> " << adc <<
" (" << adcin <<
")" <<
endl;
299 adcvec.resize(nTickReadout);
312 for (
bool kept : acs.
filter )
if ( kept ) ++nkeep;
324 digcol->push_back(rd);
art::ServiceHandle< PedestalAdditionService > m_ppad
art::ServiceHandle< SimChannelExtractService > m_pscx
bool fKeepEmptyChannels
Write out empty channels iff true.
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
enum raw::_compress Compress_t
Collection of charge vs time digitized from a single readout channel.
virtual int modify(Channel chan, AdcCountVector &adcvec) const =0
Energy deposited on a readout channel by simulated tracks.
art::ServiceHandle< AdcSuppressService > m_pzs
virtual int addNoise(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, Channel chan, AdcSignalVector &sigs) const =0
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
EDProducer(fhicl::ParameterSet const &pset)
bool fNoiseOn
noise turned on or off for debugging; default is on
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const =0
std::unique_ptr< AdcSimulator > m_pads
ChannelID_t Channel() const
DAQ channel this raw data was read from.
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const =0
SimWireDUNE(fhicl::ParameterSet const &pset)
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix=" ") const =0
art framework interface to geometry description
art::ServiceHandle< geo::Geometry > m_pgeo
art::ServiceHandle< ChannelNoiseService > m_pcns
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
void produce(art::Event &evt)
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix=" ") const =0
bool fUseRawDigitInput
Use (presumably noise-free) RawDigits for input instead of SimChannels.
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
std::string fRawDigitInputLabel
The module label for the RawDigits to read in.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool fPedestalOn
switch for simulation of nonzero pedestals
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const =0
art::ServiceHandle< AdcDistortionService > m_pdis
void reconfigure(fhicl::ParameterSet const &p)
void SetPedestal(float ped, float sigma=1.)
Set pedestal and its RMS (the latter is 0 by default)
virtual int addPedestal(Channel chan, AdcSignalVector &sigs, float &ped, float &pedrms) const =0
virtual int filter(const AdcCountVector &sigs, Channel chan, AdcPedestal ped, AdcFilterVector &keep) const =0
std::string fAdcSimulatorName
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
art::ServiceHandle< AdcCompressService > m_pcmp
Tools and modules for checking out the basics of the Monte Carlo.
std::string fSimChannelLabel
Data product holding the ionization electrons.
virtual int compress(AdcCountVector &sigs, const AdcFilterVector &keep, AdcCount offset, raw::Compress_t &comp) const =0
bool fSuppressOn
switch for simulation of zero suppression
QTextStream & endl(QTextStream &s)
bool fDistortOn
switch for simulation of stuck bits