183 art::Handle<std::vector<raw::RawDigit>> inputRawDigitHandle;
187 if (!inputRawDigitHandle.isValid())
throw std::runtime_error(
"Failed to read back RawDigits for overlay!");
190 art::Handle<std::vector<sim::SimChannel>> simChanHandle;
193 if (!simChanHandle.isValid())
throw std::runtime_error(
"Failed to recover the SimChannel information for the overlay");
196 using SimChannelMap = std::unordered_map<raw::ChannelID_t, const sim::SimChannel*>;
200 for(
const auto& simChannel : *simChanHandle) simChannelMap[simChannel.Channel()] = &simChannel;
204 std::unique_ptr< std::vector<raw::RawDigit>> digcol(
new std::vector<raw::RawDigit>);
205 digcol->reserve(inputRawDigitHandle->size());
208 std::vector<short> adcvec;
212 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(
evt);
215 for(
const auto& rawDigit : *inputRawDigitHandle)
226 size_t plane = widVec[0].Plane;
232 adcvec.resize(rawDigit.Samples(),0);
233 zeroCharge.resize(rawDigit.Samples(),0);
239 SimChannelMap::const_iterator simChanItr = simChannelMap.find(channel);
241 if (simChanItr != simChannelMap.end())
256 for(
const auto& tdcide : simChan->
TDCIDEMap())
258 unsigned int tdc = tdcide.first;
261 int tick = clockData.TPCTDC2Tick(tdc);
264 if (tick < 0 ||tick >
int(adcvec.size()))
266 std::cout <<
"tick out of range: " << tick <<
", tdc: " << tdc << std::endl;
271 double charge = simChan->
Charge(tdc);
273 chargeWork[
tick] += charge / gain;
289 short area = std::accumulate(adcvec.begin(),adcvec.end(),0,[](
const auto& val,
const auto& sum){
return sum + val - 400;});
308 rd.
SetPedestal(rawDigit.GetPedestal(),rawDigit.GetSigma());
309 digcol->push_back(std::move(rd));
312 evt.put(std::move(digcol));
std::map< int, art::Ptr< sim::SimChannel > > SimChannelMap
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.
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
art::InputTag fDriftEModuleLabel
module making the ionization electrons
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
raw::Compress_t fCompression
compression type to use
icarusutil::SignalShapingICARUSService * fSignalShapingService
Access to the response functions.
double Charge(TDC_t tdc) const
Returns the total number of ionization electrons on this channel in the specified TDC...
void MakeADCVec(std::vector< short > &adc, icarusutil::TimeVec const &charge, float ped_mean) const
std::vector< SigProcPrecision > TimeVec
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
art::InputTag fInputRawDataLabel
Label for the underlying raw digit data.
const lariov::DetPedestalProvider & fPedestalRetrievalAlg
Keep track of an instance to the pedestal retrieval alg.
void SetPedestal(float ped, float sigma=1.)
Set pedestal and its RMS (the latter is 0 by default)
const icarus_tool::IResponse & GetResponse(size_t channel) const
TDCIDEs_t const & TDCIDEMap() const
Returns all the deposited energy information as stored.
const geo::GeometryCore & fGeometry
unsigned int ChannelID_t
Type representing the ID of a readout channel.
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
int ResponseTOffset(unsigned int const channel) const
BEGIN_PROLOG could also be cout