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(
"SimReadoutBoardICARUS: chargeWork vector too small");
311 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
evt);
322 unsigned int boardCount(0);
324 std::set<raw::ChannelID_t> channelIDSet;
326 for(
const auto& boardPair : readoutBoardToChannelMap)
331 std::vector<geo::WireID> wireIDVec;
333 for(
const auto& channelPair : boardPair.second.second)
337 if (wireIDVec.size() > 0)
break;
340 if (wireIDVec.empty())
continue;
342 bool goodBoard(
false);
343 unsigned int cryostat(0);
348 if (tpcid.Cryostat == wireIDVec[0].Cryostat && tpcid.TPC == wireIDVec[0].TPC)
351 cryostat = tpcid.Cryostat;
357 if (!goodBoard)
continue;
360 for(
const auto& channelPair : boardPair.second.second)
364 size_t plane = channelPair.second;
367 if (channelIDSet.find(channel) != channelIDSet.end())
369 std::cout <<
"############### Found already used channel! channelID: " << channel << std::endl;
371 channelIDSet.insert(channel);
380 float ped_mean = 2048;
385 ped_mean += rGaussPed.fire();
389 double noise_factor(0.);
394 noise_factor = tempNoiseVec[plane].at(
fShapingTimeOrder.find( shapingTime )->second );
398 throw cet::exception(
"SimReadoutBoardICARUS")
400 <<
"Shaping Time received from signalservices_icarus.fcl is not one of allowed values"
402 <<
"Allowed values: 0.6, 1.0, 1.3, 3.0 usec"
438 std::fill(chargeWork.begin(), chargeWork.end(), 0.);
448 if( tdc < 0 )
continue;
450 double charge = simChan->
Charge(tdc);
452 chargeWork[
tick] += charge/gain;
459 MakeADCVec(adcvec, noisetmp, chargeWork, ped_mean);
462 else MakeADCVec(adcvec, noisetmp, zeroCharge, ped_mean);
475 short area = std::accumulate(adcvec.begin(),adcvec.end(),0,[](
const auto& val,
const auto& sum){
return sum + val - 400;});
486 rd.SetPedestal(ped_mean);
487 digcol->push_back(std::move(rd));
CLHEP::HepRandomEngine & fCorNoiseEngine
TPCIDVec fTPCVec
List of TPCs to process for this instance of the module.
double GetASICGain(unsigned int const channel) const
bool fSimDeadChannels
if True, simulate dead channels using the ChannelStatus service. If false, do not simulate dead chann...
Collection of charge vs time digitized from a single readout channel.
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.
virtual const TPCReadoutBoardToChannelMap & getReadoutBoardToChannelMap() const =0
The data type to uniquely identify a Plane.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
bool fSmearPedestals
If True then we smear the pedestals.
double GetShapingTime(unsigned int const planeIdx) const
std::string fOutInstanceLabel
The label to apply to the output data product.
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
void MakeADCVec(std::vector< short > &adc, icarusutil::TimeVec const &noise, icarusutil::TimeVec const &charge, float ped_mean) const
virtual bool IsPresent(raw::ChannelID_t channel) const =0
Returns whether the specified channel is physical and connected to wire.
const geo::GeometryCore & fGeometry
double Charge(TDC_t tdc) const
Returns the total number of ionization electrons on this channel in the specified TDC...
art::InputTag fDriftEModuleLabel
module making the ionization electrons
const icarusDB::IICARUSChannelMap * fChannelMap
std::vector< SigProcPrecision > TimeVec
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
icarusutil::SignalShapingICARUSService * fSignalShapingService
std::map< double, int > fShapingTimeOrder
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.
CLHEP::HepRandomEngine & fUncNoiseEngine
std::map< unsigned int, SlotChannelVecPair > TPCReadoutBoardToChannelMap
const icarus_tool::IResponse & GetResponse(size_t channel) const
std::vector< sim::SimChannel > fTestSimChannel_v
raw::Compress_t fCompression
compression type to use
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
unsigned int fNTimeSamples
number of ADC readout samples in all readout frames (per event)
CLHEP::HepRandomEngine & fPedestalEngine
BEGIN_PROLOG could also be cout
std::unique_ptr< icarus_tool::IGenNoise > fNoiseTool
Tool for generating noise.