76 #ifndef AdcChannelData_H 77 #define AdcChannelData_H 102 using View = std::vector<AdcChannelData>;
118 return EventInfo::badEventInfo();
122 return ChannelInfo::badChannelInfo();
163 time_t a_time =0,
int a_timerem =0,
165 setEventInfo(
new EventInfo(a_run, a_event, a_subRun, a_time, a_timerem, a_trigger, a_triggerClock));
172 return hasEventInfo() ? *m_peventInfo : badEventInfo();
177 time_t
time()
const {
return getEventInfo().time; }
178 int timerem()
const {
return getEventInfo().timerem; }
190 setChannelInfo(
new ChannelInfo(a_channel, a_fembID, a_fembChannel, a_channelStatus));
197 return hasChannelInfo() ? *m_pchanInfo : badChannelInfo();
208 if ( tickoff == EventInfo::badLongIndex() ) tickoff = 0;
233 if ( mname.substr(0,3) ==
"../" ) {
234 if ( viewParent ==
nullptr )
return false;
237 return metadata.find(mname) != metadata.end();
242 if ( mname.substr(0,3) ==
"../" ) {
243 if ( viewParent ==
nullptr )
return def;
247 if ( imtd == metadata.end() )
return def;
253 metadata[mname] =
val;
258 if ( mname.substr(0,3) ==
"../" ) {
259 if ( viewParent ==
nullptr )
return false;
262 if ( mname ==
"run" )
return true;
263 if ( mname ==
"subRun" )
return true;
264 if ( mname ==
"event" )
return true;;
265 if ( mname ==
"trigger" )
return true;;
266 if ( mname ==
"triggerClock" )
return true;
267 if ( mname ==
"channelClock" )
return true;
268 if ( mname ==
"channelClockOffset" )
return true;
269 if ( mname ==
"channel" )
return true;
270 if ( mname ==
"fembID" )
return true;
271 if ( mname ==
"fembChannel" )
return true;
272 if ( mname ==
"pedestal" )
return true;
273 if ( mname ==
"pedestalRms" )
return true;
274 if ( mname ==
"sampleNoise" )
return true;
275 if ( mname ==
"digitIndex" )
return true;
276 if ( mname ==
"wireIndex" )
return true;
277 if ( mname ==
"raw" )
return true;
278 if ( mname ==
"samples" )
return true;
279 if ( mname ==
"flags" )
return true;
280 if ( mname ==
"signal" )
return true;
281 if ( mname ==
"rois" )
return true;
282 if ( mname ==
"dftmags" )
return true;
283 if ( mname ==
"dftphases" )
return true;
284 if ( mname ==
"digit" )
return true;
285 if ( mname ==
"wire" )
return true;
286 if ( mname ==
"metadata" )
return metadata.size();
287 return hasMetadata(mname);
292 if ( mname.substr(0,3) ==
"../" ) {
293 if ( viewParent ==
nullptr )
return def;
297 if ( mname ==
"run" )
return run();
298 if ( mname ==
"subRun" )
return subRun();
299 if ( mname ==
"event" )
return event();
300 if ( mname ==
"trigger" )
return trigger();
301 if ( mname ==
"triggerClock" )
return triggerClock();
302 if ( mname ==
"channelClock" )
return channelClock;
303 if ( mname ==
"channelClockOffset" )
return channelClock - triggerClock();
304 if ( mname ==
"channel" )
return channel();
305 if ( mname ==
"fembID" )
return fembID();
306 if ( mname ==
"fembChannel" )
return fembChannel();
307 if ( mname ==
"pedestal" )
return pedestal;
308 if ( mname ==
"pedestalRms" )
return pedestalRms;
309 if ( mname ==
"sampleNoise" )
return sampleNoise;
310 if ( mname ==
"digitIndex" )
return digitIndex;
311 if ( mname ==
"wireIndex" )
return wireIndex;
313 if ( mname ==
"raw" )
return raw.size();
314 if ( mname ==
"samples" )
return samples.size();
315 if ( mname ==
"flags" )
return flags.size();
316 if ( mname ==
"signal" )
return signal.size();
317 if ( mname ==
"rois" )
return rois.size();
318 if ( mname ==
"dftmags" )
return dftmags.size();
319 if ( mname ==
"dftphases" )
return dftphases.size();
321 if ( mname ==
"digit" )
return digit !=
nullptr;
322 if ( mname ==
"wire" )
return wire !=
nullptr;
323 if ( mname ==
"metadata" )
return metadata.size();
325 return getMetadata(mname, def);
332 void roisFromSignal();
348 bool hasView(
Name vnam)
const;
381 #pragma link C++ class AdcChannelDataMap; 388 pedestal = badSignal();
407 m_peventInfo.reset();
416 for (
unsigned int isig=0; isig<signal.size(); ++isig ) {
418 AdcRoi& roi = rois.back();
419 if ( signal[isig] ) roi.second = isig;
422 if ( signal[isig] ) {
423 rois.push_back(
AdcRoi(isig, isig));
434 for ( ViewMap::value_type ivie : m_views ) {
435 vnams.push_back(ivie.first);
443 if ( vpnam.size() == 0 )
return true;
444 Name::size_type ipos = vpnam.find(
"/");
445 if ( ipos == Name::npos )
return m_views.count(vpnam);
446 Name vnam = vpnam.substr(0, ipos);
447 if ( ! hasView(vnam) )
return false;
448 Name vsnam = vpnam.substr(ipos + 1);
450 if ( acd.hasView(vsnam) )
return true;
460 if ( ivie == m_views.end() )
return empty;
467 const Name myname =
"AdcChannelData::updateView: ";
468 if ( vnam.size() == 0 ) {
469 std::cout << myname <<
"WARNING: View name may not be blank." <<
std::endl;
470 static View emptyView;
471 if ( emptyView.size() ) {
472 std::cout << myname <<
"ERROR: Empty view has been modified." <<
std::endl;
476 return m_views[vnam];
482 if ( vpnam.size() == 0 )
return 1;
483 Name::size_type ipos = vpnam.find(
"/");
484 if ( ipos == Name::npos )
return view(vpnam).size();
485 Name vnam = vpnam.substr(0, ipos);
486 Name vsnam = vpnam.substr(ipos + 1);
495 if ( vpnam.size() == 0 ) {
496 if ( ient == 0 )
return this;
499 Name::size_type ipos = vpnam.find(
"/");
500 if ( ipos == Name::npos ) {
501 const View& myview = view(vpnam);
502 if ( ient < myview.size() )
return &myview[ient];
505 Name vnam = vpnam.substr(0, ipos);
506 Name vsnam = vpnam.substr(ipos + 1);
510 if ( ientRem < nvie )
return dat.viewEntry(vsnam, ientRem);
519 if ( vpnam.size() == 0 ) {
520 if ( ient == 0 )
return this;
523 Name::size_type ipos = vpnam.find(
"/");
524 if ( ipos == Name::npos ) {
525 View& myview = updateView(vpnam);
526 if ( ient < myview.size() )
return &myview[ient];
529 Name vnam = vpnam.substr(0, ipos);
530 Name vsnam = vpnam.substr(ipos + 1);
534 if ( ientRem < nvie )
return dat.mutableViewEntry(vsnam, ientRem);
void setEventInfo(const EventInfo *pevi)
ChannelInfoPtr getChannelInfoPtr() const
AdcSignalVectorVector binSamples
std::vector< AdcCount > AdcCountVector
const DuneEventInfo & getEventInfo() const
std::vector< AdcChannelData > View
Collection of charge vs time digitized from a single readout channel.
Reconstruction base classes.
AdcLongIndex triggerTick0() const
std::vector< AdcFlag > AdcFlagVector
std::pair< AdcIndex, AdcIndex > AdcRoi
static AdcIndex dftNormalization()
ChannelInfoPtr m_pchanInfo
EventInfoPtr getEventInfoPtr() const
EventInfo::LongIndex LongIndex
std::shared_ptr< const EventInfo > EventInfoPtr
float getAttribute(Name mname, float def=0.0) const
bool hasEventInfo() const
const DuneChannelInfo & getChannelInfo() const
EventInfoPtr m_peventInfo
std::map< Name, float > FloatMap
void setChannelInfo(ChannelInfoPtr pchi)
NameVector viewNames() const
bool hasMetadata(Name mname) const
AdcLongIndex tickOffset() const
Index fembChannel() const
AdcChannelData(const AdcChannelData &rhs)
void setEventInfo(EventInfoPtr pevi)
void setChannelInfo(const ChannelInfo *pchi)
float getMetadata(Name mname, float def=0.0) const
std::vector< Name > NameVector
AdcSignalVector dftphases
bool hasAttribute(Name mname, float def=0.0) const
ChannelInfo::Channel Channel
void setChannelInfo(Channel a_channel, Index a_fembID=badIndex(), Index a_fembChannel=badIndex(), Index a_channelStatus=badIndex())
std::vector< AdcRoi > AdcRoiVector
Index channelStatus() const
const View & view(Name vnam) const
std::map< Name, View > ViewMap
unsigned long AdcLongIndex
std::vector< bool > AdcFilterVector
void setEventInfo(Index a_run, Index a_event, Index a_subRun=badIndex(), time_t a_time=0, int a_timerem=0, Index a_trigger=badIndex(), LongIndex a_triggerClock=badLongIndex())
AdcChannelData * mutableViewEntry(Name vpnam, AdcIndex ient)
std::vector< AdcSignalVector > AdcSignalVectorVector
std::shared_ptr< const ChannelInfo > ChannelInfoPtr
const AdcChannelData * viewEntry(Name vpnam, AdcIndex ient) const
AdcLongIndex channelClock
bool hasChannelInfo() const
Class holding the regions of interest of signal from a channel.
std::vector< AdcSignal > AdcSignalVector
View & updateView(Name vnam)
void setMetadata(Name mname, float val)
static const EventInfo & badEventInfo()
vector< vector< double > > clear
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
static Index badChannel()
static const ChannelInfo & badChannelInfo()
bool hasView(Name vnam) const
AdcLongIndex triggerClock() const
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
QTextStream & endl(QTextStream &s)
static Index badLongIndex()