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;
876 pedestal = pedestalRetrievalAlg.PedMean(channel);
895 if (wireID.planeID() != pid)
continue;
907 for (
size_t iTick =
fStartTick; iTick < max_tick; ++iTick) {
912 float const adc = uncompressed[iTick] - pedestal;
915 if (!operation->
Operate(wireID, iTick, adc))
return false;
921 return operation->
Finish();
936 , rawCharge(0.), convertedCharge(0.)
938 , ADCCorrector(PlaneID())
952 drawingRange.SetMinWireCellSize(1.F);
954 boxInfo.resize(drawingRange.NCells());
959 {
return drawingRange.hasWire((
int) wire.
Wire); }
962 {
return drawingRange.hasTick((
float) tick); }
968 std::ptrdiff_t cell = drawingRange.GetCell(wire, tick);
969 if (cell < 0)
return true;
975 convertedCharge += ADCCorrector(adc);
978 if (std::abs(info.
adc) <= std::abs(adc)) info.
adc = adc;
987 RawDataDrawerPtr()->fRawCharge[plane] = rawCharge;
988 RawDataDrawerPtr()->fConvertedCharge[plane] = convertedCharge;
992 *(RawDataDrawerPtr()->fDrawingRange) = drawingRange;
995 RawDataDrawerPtr()->QueueDrawingBoxes(view, PlaneID(), boxInfo);
1003 double rawCharge = 0., convertedCharge = 0.;
1013 std::vector<BoxInfo_t>
const& BoxInfo
1024 <<
"Filling " << BoxInfo.size() <<
" boxes to be rendered";
1035 size_t const nBoxes = BoxInfo.size();
1036 unsigned int nDrawnBoxes = 0;
1037 for (
size_t iBox = 0; iBox < nBoxes; ++iBox) {
1041 if(info.
good && (std::abs(info.
adc) < MinSignal))
continue;
1044 if (!info.
good)
continue;
1050 constexpr
float q0 = 1000.;
1051 float const sf = bScaleDigitsByCharge
1052 ?
std::min(std::sqrt((
float) info.
adc / q0), 1.0F)
1056 float min_wire, max_wire, min_tick, max_tick;
1057 std::tie(min_wire, min_tick, max_wire, max_tick)
1065 float const nsf = 1. - sf;
1066 float const half_box_wires = (max_wire - min_wire) / 2.,
1067 half_box_ticks = (max_tick - min_tick) / 2.;
1070 min_wire += nsf * half_box_wires;
1071 max_wire -= nsf * half_box_wires;
1072 min_tick += nsf * half_box_ticks;
1073 max_tick -= nsf * half_box_ticks;
1080 pBox = &(view->
AddBox(min_wire, min_tick, max_wire, max_tick));
1082 pBox = &(view->
AddBox(min_tick, min_wire, max_tick, max_wire));
1084 pBox->SetFillStyle(1001);
1085 pBox->SetFillColor(color);
1086 pBox->SetBit(kCannotPick);
1092 <<
"Sent " << nDrawnBoxes <<
"/" << BoxInfo.size()
1093 <<
" boxes to be rendered";
1109 <<
"RawDataDrawer::RunDrawOperation(): " 1110 "somewhere something went somehow wrong";
1130 virtual bool Operate
1133 if (std::abs(adc) < RoIthreshold)
return true;
1134 WireRange.add(wireID.
Wire);
1142 int& WireMin = pRawDataDrawer->fWireMin[plane];
1143 int& WireMax = pRawDataDrawer->fWireMax[plane];
1144 int& TimeMin = pRawDataDrawer->fTimeMin[plane];
1145 int& TimeMax = pRawDataDrawer->fTimeMax[plane];
1147 if ((WireMin == WireMax) && WireRange.has_data()) {
1149 mf::LogInfo(
"RawDataDrawer") <<
"Region of interest for " 1150 << std::string(PlaneID()) <<
" detected to be within wires " 1151 << WireRange.min() <<
" to " << WireRange.max()
1152 <<
" (plane has " << geom.
Nwires(PlaneID()) <<
" wires)";
1153 WireMax = WireRange.max() + 1;
1154 WireMin = WireRange.min();
1156 if ((TimeMin == TimeMax) && TDCrange.has_data()) {
1157 mf::LogInfo(
"RawDataDrawer") <<
"Region of interest for " 1158 << std::string(PlaneID()) <<
" detected to be within ticks " 1159 << TDCrange.min() <<
" to " << TDCrange.max();
1160 TimeMax = TDCrange.max() + 1;
1161 TimeMin = TDCrange.min();
1179 LOG_TRACE(
"RawDataDrawer") <<
"Region of interest for " << pid
1180 << (bExtractRoI?
" extracted":
" not extracted") <<
" on this draw";
1182 if (!bExtractRoI)
return;
1186 throw std::runtime_error
1187 (
"RawDataDrawer::RunRoIextractor(): somewhere something went somehow wrong");
1224 std::unique_ptr<OperationBaseClass> operation;
1228 << __func__ <<
"() setting up one-pass drawing";
1229 operation.reset(
new BoxDrawer(pid,
this, view));
1232 LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() adding RoI extraction";
1236 std::unique_ptr<OperationBaseClass> drawer(std::move(operation));
1237 std::unique_ptr<OperationBaseClass> extractor
1249 <<
"RawDataDrawer::RunDrawOperation(): " 1250 "somewhere something went somehow wrong";
1257 <<
"() setting up RoI extraction for " << pid;
1261 <<
"RawDataDrawer::RunDrawOperation():" 1262 " something went somehow wrong while extracting RoI";
1267 <<
"() using existing RoI for " << pid
1277 LOG_DEBUG(
"RawDataDrawer") << __func__ <<
"() setting up drawing";
1281 <<
"RawDataDrawer::RunDrawOperation():" 1282 " something went somehow wrong while drawing";
1293 if((
unsigned int)plane>=
fWireMin.size())
1294 {
mf::LogWarning (
"RawDataDrawer") <<
" Requested plane " << plane <<
" is larger than those available " << std::endl;
1303 if ((minw == maxw) || (mint == maxt))
return 1;
1306 minw= (minw-30<0) ? 0 : minw-30;
1307 mint= (mint-10<0) ? 0 : mint-10;
1309 maxw= (maxw+10>(int)geo->
Nwires(plane)) ? geo->
Nwires(plane) : maxw+10;
1339 lariov::ChannelStatusProvider
const& channelStatus
1349 if (!channelStatus.IsPresent(channel))
continue;
1355 if (!rawopt->
fSeeBadChannels && channelStatus.IsBad(channel))
continue;
1357 std::vector<geo::WireID> wireids = geo->
ChannelToWire(channel);
1358 for(
auto const& wid : wireids){
1360 if (wid.planeID() != pid)
continue;
1369 pedestal = pedestalRetrievalAlg.PedMean(channel);
1384 for(
short d: uncompressed)
1385 histo->Fill(
float(
d) - pedestal);
1419 mf::LogError(
"RawDataDrawer") << __func__ <<
": no channel associated to " 1420 << std::string(wireid);
1425 lariov::ChannelStatusProvider
const& channelStatus
1428 if (!channelStatus.IsPresent(channel))
return;
1446 <<
": can't find raw digit for channel #" << channel
1447 <<
" (" << std::string(wireid) <<
")";
1458 pedestal = pedestalRetrievalAlg.PedMean(channel);
1473 for(
size_t j = 0; j < uncompressed.size(); ++j)
1474 histo->Fill(
float(j),
float(uncompressed[j]) - pedestal);
1579 LOG_DEBUG(
"RawDataDrawer") <<
"RawDataDrawer[" << ((
void*)
this)
1580 <<
"]: resetting the region of interest";
1595 LOG_DEBUG(
"RawDataDrawer") <<
"GetRawDigits() for " << new_timestamp
1596 <<
" (last for: " << *
fCacheID <<
")";
1607 *fCacheID = new_timestamp;
1614 (lariov::ChannelStatusProvider::Status_t channel_status)
const 1617 if (!lariov::ChannelStatusProvider::IsValidStatus(channel_status))
1623 if (channel_status < drawopt->fMinChannelStatus)
return false;
1636 if (!data.hasData()) UncompressData();
1647 void RawDigitInfo_t::Clear() {
1649 sample_info.reset();
1653 void RawDigitInfo_t::UncompressData()
const {
1660 if (digit->Compression() ==
kNone) {
1662 data.PointToData(digit->ADCs());
1667 int pedestal = (int)digit->GetPedestal();
1669 samples.resize(digit->Samples());
1670 Uncompress(digit->ADCs(), samples, pedestal, digit->Compression());
1671 data.StealData(std::move(samples));
1675 samples.resize(digit->Samples());
1676 Uncompress(digit->ADCs(), samples, digit->Compression());
1677 data.StealData(std::move(samples));
1683 void RawDigitInfo_t::CollectSampleInfo()
const {
1690 (samples.begin(), samples.end());
1693 sample_info->min_charge = stat.
min();
1694 sample_info->max_charge = stat.max();
1701 if (!sample_info) CollectSampleInfo();
1702 return *sample_info;
1705 template <
typename Stream>
1706 void RawDigitInfo_t::Dump(Stream&& out)
const {
1707 out <<
" digit at " << ((
void*) digit.get()) <<
" on channel #" << digit->Channel()
1708 <<
" with " << digit->NADC();
1709 if (digit->Compression() ==
kNone) out <<
" uncompressed data";
1710 else out <<
" data items compressed with <" << digit->Compression() <<
">";
1712 out <<
" with data (" << data->size() <<
" samples)";
1713 else out <<
" without data";
1723 auto iDigit = std::find_if(
1724 digits.cbegin(), digits.cend(),
1726 {
return digit.Channel() == channel; }
1728 return (iDigit == digits.cend())?
nullptr: &*iDigit;
1731 std::vector<raw::RawDigit>
const* RawDigitCacheDataClass::ReadProduct
1735 if (!evt.
getByLabel(label, rdcol))
return nullptr;
1740 void RawDigitCacheDataClass::Refill
1743 digits.resize(rdcol->size());
1744 for(
size_t iDigit = 0; iDigit < rdcol->size(); ++iDigit) {
1746 digits[iDigit].Fill(pDigit);
1747 size_t samples = pDigit->
Samples();
1748 if (samples > max_samples) max_samples = samples;
1753 void RawDigitCacheDataClass::Invalidate() {
1758 void RawDigitCacheDataClass::Clear() {
1766 RawDigitCacheDataClass::CheckUpToDate
1794 if (res.digits->empty())
1803 if (&(pInfo->
Digit()) != &(res.digits->front()))
1806 res.bUpToDate =
true;
1816 if (update_info)
return false;
1819 <<
"Refilling raw digit cache RawDigitCacheDataClass[" 1820 << ((
void*)
this ) <<
"] for " << new_timestamp;
1833 timestamp = new_timestamp;
1838 template <
typename Stream>
1839 void RawDigitCacheDataClass::Dump(Stream&& out)
const {
1840 out <<
"Cache at " << ((
void*)
this)
1841 <<
" with time stamp " << std::string(timestamp)
1842 <<
" and " << digits.size()
1843 <<
" entries (maximum sample: " << max_samples <<
");" 1844 <<
" data at " << ((
void*) digits.data());
1847 digitInfo.Dump(out);
1856 std::ptrdiff_t GridAxisClass::GetCell(
float coord)
const {
1857 return std::ptrdiff_t((coord -
min) / cell_size);
1862 bool GridAxisClass::Init(
size_t nDiv,
float new_min,
float new_max) {
1864 n_cells =
std::max(nDiv,
size_t(1));
1865 return SetLimits(new_min, new_max);
1871 bool GridAxisClass::SetLimits(
float new_min,
float new_max) {
1874 cell_size = Length() / float(n_cells);
1876 return std::isnormal(cell_size);
1881 bool GridAxisClass::SetMinCellSize(
float min_size) {
1882 if (cell_size >= min_size)
return false;
1885 n_cells = (size_t)
std::max(std::floor(Length() / min_size), 1.0F);
1889 cell_size = Length() / float(n_cells);
1895 bool GridAxisClass::SetMaxCellSize(
float max_size) {
1896 if (cell_size <= max_size)
return false;
1899 n_cells = (size_t)
std::max(std::ceil(Length() / max_size), 1.0F);
1903 cell_size = Length() / float(n_cells);
1909 template <
typename Stream>
1910 void GridAxisClass::Dump(Stream&& out)
const {
1911 out << NCells() <<
" cells from " << Min() <<
" to " << Max()
1912 <<
" (length: " << Length() <<
")";
1919 CellGridClass::CellGridClass(
unsigned int nWires,
unsigned int nTDC)
1920 : wire_axis((size_t) nWires, 0., float(nWires))
1921 , tdc_axis((size_t) nTDC, 0., float(nTDC))
1928 float min_wire,
float max_wire,
unsigned int nWires,
1929 float min_tdc,
float max_tdc,
unsigned int nTDC
1931 :
wire_axis((size_t) nWires, min_wire, max_wire)
1932 ,
tdc_axis((size_t) nTDC, min_tdc, max_tdc)
1949 (std::ptrdiff_t iCell)
const 1953 std::ptrdiff_t iWireCell = (std::ptrdiff_t) (iCell / nTDCCells),
1954 iTDCCell = (std::ptrdiff_t) (iCell % nTDCCells);
1957 return std::tuple<float, float, float, float>(
1965 template <
typename Stream>
1967 out <<
"Wire axis: ";
1969 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.
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.
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.
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.