60 #include <type_traits>
67 #include "TVirtualPad.h"
82 #include "nuevdb/EventDisplayBase/View2D.h"
84 #include "art/Framework/Principal/Event.h"
85 #include "art/Framework/Principal/Handle.h"
86 #include "art/Framework/Services/Registry/ServiceHandle.h"
87 #include "canvas/Persistency/Common/Ptr.h"
88 #include "canvas/Utilities/Exception.h"
89 #include "canvas/Utilities/InputTag.h"
90 #include "cetlib_except/demangle.h"
91 #include "messagefacility/MessageLogger/MessageLogger.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>;
209 art::Ptr<raw::RawDigit>
250 void Fill(art::Ptr<raw::RawDigit>
const& src);
256 template <
typename Stream>
261 short min_charge = std::numeric_limits<short>::max();
262 short max_charge = std::numeric_limits<short>::max();
269 mutable ::details::PointerToData_t<raw::RawDigit::ADCvector_t const>
data;
289 std::vector<RawDigitInfo_t>
const&
316 void Refill(art::Handle<std::vector<raw::RawDigit>>& rdcol);
326 template <
typename Stream>
333 std::vector<raw::RawDigit>
const*
digits =
nullptr;
351 art::Event
const*
evt =
nullptr)
const;
353 static std::vector<raw::RawDigit>
const*
ReadProduct(art::Event
const&
evt,
354 art::InputTag label);
358 std::vector<evd::details::RawDigitInfo_t>::const_iterator
361 return cache.
Digits().cbegin();
363 std::vector<evd::details::RawDigitInfo_t>::const_iterator
366 return cache.
Digits().cend();
392 return (iCell >= 0) && ((size_t)iCell <
NCells());
399 return (coord >=
Min()) && (coord <
Max());
459 bool Init(
size_t nDiv,
float new_min,
float new_max);
462 bool SetLimits(
float new_min,
float new_max);
480 template <
typename Stream>
530 std::ptrdiff_t
GetCell(
float wire,
float tick)
const;
533 std::tuple<float, float, float, float>
GetCellBox(std::ptrdiff_t iCell)
const;
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;
600 SetWireRange(
float min_wire,
float max_wire,
unsigned int nWires,
float min_size)
629 SetTDCRange(
float min_tdc,
float max_tdc,
unsigned int nTDC,
float min_size)
652 template <
typename Stream>
666 ,
wirePitch{art::ServiceHandle<geo::Geometry const>()->WirePitch(pid)}
674 if (adc < 0.)
return 0.;
696 : digit_cache(new details::RawDigitCacheDataClass)
700 , fDrawingRange(new details::CellGridClass)
702 art::ServiceHandle<geo::Geometry const> geo;
704 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
705 geo::TPCID tpcid(rawopt->fCryostat, rawopt->fTPC);
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";
764 mf::LogDebug log(
"RawDataDrawer");
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!";
840 return cet::demangle_symbol(
typeid(*this).name());
846 return Operate(wireID, tick, adc);
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;
920 std::string
msg = cet::demangle_symbol(
typeid(*this).name());
924 msg +=
" " + op->Name();
946 if (
PlaneID() != new_op->PlaneID()) {
947 throw art::Exception(art::errors::LogicError)
948 <<
"RawDataDrawer::ManyOperations(): trying to run operations on "
949 << std::string(
PlaneID()) <<
" and " << std::string(new_op->PlaneID())
950 <<
" at the same time";
953 throw art::Exception(art::errors::LogicError)
954 <<
"RawDataDrawer::ManyOperations(): "
955 "trying to run operations on different RawDataDrawer";
967 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
971 MF_LOG_DEBUG(
"RawDataDrawer") <<
"RawDataDrawer::RunOperation() running " << operation->
Name();
978 art::ServiceHandle<lariov::ChannelStatusService const>()->GetProvider();
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;
1012 bool const bGood = rawopt->fSeeBadChannels || !channelStatus.
IsBad(channel);
1017 if (!bGood)
continue;
1024 if (rawopt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.
PedMean(channel); }
1025 else if (rawopt->fPedestalOption == 1) {
1028 else if (rawopt->fPedestalOption == 2) {
1032 mf::LogWarning(
"RawDataDrawer")
1033 <<
" PedestalOption is not understood: " << rawopt->fPedestalOption
1034 <<
". Pedestals not subtracted.";
1041 if (wireID.planeID() != pid)
continue;
1048 size_t const max_tick = std::min({uncompressed.size(), size_t(
fStartTick +
fTicks)});
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)
1085 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
1117 if (cell < 0)
return true;
1161 std::vector<BoxInfo_t>
const& BoxInfo)
1169 MF_LOG_DEBUG(
"RawDataDrawer") <<
"Filling " << BoxInfo.size() <<
" boxes to be rendered";
1175 art::ServiceHandle<evd::ColorDrawingOptions const> cst;
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";
1245 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
1246 if (rawopt->fDrawRawDataOrCalibWires == 1)
return;
1249 BoxDrawer drawer(detProp, pid,
this, view);
1251 throw art::Exception(art::errors::Unknown) <<
"RawDataDrawer::RunDrawOperation(): "
1252 "somewhere something went somehow wrong";
1287 mf::LogInfo(
"RawDataDrawer")
1288 <<
"Region of interest for " << std::string(
PlaneID()) <<
" detected to be within wires "
1295 mf::LogInfo(
"RawDataDrawer")
1296 <<
"Region of interest for " << std::string(
PlaneID()) <<
" detected to be within ticks "
1311 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
1316 MF_LOG_TRACE(
"RawDataDrawer") <<
"Region of interest for " << pid
1317 << (bExtractRoI ?
" extracted" :
" not extracted")
1320 if (!bExtractRoI)
return;
1324 throw std::runtime_error(
1325 "RawDataDrawer::RunRoIextractor(): somewhere something went somehow wrong");
1340 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
1343 bool const bDraw = (rawopt->fDrawRawDataOrCalibWires != 1);
1349 art::ServiceHandle<geo::Geometry const> geom;
1353 bool theDroidIAmLookingFor =
false;
1356 for (
const auto& rawDataLabel : rawopt->fRawDataLabels) {
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));
1401 std::unique_ptr<OperationBaseClass> extractor(
new RoIextractorClass(pid,
this));
1410 throw art::Exception(art::errors::Unknown) <<
"RawDataDrawer::RunDrawOperation(): "
1411 "somewhere something went somehow wrong";
1417 MF_LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() setting up RoI extraction for " << pid;
1420 throw art::Exception(art::errors::Unknown)
1421 <<
"RawDataDrawer::RunDrawOperation():"
1422 " something went somehow wrong while extracting RoI";
1426 MF_LOG_DEBUG(
"RawDataDrawer")
1427 << __func__ <<
"() using existing RoI for " << pid <<
": wires ( " <<
fWireMin[plane]
1436 MF_LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() setting up drawing";
1437 BoxDrawer drawer(detProp, pid,
this, view);
1439 throw art::Exception(art::errors::Unknown) <<
"RawDataDrawer::RunDrawOperation():"
1440 " something went somehow wrong while drawing";
1449 art::ServiceHandle<geo::Geometry const> geo;
1451 if ((
unsigned int)plane >=
fWireMin.size()) {
1452 mf::LogWarning(
"RawDataDrawer")
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;
1488 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
1489 if (rawopt->fDrawRawDataOrCalibWires == 1)
return;
1491 art::ServiceHandle<geo::Geometry const> geo;
1495 for (
const auto& rawDataLabel : rawopt->fRawDataLabels) {
1500 art::ServiceHandle<lariov::ChannelStatusService const>()->GetProvider();
1504 art::ServiceHandle<lariov::DetPedestalService const>()->GetPedestalProvider();
1510 if (!channelStatus.
IsPresent(channel))
continue;
1516 if (!rawopt->fSeeBadChannels && channelStatus.
IsBad(channel))
continue;
1518 std::vector<geo::WireID> wireids = geo->ChannelToWire(channel);
1519 for (
auto const& wid : wireids) {
1521 if (wid.planeID() != pid)
continue;
1528 if (rawopt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.
PedMean(channel); }
1529 else if (rawopt->fPedestalOption == 1) {
1532 else if (rawopt->fPedestalOption == 2) {
1536 mf::LogWarning(
"RawDataDrawer")
1537 <<
" PedestalOption is not understood: " << rawopt->fPedestalOption
1538 <<
". Pedestals not subtracted.";
1541 for (
short d : uncompressed)
1542 histo->Fill(
float(d) - pedestal);
1561 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
1562 if (rawopt->fDrawRawDataOrCalibWires == 1)
return;
1568 for (
const auto& rawDataLabel : rawopt->fRawDataLabels) {
1577 art::ServiceHandle<geo::Geometry const> geom;
1580 mf::LogError(
"RawDataDrawer")
1581 << __func__ <<
": no channel associated to " << std::string(wireid);
1587 art::ServiceHandle<lariov::ChannelStatusService const>()->GetProvider();
1589 if (!channelStatus.
IsPresent(channel))
return;
1595 if (!rawopt->fSeeBadChannels && channelStatus.
IsBad(channel))
return;
1599 art::ServiceHandle<lariov::DetPedestalService const>()->GetPedestalProvider();
1617 if (rawopt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.
PedMean(channel); }
1618 else if (rawopt->fPedestalOption == 1) {
1619 pedestal = pDigit->
DigitPtr()->GetPedestal();
1621 else if (rawopt->fPedestalOption == 2) {
1625 mf::LogWarning(
"RawDataDrawer")
1626 <<
" PedestalOption is not understood: " << rawopt->fPedestalOption
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;
1780 art::ServiceHandle<evd::RawDrawingOptions const> drawopt;
1781 if (channel_status > drawopt->fMaxChannelStatus)
return false;
1782 if (channel_status < drawopt->fMinChannelStatus)
return false;
1822 art::ServiceHandle<evd::RawDrawingOptions const> drawopt;
1824 if (
digit->Compression() == kNone) {
1830 if (drawopt->fUncompressWithPed) {
1831 int pedestal = (int)
digit->GetPedestal();
1833 samples.resize(
digit->Samples());
1835 data.StealData(std::move(samples));
1839 samples.resize(
digit->Samples());
1841 data.StealData(std::move(samples));
1871 template <
typename Stream>
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*
1904 art::Handle<std::vector<raw::RawDigit>> rdcol;
1905 if (!evt.getByLabel(label, rdcol))
return nullptr;
1912 digits.resize(rdcol->size());
1913 for (
size_t iDigit = 0; iDigit < rdcol->size(); ++iDigit) {
1914 art::Ptr<raw::RawDigit> pDigit(rdcol, iDigit);
1915 digits[iDigit].Fill(pDigit);
1916 size_t samples = pDigit->Samples();
1937 art::Event
const*
evt )
const
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;
1988 art::Handle<std::vector<raw::RawDigit>> rdcol;
1989 if (!evt.getByLabel(new_timestamp.
inputLabel(), rdcol)) {
1990 mf::LogWarning(
"RawDataDrawer")
1991 <<
"no RawDigit collection '" << new_timestamp.
inputLabel() <<
"' found";
2001 template <
typename Stream>
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);
2029 n_cells = std::max(nDiv,
size_t(1));
2049 if (
cell_size >= min_size)
return false;
2052 n_cells = (size_t)std::max(std::floor(
Length() / min_size), 1.0F);
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>
2080 out <<
NCells() <<
" cells from " <<
Min() <<
" to " <<
Max() <<
" (length: " <<
Length()
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: ";
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
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)
This_t & add(Data_t value)
Include a single value in the statistics.
size_t max_samples
the largest number of ticks in any digit
bool ProcessTick(size_t tick) override
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.
bool Operate(geo::WireID const &wireID, size_t tick, float adc) override
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
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.
float Min() const
Returns the extremes of the axis.
const_reference operator*() const
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
virtual ~OperationBaseClass()=default
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
void Dump(Stream &&out) const
Dump the content of the cache.
Classes detecting configuration changes.
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
Definition of basic raw digits.
SampleInfo_t const & SampleInfo() const
Returns the uncompressed data.
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.
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.
BEGIN_PROLOG channel_status
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
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.
short min_charge
minimum charge
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
The color scales used by the event display.
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
void Refill(art::Handle< std::vector< raw::RawDigit >> &rdcol)
Fills the cache from the specified raw digits product handle.
virtual bool IsPresent(raw::ChannelID_t channel) const =0
Returns whether the specified channel is physical and connected to wire.
Data_t min() const
Returns the accumulated minimum, or a very large number if no values.
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)
enum geo::_plane_sigtype SigType_t
RawDataDrawer * pRawDataDrawer
bool hasWire(int wire) const
std::ptrdiff_t operator()(float coord) const
ADCCorrectorClass(detinfo::DetectorPropertiesData const &dp, geo::PlaneID const &pid)
bool SetLimits(float new_min, float new_max)
Initialize the axis limits, returns whether cell size is finite.
Cached set of RawDigitInfo_t.
Collect all the RawData header files together.
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
std::add_lvalue_reference_t< const_value_type > const_reference
bool Init(size_t nDiv, float new_min, float new_max)
Initialize the axis, returns whether cell size is finite.
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.
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
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.
void Dump(Stream &&out) const
Dumps the content of the digit info.
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
Description of geometry of one entire detector.
virtual bool Operate(geo::WireID const &wireID, size_t tick, float adc)=0
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
bool operator()(geo::WireID const &wireID, size_t tick, float adc)
bool Initialize() override
void Invalidate()
Clears the cache and marks it as invalid (use Update() to fill it)
short max_charge
maximum charge
bool isEmpty() const
Returns whether minimum and maximum match.
bool Initialize() override
bool bOwned
whether we own our data
void UncompressData() const
Fills the uncompressed data cache.
void CollectSampleInfo() const
Fills the sample info cache.
Class to aid in the rendering of RawData objects.
void Clear()
Empties the cache.
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)
geo::PlaneID const & PlaneID() const
void NewData(T const &data)
Create a owned copy of the specified object.
RawDigitInfo_t const * FindChannel(raw::ChannelID_t channel) const
Returns a pointer to the digit info of given channel, nullptr if none.
virtual bool ProcessWire(geo::WireID const &)
bool hasCoord(float coord) const
Returns whether the coordinate is included in the range or not.
bool hasRegionOfInterest(geo::PlaneID::PlaneID_t plane) const
std::string to_string(WindowPattern const &pattern)
bool SetMaxCellSize(float max_size)
void SetWireRange(float min_wire, float max_wire, unsigned int nWires)
Sets the complete wire range.
static std::vector< raw::RawDigit > const * ReadProduct(art::Event const &evt, art::InputTag label)
double BirksCorrection(double dQdX) const
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
float max
extremes of the axis
void PointToData(reference data)
Point to the specified data, not acquiring ownership.
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.
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
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
bool good
whether the channel is not bad
void Dump(Stream &&out) const
BoolWithUpToDateMetadata CheckUpToDate(CacheID_t const &ts, art::Event const *evt=nullptr) const
Checks whether an update is needed; can load digits in the process.
unsigned int WireID_t
Type for the ID number.
bool owned() const
Returns whether we have data and we own it.
static std::vector< raw::RawDigit > const EmptyRawDigits
Empty collection, used in return value of invalid digits.
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
::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
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.
void SetTDCRange(unsigned int nTDC)
Sets a simple TDC range: all the ticks, one cell per tick.
void Fill(art::Ptr< raw::RawDigit > const &src)
Parses the specified digit.
void StealData(std::remove_const_t< T > &&data)
Move data from the specified object, and own it.
std::vector< RawDigitInfo_t > digits
vector of raw digit information
GridAxisClass const & TDCAxis() const
Return the information about the TDCs.
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.
art framework interface to geometry description
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
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.
bool SetMinCellSize(float min_size)
void AddOperation(std::unique_ptr< OperationBaseClass > new_op)
std::string Name() const override
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.
void Clear()
Deletes the data.