LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evd::RawDataDrawer Class Reference

Aid in the rendering of RawData objects. More...

#include "RawDataDrawer.h"

Classes

class  BoxDrawer
 
struct  BoxInfo_t
 
class  ManyOperations
 
class  OperationBaseClass
 
struct  PadResolution_t
 Stores the information about the drawing area. More...
 
class  RoIextractorClass
 

Public Member Functions

 RawDataDrawer ()
 
 ~RawDataDrawer ()
 
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. More...
 
void FillQHisto (const art::Event &evt, unsigned int plane, TH1F *histo)
 
void FillTQHisto (const art::Event &evt, unsigned int plane, unsigned int wire, TH1F *histo)
 
double StartTick () const
 
double TotalClockTicks () const
 
void ExtractRange (TVirtualPad *pPad, std::vector< double > const *zoom=nullptr)
 Fills the viewport information from the specified pad. More...
 
void SetDrawingLimits (float low_wire, float high_wire, float low_tdc, float high_tdc)
 Fills the viewport borders from the specified extremes. More...
 
int GetRegionOfInterest (int plane, int &minw, int &maxw, int &mint, int &maxt)
 
void ResetRegionOfInterest ()
 Forgets about the current region of interest. More...
 
bool hasRegionOfInterest (geo::PlaneID::PlaneID_t plane) const
 
void GetChargeSum (int plane, double &charge, double &convcharge)
 

Private Member Functions

void Reset (art::Event const &event)
 Prepares for a new event (if somebody tells it to) More...
 
void GetRawDigits (art::Event const &evt)
 Reads raw::RawDigits; also triggers Reset() More...
 
bool ProcessChannelWithStatus (lariov::ChannelStatusProvider::Status_t channel_status) const
 Returns whether a channel with the specified status should be processed. More...
 
void DrawRawDigit2D (art::Event const &evt, evdb::View2D *view, unsigned int plane)
 Performs the 2D wire plane drawing. More...
 
void GetRawDigits (art::Event const &evt, details::CacheID_t const &new_timestamp)
 Makes sure raw::RawDigit's are available for the current settings. More...
 
bool RunOperation (art::Event const &evt, OperationBaseClass *operation)
 
void QueueDrawingBoxes (evdb::View2D *view, geo::PlaneID const &pid, std::vector< BoxInfo_t > const &BoxInfo)
 
