265 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
279 std::vector<const sim::SimChannel*> channels(maxChannel,
nullptr);
282 std::vector<const sim::SimChannel*> chanHandle;
285 for(
const auto& simChannel : chanHandle) channels.at(simChannel->Channel()) = simChannel;
288 for(
const auto& testChannel :
fTestSimChannel_v) channels.at(testChannel.Channel()) = &testChannel;
292 std::unique_ptr< std::vector<raw::RawDigit>> digcol(
new std::vector<raw::RawDigit>);
293 digcol->reserve(maxChannel);
308 if (chargeWork.size() <
fNTimeSamples)
throw std::range_error(
"SimWireICARUS: chargeWork vector too small");
311 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
evt);
314 for(
const auto& noiseTool :
fNoiseToolVec) noiseTool->nextEvent();
323 using ChannelPair = std::pair<raw::ChannelID_t,raw::ChannelID_t>;
324 using ChannelPairVec = std::vector<ChannelPair>;
326 ChannelPairVec channelPairVec;
335 channelPairVec.emplace_back(planeStartChannel, planeEndChannel);
340 using MBWithSignalSet = std::set<raw::ChannelID_t>;
342 MBWithSignalSet mbWithSignalSet;
344 for(
const ChannelPair& channelPair : channelPairVec)
352 for(
raw::ChannelID_t mbIdx = firstMBIdx; mbIdx < endMBIdx; mbIdx++) mbWithSignalSet.insert(mbIdx);
356 for(
const auto& simChan : channels)
362 if (channel >= channelPair.first && channel < channelPair.second) mbWithSignalSet.insert(channel/
fNumChanPerMB);
369 for(
const auto& mb : mbWithSignalSet)
382 size_t plane = widVec[0].Plane;
383 size_t wire = widVec[0].Wire;
384 size_t board = wire / 32;
387 float ped_mean = pedestalRetrievalAlg.
PedMean(channel);
392 ped_mean += rGaussPed.fire();
396 double noise_factor(0.);
406 noise_factor = tempNoiseVec[plane].at(
fShapingTimeOrder.find( shapingTime )->second );
410 throw cet::exception(
"SimWireICARUS")
412 <<
"Shaping Time received from signalservices_icarus.fcl is not one of allowed values"
414 <<
"Allowed values: 0.6, 1.0, 1.3, 3.0 usec"
434 std::fill(chargeWork.begin(), chargeWork.end(), 0.);
439 int tdc = clockData.TPCTick2TDC(
tick);
442 if( tdc < 0 )
continue;
444 double charge = simChan->
Charge(tdc);
446 chargeWork[
tick] += charge/gain;
453 MakeADCVec(adcvec, noisetmp, chargeWork, ped_mean);
456 else MakeADCVec(adcvec, noisetmp, zeroCharge, ped_mean);
469 short area = std::accumulate(adcvec.begin(),adcvec.end(),0,[](
const auto& val,
const auto& sum){
return sum + val - 400;});
478 rd.SetPedestal(ped_mean);
479 digcol->push_back(std::move(rd));
raw::Compress_t fCompression
compression type to use
double GetASICGain(unsigned int const channel) const
Collection of charge vs time digitized from a single readout channel.
Energy deposited on a readout channel by simulated tracks.
IteratorBox< plane_iterator,&GeometryCore::begin_plane,&GeometryCore::end_plane > IteratePlanes() const
Enables ranged-for loops on all planes of the detector.
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
std::vector< std::unique_ptr< icarus_tool::IGenNoise > > fNoiseToolVec
Tool for generating noise.
CLHEP::HepRandomEngine & fUncNoiseEngine
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
double GetShapingTime(unsigned int const planeIdx) const
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
bool fSmearPedestals
If True then we smear the pedestals.
virtual bool IsPresent(raw::ChannelID_t channel) const =0
Returns whether the specified channel is physical and connected to wire.
std::string fOutInstanceLabel
The label to apply to the output data product.
double Charge(TDC_t tdc) const
Returns the total number of ionization electrons on this channel in the specified TDC...
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
std::vector< SigProcPrecision > TimeVec
bool fSuppressNoSignal
If no signal on wire (simchannel) then suppress the channel.
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
TPCIDVec fTPCVec
List of TPCs to process for this instance of the module.
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
Class providing information about the quality of channels.
DoubleVec2 GetNoiseFactVec()
The data type to uniquely identify a TPC.
int fNumChanPerMB
Number of channels per motherboard.
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
bool fSimDeadChannels
if True, simulate dead channels using the ChannelStatus service. If false, do not simulate dead chann...
const geo::GeometryCore & fGeometry
std::map< double, int > fShapingTimeOrder
CLHEP::HepRandomEngine & fCorNoiseEngine
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
CLHEP::HepRandomEngine & fPedestalEngine
unsigned int fNTimeSamples
number of ADC readout samples in all readout frames (per event)
const icarus_tool::IResponse & GetResponse(size_t channel) const
virtual float PedRms(raw::ChannelID_t ch) const =0
std::vector< sim::SimChannel > fTestSimChannel_v
icarusutil::SignalShapingICARUSService * fSignalShapingService
unsigned int ChannelID_t
Type representing the ID of a readout channel.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
int ResponseTOffset(unsigned int const channel) const
void MakeADCVec(std::vector< short > &adc, icarusutil::TimeVec const &noise, icarusutil::TimeVec const &charge, float ped_mean) const
art::InputTag fDriftEModuleLabel
module making the ionization electrons