158 const string myname =
"StandardRawDigitPrepService:prepare: ";
161 cout << myname <<
"Processing digits..." <<
endl;
162 cout << myname <<
" # input digits: " << datamap.size() <<
endl;
168 vector<AdcChannel> skipChannels;
169 for ( AdcChannelDataMap::value_type& iacd : datamap ) {
172 if (
m_LogLevel >= 3 ) cout << myname <<
"Processing digit for channel " << chan <<
endl;
173 if ( data.
digit ==
nullptr ) {
174 if (
m_LogLevel >= 2 ) cout << myname <<
"Skipping null digit." <<
endl;
175 skipChannels.push_back(chan);
180 cout << myname <<
"ERROR: Inconsistent channel number!" <<
endl;
181 skipChannels.push_back(chan);
185 unsigned int chanstat = chan;
191 if (
m_LogLevel >= 3 ) cout << myname <<
"Skipping bad channel " << chanstat <<
endl;
192 skipChannels.push_back(chan);
196 if (
m_LogLevel >= 3 ) cout << myname <<
"Skipping noisy channel " << chanstat <<
endl;
197 skipChannels.push_back(chan);
201 string state =
"extracted";
203 if (
m_LogLevel >= 3 ) cout << myname <<
"Saving intermediate state " << state <<
"." <<
endl;
205 snames.insert(state);
209 string state =
"mitigated";
211 if (
m_LogLevel >= 3 ) cout << myname <<
"Saving intermediate state " << state <<
"." <<
endl;
213 snames.insert(state);
225 cout << myname <<
"Dumping channel " <<
m_DumpChannel <<
", Tick " << isig <<
endl;
227 if ( datamap.size() == 0 ) {
228 cout <<
"Prepared data is empty." <<
endl;
231 cout <<
" First channel is " << datamap.begin()->first <<
endl;
232 cout <<
" Last channel is " << datamap.end()->first <<
endl;
235 cout << myname <<
" Pedestal: " << datamap[ichan].pedestal <<
endl;
236 if ( isig >= datamap[ichan].
raw.size() ) {
237 cout << myname <<
"Raw data does not include tick. Size is " << datamap[ichan].raw.size() <<
"." <<
endl;
239 cout << myname <<
" raw: " << datamap[ichan].raw[isig] <<
endl;
240 cout << myname <<
" flag: " << datamap[ichan].
flags[isig] <<
endl;
241 cout << myname <<
" After ext: " << datamap[ichan].samples[isig] <<
endl;
247 string state =
"noiseRemoved";
249 if (
m_LogLevel >= 3 ) cout << myname <<
"Saving intermediate state " << state <<
"." <<
endl;
250 for (
const auto& idat : datamap ) {
254 snames.insert(state);
259 for ( AdcChannelDataMap::value_type& chdata : datamap ) {
263 if (
m_DoDump ) cout << myname <<
" After dco: " << datamap[ichan].samples[isig] <<
endl;
265 for (
auto& chdata : datamap ) {
273 for (
auto& chdata : datamap ) {
276 if (
m_DoDump && chdata.first == ichan ) {
278 for (
AdcRoi roi : acd.
rois )
if ( isig >= roi.first && isig <= roi.second ) rois.push_back(roi);
279 cout << myname <<
" After roi: " << rois.size() <<
" of " << acd.
rois.size() <<
" match: ";
280 for (
AdcRoi roi : rois ) cout <<
" (" << roi.first <<
" , " << roi.second <<
")";
288 cout << myname <<
"WARNING: Wire building requested without ROI building." <<
endl;
292 for (
auto& chdata : datamap ) {
296 cout << myname <<
" Wire: " << pwires->back().Signal().at(isig) <<
endl;
299 for (
string sname : snames ) {
301 auto inamedacdmap = intStates.
dataMaps.find(sname);
302 if ( inamedacdmap == intStates.
dataMaps.end() ) {
303 cout << myname <<
"WARNING: State " << sname <<
" does not have data." <<
endl;
306 auto inamedwires = intStates.
wires.find(sname);
307 if ( inamedwires == intStates.
wires.end() ) {
308 cout << myname <<
"WARNING: State " << sname <<
" does not have a wire container." <<
endl;
312 std::vector<recob::Wire>* pwiresState = inamedwires->second;
313 for (
auto& chdata : acdmapState ) {
322 cout << myname <<
" State " << sname <<
" wire: " 323 << pwires->back().Signal().at(isig) <<
endl;
329 unsigned int idto = 0;
330 if (
m_LogLevel >= 2 ) cout << myname <<
"Running display tools." <<
endl;
335 padv->viewMap(datamap);
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
virtual int update(AdcChannelData &data) const =0
virtual int find(AdcChannelData &data) const =0
virtual int build(AdcChannelData &data) const =0
virtual bool IsNoisy(raw::ChannelID_t channel) const =0
Returns whether the specified channel is noisy in the current run.
const AdcNoiseRemovalService * m_pNoiseRemoval
ChannelID_t Channel() const
DAQ channel this raw data was read from.
std::pair< AdcIndex, AdcIndex > AdcRoi
virtual int evaluate(const AdcChannelData &data, AdcSignal *pped=nullptr, AdcSignal *prms=nullptr, AdcSignal *ppederr=nullptr, AdcSignal *prmserr=nullptr) const =0
bool m_ChannelStatusOnline
const ChannelMappingService * m_pChannelMappingService
const AdcChannelDataCopyService * m_pAdcChannelDataCopyService
const raw::RawDigit * digit
const AdcMitigationService * m_pmitigateSvc
const PedestalEvaluationService * m_pPedestalEvaluation
bool m_DoPedestalAdjustment
std::map< Name, AdcChannelDataMap > dataMaps
virtual int build(AdcChannelData &data, WireVector *wires) const =0
virtual int copy(const AdcChannelData &oldacd, AdcChannelData &newacd) const =0
const AdcRoiBuildingService * m_pRoiBuildingService
const AdcWireBuildingService * m_pWireBuildingService
const AdcSignalFindingService * m_pAdcSignalFindingService
std::vector< AdcChannelToolPtr > m_DisplayToolPtrs
const AdcDeconvolutionService * m_pDeconvolutionService
unsigned int m_WiresWithoutROIFlag
virtual int update(AdcChannelDataMap &datamap) const =0
bool m_DoEarlySignalFinding
const lariov::ChannelStatusProvider * m_pChannelStatusProvider
std::map< Name, WireContainer * > wires
unsigned int m_DumpChannel
std::unique_ptr< AdcChannelTool > AdcChannelToolPtr
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
const RawDigitExtractService * m_pExtractSvc
virtual int update(detinfo::DetectorClocksData const &clockData, AdcChannelData &data) const =0
std::vector< std::string > m_FoundDisplayToolNames
QTextStream & endl(QTextStream &s)
virtual Channel online(Channel offlineChannel) const =0