60 #include <type_traits> 67 #include "TVirtualPad.h" 82 #include "nuevdb/EventDisplayBase/View2D.h" 90 #include "cetlib_except/demangle.h" 94 template <
typename Stream,
typename T>
98 out << header <<
": " << range.
min() <<
" -- " << range.
max() <<
" (" 99 << (range.
has_data() ?
"valid" :
"invalid") <<
")";
107 template <
typename T>
112 using reference = std::add_lvalue_reference_t<value_type>;
114 using pointer = std::add_pointer_t<value_type>;
233 return SampleInfo().min_charge;
240 return SampleInfo().max_charge;
256 template <
typename Stream>
257 void Dump(Stream&& out)
const;
269 mutable ::details::PointerToData_t<raw::RawDigit::ADCvector_t const>
data;
275 void UncompressData()
const;
278 void CollectSampleInfo()
const;
289 std::vector<RawDigitInfo_t>
const&
309 return digits.empty();
316 void Refill(
art::Handle<std::vector<raw::RawDigit>>& rdcol);
326 template <
typename Stream>
327 void Dump(Stream&& out)
const;
332 bool bUpToDate =
false;
333 std::vector<raw::RawDigit>
const* digits =
nullptr;
337 : bUpToDate(uptodate), digits(newdigits)
340 operator bool()
const {
return bUpToDate; }
347 size_t max_samples = 0;
353 static std::vector<raw::RawDigit>
const* ReadProduct(
art::Event const& evt,
361 return cache.
Digits().cbegin();
366 return cache.
Digits().cend();
380 std::ptrdiff_t GetCell(
float coord)
const;
384 return GetCell(coord);
392 return (iCell >= 0) && ((size_t)iCell < NCells());
399 return (coord >= Min()) && (coord < Max());
448 return Min() + CellSize() * iCell;
455 return LowerEdge(iCell + 1);
459 bool Init(
size_t nDiv,
float new_min,
float new_max);
462 bool SetLimits(
float new_min,
float new_max);
466 bool SetMinCellSize(
float min_size);
470 bool SetMaxCellSize(
float max_size);
477 return SetMinCellSize(min_size) || SetMaxCellSize(max_size);
480 template <
typename Stream>
481 void Dump(Stream&& out)
const;
512 return wire_axis.NCells() * tdc_axis.NCells();
530 std::ptrdiff_t GetCell(
float wire,
float tick)
const;
533 std::tuple<float, float, float, float> GetCellBox(std::ptrdiff_t iCell)
const;
540 return wire_axis.hasCoord(wire);
545 return hasWire((
float)wire);
554 return tdc_axis.hasCoord(tick);
559 return hasTick((
float)tick);
565 template <
typename CONT>
567 Add(CONT& cont,
float wire,
float tick,
typename CONT::value_type v)
569 std::ptrdiff_t cell = GetCell(wire, tick);
570 if (cell < 0)
return false;
571 cont[(size_t)cell] += v;
581 SetWireRange(0., (
float)nWires, nWires);
588 wire_axis.SetLimits(min_wire, max_wire);
595 wire_axis.Init(nWires, min_wire, max_wire);
600 SetWireRange(
float min_wire,
float max_wire,
unsigned int nWires,
float min_size)
602 wire_axis.Init(nWires, min_wire, max_wire);
603 wire_axis.SetMinCellSize(min_size);
610 SetTDCRange(0., (
float)nTDC, nTDC);
617 tdc_axis.Init(nTDC, min_tdc, max_tdc);
624 tdc_axis.SetLimits(min_tdc, max_tdc);
629 SetTDCRange(
float min_tdc,
float max_tdc,
unsigned int nTDC,
float min_size)
631 tdc_axis.Init(nTDC, min_tdc, max_tdc);
632 tdc_axis.SetMinCellSize(min_size);
641 return wire_axis.SetMinCellSize(min_size);
648 return tdc_axis.SetMinCellSize(min_size);
652 template <
typename Stream>
653 void Dump(Stream&& out)
const;
667 , electronsToADC{dp.ElectronsToADC()}
674 if (adc < 0.)
return 0.;
675 double const dQdX = adc / wirePitch / electronsToADC;
676 return detProp.BirksCorrection(dQdX);
692 std::vector<raw::RawDigit>
const RawDataDrawer::EmptyRawDigits;
695 RawDataDrawer::RawDataDrawer()
696 : digit_cache(new
details::RawDigitCacheDataClass)
700 , fDrawingRange(new
details::CellGridClass)
711 unsigned int nplanes = geo->
Nplanes(tpcid);
732 MF_LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() setting drawing range as wires ( " << low_wire
733 <<
" - " << high_wire <<
" ), ticks ( " << low_tdc <<
" - " 746 MF_LOG_DEBUG(
"RawDataDrawer") <<
"Pad size not available -- using existing cell size";
765 log <<
"ExtractRange() on pad '" << pPad->GetName() <<
"'";
767 TFrame
const* pFrame = pPad->GetFrame();
770 double low_wire = pFrame->GetX1(), high_wire = pFrame->GetX2();
771 double low_tdc = pFrame->GetY1(), high_tdc = pFrame->GetY2();
772 double const wire_pixels = pPad->XtoAbsPixel(high_wire) - pPad->XtoAbsPixel(low_wire);
773 double const tdc_pixels = -(pPad->YtoAbsPixel(high_tdc) - pPad->YtoAbsPixel(low_tdc));
784 log <<
", from external source,";
785 low_wire = (*zoom)[0];
786 high_wire = (*zoom)[1];
787 low_tdc = (*zoom)[2];
788 high_tdc = (*zoom)[3];
791 log <<
" spans wires " << low_wire <<
"-" << high_wire <<
" and TDC " << low_tdc <<
"-" 802 log <<
"\n no frame!";
811 : pRawDataDrawer(data_drawer), planeID(pid)
840 return cet::demangle_symbol(
typeid(*this).name());
846 return Operate(wireID, tick, adc);
857 return pRawDataDrawer;
869 std::vector<std::unique_ptr<RawDataDrawer::OperationBaseClass>>
operations;
880 for (std::unique_ptr<OperationBaseClass>
const& op : operations)
881 if (!op->Initialize()) bAllOk =
false;
888 for (std::unique_ptr<OperationBaseClass>
const& op : operations)
889 if (op->ProcessWire(wireID))
return true;
895 for (std::unique_ptr<OperationBaseClass>
const& op : operations)
896 if (op->ProcessTick(tick))
return true;
903 for (std::unique_ptr<OperationBaseClass>
const& op : operations)
904 if (!op->Operate(wireID, tick, adc))
return false;
912 for (std::unique_ptr<OperationBaseClass>
const& op : operations)
913 if (!op->Finish()) bAllOk =
false;
921 msg += (
" [running " +
std::to_string(operations.size()) +
" operations:");
922 for (
auto const& op : operations) {
924 msg +=
" " + op->Name();
934 return operations.at(iOp).get();
939 return operations.at(iOp).get();
946 if (
PlaneID() != new_op->PlaneID()) {
948 <<
"RawDataDrawer::ManyOperations(): trying to run operations on " 950 <<
" at the same time";
952 if (RawDataDrawerPtr() && (RawDataDrawerPtr() != new_op->RawDataDrawerPtr())) {
954 <<
"RawDataDrawer::ManyOperations(): " 955 "trying to run operations on different RawDataDrawer";
957 operations.emplace_back(
std::move(new_op));
971 MF_LOG_DEBUG(
"RawDataDrawer") <<
"RawDataDrawer::RunOperation() running " << operation->
Name();
982 *(lar::providerFrom<lariov::DetPedestalService>());
992 if (!channelStatus.
IsPresent(channel))
continue;
1001 std::vector<geo::WireID> WireIDs = geom.
ChannelToWire(channel);
1003 bool bDrawChannel =
false;
1005 if (wireID.planeID() != pid)
continue;
1006 bDrawChannel =
true;
1009 if (!bDrawChannel)
continue;
1017 if (!bGood)
continue;
1034 <<
". Pedestals not subtracted.";
1041 if (wireID.planeID() != pid)
continue;
1050 for (
size_t iTick =
fStartTick; iTick < max_tick; ++iTick) {
1055 float const adc = uncompressed[iTick] - pedestal;
1058 if (!operation->
Operate(wireID, iTick, adc))
return false;
1064 return operation->
Finish();
1073 evdb::View2D* new_view)
1077 , convertedCharge(0.)
1079 , ADCCorrector(detProp,
PlaneID())
1094 drawingRange.SetMinWireCellSize(1.F);
1096 boxInfo.resize(drawingRange.NCells());
1103 return drawingRange.hasWire((
int)wire.
Wire);
1109 return drawingRange.hasTick((
float)tick);
1116 std::ptrdiff_t cell = drawingRange.GetCell(wire, tick);
1117 if (cell < 0)
return true;
1123 convertedCharge += ADCCorrector(adc);
1136 RawDataDrawerPtr()->fRawCharge[plane] = rawCharge;
1137 RawDataDrawerPtr()->fConvertedCharge[plane] = convertedCharge;
1141 *(RawDataDrawerPtr()->fDrawingRange) = drawingRange;
1144 RawDataDrawerPtr()->QueueDrawingBoxes(view,
PlaneID(), boxInfo);
1152 double rawCharge = 0., convertedCharge = 0.;
1161 std::vector<BoxInfo_t>
const& BoxInfo)
1169 MF_LOG_DEBUG(
"RawDataDrawer") <<
"Filling " << BoxInfo.size() <<
" boxes to be rendered";
1179 evdb::ColorScale
const& ColorSet = cst->
RawQ(sigType);
1180 size_t const nBoxes = BoxInfo.size();
1181 unsigned int nDrawnBoxes = 0;
1182 for (
size_t iBox = 0; iBox < nBoxes; ++iBox) {
1189 if (!info.
good)
continue;
1192 int const color = ColorSet.GetColor(info.
adc);
1195 constexpr
float q0 = 1000.;
1196 float const sf = bScaleDigitsByCharge ?
std::min(std::sqrt((
float)info.
adc / q0), 1.0F) : 1.;
1199 float min_wire, max_wire, min_tick, max_tick;
1207 float const nsf = 1. - sf;
1208 float const half_box_wires = (max_wire - min_wire) / 2.,
1209 half_box_ticks = (max_tick - min_tick) / 2.;
1212 min_wire += nsf * half_box_wires;
1213 max_wire -= nsf * half_box_wires;
1214 min_tick += nsf * half_box_ticks;
1215 max_tick -= nsf * half_box_ticks;
1222 pBox = &(view->AddBox(min_wire, min_tick, max_wire, max_tick));
1224 pBox = &(view->AddBox(min_tick, min_wire, max_tick, max_wire));
1226 pBox->SetFillStyle(1001);
1227 pBox->SetFillColor(color);
1228 pBox->SetBit(kCannotPick);
1233 MF_LOG_DEBUG(
"RawDataDrawer") <<
"Sent " << nDrawnBoxes <<
"/" << BoxInfo.size()
1234 <<
" boxes to be rendered";
1252 "somewhere something went somehow wrong";
1270 if (
std::abs(adc) < RoIthreshold)
return true;
1271 WireRange.add(wireID.
Wire);
1280 int& WireMin = pRawDataDrawer->fWireMin[plane];
1281 int& WireMax = pRawDataDrawer->fWireMax[plane];
1282 int& TimeMin = pRawDataDrawer->fTimeMin[plane];
1283 int& TimeMax = pRawDataDrawer->fTimeMax[plane];
1285 if ((WireMin == WireMax) && WireRange.has_data()) {
1288 <<
"Region of interest for " <<
std::string(
PlaneID()) <<
" detected to be within wires " 1289 << WireRange.min() <<
" to " << WireRange.max() <<
" (plane has " 1291 WireMax = WireRange.max() + 1;
1292 WireMin = WireRange.min();
1294 if ((TimeMin == TimeMax) && TDCrange.has_data()) {
1296 <<
"Region of interest for " <<
std::string(
PlaneID()) <<
" detected to be within ticks " 1297 << TDCrange.min() <<
" to " << TDCrange.max();
1298 TimeMax = TDCrange.max() + 1;
1299 TimeMin = TDCrange.min();
1317 << (bExtractRoI ?
" extracted" :
" not extracted")
1320 if (!bExtractRoI)
return;
1324 throw std::runtime_error(
1325 "RawDataDrawer::RunRoIextractor(): somewhere something went somehow wrong");
1353 bool theDroidIAmLookingFor =
false;
1365 std::vector<geo::WireID> WireIDs = geom->
ChannelToWire(rawDigit.Channel());
1368 if (wireID.planeID() !=
pid)
continue;
1369 theDroidIAmLookingFor =
true;
1373 if (theDroidIAmLookingFor)
break;
1376 if (theDroidIAmLookingFor)
break;
1379 if (!theDroidIAmLookingFor)
return;
1389 std::unique_ptr<OperationBaseClass> operation;
1392 MF_LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() setting up one-pass drawing";
1393 operation.reset(
new BoxDrawer(detProp,
pid,
this, view));
1396 MF_LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() adding RoI extraction";
1400 std::unique_ptr<OperationBaseClass> drawer(
std::move(operation));
1411 "somewhere something went somehow wrong";
1417 MF_LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() setting up RoI extraction for " <<
pid;
1421 <<
"RawDataDrawer::RunDrawOperation():" 1422 " something went somehow wrong while extracting RoI";
1427 << __func__ <<
"() using existing RoI for " <<
pid <<
": wires ( " <<
fWireMin[plane]
1436 MF_LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() setting up drawing";
1440 " something went somehow wrong while drawing";
1451 if ((
unsigned int)plane >=
fWireMin.size()) {
1453 <<
" Requested plane " << plane <<
" is larger than those available " <<
std::endl;
1462 if ((minw == maxw) || (mint == maxt))
return 1;
1465 minw = (minw - 30 < 0) ? 0 : minw - 30;
1466 mint = (mint - 10 < 0) ? 0 : mint - 10;
1468 maxw = (maxw + 10 > (
int)geo->
Nwires(plane)) ? geo->
Nwires(plane) : maxw + 10;
1510 if (!channelStatus.
IsPresent(channel))
continue;
1518 std::vector<geo::WireID> wireids = geo->
ChannelToWire(channel);
1519 for (
auto const& wid : wireids) {
1521 if (wid.planeID() !=
pid)
continue;
1538 <<
". Pedestals not subtracted.";
1541 for (
short d : uncompressed)
1542 histo->Fill(
float(
d) - pedestal);
1581 << __func__ <<
": no channel associated to " <<
std::string(wireid);
1589 if (!channelStatus.
IsPresent(channel))
return;
1627 <<
". Pedestals not subtracted.";
1630 for (
size_t j = 0; j < uncompressed.size(); ++j)
1631 histo->Fill(
float(j),
1632 float(uncompressed[j]) - pedestal);
1740 MF_LOG_DEBUG(
"RawDataDrawer") <<
"RawDataDrawer[" << ((
void*)
this)
1741 <<
"]: resetting the region of interest";
1755 MF_LOG_DEBUG(
"RawDataDrawer") <<
"GetRawDigits() for " << new_timestamp
1756 <<
" (last for: " << *
fCacheID <<
")";
1767 *fCacheID = new_timestamp;
1782 if (channel_status < drawopt->fMinChannelStatus)
return false;
1797 if (!
data.hasData()) UncompressData();
1809 RawDigitInfo_t::Clear()
1812 sample_info.reset();
1816 RawDigitInfo_t::UncompressData()
const 1824 if (digit->Compression() ==
kNone) {
1826 data.PointToData(digit->ADCs());
1831 int pedestal = (
int)digit->GetPedestal();
1833 samples.resize(digit->Samples());
1834 Uncompress(digit->ADCs(), samples, pedestal, digit->Compression());
1839 samples.resize(digit->Samples());
1840 Uncompress(digit->ADCs(), samples, digit->Compression());
1847 RawDigitInfo_t::CollectSampleInfo()
const 1858 sample_info->min_charge =
stat.min();
1859 sample_info->max_charge =
stat.max();
1865 RawDigitInfo_t::SampleInfo()
const 1867 if (!sample_info) CollectSampleInfo();
1868 return *sample_info;
1871 template <
typename Stream>
1873 RawDigitInfo_t::Dump(Stream&& out)
const 1875 out <<
" digit at " << ((
void*)digit.get()) <<
" on channel #" << digit->Channel()
1876 <<
" with " << digit->NADC();
1877 if (digit->Compression() ==
kNone)
1878 out <<
" uncompressed data";
1880 out <<
" data items compressed with <" << digit->Compression() <<
">";
1882 out <<
" with data (" <<
data->size() <<
" samples)";
1884 out <<
" without data";
1894 auto iDigit = std::find_if(
1896 return digit.Channel() ==
channel;
1898 return (iDigit == digits.cend()) ?
nullptr : &*iDigit;
1901 std::vector<raw::RawDigit>
const*
1905 if (!evt.
getByLabel(label, rdcol))
return nullptr;
1910 RawDigitCacheDataClass::Refill(
art::Handle<std::vector<raw::RawDigit>>& rdcol)
1912 digits.resize(rdcol->size());
1913 for (
size_t iDigit = 0; iDigit < rdcol->size(); ++iDigit) {
1915 digits[iDigit].Fill(pDigit);
1916 size_t samples = pDigit->
Samples();
1917 if (samples > max_samples) max_samples = samples;
1922 RawDigitCacheDataClass::Invalidate()
1928 RawDigitCacheDataClass::Clear()
1953 if (
empty())
return res;
1955 if (!evt)
return res;
1959 if (!res.digits)
return res;
1961 if (res.digits->empty())
1967 if (!pInfo)
return res;
1969 if (&(pInfo->
Digit()) != &(res.digits->front()))
1972 res.bUpToDate =
true;
1981 if (update_info)
return false;
1983 MF_LOG_DEBUG(
"RawDataDrawer") <<
"Refilling raw digit cache RawDigitCacheDataClass[" 1984 << ((
void*)
this) <<
"] for " << new_timestamp;
1991 <<
"no RawDigit collection '" << new_timestamp.
inputLabel() <<
"' found";
1997 timestamp = new_timestamp;
2001 template <
typename Stream>
2003 RawDigitCacheDataClass::Dump(Stream&& out)
const 2005 out <<
"Cache at " << ((
void*)
this) <<
" with time stamp " <<
std::string(timestamp)
2006 <<
" and " << digits.size() <<
" entries (maximum sample: " << max_samples <<
");" 2007 <<
" data at " << ((
void*)digits.data());
2010 digitInfo.Dump(out);
2019 GridAxisClass::GetCell(
float coord)
const 2021 return std::ptrdiff_t((coord -
min) / cell_size);
2029 n_cells =
std::max(nDiv,
size_t(1));
2030 return SetLimits(new_min, new_max);
2036 GridAxisClass::SetLimits(
float new_min,
float new_max)
2042 return std::isnormal(cell_size);
2047 GridAxisClass::SetMinCellSize(
float min_size)
2049 if (cell_size >= min_size)
return false;
2052 n_cells = (size_t)
std::max(std::floor(
Length() / min_size), 1.0F);
2062 GridAxisClass::SetMaxCellSize(
float max_size)
2064 if (cell_size <= max_size)
return false;
2067 n_cells = (size_t)
std::max(std::ceil(
Length() / max_size), 1.0F);
2076 template <
typename Stream>
2078 GridAxisClass::Dump(Stream&& out)
const 2080 out << NCells() <<
" cells from " << Min() <<
" to " << Max() <<
" (length: " <<
Length()
2087 CellGridClass::CellGridClass(
unsigned int nWires,
unsigned int nTDC)
2088 : wire_axis((size_t)nWires, 0.,
float(nWires)), tdc_axis((size_t)nTDC, 0.,
float(nTDC))
2094 unsigned int nWires,
2098 :
wire_axis((size_t)nWires, min_wire, max_wire),
tdc_axis((size_t)nTDC, min_tdc, max_tdc)
2113 std::tuple<float, float, float, float>
2118 std::ptrdiff_t iWireCell = (std::ptrdiff_t)(iCell / nTDCCells),
2119 iTDCCell = (std::ptrdiff_t)(iCell % nTDCCells);
2128 template <
typename Stream>
2132 out <<
"Wire axis: ";
2134 out <<
"; time axis: ";
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
int GetRegionOfInterest(int plane, int &minw, int &maxw, int &mint, int &maxt)
float GetPedestal() const
Data_t max() const
Returns the accumulated maximum, or a very small number if no values.
const_pointer operator->() const
details::CellGridClass drawingRange
float Length(const PFPStruct &pfp)
short MaxCharge() const
maximum charge
bool has_data() const
Returns whether at least one datum has been added.
~PointerToData_t()
Destructor: gets rid of the owned data.
int fScaleDigitsByCharge
scale the size of the digit by the charge
bool Update(art::Event const &evt, CacheID_t const &new_timestamp)
BoxDrawer(detinfo::DetectorPropertiesData const &detProp, geo::PlaneID const &pid, RawDataDrawer *dataDrawer, evdb::View2D *new_view)
bool sameProduct(PlaneDataChangeTracker_t const &as) const
Returns whether we are in the same event (the rest could differ)
bool SetCellSizeBoundary(float min_size, float max_size)
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
bool ProcessTick(size_t tick) override
unsigned int fTPC
TPC number to draw, typically set by TWQProjectionView.
Collection of charge vs time digitized from a single readout channel.
void SetWireRange(float min_wire, float max_wire)
Sets the wire range, leaving the number of wire cells unchanged.
void FillTQHisto(const art::Event &evt, unsigned int plane, unsigned int wire, TH1F *histo)
int adc
total ADC count in this box
raw::RawDigit const & Digit() const
Returns an art pointer to the actual digit.
void SetTDCRange(float min_tdc, float max_tdc, unsigned int nTDC, float min_size)
Sets the complete TDC range, with minimum cell size.
void SetWireRange(float min_wire, float max_wire, unsigned int nWires, float min_size)
Sets the complete wire range, with minimum cell size.
void msg(const char *fmt,...)
bool Operate(geo::WireID const &wireID, size_t tick, float adc) override
OperationBaseClass(geo::PlaneID const &pid, RawDataDrawer *data_drawer=nullptr)
void RunDrawOperation(art::Event const &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
void SetWireRange(unsigned int nWires)
Display parameters for the raw data.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
float Min() const
Returns the extremes of the axis.
int fDrawRawDataOrCalibWires
0 for raw
const_reference operator*() const
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
void Dump(Stream &&out) const
Prints the current axes on the specified stream.
void SetDrawingLimitsFromRoI(geo::PlaneID::PlaneID_t plane)
double fStartTick
low tick
unsigned int PlaneID_t
Type for the ID number.
The data type to uniquely identify a Plane.
details::CacheID_t * fCacheID
information about the last processed plane
GridAxisClass const & WireAxis() const
Return the information about the wires.
std::unique_ptr< SampleInfo_t > sample_info
Information collected from the uncompressed data.
CacheID_t timestamp
object expressing validity range of cached data
ChannelID_t Channel() const
DAQ channel this raw data was read from.
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
float cell_size
size of each cell
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
bool SetMinTDCCellSize(float min_size)
Sets the minimum size for TDC cells.
double wirePitch
wire pitch
std::ptrdiff_t GetCell(float wire, float tick) const
Returns the index of specified cell, or -1 if out of range.
GridAxisClass()
Default constructor: an invalid range.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
void SetTDCRange(float min_tdc, float max_tdc)
Sets the TDC range, leaving the number of ticks unchanged.
std::vector< BoxInfo_t > boxInfo
void RawDigit2D(art::Event const &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane, bool bZoomToRoI=false)
Draws raw digit content in 2D wire plane representation.
bool hasTick(int tick) const
bool operator!() const
Returns whether we point to nothing.
WireID_t Wire
Index of the wire within its plane.
ManyOperations(geo::PlaneID const &pid, RawDataDrawer *data_drawer=nullptr)
bool hasTick(float tick) const
Returns whether the range includes the specified wire.
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
void PointToData(pointer data)
Point to the specified data, not acquiring ownership.
raw::ChannelID_t Channel() const
Returns the channel of this digit (for convenience)
bool ProcessChannelWithStatus(lariov::ChannelStatusProvider::Status_t channel_status) const
Returns whether a channel with the specified status should be processed.
Classes gathering simple statistics.
std::vector< double > fRawCharge
Sum of Raw Charge.
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
std::vector< int > fWireMin
lowest wire in interesting region for each plane
art framework interface to geometry description
double electronsToADC
conversion constant
Manages a cell-like division of a coordinate.
std::add_pointer_t< value_type > pointer
void SetDrawingLimits(float low_wire, float high_wire, float low_tdc, float high_tdc)
Fills the viewport borders from the specified extremes.
size_t n_cells
number of cells in the axis
friend class RoIextractorClass
details::ADCCorrectorClass ADCCorrector
unsigned short Status_t
type representing channel status
std::vector< int > fTimeMax
highest time in interesting region for each plane
Keeps track of the minimum and maximum value we observed.
Information about a RawDigit; may contain uncompressed duplicate of data.
art::InputTag const & inputLabel() const
OperationBaseClass const * Operator(size_t iOp) const
std::add_lvalue_reference_t< value_type > reference
Data_t min() const
Returns the accumulated minimum, or a very large number if no values.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
detinfo::DetectorPropertiesData const & detProp
float Length() const
Returns the length of the axis.
double fTicks
number of ticks of the clock
mutable::details::PointerToData_t< raw::RawDigit::ADCvector_t const > data
Uncompressed data.
bool ProcessWire(geo::WireID const &wire) override
void AcquireData(pointer data)
Acquire ownership of the specified data.
PadResolution_t PadResolution
stored pad resolution
short MinCharge() const
minimum charge
raw::RawDigit::ADCvector_t const & Data() const
average charge
bool SetMinWireCellSize(float min_size)
Sets the minimum size for wire cells.
double operator()(float adc) const
Applies Birks correction to the specified pedestal-subtracted charge.
bool Add(CONT &cont, float wire, float tick, typename CONT::value_type v)
const evdb::ColorScale & RawQ(geo::SigType_t st) const
unsigned int fCryostat
Cryostat number to draw, typically set by TWQProjectionView.
enum geo::_plane_sigtype SigType_t
std::string Name() const override
bool hasWire(int wire) const
std::ptrdiff_t operator()(float coord) const
ADCCorrectorClass(detinfo::DetectorPropertiesData const &dp, geo::PlaneID const &pid)
unsigned int fMaxChannelStatus
Display channels with this status and below.
Cached set of RawDigitInfo_t.
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
float UpperEdge(std::ptrdiff_t iCell) const
Returns the upper edge of the cell.
float LowerEdge(std::ptrdiff_t iCell) const
Returns the lower edge of the cell.
void FillQHisto(const art::Event &evt, unsigned int plane, TH1F *histo)
void GetChargeSum(int plane, double &charge, double &convcharge)
virtual bool Initialize()
double fMinSignal
minimum ADC count to display a time bin
void RunRoIextractor(art::Event const &evt, unsigned int plane)
std::vector< int > fWireMax
highest wire in interesting region for each plane
double fTicks
number of TDC ticks to display, ie # fTicks past fStartTick
std::add_lvalue_reference_t< const_value_type > const_reference
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
constexpr bool isValidChannelID(raw::ChannelID_t channel)
void GetRawDigits(art::Event const &evt)
Reads raw::RawDigits; also triggers Reset()
virtual Status_t Status(raw::ChannelID_t channel) const
Returns a status integer with arbitrary meaning.
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
bool hasCell(std::ptrdiff_t iCell) const
Returns whether the cell is present or not.
double TotalClockTicks() const
Class providing information about the quality of channels.
static int max(int a, int b)
The data type to uniquely identify a TPC.
Description of geometry of one entire detector.
virtual bool Operate(geo::WireID const &wireID, size_t tick, float adc)=0
bool operator()(geo::WireID const &wireID, size_t tick, float adc)
bool Initialize() override
bool isEmpty() const
Returns whether minimum and maximum match.
bool Initialize() override
bool bOwned
whether we own our data
Detector simulation of raw signals on wires.
void SetTDCRange(float min_tdc, float max_tdc, unsigned int nTDC)
Sets the complete TDC range.
float CellSize() const
Returns the cell size.
Detects the presence of a new event, data product or wire plane.
std::vector< RawDigitInfo_t > const & Digits() const
Returns the list of digit info.
CellGridClass()
Default constructor: invalid ranges.
bool empty() const
Returns whether the cache is empty() (STL-like interface)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
geo::PlaneID const & PlaneID() const
std::size_t color(std::string const &procname)
void NewData(T const &data)
Create a owned copy of the specified object.
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
RawDigitInfo_t const * FindChannel(raw::ChannelID_t channel) const
Returns a pointer to the digit info of given channel, nullptr if none.
int fTicksPerPoint
number of ticks to include in one point
virtual bool IsPresent(raw::ChannelID_t channel) const =0
Returns whether the specified channel is physical and connected to wire.
virtual bool ProcessWire(geo::WireID const &)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
bool fSeeBadChannels
Allow "bad" channels to be viewed.
bool hasCoord(float coord) const
Returns whether the coordinate is included in the range or not.
bool hasRegionOfInterest(geo::PlaneID::PlaneID_t plane) const
void SetWireRange(float min_wire, float max_wire, unsigned int nWires)
Sets the complete wire range.
void PointToData(reference data)
Point to the specified data, not acquiring ownership.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
pointer pData
pointer to data
bool hasWire(float wire) const
Returns whether the range includes the specified wire.
size_t NCells() const
Returns the length of the axis.
void QueueDrawingBoxes(evdb::View2D *view, geo::PlaneID const &pid, std::vector< BoxInfo_t > const &BoxInfo)
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
void Clear()
Stop pointing to the data; if owned, delete it.
std::vector< art::InputTag > fRawDataLabels
module label that made the raw digits, default is daq
Aid in the rendering of RawData objects.
Interface for experiment-specific channel quality info provider.
art::Ptr< raw::RawDigit > digit
a pointer to the actual digit
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
GridAxisClass(size_t nDiv, float new_min, float new_max)
Constructor: sets the limits and the number of cells.
bool ProcessTick(size_t tick) override
double fStartTick
Starting tick for the display.
bool good
whether the channel is not bad
void Dump(Stream &&out) const
unsigned int WireID_t
Type for the ID number.
bool owned() const
Returns whether we have data and we own it.
detail::Node< FrameID, bool > PlaneID
RawDataDrawer * RawDataDrawerPtr() const
size_t MaxSamples() const
Returns the largest number of samples in the unpacked raw digits.
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
void ResetRegionOfInterest()
Forgets about the current region of interest.
details::CellGridClass * fDrawingRange
information about the viewport
std::vector< int > fTimeMin
lowest time in interesting region for each plane
void Uncompress(const gar::raw::ADCvector_t &adc, gar::raw::ADCvector_t &uncompressed, gar::raw::Compress_t compress)
Uncompresses a raw data buffer.
::util::PlaneDataChangeTracker_t CacheID_t
std::add_const_t< value_type > const_value_type
Manages a grid-like division of 2D space.
bool ProcessWire(geo::WireID const &wireID) override
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Applies Birks correction.
Interface for experiment-specific service for channel quality info.
OperationBaseClass * Operator(size_t iOp)
virtual std::string Name() const
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.
int fPedestalOption
0: use DetPedestalService; 1: Use pedestal in raw::RawDigt; 2: no ped subtraction ...
void SetTDCRange(unsigned int nTDC)
Sets a simple TDC range: all the ticks, one cell per tick.
void StealData(std::remove_const_t< T > &&data)
Move data from the specified object, and own it.
LArSoft geometry interface.
std::vector< RawDigitInfo_t > digits
vector of raw digit information
GridAxisClass const & TDCAxis() const
Return the information about the TDCs.
std::string to_string(ModuleType const mt)
bool hasData() const
Returns whether we have data.
art::Ptr< raw::RawDigit > DigitPtr() const
Returns an art pointer to the actual digit.
bool RunOperation(art::Event const &evt, OperationBaseClass *operation)
std::tuple< float, float, float, float > GetCellBox(std::ptrdiff_t iCell) const
Returns the coordinates { w1, t1, w2, t2 } of specified cell.
size_t NCells() const
Returns the total number of cells in the grid.
void SetData(pointer data, bool owned)
Sets the data and the ownership.
bool Operate(geo::WireID const &wireID, size_t tick, float adc) override
bool Update(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, bool prt)
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
QTextStream & endl(QTextStream &s)
bool fUncompressWithPed
Option to uncompress with pedestal. Turned off by default.
virtual bool ProcessTick(size_t)
std::add_pointer_t< const_value_type > const_pointer
static bool IsValidStatus(Status_t status)
Returns whether the specified status is a valid one.
std::ptrdiff_t GetCell(float coord) const
Returns the index of the specified cell.
void AddOperation(std::unique_ptr< OperationBaseClass > new_op)
std::vector< double > fConvertedCharge
Sum of Charge Converted using Birks' formula.
void ExtractRange(TVirtualPad *pPad, std::vector< double > const *zoom=nullptr)
Fills the viewport information from the specified pad.