void RunDrawOperation (art::Event const &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
 
void RunRoIextractor (art::Event const &evt, unsigned int plane)
 
void SetDrawingLimitsFromRoI (geo::PlaneID::PlaneID_t plane)
 
void SetDrawingLimitsFromRoI (geo::PlaneID const pid)
 

Private Attributes

evd::details::RawDigitCacheDataClassdigit_cache
 Cache of raw digits. More...
 
double fStartTick
 low tick More...
 
double fTicks
 number of ticks of the clock More...
 
std::vector< int > fWireMin
 lowest wire in interesting region for each plane More...
 
std::vector< int > fWireMax
 highest wire in interesting region for each plane More...
 
std::vector< int > fTimeMin
 lowest time in interesting region for each plane More...
 
std::vector< int > fTimeMax
 highest time in interesting region for each plane More...
 
std::vector< double > fRawCharge
 Sum of Raw Charge. More...
 
std::vector< double > fConvertedCharge
 Sum of Charge Converted using Birks' formula. More...
 
PadResolution_t PadResolution
 stored pad resolution More...
 
details::CacheID_tfCacheID
 information about the last processed plane More...
 
details::CellGridClassfDrawingRange
 information about the viewport More...
 

Static Private Attributes

static std::vector< raw::RawDigit > const EmptyRawDigits
 Empty collection, used in return value of invalid digits. More...
 

Friends

class BoxDrawer
 
class RoIextractorClass
 

Detailed Description

Aid in the rendering of RawData objects.

Definition at line 47 of file RawDataDrawer.h.

Constructor & Destructor Documentation

evd::RawDataDrawer::RawDataDrawer ( )

Definition at line 531 of file RawDataDrawer.cxx.

References fConvertedCharge, evd::RawDrawingOptions::fCryostat, fRawCharge, evd::RawDrawingOptions::fStartTick, fStartTick, evd::RawDrawingOptions::fTicks, fTicks, fTimeMax, fTimeMin, evd::RawDrawingOptions::fTPC, fWireMax, fWireMin, and geo::GeometryCore::Nplanes().

532  : digit_cache(new details::RawDigitCacheDataClass)
533  , fStartTick(0)
534  , fTicks(2048)
536  , fDrawingRange(new details::CellGridClass)
537  {
539 
541  geo::TPCID tpcid(rawopt->fCryostat, rawopt->fTPC);
542 
543  fStartTick = rawopt->fStartTick;
544  fTicks = rawopt->fTicks;
545 
546  // set the list of bad channels in this detector
547  unsigned int nplanes = geo->Nplanes(tpcid);
548  fWireMin.resize(nplanes, -1);
549  fWireMax.resize(nplanes, -1);
550  fTimeMin.resize(nplanes, -1);
551  fTimeMax.resize(nplanes, -1);
552  fRawCharge.resize(nplanes, 0);
553  fConvertedCharge.resize(nplanes, 0);
554  }
unsigned int fTPC
TPC number to draw, typically set by TWQProjectionView.
double fStartTick
low tick
details::CacheID_t * fCacheID
information about the last processed plane
std::vector< double > fRawCharge
Sum of Raw Charge.
std::vector< int > fWireMin
lowest wire in interesting region for each plane
std::vector< int > fTimeMax
highest time in interesting region for each plane
double fTicks
number of ticks of the clock
unsigned int fCryostat
Cryostat number to draw, typically set by TWQProjectionView.
std::vector< int > fWireMax
highest wire in interesting region for each plane
double fTicks
number of TDC ticks to display, ie # fTicks past fStartTick
The data type to uniquely identify a TPC.
Definition: geo_types.h:381
double fStartTick
Starting tick for the display.
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
Definition: GeometryCore.h:977
details::CellGridClass * fDrawingRange
information about the viewport
std::vector< int > fTimeMin
lowest time in interesting region for each plane
::util::PlaneDataChangeTracker_t CacheID_t
Definition: RawDataDrawer.h:42
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.
Namespace collecting geometry-related classes utilities.
std::vector< double > fConvertedCharge
Sum of Charge Converted using Birks&#39; formula.
evd::RawDataDrawer::~RawDataDrawer ( )

Definition at line 557 of file RawDataDrawer.cxx.

References digit_cache, fCacheID, and fDrawingRange.

558  {
559  delete digit_cache;
560  delete fDrawingRange;
561  delete fCacheID;
562  }
details::CacheID_t * fCacheID
information about the last processed plane
details::CellGridClass * fDrawingRange
information about the viewport
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.

Member Function Documentation

void evd::RawDataDrawer::DrawRawDigit2D ( art::Event const &  evt,
evdb::View2D view,
unsigned int  plane 
)
private

Performs the 2D wire plane drawing.

void evd::RawDataDrawer::ExtractRange ( TVirtualPad *  pPad,
std::vector< double > const *  zoom = nullptr 
)

Fills the viewport information from the specified pad.

Definition at line 598 of file RawDataDrawer.cxx.

References fDrawingRange, evd::RawDataDrawer::PadResolution_t::height, PadResolution, evd::details::CellGridClass::SetTDCRange(), evd::details::CellGridClass::SetWireRange(), and evd::RawDataDrawer::PadResolution_t::width.

Referenced by evd::TWireProjPad::Draw().

600  {
601  mf::LogDebug log("RawDataDrawer");
602  log << "ExtractRange() on pad '" << pPad->GetName() << "'";
603 
604  TFrame const* pFrame = pPad->GetFrame();
605  if (pFrame) {
606  // these coordinates are used to find the actual extent of pad in pixels
607  double low_wire = pFrame->GetX1(), high_wire = pFrame->GetX2();
608  double low_tdc = pFrame->GetY1(), high_tdc = pFrame->GetY2();
609  double const wire_pixels = pPad->XtoAbsPixel(high_wire) - pPad->XtoAbsPixel(low_wire);
610  double const tdc_pixels = -(pPad->YtoAbsPixel(high_tdc) - pPad->YtoAbsPixel(low_tdc));
611 
612  PadResolution.width = (unsigned int)wire_pixels;
613  PadResolution.height = (unsigned int)tdc_pixels;
614 
615  log << "\n frame window is " << PadResolution.width << "x" << PadResolution.height
616  << " pixel big and";
617  // those coordinates also are a (unreliable) estimation of the zoom;
618  // if we have a better one, let's use it
619  // (this does not change the size of the window in terms of pixels)
620  if (zoom) {
621  log << ", from external source,";
622  low_wire = (*zoom)[0];
623  high_wire = (*zoom)[1];
624  low_tdc = (*zoom)[2];
625  high_tdc = (*zoom)[3];
626  }
627 
628  log << " spans wires " << low_wire << "-" << high_wire << " and TDC " << low_tdc << "-"
629  << high_tdc;
630 
631  // TODO support swapping axes here:
632  // if (rawopt.fAxisOrientation < 1) { normal ; } else { swapped; }
633 
634  fDrawingRange->SetWireRange(low_wire, high_wire, (unsigned int)wire_pixels, 1.0);
635  fDrawingRange->SetTDCRange(low_tdc, high_tdc, (unsigned int)tdc_pixels, 1.0);
636  }
637  else {
638  // keep the old frame (if any)
639  log << "\n no frame!";
640  }
641 
642  } // RawDataDrawer::ExtractRange()
void SetWireRange(unsigned int nWires)
Sets the wire range, leaving the number of wire cells unchanged.
PadResolution_t PadResolution
stored pad resolution
details::CellGridClass * fDrawingRange
information about the viewport
void SetTDCRange(unsigned int nTDC)
Sets a simple TDC range: all the ticks, one cell per tick.
void evd::RawDataDrawer::FillQHisto ( const art::Event evt,
unsigned int  plane,
TH1F *  histo 
)

Definition at line 1264 of file RawDataDrawer.cxx.

References raw::RawDigit::Channel(), geo::GeometryCore::ChannelToWire(), evd::RawDrawingOptions::CurrentTPC(), d, digit_cache, evd::RawDrawingOptions::fDrawRawDataOrCalibWires, evd::RawDrawingOptions::fPedestalOption, evd::RawDrawingOptions::fRawDataLabels, evd::RawDrawingOptions::fSeeBadChannels, raw::RawDigit::GetPedestal(), GetRawDigits(), and ProcessChannelWithStatus().

1265  {
1266 
1267  // Check if we're supposed to draw raw hits at all
1269  if (rawopt->fDrawRawDataOrCalibWires == 1) return;
1270 
1272 
1273  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1274 
1275  for (const auto& rawDataLabel : rawopt->fRawDataLabels) {
1276  details::CacheID_t NewCacheID(evt, rawDataLabel, pid);
1277  GetRawDigits(evt, NewCacheID);
1278 
1279  lariov::ChannelStatusProvider const& channelStatus =
1281 
1282  //get pedestal conditions
1283  const lariov::DetPedestalProvider& pedestalRetrievalAlg =
1285 
1286  for (evd::details::RawDigitInfo_t const& digit_info : *digit_cache) {
1287  raw::RawDigit const& hit = digit_info.Digit();
1288  raw::ChannelID_t const channel = hit.Channel();
1289 
1290  if (!channelStatus.IsPresent(channel)) continue;
1291 
1292  // The following test is meant to be temporary until the "correct" solution is implemented
1293  if (!ProcessChannelWithStatus(channelStatus.Status(channel))) continue;
1294 
1295  // to be explicit: we don't cound bad channels in
1296  if (!rawopt->fSeeBadChannels && channelStatus.IsBad(channel)) continue;
1297 
1298  std::vector<geo::WireID> wireids = geo->ChannelToWire(channel);
1299  for (auto const& wid : wireids) {
1300  // check that the plane and tpc are the correct ones to draw
1301  if (wid.planeID() != pid) continue;
1302 
1303  raw::RawDigit::ADCvector_t const& uncompressed = digit_info.Data();
1304 
1305  //float const pedestal = pedestalRetrievalAlg.PedMean(channel);
1306  // recover the pedestal
1307  float pedestal = 0;
1308  if (rawopt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.PedMean(channel); }
1309  else if (rawopt->fPedestalOption == 1) {
1310  pedestal = hit.GetPedestal();
1311  }
1312  else if (rawopt->fPedestalOption == 2) {
1313  pedestal = 0;
1314  }
1315  else {
1316  mf::LogWarning("RawDataDrawer")
1317  << " PedestalOption is not understood: " << rawopt->fPedestalOption
1318  << ". Pedestals not subtracted.";
1319  }
1320 
1321  for (short d : uncompressed)
1322  histo->Fill(float(d) - pedestal); //pedestals[plane]); //hit.GetPedestal());
1323 
1324  // this channel is on the correct plane, don't double count the raw signal
1325  // if there are more than one wids for the channel
1326  break;
1327  } // end loop over wids
1328  } //end loop over raw hits
1329  } //end loop over labels
1330  }
float GetPedestal() const
Definition: RawDigit.h:221
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:68
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
int fDrawRawDataOrCalibWires
0 for raw
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:213
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:72
bool ProcessChannelWithStatus(lariov::ChannelStatusProvider::Status_t channel_status) const
Returns whether a channel with the specified status should be processed.
Information about a RawDigit; may contain uncompressed duplicate of data.
Float_t d
Definition: plot.C:235
void GetRawDigits(art::Event const &evt)
Reads raw::RawDigits; also triggers Reset()
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
Detector simulation of raw signals on wires.
bool fSeeBadChannels
Allow "bad" channels to be viewed.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< art::InputTag > fRawDataLabels
module label that made the raw digits, default is daq
::util::PlaneDataChangeTracker_t CacheID_t
Definition: RawDataDrawer.h:42
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.
int fPedestalOption
0: use DetPedestalService; 1: Use pedestal in raw::RawDigt; 2: no ped subtraction ...
Namespace collecting geometry-related classes utilities.
void evd::RawDataDrawer::FillTQHisto ( const art::Event evt,
unsigned int  plane,
unsigned int  wire,
TH1F *  histo 
)

Definition at line 1333 of file RawDataDrawer.cxx.

References evd::RawDrawingOptions::CurrentTPC(), evd::details::RawDigitInfo_t::Data(), digit_cache, evd::details::RawDigitInfo_t::DigitPtr(), evd::details::RawDigitCacheDataClass::empty(), evd::RawDrawingOptions::fDrawRawDataOrCalibWires, evd::details::RawDigitCacheDataClass::FindChannel(), evd::RawDrawingOptions::fPedestalOption, evd::RawDrawingOptions::fRawDataLabels, evd::RawDrawingOptions::fSeeBadChannels, raw::RawDigit::GetPedestal(), GetRawDigits(), raw::isValidChannelID(), geo::GeometryCore::PlaneWireToChannel(), and ProcessChannelWithStatus().

1337  {
1338 
1339  // Check if we're supposed to draw raw hits at all
1341  if (rawopt->fDrawRawDataOrCalibWires == 1) return;
1342 
1343  // make sure we have the raw digits cached
1344  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1345 
1346  // loop over labels
1347  for (const auto& rawDataLabel : rawopt->fRawDataLabels) {
1348  details::CacheID_t NewCacheID(evt, rawDataLabel, pid);
1349  GetRawDigits(evt, NewCacheID);
1350 
1351  if (digit_cache->empty()) return;
1352 
1353  geo::WireID const wireid(pid, wire);
1354 
1355  // find the channel
1357  raw::ChannelID_t const channel = geom->PlaneWireToChannel(wireid);
1358  if (!raw::isValidChannelID(channel)) { // no channel, empty histogram
1359  mf::LogError("RawDataDrawer")
1360  << __func__ << ": no channel associated to " << std::string(wireid);
1361  return;
1362  } // if no channel
1363 
1364  // check the channel status; bad channels are still ok.
1365  lariov::ChannelStatusProvider const& channelStatus =
1367 
1368  if (!channelStatus.IsPresent(channel)) return;
1369 
1370  // The following test is meant to be temporary until the "correct" solution is implemented
1371  if (!ProcessChannelWithStatus(channelStatus.Status(channel))) return;
1372 
1373  // we accept to see the content of a bad channel, so this is commented out:
1374  if (!rawopt->fSeeBadChannels && channelStatus.IsBad(channel)) return;
1375 
1376  //get pedestal conditions
1377  const lariov::DetPedestalProvider& pedestalRetrievalAlg =
1379 
1380  // find the raw digit
1381  // (iDigit is an iterator to a evd::details::RawDigitInfo_t)
1382  evd::details::RawDigitInfo_t const* pDigit = digit_cache->FindChannel(channel);
1383 
1384  if (
1385  !pDigit) { // this is weird... actually no, this can happen if the RawDigits are per TPC (or something)
1386  // mf::LogWarning("RawDataDrawer") << __func__
1387  // << ": can't find raw digit for channel #" << channel
1388  // << " (" << std::string(wireid) << ")";
1389  continue;
1390  }
1391 
1392  raw::RawDigit::ADCvector_t const& uncompressed = pDigit->Data();
1393 
1394  // recover the pedestal
1395  float pedestal = 0;
1396  if (rawopt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.PedMean(channel); }
1397  else if (rawopt->fPedestalOption == 1) {
1398  pedestal = pDigit->DigitPtr()->GetPedestal();
1399  }
1400  else if (rawopt->fPedestalOption == 2) {
1401  pedestal = 0;
1402  }
1403  else {
1404  mf::LogWarning("RawDataDrawer")
1405  << " PedestalOption is not understood: " << rawopt->fPedestalOption
1406  << ". Pedestals not subtracted.";
1407  }
1408 
1409  for (size_t j = 0; j < uncompressed.size(); ++j)
1410  histo->Fill(float(j),
1411  float(uncompressed[j]) - pedestal); //pedestals[plane]); //hit.GetPedestal());
1412  }
1413 
1414  } // RawDataDrawer::FillTQHisto()
float GetPedestal() const
Definition: RawDigit.h:221
int fDrawRawDataOrCalibWires
0 for raw
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:72
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
bool ProcessChannelWithStatus(lariov::ChannelStatusProvider::Status_t channel_status) const
Returns whether a channel with the specified status should be processed.
Information about a RawDigit; may contain uncompressed duplicate of data.
raw::RawDigit::ADCvector_t const & Data() const
average charge
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:35
void GetRawDigits(art::Event const &evt)
Reads raw::RawDigits; also triggers Reset()
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
bool empty() const
Returns whether the cache is empty() (STL-like interface)
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.
bool fSeeBadChannels
Allow "bad" channels to be viewed.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< art::InputTag > fRawDataLabels
module label that made the raw digits, default is daq
::util::PlaneDataChangeTracker_t CacheID_t
Definition: RawDataDrawer.h:42
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.
int fPedestalOption
0: use DetPedestalService; 1: Use pedestal in raw::RawDigt; 2: no ped subtraction ...
art::Ptr< raw::RawDigit > DigitPtr() const
Returns an art pointer to the actual digit.
void evd::RawDataDrawer::GetChargeSum ( int  plane,
double &  charge,
double &  convcharge 
)

Definition at line 1257 of file RawDataDrawer.cxx.

References fConvertedCharge, and fRawCharge.

1258  {
1259  charge = fRawCharge[plane];
1260  convcharge = fConvertedCharge[plane];
1261  }
std::vector< double > fRawCharge
Sum of Raw Charge.
std::vector< double > fConvertedCharge
Sum of Charge Converted using Birks&#39; formula.
void evd::RawDataDrawer::GetRawDigits ( art::Event const &  evt)
private

Reads raw::RawDigits; also triggers Reset()

Referenced by FillQHisto(), FillTQHisto(), and RawDigit2D().

void evd::RawDataDrawer::GetRawDigits ( art::Event const &  evt,
details::CacheID_t const &  new_timestamp 
)
private

Makes sure raw::RawDigit's are available for the current settings.

Parameters
evtevent to read the digits from
tsa cache ID assessing the new state the cache should move to

The function will ask the data cache for an update (RawDigitCacheDataClass::Update()). The cache will evaluate whether it is already in a state compatible with ts or if cache needs to be invalidated, in which case it will fill with new data. This method also triggers a Reset() if the target state differs from the old one.

Definition at line 1529 of file RawDataDrawer.cxx.

References digit_cache, fCacheID, MF_LOG_DEBUG, ResetRegionOfInterest(), and evd::details::RawDigitCacheDataClass::Update().

1530  {
1531  MF_LOG_DEBUG("RawDataDrawer") << "GetRawDigits() for " << new_timestamp
1532  << " (last for: " << *fCacheID << ")";
1533 
1534  // update cache
1535  digit_cache->Update(evt, new_timestamp);
1536 
1537  // if time stamp is changing, we want to reconsider which region is
1538  // interesting
1539  if (!fCacheID->sameTPC(new_timestamp)) ResetRegionOfInterest();
1540 
1541  // all the caches have been properly updated or invalidated;
1542  // we are now on a new cache state
1543  *fCacheID = new_timestamp;
1544 
1545  } // RawDataDrawer::GetRawDigits()
bool Update(art::Event const &evt, CacheID_t const &new_timestamp)
details::CacheID_t * fCacheID
information about the last processed plane
#define MF_LOG_DEBUG(id)
void ResetRegionOfInterest()
Forgets about the current region of interest.
TCEvent evt
Definition: DataStructs.cxx:8
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.
int evd::RawDataDrawer::GetRegionOfInterest ( int  plane,
int &  minw,
int &  maxw,
int &  mint,
int &  maxt 
)

Definition at line 1228 of file RawDataDrawer.cxx.

References fTimeMax, fTimeMin, fWireMax, fWireMin, geo::GeometryCore::Nwires(), and TotalClockTicks().

Referenced by evd::TWireProjPad::ShowFull().

1229  {
1231 
1232  if ((unsigned int)plane >= fWireMin.size()) {
1233  mf::LogWarning("RawDataDrawer")
1234  << " Requested plane " << plane << " is larger than those available " << std::endl;
1235  return -1;
1236  }
1237 
1238  minw = fWireMin[plane];
1239  maxw = fWireMax[plane];
1240  mint = fTimeMin[plane];
1241  maxt = fTimeMax[plane];
1242 
1243  if ((minw == maxw) || (mint == maxt)) return 1;
1244 
1245  //make values a bit larger, but make sure they don't go out of bounds
1246  minw = (minw - 30 < 0) ? 0 : minw - 30;
1247  mint = (mint - 10 < 0) ? 0 : mint - 10;
1248 
1249  geo::PlaneID const planeid(0, 0, plane);
1250  maxw = (maxw + 10 > (int)geo->Nwires(planeid)) ? geo->Nwires(planeid) : maxw + 10;
1251  maxt = (maxt + 10 > TotalClockTicks()) ? TotalClockTicks() : maxt + 10;
1252 
1253  return 0;
1254  }
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
std::vector< int > fWireMin
lowest wire in interesting region for each plane
std::vector< int > fTimeMax
highest time in interesting region for each plane
std::vector< int > fWireMax
highest wire in interesting region for each plane
double TotalClockTicks() const
Definition: RawDataDrawer.h:84
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
unsigned int Nwires(PlaneID const &planeid) const
Returns the total number of wires in the specified plane.
std::vector< int > fTimeMin
lowest time in interesting region for each plane
Namespace collecting geometry-related classes utilities.
bool evd::RawDataDrawer::hasRegionOfInterest ( geo::PlaneID::PlaneID_t  plane) const

Returns whether there is currently a valid region of interest for the specified plane

Definition at line 1506 of file RawDataDrawer.cxx.

References fTimeMax, and fWireMax.

Referenced by RawDigit2D(), and RunRoIextractor().

1507  {
1508 
1509  return (fWireMax[plane] != -1) && (fTimeMax[plane] != -1);
1510 
1511  } // RawDataDrawer::hasRegionOfInterest()
std::vector< int > fTimeMax
highest time in interesting region for each plane
std::vector< int > fWireMax
highest wire in interesting region for each plane
bool evd::RawDataDrawer::ProcessChannelWithStatus ( lariov::ChannelStatusProvider::Status_t  channel_status) const
private

Returns whether a channel with the specified status should be processed.

Definition at line 1548 of file RawDataDrawer.cxx.

References evd::RawDrawingOptions::fMaxChannelStatus.

Referenced by FillQHisto(), FillTQHisto(), and RunOperation().

1550  {
1551  // if we don't have a valid status, we can't reject the channel
1552  if (!lariov::ChannelStatusProvider::IsValidStatus(channel_status)) return true;
1553 
1554  // is the status "too bad"?
1556  if (channel_status > drawopt->fMaxChannelStatus) return false;
1557  if (channel_status < drawopt->fMinChannelStatus) return false;
1558 
1559  // no reason to reject it...
1560  return true;
1561  } // RawDataDrawer::ProcessChannel()
unsigned int fMaxChannelStatus
Display channels with this status and below.
void evd::RawDataDrawer::QueueDrawingBoxes ( evdb::View2D view,
geo::PlaneID const &  pid,
std::vector< BoxInfo_t > const &  BoxInfo 
)
private

Definition at line 946 of file RawDataDrawer.cxx.

References util::abs(), evd::RawDataDrawer::BoxInfo_t::adc, evdb::View2D::AddBox(), color(), evd::RawDrawingOptions::fAxisOrientation, fDrawingRange, evd::RawDrawingOptions::fMinSignal, evd::RawDrawingOptions::fScaleDigitsByCharge, evd::details::CellGridClass::GetCellBox(), evdb::ColorScale::GetColor(), evd::RawDataDrawer::BoxInfo_t::good, MF_LOG_DEBUG, evd::ColorDrawingOptions::RawQ(), and geo::GeometryCore::SignalType().

949  {
950  //
951  // All the information is now collected in BoxInfo.
952  // Make boxes out of it.
953  //
955 
956  MF_LOG_DEBUG("RawDataDrawer") << "Filling " << BoxInfo.size() << " boxes to be rendered";
957 
958  // drawing options:
959  float const MinSignal = rawopt.fMinSignal;
960  bool const bScaleDigitsByCharge = rawopt.fScaleDigitsByCharge;
961 
963 
965  geo::SigType_t const sigType = geom.SignalType(pid);
966  evdb::ColorScale const& ColorSet = cst->RawQ(sigType);
967  size_t const nBoxes = BoxInfo.size();
968  unsigned int nDrawnBoxes = 0;
969  for (size_t iBox = 0; iBox < nBoxes; ++iBox) {
970  BoxInfo_t const& info = BoxInfo[iBox];
971 
972  // too little signal, don't bother drawing
973  if (info.good && (std::abs(info.adc) < MinSignal)) continue;
974 
975  // skip the bad cells
976  if (!info.good) continue;
977 
978  // box color, proportional to the ADC count
979  int const color = ColorSet.GetColor(info.adc);
980 
981  // scale factor, proportional to ADC count (optional)
982  constexpr float q0 = 1000.;
983  float const sf = bScaleDigitsByCharge ? std::min(std::sqrt((float)info.adc / q0), 1.0F) : 1.;
984 
985  // coordinates of the cell box
986  float min_wire, max_wire, min_tick, max_tick;
987  std::tie(min_wire, min_tick, max_wire, max_tick) = fDrawingRange->GetCellBox(iBox);
988  /*
989  MF_LOG_TRACE("RawDataDrawer")
990  << "Wires ( " << min_wire << " - " << max_wire << " ) ticks ("
991  << min_tick << " - " << max_tick << " ) for cell " << iBox;
992  */
993  if (sf != 1.) { // need to shrink the box
994  float const nsf = 1. - sf; // negation of scale factor
995  float const half_box_wires = (max_wire - min_wire) / 2.,
996  half_box_ticks = (max_tick - min_tick) / 2.;
997 
998  // shrink the box:
999  min_wire += nsf * half_box_wires;
1000  max_wire -= nsf * half_box_wires;
1001  min_tick += nsf * half_box_ticks;
1002  max_tick -= nsf * half_box_ticks;
1003  } // if scaling
1004 
1005  // allocate the box on the view;
1006  // the order of the coordinates depends on the orientation
1007  TBox* pBox;
1008  if (rawopt.fAxisOrientation < 1)
1009  pBox = &(view->AddBox(min_wire, min_tick, max_wire, max_tick));
1010  else
1011  pBox = &(view->AddBox(min_tick, min_wire, max_tick, max_wire));
1012 
1013  pBox->SetFillStyle(1001);
1014  pBox->SetFillColor(color);
1015  pBox->SetBit(kCannotPick);
1016 
1017  ++nDrawnBoxes;
1018  } // for (iBox)
1019 
1020  MF_LOG_DEBUG("RawDataDrawer") << "Sent " << nDrawnBoxes << "/" << BoxInfo.size()
1021  << " boxes to be rendered";
1022  } // RawDataDrawer::QueueDrawingBoxes()
int fScaleDigitsByCharge
scale the size of the digit by the charge
Display parameters for the raw data.
constexpr auto abs(T v)
Returns the absolute value of the argument.
int GetColor(double x) const
Definition: ColorScale.cxx:126
TBox & AddBox(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:263
Build an association between a numerical range and a ROOT color index for use in, eg...
Definition: ColorScale.h:44
const evdb::ColorScale & RawQ(geo::SigType_t st) const
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
double fMinSignal
minimum ADC count to display a time bin
Description of geometry of one entire detector.
Definition: GeometryCore.h:119
std::size_t color(std::string const &procname)
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
#define MF_LOG_DEBUG(id)
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
details::CellGridClass * fDrawingRange
information about the viewport
std::tuple< float, float, float, float > GetCellBox(std::ptrdiff_t iCell) const
Returns the coordinates { w1, t1, w2, t2 } of specified cell.
void evd::RawDataDrawer::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.

Parameters
evtsource for raw digits
viewtarget rendered object
planenumber of the plane to be drawn
bZoomToRoIwhether to render only te region of interest

This function performs pre-rendering of the raw digit content into a 2D view of the wire plane as TDC vs. wire number. The material for rendering is created and sent to view object for actual rendering. The pre-rendering result currently depends on information from the current rendering canvas, and in particular on its viewport in the (wire, TDC) space.

If no zoom to the region of interest is required, the region itself is computed (only if not known yet) while the rendering is performed. If the zoom is required instead, rendering is performed in two steps; in the first, run only of no region of interest is known yet, the region is extracted. In the second, that information is used for rendering.

Definition at line 1115 of file RawDataDrawer.cxx.

References evd::RawDataDrawer::ManyOperations::AddOperation(), BoxDrawer, geo::GeometryCore::ChannelToWire(), evd::RawDrawingOptions::CurrentTPC(), digit_cache, evd::details::RawDigitCacheDataClass::Digits(), evd::RawDrawingOptions::fDrawRawDataOrCalibWires, evd::RawDrawingOptions::fRawDataLabels, fTimeMax, fTimeMin, fWireMax, fWireMin, GetRawDigits(), hasRegionOfInterest(), MF_LOG_DEBUG, RoIextractorClass, RunOperation(), SetDrawingLimitsFromRoI(), and art::errors::Unknown.

Referenced by evd::TWireProjPad::Draw().

1121  {
1123  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1124 
1125  bool const bDraw = (rawopt->fDrawRawDataOrCalibWires != 1);
1126  // if we don't need to draw, don't bother doing anything;
1127  // if the region of interest is required, RunRoIextractor() should be called
1128  // (ok, now it's private, but it could be exposed)
1129  if (!bDraw) return;
1130 
1132 
1133  // Need to loop over the labels, but we don't want to zap existing cached RawDigits that are valid
1134  // So... do the painful search to make sure the RawDigits we recover at those we are searching for.
1135  bool theDroidIAmLookingFor = false;
1136 
1137  // Loop over labels
1138  for (const auto& rawDataLabel : rawopt->fRawDataLabels) {
1139  // make sure we reset what needs to be reset
1140  // before the operations are initialized;
1141  // we call for reading raw digits; they will be cached, so it's not a waste
1142  details::CacheID_t NewCacheID(evt, rawDataLabel, pid);
1143  GetRawDigits(evt, NewCacheID);
1144 
1145  // Painful check to see if these RawDigits contain the droids we are looking for
1146  for (const auto& rawDigit : digit_cache->Digits()) {
1147  std::vector<geo::WireID> WireIDs = geom->ChannelToWire(rawDigit.Channel());
1148 
1149  for (geo::WireID const& wireID : WireIDs) {
1150  if (wireID.planeID() != pid) continue; // not us!
1151  theDroidIAmLookingFor = true;
1152  break;
1153  } // for wires
1154 
1155  if (theDroidIAmLookingFor) break;
1156  }
1157 
1158  if (theDroidIAmLookingFor) break;
1159  }
1160 
1161  if (!theDroidIAmLookingFor) return;
1162 
1163  bool const hasRoI = hasRegionOfInterest(plane);
1164 
1165  // - if we don't have a RoI yet, we want to get it while we draw
1166  // * if we are zooming into it now, we have to extract it first, then draw
1167  // * if we are not zooming, we can do both at the same time
1168  // - if we have a RoI, we don't want to extract it again
1169  if (!bZoomToRoI) { // we are not required to zoom to the RoI
1170 
1171  std::unique_ptr<OperationBaseClass> operation;
1172 
1173  // we will do the drawing in one pass
1174  MF_LOG_DEBUG("RawDataDrawer") << __func__ << "() setting up one-pass drawing";
1175  operation.reset(new BoxDrawer(detProp, pid, this, view));
1176 
1177  if (!hasRoI) { // we don't have any RoI; since it's cheap, let's get it
1178  MF_LOG_DEBUG("RawDataDrawer") << __func__ << "() adding RoI extraction";
1179 
1180  // swap cards: operation becomes a multiple operation:
1181  // - prepare the two operations (one is there already, somehow)
1182  std::unique_ptr<OperationBaseClass> drawer(std::move(operation));
1183  std::unique_ptr<OperationBaseClass> extractor(new RoIextractorClass(pid, this));
1184  // - create a new composite operation and give it the sub-ops
1185  operation.reset(new ManyOperations(pid, this));
1186  ManyOperations* pManyOps = static_cast<ManyOperations*>(operation.get());
1187  pManyOps->AddOperation(std::move(drawer));
1188  pManyOps->AddOperation(std::move(extractor));
1189  }
1190 
1191  if (!RunOperation(evt, operation.get())) {
1192  throw art::Exception(art::errors::Unknown) << "RawDataDrawer::RunDrawOperation(): "
1193  "somewhere something went somehow wrong";
1194  }
1195  }
1196  else { // we are zooming to RoI
1197  // first, we want the RoI extracted; the extractor will update this object
1198  if (!hasRoI) {
1199  MF_LOG_DEBUG("RawDataDrawer") << __func__ << "() setting up RoI extraction for " << pid;
1200  RoIextractorClass extractor(pid, this);
1201  if (!RunOperation(evt, &extractor)) {
1203  << "RawDataDrawer::RunDrawOperation():"
1204  " something went somehow wrong while extracting RoI";
1205  }
1206  }
1207  else {
1208  MF_LOG_DEBUG("RawDataDrawer")
1209  << __func__ << "() using existing RoI for " << pid << ": wires ( " << fWireMin[plane]
1210  << " - " << fWireMax[plane] << " ), ticks ( " << fTimeMin[plane] << " - "
1211  << fTimeMax[plane] << " )";
1212  }
1213 
1214  // adopt the drawing limits information from the wire/time limits
1216 
1217  // then we draw
1218  MF_LOG_DEBUG("RawDataDrawer") << __func__ << "() setting up drawing";
1219  BoxDrawer drawer(detProp, pid, this, view);
1220  if (!RunOperation(evt, &drawer)) {
1221  throw art::Exception(art::errors::Unknown) << "RawDataDrawer::RunDrawOperation():"
1222  " something went somehow wrong while drawing";
1223  }
1224  }
1225  } // RawDataDrawer::RawDigit2D()
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
int fDrawRawDataOrCalibWires
0 for raw
void SetDrawingLimitsFromRoI(geo::PlaneID::PlaneID_t plane)
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
std::vector< int > fWireMin
lowest wire in interesting region for each plane
friend class RoIextractorClass
std::vector< int > fTimeMax
highest time in interesting region for each plane
std::vector< int > fWireMax
highest wire in interesting region for each plane
void GetRawDigits(art::Event const &evt)
Reads raw::RawDigits; also triggers Reset()
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
std::vector< RawDigitInfo_t > const & Digits() const
Returns the list of digit info.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool hasRegionOfInterest(geo::PlaneID::PlaneID_t plane) const
friend class BoxDrawer
#define MF_LOG_DEBUG(id)
std::vector< art::InputTag > fRawDataLabels
module label that made the raw digits, default is daq
std::vector< int > fTimeMin
lowest time in interesting region for each plane
::util::PlaneDataChangeTracker_t CacheID_t
Definition: RawDataDrawer.h:42
TCEvent evt
Definition: DataStructs.cxx:8
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.
bool RunOperation(art::Event const &evt, OperationBaseClass *operation)
void evd::RawDataDrawer::Reset ( art::Event const &  event)
private

Prepares for a new event (if somebody tells it to)

void evd::RawDataDrawer::ResetRegionOfInterest ( )

Forgets about the current region of interest.

Definition at line 1514 of file RawDataDrawer.cxx.

References trkf::fill(), fTimeMax, fTimeMin, fWireMax, fWireMin, and MF_LOG_DEBUG.

Referenced by GetRawDigits().

1515  {
1516 
1517  MF_LOG_DEBUG("RawDataDrawer") << "RawDataDrawer[" << ((void*)this)
1518  << "]: resetting the region of interest";
1519 
1520  std::fill(fWireMin.begin(), fWireMin.end(), -1);
1521  std::fill(fWireMax.begin(), fWireMax.end(), -1);
1522  std::fill(fTimeMin.begin(), fTimeMin.end(), -1);
1523  std::fill(fTimeMax.begin(), fTimeMax.end(), -1);
1524 
1525  } // RawDataDrawer::ResetRegionOfInterest()
std::vector< int > fWireMin
lowest wire in interesting region for each plane
std::vector< int > fTimeMax
highest time in interesting region for each plane
std::vector< int > fWireMax
highest wire in interesting region for each plane
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
#define MF_LOG_DEBUG(id)
std::vector< int > fTimeMin
lowest time in interesting region for each plane
void evd::RawDataDrawer::RunDrawOperation ( art::Event const &  evt,
detinfo::DetectorPropertiesData const &  detProp,
evdb::View2D view,
unsigned int  plane 
)
private

Definition at line 1024 of file RawDataDrawer.cxx.

References evd::RawDrawingOptions::CurrentTPC(), evd::RawDrawingOptions::fDrawRawDataOrCalibWires, RunOperation(), and art::errors::Unknown.

1028  {
1029 
1030  // Check if we're supposed to draw raw hits at all
1032  if (rawopt->fDrawRawDataOrCalibWires == 1) return;
1033 
1034  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1035  BoxDrawer drawer(detProp, pid, this, view);
1036  if (!RunOperation(evt, &drawer)) {
1037  throw art::Exception(art::errors::Unknown) << "RawDataDrawer::RunDrawOperation(): "
1038  "somewhere something went somehow wrong";
1039  }
1040 
1041  } // RawDataDrawer::RunDrawOperation()
int fDrawRawDataOrCalibWires
0 for raw
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
friend class BoxDrawer
TCEvent evt
Definition: DataStructs.cxx:8
bool RunOperation(art::Event const &evt, OperationBaseClass *operation)
bool evd::RawDataDrawer::RunOperation ( art::Event const &  evt,
OperationBaseClass operation 
)
private

Definition at line 760 of file RawDataDrawer.cxx.

References raw::RawDigit::Channel(), geo::GeometryCore::ChannelToWire(), digit_cache, evd::details::RawDigitCacheDataClass::empty(), evd::RawDataDrawer::OperationBaseClass::Finish(), evd::RawDrawingOptions::fPedestalOption, evd::RawDrawingOptions::fSeeBadChannels, fStartTick, fTicks, raw::RawDigit::GetPedestal(), evd::RawDataDrawer::OperationBaseClass::Initialize(), MF_LOG_DEBUG, evd::RawDataDrawer::OperationBaseClass::Name(), evd::RawDataDrawer::OperationBaseClass::Operate(), evd::RawDataDrawer::OperationBaseClass::PlaneID(), ProcessChannelWithStatus(), evd::RawDataDrawer::OperationBaseClass::ProcessTick(), and evd::RawDataDrawer::OperationBaseClass::ProcessWire().

Referenced by RawDigit2D(), RunDrawOperation(), and RunRoIextractor().

761  {
762  geo::PlaneID const& pid = operation->PlaneID();
764 
765  if (digit_cache->empty()) return true;
766 
767  MF_LOG_DEBUG("RawDataDrawer") << "RawDataDrawer::RunOperation() running " << operation->Name();
768 
769  // if we have an initialization failure, return false immediately;
770  // but it's way better if the failure throws an exception
771  if (!operation->Initialize()) return false;
772 
773  lariov::ChannelStatusProvider const& channelStatus =
775 
776  //get pedestal conditions
777  const lariov::DetPedestalProvider& pedestalRetrievalAlg =
778  *(lar::providerFrom<lariov::DetPedestalService>());
779 
780  geo::GeometryCore const& geom = *(lar::providerFrom<geo::Geometry>());
781 
782  // loop over all the channels/raw digits
783  for (evd::details::RawDigitInfo_t const& digit_info : *digit_cache) {
784  raw::RawDigit const& hit = digit_info.Digit();
785  raw::ChannelID_t const channel = hit.Channel();
786 
787  // skip the bad channels
788  if (!channelStatus.IsPresent(channel)) continue;
789  // The following test is meant to be temporary until the "correct" solution is implemented
790  if (!ProcessChannelWithStatus(channelStatus.Status(channel))) continue;
791 
792  // we have a list of all channels, but we are drawing only on one plane;
793  // most of the channels will not contribute to this plane,
794  // and before we start querying databases, unpacking data etc.
795  // we want to know it's for something
796 
797  std::vector<geo::WireID> WireIDs = geom.ChannelToWire(channel);
798 
799  bool bDrawChannel = false;
800  for (geo::WireID const& wireID : WireIDs) {
801  if (wireID.planeID() != pid) continue; // not us!
802  bDrawChannel = true;
803  break;
804  } // for wires
805  if (!bDrawChannel) continue;
806 
807  // collect bad channels
808  bool const bGood = rawopt->fSeeBadChannels || !channelStatus.IsBad(channel);
809 
810  // nothing else to be done if the channel is not good:
811  // cells are marked bad by default and if any good channel falls in any of
812  // them, they become good
813  if (!bGood) continue;
814 
815  // at this point we know we have to process this channel
816  raw::RawDigit::ADCvector_t const& uncompressed = digit_info.Data();
817 
818  // recover the pedestal
819  float pedestal = 0;
820  if (rawopt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.PedMean(channel); }
821  else if (rawopt->fPedestalOption == 1) {
822  pedestal = hit.GetPedestal();
823  }
824  else if (rawopt->fPedestalOption == 2) {
825  pedestal = 0;
826  }
827  else {
828  mf::LogWarning("RawDataDrawer")
829  << " PedestalOption is not understood: " << rawopt->fPedestalOption
830  << ". Pedestals not subtracted.";
831  }
832 
833  // loop over all the wires that are covered by this channel;
834  // without knowing better, we have to draw into all of them
835  for (geo::WireID const& wireID : WireIDs) {
836  // check that the plane and tpc are the correct ones to draw
837  if (wireID.planeID() != pid) continue; // not us!
838 
839  // do we have anything to do with this wire?
840  if (!operation->ProcessWire(wireID)) continue;
841 
842  // get an iterator over the adc values
843  // accumulate all the data of this wire in our "cells"
844  size_t const max_tick = std::min({uncompressed.size(), size_t(fStartTick + fTicks)});
845 
846  for (size_t iTick = fStartTick; iTick < max_tick; ++iTick) {
847 
848  // do we have anything to do with this wire?
849  if (!operation->ProcessTick(iTick)) continue;
850 
851  float const adc = uncompressed[iTick] - pedestal;
852  //std::cout << "adc, pedestal: " << adc << " " << pedestal << std::endl;
853 
854  if (!operation->Operate(wireID, iTick, adc)) return false;
855 
856  } // if good
857  } // for wires
858  } // for channels
859 
860  return operation->Finish();
861  } // ChannelLooper()
float GetPedestal() const
Definition: RawDigit.h:221
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:68
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
double fStartTick
low tick
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:213
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:72
bool ProcessChannelWithStatus(lariov::ChannelStatusProvider::Status_t channel_status) const
Returns whether a channel with the specified status should be processed.
Information about a RawDigit; may contain uncompressed duplicate of data.
double fTicks
number of ticks of the clock
Description of geometry of one entire detector.
Definition: GeometryCore.h:119
Detector simulation of raw signals on wires.
bool empty() const
Returns whether the cache is empty() (STL-like interface)
bool fSeeBadChannels
Allow "bad" channels to be viewed.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
#define MF_LOG_DEBUG(id)
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
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 evd::RawDataDrawer::RunRoIextractor ( art::Event const &  evt,
unsigned int  plane 
)
private

Definition at line 1092 of file RawDataDrawer.cxx.

References evd::RawDrawingOptions::CurrentTPC(), hasRegionOfInterest(), MF_LOG_TRACE, and RunOperation().

1093  {
1095  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1096 
1097  // if we have no region of interest, prepare to extract it
1098  bool const bExtractRoI = !hasRegionOfInterest(plane);
1099  MF_LOG_TRACE("RawDataDrawer") << "Region of interest for " << pid
1100  << (bExtractRoI ? " extracted" : " not extracted")
1101  << " on this draw";
1102 
1103  if (!bExtractRoI) return;
1104 
1105  RoIextractorClass Extractor(pid, this);
1106  if (!RunOperation(evt, &Extractor)) {
1107  throw std::runtime_error(
1108  "RawDataDrawer::RunRoIextractor(): somewhere something went somehow wrong");
1109  }
1110 
1111  } // RawDataDrawer::RunRoIextractor()
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
friend class RoIextractorClass
#define MF_LOG_TRACE(id)
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
bool hasRegionOfInterest(geo::PlaneID::PlaneID_t plane) const
TCEvent evt
Definition: DataStructs.cxx:8
bool RunOperation(art::Event const &evt, OperationBaseClass *operation)
void evd::RawDataDrawer::SetDrawingLimits ( float  low_wire,
float  high_wire,
float  low_tdc,
float  high_tdc 
)

Fills the viewport borders from the specified extremes.

Definition at line 565 of file RawDataDrawer.cxx.

References fDrawingRange, evd::RawDataDrawer::PadResolution_t::height, MF_LOG_DEBUG, PadResolution, evd::details::CellGridClass::SetMinTDCCellSize(), evd::details::CellGridClass::SetMinWireCellSize(), evd::details::CellGridClass::SetTDCRange(), evd::details::CellGridClass::SetWireRange(), and evd::RawDataDrawer::PadResolution_t::width.

Referenced by SetDrawingLimitsFromRoI().

569  {
570  MF_LOG_DEBUG("RawDataDrawer") << __func__ << "() setting drawing range as wires ( " << low_wire
571  << " - " << high_wire << " ), ticks ( " << low_tdc << " - "
572  << high_tdc << " )";
573 
574  // we need to set the minimum cell size to 1, otherwise some cell will not
575  // cover any wire/tick and they will be always empty
576  if (PadResolution) {
577  // TODO implement support for swapping axes here
578  unsigned int wire_pixels = PadResolution.width;
579  unsigned int tdc_pixels = PadResolution.height;
580  fDrawingRange->SetWireRange(low_wire, high_wire, wire_pixels, 1.F);
581  fDrawingRange->SetTDCRange(low_tdc, high_tdc, tdc_pixels, 1.F);
582  }
583  else {
584  MF_LOG_DEBUG("RawDataDrawer") << "Pad size not available -- using existing cell size";
585  fDrawingRange->SetWireRange(low_wire, high_wire);
587  fDrawingRange->SetTDCRange(low_tdc, high_tdc);
589  }
590 
591  } // RawDataDrawer::SetDrawingLimits()
void SetWireRange(unsigned int nWires)
Sets the wire range, leaving the number of wire cells unchanged.
bool SetMinTDCCellSize(float min_size)
Sets the minimum size for TDC cells.
PadResolution_t PadResolution
stored pad resolution
bool SetMinWireCellSize(float min_size)
Sets the minimum size for wire cells.
#define MF_LOG_DEBUG(id)
details::CellGridClass * fDrawingRange
information about the viewport
void SetTDCRange(unsigned int nTDC)
Sets a simple TDC range: all the ticks, one cell per tick.
void evd::RawDataDrawer::SetDrawingLimitsFromRoI ( geo::PlaneID::PlaneID_t  plane)
private

Definition at line 593 of file RawDataDrawer.cxx.

References fTimeMax, fTimeMin, fWireMax, fWireMin, and SetDrawingLimits().

Referenced by RawDigit2D().

594  {
595  SetDrawingLimits(fWireMin[plane], fWireMax[plane], fTimeMin[plane], fTimeMax[plane]);
596  } // RawDataDrawer::SetDrawingLimitsFromRoI()
std::vector< int > fWireMin
lowest wire in interesting region for each plane
void SetDrawingLimits(float low_wire, float high_wire, float low_tdc, float high_tdc)
Fills the viewport borders from the specified extremes.
std::vector< int > fTimeMax
highest time in interesting region for each plane
std::vector< int > fWireMax
highest wire in interesting region for each plane
std::vector< int > fTimeMin
lowest time in interesting region for each plane
void evd::RawDataDrawer::SetDrawingLimitsFromRoI ( geo::PlaneID const  pid)
inlineprivate

Definition at line 199 of file RawDataDrawer.h.

References geo::PlaneID::Plane, and SetDrawingLimitsFromRoI().

Referenced by SetDrawingLimitsFromRoI().

199 { SetDrawingLimitsFromRoI(pid.Plane); }
void SetDrawingLimitsFromRoI(geo::PlaneID::PlaneID_t plane)
double evd::RawDataDrawer::StartTick ( ) const
inline

Definition at line 83 of file RawDataDrawer.h.

Referenced by evd::TQPad::BookHistogram(), and evd::TWireProjPad::TWireProjPad().

83 { return fStartTick; }
double fStartTick
low tick
double evd::RawDataDrawer::TotalClockTicks ( ) const
inline

Definition at line 84 of file RawDataDrawer.h.

Referenced by evd::TQPad::BookHistogram(), GetRegionOfInterest(), and evd::TWireProjPad::TWireProjPad().

84 { return fTicks; }
double fTicks
number of ticks of the clock

Friends And Related Function Documentation

friend class BoxDrawer
friend

Definition at line 125 of file RawDataDrawer.h.

Referenced by RawDigit2D().

friend class RoIextractorClass
friend

Definition at line 135 of file RawDataDrawer.h.

Referenced by RawDigit2D().

Member Data Documentation

evd::details::RawDigitCacheDataClass* evd::RawDataDrawer::digit_cache
private

Cache of raw digits.

Definition at line 139 of file RawDataDrawer.h.

Referenced by FillQHisto(), FillTQHisto(), GetRawDigits(), RawDigit2D(), RunOperation(), and ~RawDataDrawer().

std::vector< raw::RawDigit > const evd::RawDataDrawer::EmptyRawDigits
staticprivate

Empty collection, used in return value of invalid digits.

Definition at line 202 of file RawDataDrawer.h.

details::CacheID_t* evd::RawDataDrawer::fCacheID
private

information about the last processed plane

Definition at line 165 of file RawDataDrawer.h.

Referenced by GetRawDigits(), and ~RawDataDrawer().

std::vector<double> evd::RawDataDrawer::fConvertedCharge
private

Sum of Charge Converted using Birks' formula.

Definition at line 161 of file RawDataDrawer.h.

Referenced by GetChargeSum(), and RawDataDrawer().

details::CellGridClass* evd::RawDataDrawer::fDrawingRange
private

information about the viewport

Definition at line 168 of file RawDataDrawer.h.

Referenced by ExtractRange(), QueueDrawingBoxes(), SetDrawingLimits(), and ~RawDataDrawer().

std::vector<double> evd::RawDataDrawer::fRawCharge
private

Sum of Raw Charge.

Definition at line 160 of file RawDataDrawer.h.

Referenced by GetChargeSum(), and RawDataDrawer().

double evd::RawDataDrawer::fStartTick
private

low tick

Definition at line 152 of file RawDataDrawer.h.

Referenced by RawDataDrawer(), and RunOperation().

double evd::RawDataDrawer::fTicks
private

number of ticks of the clock

Definition at line 153 of file RawDataDrawer.h.

Referenced by RawDataDrawer(), and RunOperation().

std::vector<int> evd::RawDataDrawer::fTimeMax
private

highest time in interesting region for each plane

Definition at line 158 of file RawDataDrawer.h.

Referenced by GetRegionOfInterest(), hasRegionOfInterest(), RawDataDrawer(), RawDigit2D(), ResetRegionOfInterest(), and SetDrawingLimitsFromRoI().

std::vector<int> evd::RawDataDrawer::fTimeMin
private

lowest time in interesting region for each plane

Definition at line 157 of file RawDataDrawer.h.

Referenced by GetRegionOfInterest(), RawDataDrawer(), RawDigit2D(), ResetRegionOfInterest(), and SetDrawingLimitsFromRoI().

std::vector<int> evd::RawDataDrawer::fWireMax
private

highest wire in interesting region for each plane

Definition at line 156 of file RawDataDrawer.h.

Referenced by GetRegionOfInterest(), hasRegionOfInterest(), RawDataDrawer(), RawDigit2D(), ResetRegionOfInterest(), and SetDrawingLimitsFromRoI().

std::vector<int> evd::RawDataDrawer::fWireMin
private

lowest wire in interesting region for each plane

Definition at line 155 of file RawDataDrawer.h.

Referenced by GetRegionOfInterest(), RawDataDrawer(), RawDigit2D(), ResetRegionOfInterest(), and SetDrawingLimitsFromRoI().

PadResolution_t evd::RawDataDrawer::PadResolution
private

stored pad resolution

Definition at line 163 of file RawDataDrawer.h.

Referenced by ExtractRange(), and SetDrawingLimits().


The documentation for this class was generated from the following files: