59 #include <type_traits> 68 #include "TVirtualPad.h" 76 #include "larevt/CalibrationDBI/Interface/DetPedestalService.h" 77 #include "larevt/CalibrationDBI/Interface/DetPedestalProvider.h" 80 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" 81 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" 98 #include "cetlib_except/demangle.h" 102 template <
typename Stream,
typename T>
106 out << header <<
": " << range.
min() <<
" -- " << range.
max()
107 <<
" (" << (range.
has_data()?
"valid":
"invalid") <<
")";
116 template <
typename T>
121 using reference = std::add_lvalue_reference_t<value_type>;
123 = std::add_lvalue_reference_t<const_value_type>;
124 using pointer = std::add_pointer_t<value_type>;
200 short MinCharge()
const {
return SampleInfo().min_charge; }
203 short MaxCharge()
const {
return SampleInfo().max_charge; }
218 template <
typename Stream>
219 void Dump(Stream&& out)
const;
231 mutable ::details::PointerToData_t<raw::RawDigit::ADCvector_t const>
data;
237 void UncompressData()
const;
240 void CollectSampleInfo()
const;
253 std::vector<RawDigitInfo_t>
const&
Digits()
const {
return digits; }
262 bool empty()
const {
return digits.empty(); }
268 void Refill(
art::Handle<std::vector<raw::RawDigit>>& rdcol);
278 template <
typename Stream>
279 void Dump(Stream&& out)
const;
285 bool bUpToDate =
false;
286 std::vector<raw::RawDigit>
const* digits =
nullptr;
290 (
bool uptodate, std::vector<raw::RawDigit>
const* newdigits):
291 bUpToDate(uptodate), digits(newdigits)
294 operator bool()
const {
return bUpToDate; }
301 size_t max_samples = 0;
307 static std::vector<raw::RawDigit>
const* ReadProduct
315 {
return cache.
Digits().cbegin(); }
318 {
return cache.
Digits().cend(); }
330 { Init(nDiv, new_min, new_max); }
333 std::ptrdiff_t GetCell(
float coord)
const;
335 std::ptrdiff_t operator() (
float coord)
const {
return GetCell(coord); }
340 {
return (iCell >= 0) && ((size_t) iCell < NCells()); }
344 {
return (coord >= Min()) && (coord < Max()); }
348 float Min()
const {
return min; }
357 size_t NCells()
const {
return n_cells; }
367 {
return Min() + CellSize() * iCell; }
371 {
return LowerEdge(iCell + 1); }
374 bool Init(
size_t nDiv,
float new_min,
float new_max);
377 bool SetLimits(
float new_min,
float new_max);
381 bool SetMinCellSize(
float min_size);
385 bool SetMaxCellSize(
float max_size);
390 {
return SetMinCellSize(min_size) || SetMaxCellSize(max_size); }
392 template <
typename Stream>
393 void Dump(Stream&& out)
const;
416 float min_wire,
float max_wire,
unsigned int nWires,
417 float min_tdc,
float max_tdc,
unsigned int nTDC
421 size_t NCells()
const {
return wire_axis.NCells() * tdc_axis.NCells(); }
431 std::ptrdiff_t GetCell(
float wire,
float tick)
const;
434 std::tuple<float, float, float, float> GetCellBox
435 (std::ptrdiff_t iCell)
const;
438 bool hasWire(
float wire)
const {
return wire_axis.hasCoord(wire); }
444 bool hasTick(
float tick)
const {
return tdc_axis.hasCoord(tick); }
452 template <
typename CONT>
453 bool Add(CONT& cont,
float wire,
float tick,
typename CONT::value_type v)
455 std::ptrdiff_t cell = GetCell(wire, tick);
456 if (cell < 0)
return false;
457 cont[(size_t) cell] += v;
466 { SetWireRange(0., (
float) nWires, nWires); }
470 { wire_axis.SetLimits(min_wire, max_wire); }
474 { wire_axis.Init(nWires, min_wire, max_wire); }
478 (
float min_wire,
float max_wire,
unsigned int nWires,
float min_size)
480 wire_axis.Init(nWires, min_wire, max_wire);
481 wire_axis.SetMinCellSize(min_size);
486 { SetTDCRange(0., (
float) nTDC, nTDC); }
490 { tdc_axis.Init(nTDC, min_tdc, max_tdc); }
494 { tdc_axis.SetLimits(min_tdc, max_tdc); }
498 (
float min_tdc,
float max_tdc,
unsigned int nTDC,
float min_size)
500 tdc_axis.Init(nTDC, min_tdc, max_tdc);
501 tdc_axis.SetMinCellSize(min_size);
508 {
return wire_axis.SetMinCellSize(min_size); }
512 {
return tdc_axis.SetMinCellSize(min_size); }
515 template <
typename Stream>
516 void Dump(Stream&& out)
const;
537 if (adc < 0.)
return 0.;
538 double const dQdX = adc / wirePitch / electronsToADC;
542 double operator() (
float adc)
const {
return Correct(adc); }
565 std::vector<raw::RawDigit>
const RawDataDrawer::EmptyRawDigits;
568 RawDataDrawer::RawDataDrawer()
569 : digit_cache(new
details::RawDigitCacheDataClass)
570 , fStartTick(0),fTicks(2048)
572 , fDrawingRange(new
details::CellGridClass)
583 unsigned int nplanes=geo->
Nplanes(tpcid);
603 (
float low_wire,
float high_wire,
float low_tdc,
float high_tdc)
606 <<
"() setting drawing range as wires ( " 607 << low_wire <<
" - " << high_wire
608 <<
" ), ticks ( " << low_tdc <<
" - " << high_tdc <<
" )";
621 <<
"Pad size not available -- using existing cell size";
640 (TVirtualPad* pPad, std::vector<double>
const* zoom )
643 log <<
"ExtractRange() on pad '" << pPad->GetName() <<
"'";
645 TFrame
const* pFrame = pPad->GetFrame();
648 double low_wire = pFrame->GetX1(), high_wire = pFrame->GetX2();
649 double low_tdc = pFrame->GetY1(), high_tdc = pFrame->GetY2();
650 double const wire_pixels = pPad->XtoAbsPixel(high_wire) - pPad->XtoAbsPixel(low_wire);
651 double const tdc_pixels = -(pPad->YtoAbsPixel(high_tdc) - pPad->YtoAbsPixel(low_tdc));
656 log <<
"\n frame window is " 663 log <<
", from external source,";
664 low_wire = (*zoom)[0];
665 high_wire = (*zoom)[1];
666 low_tdc = (*zoom)[2];
667 high_tdc = (*zoom)[3];
670 log <<
" spans wires " 671 << low_wire <<
"-" << high_wire <<
" and TDC " << low_tdc <<
"-" << high_tdc;
681 log <<
"\n no frame!";
692 : pRawDataDrawer(data_drawer), planeID(pid) {}
701 virtual bool Operate(
geo::WireID const& wireID,
size_t tick,
float adc) = 0;
705 virtual std::string
Name()
const 706 {
return cet::demangle_symbol(
typeid(*this).name()); }
708 bool operator() (
geo::WireID const& wireID,
size_t tick,
float adc)
709 {
return Operate(wireID, tick, adc); }
724 std::vector<std::unique_ptr<RawDataDrawer::OperationBaseClass>>
operations;
735 for (std::unique_ptr<OperationBaseClass>
const& op: operations)
736 if (!op->Initialize()) bAllOk =
false;
742 for (std::unique_ptr<OperationBaseClass>
const& op: operations)
743 if (op->ProcessWire(wireID))
return true;
748 for (std::unique_ptr<OperationBaseClass>
const& op: operations)
749 if (op->ProcessTick(tick))
return true;
756 for (std::unique_ptr<OperationBaseClass>
const& op: operations)
757 if (!op->Operate(wireID, tick, adc))
return false;
764 for (std::unique_ptr<OperationBaseClass>
const& op: operations)
765 if (!op->Finish()) bAllOk =
false;
769 virtual std::string
Name()
const override 771 std::string msg = cet::demangle_symbol(
typeid(*this).name());
773 (
" [running " +
std::to_string(operations.size()) +
" operations:");
774 for (
auto const& op: operations) {
775 if (op) msg +=
" " + op->Name();
776 else msg +=
" <invalid>";
782 {
return operations.at(iOp).get(); }
784 {
return operations.at(iOp).get(); }
789 if (PlaneID() != new_op->PlaneID()) {
791 <<
"RawDataDrawer::ManyOperations(): trying to run operations on " 792 << std::string(PlaneID()) <<
" and " 793 << std::string(new_op->PlaneID()) <<
" at the same time";
795 if (RawDataDrawerPtr()
796 && (RawDataDrawerPtr() != new_op->RawDataDrawerPtr())
800 <<
"RawDataDrawer::ManyOperations(): " 801 "trying to run operations on different RawDataDrawer" 804 operations.emplace_back(std::move(new_op));
821 LOG_DEBUG(
"RawDataDrawer") <<
"RawDataDrawer::RunOperation() running " 822 << operation->
Name();
828 lariov::ChannelStatusProvider
const& channelStatus
832 const lariov::DetPedestalProvider& pedestalRetrievalAlg = *(lar::providerFrom<lariov::DetPedestalService>());
842 if (!channelStatus.IsPresent(channel))
continue;
851 std::vector<geo::WireID> WireIDs = geom.
ChannelToWire(channel);
853 bool bDrawChannel =
false;
855 if (wireID.planeID() != pid)
continue;
859 if (!bDrawChannel)
continue;
862 bool const bGood = rawopt->
fSeeBadChannels || !channelStatus.IsBad(channel);
867 if (!bGood)
continue;
873 float const pedestal = pedestalRetrievalAlg.PedMean(channel);
879 if (wireID.planeID() != pid)
continue;
891 for (
size_t iTick =
fStartTick; iTick < max_tick; ++iTick) {
896 float const adc = uncompressed[iTick] - pedestal;
898 if (!operation->
Operate(wireID, iTick, adc))
return false;
904 return operation->
Finish();
919 , rawCharge(0.), convertedCharge(0.)
921 , ADCCorrector(PlaneID())
935 drawingRange.SetMinWireCellSize(1.F);
937 boxInfo.resize(drawingRange.NCells());
942 {
return drawingRange.hasWire((
int) wire.
Wire); }
945 {
return drawingRange.hasTick((
float) tick); }
951 std::ptrdiff_t cell = drawingRange.GetCell(wire, tick);
952 if (cell < 0)
return true;
958 convertedCharge += ADCCorrector(adc);
961 if (std::abs(info.
adc) <= std::abs(adc)) info.
adc = adc;
970 RawDataDrawerPtr()->fRawCharge[plane] = rawCharge;
971 RawDataDrawerPtr()->fConvertedCharge[plane] = convertedCharge;
975 *(RawDataDrawerPtr()->fDrawingRange) = drawingRange;
978 RawDataDrawerPtr()->QueueDrawingBoxes(view, PlaneID(), boxInfo);
986 double rawCharge = 0., convertedCharge = 0.;
996 std::vector<BoxInfo_t>
const& BoxInfo
1007 <<
"Filling " << BoxInfo.size() <<
" boxes to be rendered";
1018 size_t const nBoxes = BoxInfo.size();
1019 unsigned int nDrawnBoxes = 0;
1020 for (
size_t iBox = 0; iBox < nBoxes; ++iBox) {
1024 if(info.
good && (std::abs(info.
adc) < MinSignal))
continue;
1027 if (!info.
good)
continue;
1033 constexpr
float q0 = 1000.;
1034 float const sf = bScaleDigitsByCharge
1035 ?
std::min(std::sqrt((
float) info.
adc / q0), 1.0F)
1039 float min_wire, max_wire, min_tick, max_tick;
1040 std::tie(min_wire, min_tick, max_wire, max_tick)
1048 float const nsf = 1. - sf;
1049 float const half_box_wires = (max_wire - min_wire) / 2.,
1050 half_box_ticks = (max_tick - min_tick) / 2.;
1053 min_wire += nsf * half_box_wires;
1054 max_wire -= nsf * half_box_wires;
1055 min_tick += nsf * half_box_ticks;
1056 max_tick -= nsf * half_box_ticks;
1063 pBox = &(view->
AddBox(min_wire, min_tick, max_wire, max_tick));
1065 pBox = &(view->
AddBox(min_tick, min_wire, max_tick, max_wire));
1067 pBox->SetFillStyle(1001);
1068 pBox->SetFillColor(color);
1069 pBox->SetBit(kCannotPick);
1075 <<
"Sent " << nDrawnBoxes <<
"/" << BoxInfo.size()
1076 <<
" boxes to be rendered";
1092 <<
"RawDataDrawer::RunDrawOperation(): " 1093 "somewhere something went somehow wrong";
1113 virtual bool Operate
1116 if (std::abs(adc) < RoIthreshold)
return true;
1117 WireRange.add(wireID.
Wire);
1125 int& WireMin = pRawDataDrawer->fWireMin[plane];
1126 int& WireMax = pRawDataDrawer->fWireMax[plane];
1127 int& TimeMin = pRawDataDrawer->fTimeMin[plane];
1128 int& TimeMax = pRawDataDrawer->fTimeMax[plane];
1130 if ((WireMin == WireMax) && WireRange.has_data()) {
1132 mf::LogInfo(
"RawDataDrawer") <<
"Region of interest for " 1133 << std::string(PlaneID()) <<
" detected to be within wires " 1134 << WireRange.min() <<
" to " << WireRange.max()
1135 <<
" (plane has " << geom.
Nwires(PlaneID()) <<
" wires)";
1136 WireMax = WireRange.max() + 1;
1137 WireMin = WireRange.min();
1139 if ((TimeMin == TimeMax) && TDCrange.has_data()) {
1140 mf::LogInfo(
"RawDataDrawer") <<
"Region of interest for " 1141 << std::string(PlaneID()) <<
" detected to be within ticks " 1142 << TDCrange.min() <<
" to " << TDCrange.max();
1143 TimeMax = TDCrange.max() + 1;
1144 TimeMin = TDCrange.min();
1162 LOG_TRACE(
"RawDataDrawer") <<
"Region of interest for " << pid
1163 << (bExtractRoI?
" extracted":
" not extracted") <<
" on this draw";
1165 if (!bExtractRoI)
return;
1169 throw std::runtime_error
1170 (
"RawDataDrawer::RunRoIextractor(): somewhere something went somehow wrong");
1207 std::unique_ptr<OperationBaseClass> operation;
1211 << __func__ <<
"() setting up one-pass drawing";
1212 operation.reset(
new BoxDrawer(pid,
this, view));
1215 LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() adding RoI extraction";
1219 std::unique_ptr<OperationBaseClass> drawer(std::move(operation));
1220 std::unique_ptr<OperationBaseClass> extractor
1232 <<
"RawDataDrawer::RunDrawOperation(): " 1233 "somewhere something went somehow wrong";
1240 <<
"() setting up RoI extraction for " << pid;
1244 <<
"RawDataDrawer::RunDrawOperation():" 1245 " something went somehow wrong while extracting RoI";
1250 <<
"() using existing RoI for " << pid
1260 LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() setting up drawing";
1264 <<
"RawDataDrawer::RunDrawOperation():" 1265 " something went somehow wrong while drawing";
1276 if((
unsigned int)plane>=
fWireMin.size())
1277 {
mf::LogWarning (
"RawDataDrawer") <<
" Requested plane " << plane <<
" is larger than those available " << std::endl;
1286 if ((minw == maxw) || (mint == maxt))
return 1;
1289 minw= (minw-30<0) ? 0 : minw-30;
1290 mint= (mint-10<0) ? 0 : mint-10;
1292 maxw= (maxw+10>(int)geo->
Nwires(plane)) ? geo->
Nwires(plane) : maxw+10;
1322 lariov::ChannelStatusProvider
const& channelStatus
1332 if (!channelStatus.IsPresent(channel))
continue;
1338 if (!rawopt->
fSeeBadChannels && channelStatus.IsBad(channel))
continue;
1340 std::vector<geo::WireID> wireids = geo->
ChannelToWire(channel);
1341 for(
auto const& wid : wireids){
1343 if (wid.planeID() != pid)
continue;
1347 float const pedestal = pedestalRetrievalAlg.PedMean(channel);
1349 for(
short d: uncompressed)
1350 histo->Fill(
float(
d) - pedestal);
1384 mf::LogError(
"RawDataDrawer") << __func__ <<
": no channel associated to " 1385 << std::string(wireid);
1390 lariov::ChannelStatusProvider
const& channelStatus
1393 if (!channelStatus.IsPresent(channel))
return;
1411 <<
": can't find raw digit for channel #" << channel
1412 <<
" (" << std::string(wireid) <<
")";
1418 float const pedestal = pedestalRetrievalAlg.PedMean(channel);
1420 for(
size_t j = 0; j < uncompressed.size(); ++j)
1421 histo->Fill(
float(j),
float(uncompressed[j]) - pedestal);
1526 LOG_DEBUG(
"RawDataDrawer") <<
"RawDataDrawer[" << ((
void*)
this)
1527 <<
"]: resetting the region of interest";
1542 LOG_DEBUG(
"RawDataDrawer") <<
"GetRawDigits() for " << new_timestamp
1543 <<
" (last for: " << *
fCacheID <<
")";
1554 *fCacheID = new_timestamp;
1561 (lariov::ChannelStatusProvider::Status_t channel_status)
const 1564 if (!lariov::ChannelStatusProvider::IsValidStatus(channel_status))
1570 if (channel_status < drawopt->fMinChannelStatus)
return false;
1583 if (!data.hasData()) UncompressData();
1594 void RawDigitInfo_t::Clear() {
1596 sample_info.reset();
1600 void RawDigitInfo_t::UncompressData()
const {
1607 if (digit->Compression() ==
kNone) {
1609 data.PointToData(digit->ADCs());
1614 int pedestal = (int)digit->GetPedestal();
1616 Uncompress(digit->ADCs(), samples, pedestal, digit->Compression());
1617 data.StealData(std::move(samples));
1621 Uncompress(digit->ADCs(), samples, digit->Compression());
1622 data.StealData(std::move(samples));
1628 void RawDigitInfo_t::CollectSampleInfo()
const {
1635 (samples.begin(), samples.end());
1638 sample_info->min_charge = stat.
min();
1639 sample_info->max_charge = stat.max();
1646 if (!sample_info) CollectSampleInfo();
1647 return *sample_info;
1650 template <
typename Stream>
1651 void RawDigitInfo_t::Dump(Stream&& out)
const {
1652 out <<
" digit at " << ((
void*) digit.get()) <<
" on channel #" << digit->Channel()
1653 <<
" with " << digit->NADC();
1654 if (digit->Compression() ==
kNone) out <<
" uncompressed data";
1655 else out <<
" data items compressed with <" << digit->Compression() <<
">";
1657 out <<
" with data (" << data->size() <<
" samples)";
1658 else out <<
" without data";
1668 auto iDigit = std::find_if(
1669 digits.cbegin(), digits.cend(),
1671 {
return digit.Channel() == channel; }
1673 return (iDigit == digits.cend())?
nullptr: &*iDigit;
1676 std::vector<raw::RawDigit>
const* RawDigitCacheDataClass::ReadProduct
1680 if (!evt.
getByLabel(label, rdcol))
return nullptr;
1685 void RawDigitCacheDataClass::Refill
1688 digits.resize(rdcol->size());
1689 for(
size_t iDigit = 0; iDigit < rdcol->size(); ++iDigit) {
1691 digits[iDigit].Fill(pDigit);
1692 size_t samples = pDigit->
Samples();
1693 if (samples > max_samples) max_samples = samples;
1698 void RawDigitCacheDataClass::Invalidate() {
1703 void RawDigitCacheDataClass::Clear() {
1711 RawDigitCacheDataClass::CheckUpToDate
1739 if (res.digits->empty())
1748 if (&(pInfo->
Digit()) != &(res.digits->front()))
1751 res.bUpToDate =
true;
1761 if (update_info)
return false;
1764 <<
"Refilling raw digit cache RawDigitCacheDataClass[" 1765 << ((
void*)
this ) <<
"] for " << new_timestamp;
1778 timestamp = new_timestamp;
1783 template <
typename Stream>
1784 void RawDigitCacheDataClass::Dump(Stream&& out)
const {
1785 out <<
"Cache at " << ((
void*)
this)
1786 <<
" with time stamp " << std::string(timestamp)
1787 <<
" and " << digits.size()
1788 <<
" entries (maximum sample: " << max_samples <<
");" 1789 <<
" data at " << ((
void*) digits.data());
1792 digitInfo.Dump(out);
1801 std::ptrdiff_t GridAxisClass::GetCell(
float coord)
const {
1802 return std::ptrdiff_t((coord -
min) / cell_size);
1807 bool GridAxisClass::Init(
size_t nDiv,
float new_min,
float new_max) {
1809 n_cells =
std::max(nDiv,
size_t(1));
1810 return SetLimits(new_min, new_max);
1816 bool GridAxisClass::SetLimits(
float new_min,
float new_max) {
1819 cell_size = Length() / float(n_cells);
1821 return std::isnormal(cell_size);
1826 bool GridAxisClass::SetMinCellSize(
float min_size) {
1827 if (cell_size >= min_size)
return false;
1830 n_cells = (size_t)
std::max(std::floor(Length() / min_size), 1.0F);
1834 cell_size = Length() / float(n_cells);
1840 bool GridAxisClass::SetMaxCellSize(
float max_size) {
1841 if (cell_size <= max_size)
return false;
1844 n_cells = (size_t)
std::max(std::ceil(Length() / max_size), 1.0F);
1848 cell_size = Length() / float(n_cells);
1854 template <
typename Stream>
1855 void GridAxisClass::Dump(Stream&& out)
const {
1856 out << NCells() <<
" cells from " << Min() <<
" to " << Max()
1857 <<
" (length: " << Length() <<
")";
1864 CellGridClass::CellGridClass(
unsigned int nWires,
unsigned int nTDC)
1865 : wire_axis((size_t) nWires, 0., float(nWires))
1866 , tdc_axis((size_t) nTDC, 0., float(nTDC))
1873 float min_wire,
float max_wire,
unsigned int nWires,
1874 float min_tdc,
float max_tdc,
unsigned int nTDC
1876 :
wire_axis((size_t) nWires, min_wire, max_wire)
1877 ,
tdc_axis((size_t) nTDC, min_tdc, max_tdc)
1894 (std::ptrdiff_t iCell)
const 1898 std::ptrdiff_t iWireCell = (std::ptrdiff_t) (iCell / nTDCCells),
1899 iTDCCell = (std::ptrdiff_t) (iCell % nTDCCells);
1902 return std::tuple<float, float, float, float>(
1910 template <
typename Stream>
1912 out <<
"Wire axis: ";
1914 out <<
"; time axis: ";
int GetRegionOfInterest(int plane, int &minw, int &maxw, int &mint, int &maxt)
Data_t max() const
Returns the accumulated maximum, or a very small number if no values.
virtual bool Initialize() override
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)
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)
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
virtual bool ProcessTick(size_t tick) override
raw::RawDigit const & Digit() const
Returns an art pointer to the actual digit.
Encapsulate the construction of a single cyostat.
double Correct(float adc) const
Applies Birks correction to the specified pedestal-subtracted charge.
void SetWireRange(unsigned int nWires)
Sets the wire range, leaving the number of wire cells unchanged.
Display parameters for the raw data.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
int fDrawRawDataOrCalibWires
0 for raw
const_reference operator*() const
virtual bool ProcessTick(size_t tick) override
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
TNtupleSim Fill(f1, f2, f3, f4)
virtual double BirksCorrection(double dQdX) const =0
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
void Dump(Stream &&out) const
Prints the current axes on the specified stream.
void SetDrawingLimitsFromRoI(geo::PlaneID::PlaneID_t plane)
double fStartTick
low tick
art::InputTag fRawDataLabel
module label that made the raw digits, default is daq
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
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.
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.
void update(geo::PlaneID const &pid)
bool hasTick(int tick) const
Returns whether the range includes the specified wire.
bool operator!() const
Returns whether we point to nothing.
A collection of drawable 2-D objects.
BoxDrawer(geo::PlaneID const &pid, RawDataDrawer *dataDrawer, evdb::View2D *new_view)
WireID_t Wire
Index of the wire within its plane.
int GetColor(double x) const
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)
virtual std::string Name() const override
bool ProcessChannelWithStatus(lariov::ChannelStatusProvider::Status_t channel_status) const
Returns whether a channel with the specified status should be processed.
Classes gathering simple statistics.
Singleton to hold the current art::Event for the event display.
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
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
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.
unsigned short Samples() const
Number of samples in the uncompressed ADC data.
size_t n_cells
number of cells in the axis
friend class RoIextractorClass
details::ADCCorrectorClass ADCCorrector
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.
TBox & AddBox(double x1, double y1, double x2, double y2)
Information about a RawDigit; may contain uncompressed duplicate of data.
art::InputTag const & inputLabel() const
Returns whether we are in the same event (the rest could differ)
OperationBaseClass const * Operator(size_t iOp) const
unsigned int PlaneID_t
Type for the ID number.
std::add_lvalue_reference_t< value_type > reference
Data_t min() const
Returns the accumulated minimum, or a very large number if no values.
virtual bool Finish() override
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.
void RunDrawOperation(art::Event const &evt, evdb::View2D *view, unsigned int plane)
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.
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.
Build an association between a numerical range and a ROOT color index for use in, eg...
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
Enumerate the possible plane projections.
bool hasWire(int wire) const
Returns whether the range includes the specified wire.
unsigned int fMaxChannelStatus
Display channels with this status and below.
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
double fTicks
number of TDC ticks to display, ie # fTicks past fStartTick
void RawDigit2D(art::Event const &evt, evdb::View2D *view, unsigned int plane, bool bZoomToRoI=false)
Draws raw digit content in 2D wire plane representation.
std::add_lvalue_reference_t< const_value_type > const_reference
constexpr bool isValidChannelID(raw::ChannelID_t channel)
void GetRawDigits(art::Event const &evt)
Reads raw::RawDigits; also triggers Reset()
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
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
The data type to uniquely identify a TPC.
Description of geometry of one entire detector.
virtual bool ProcessWire(geo::WireID const &wire) override
virtual bool Operate(geo::WireID const &wireID, size_t tick, float adc)=0
ADCCorrectorClass()
Default constructor: awaits for update()
float Max() const
Returns the extremes of the axis.
bool isEmpty() const
Returns whether minimum and maximum match.
virtual bool Initialize() override
bool bOwned
whether we own our data
Class to aid in the rendering of RawData objects.
Detector simulation of raw signals on wires.
virtual bool ProcessWire(geo::WireID const &wireID) override
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)
unsigned int WireID_t
Type for the ID number.
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 ProcessWire(geo::WireID const &)
std::string to_string(Flag_t< Storage > const flag)
Convert a flag into a stream (shows its index).
Encapsulate the construction of a single detector plane.
ADCCorrectorClass(geo::PlaneID const &pid)
Constructor: update()s with the specified information.
bool fSeeBadChannels
Allow "bad" channels to be viewed.
virtual bool Finish() override
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) 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
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
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.
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.
double fStartTick
Starting tick for the display.
bool good
whether the channel is not bad
void Dump(Stream &&out) const
bool owned() const
Returns whether we have data and we own it.
float electronsToADC
conversion constant
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.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Applies Birks correction.
OperationBaseClass * Operator(size_t iOp)
virtual std::string Name() const
float wirePitch
wire pitch
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.
virtual double ElectronsToADC() const =0
void StealData(std::remove_const_t< T > &&data)
Move data from the specified object, and own it.
Namespace collecting geometry-related classes utilities.
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 fUncompressWithPed
Option to uncompress with pedestal. Turned off by default.
Encapsulate the construction of a single detector plane.
virtual bool ProcessTick(size_t)
std::add_pointer_t< const_value_type > const_pointer
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.