LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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
 
class  RoIextractorClass
 

Public Member Functions

 RawDataDrawer ()
 
 ~RawDataDrawer ()
 
void RawDigit2D (art::Event const &evt, 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, 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 40 of file RawDataDrawer.h.

Constructor & Destructor Documentation

evd::RawDataDrawer::RawDataDrawer ( )

Definition at line 568 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().

569  : digit_cache(new details::RawDigitCacheDataClass)
570  , fStartTick(0),fTicks(2048)
572  , fDrawingRange(new details::CellGridClass)
573  {
575 
577  geo::TPCID tpcid(rawopt->fCryostat, rawopt->fTPC);
578 
579  fStartTick = rawopt->fStartTick;
580  fTicks = rawopt->fTicks;
581 
582  // set the list of bad channels in this detector
583  unsigned int nplanes=geo->Nplanes(tpcid);
584  fWireMin.resize(nplanes,-1);
585  fWireMax.resize(nplanes,-1);
586  fTimeMin.resize(nplanes,-1);
587  fTimeMax.resize(nplanes,-1);
588  fRawCharge.resize(nplanes,0);
589  fConvertedCharge.resize(nplanes,0);
590  }
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
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
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:195
double fStartTick
Starting tick for the display.
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:35
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 593 of file RawDataDrawer.cxx.

References digit_cache, fCacheID, fDrawingRange, and SetDrawingLimits().

594  {
595  delete digit_cache;
596  delete fDrawingRange;
597  delete fCacheID;
598  }
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 640 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 SetDrawingLimitsFromRoI().

641  {
642  mf::LogDebug log("RawDataDrawer");
643  log << "ExtractRange() on pad '" << pPad->GetName() << "'";
644 
645  TFrame const* pFrame = pPad->GetFrame();
646  if (pFrame) {
647  // these coordinates are used to find the actual extent of pad in pixels
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));
652 
653  PadResolution.width = (unsigned int) wire_pixels;
654  PadResolution.height = (unsigned int) tdc_pixels;
655 
656  log << "\n frame window is "
658  << " pixel big and";
659  // those coordinates also are a (unreliable) estimation of the zoom;
660  // if we have a better one, let's use it
661  // (this does not change the size of the window in terms of pixels)
662  if (zoom) {
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];
668  }
669 
670  log << " spans wires "
671  << low_wire << "-" << high_wire << " and TDC " << low_tdc << "-" << high_tdc;
672 
673  // TODO support swapping axes here:
674  // if (rawopt.fAxisOrientation < 1) { normal ; } else { swapped; }
675 
676  fDrawingRange->SetWireRange(low_wire, high_wire, (unsigned int) wire_pixels, 1.0);
677  fDrawingRange->SetTDCRange(low_tdc, high_tdc, (unsigned int) tdc_pixels, 1.0);
678  }
679  else {
680  // keep the old frame (if any)
681  log << "\n no frame!";
682  }
683 
684  } // 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 1324 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::fRawDataLabel, evd::RawDrawingOptions::fSeeBadChannels, raw::RawDigit::GetPedestal(), GetRawDigits(), and ProcessChannelWithStatus().

1327  {
1328 
1329  // Check if we're supposed to draw raw hits at all
1331  if (rawopt->fDrawRawDataOrCalibWires==1) return;
1332 
1334 
1335  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1336  details::CacheID_t NewCacheID(evt, rawopt->fRawDataLabel, pid);
1337  GetRawDigits(evt, NewCacheID);
1338 
1339  lariov::ChannelStatusProvider const& channelStatus
1341 
1342  //get pedestal conditions
1343  const lariov::DetPedestalProvider& pedestalRetrievalAlg = art::ServiceHandle<lariov::DetPedestalService>()->GetPedestalProvider();
1344 
1345  for (evd::details::RawDigitInfo_t const& digit_info: *digit_cache) {
1346  raw::RawDigit const& hit = digit_info.Digit();
1347  raw::ChannelID_t const channel = hit.Channel();
1348 
1349  if (!channelStatus.IsPresent(channel)) continue;
1350 
1351  // The following test is meant to be temporary until the "correct" solution is implemented
1352  if (!ProcessChannelWithStatus(channelStatus.Status(channel))) continue;
1353 
1354  // to be explicit: we don't cound bad channels in
1355  if (!rawopt->fSeeBadChannels && channelStatus.IsBad(channel)) continue;
1356 
1357  std::vector<geo::WireID> wireids = geo->ChannelToWire(channel);
1358  for(auto const& wid : wireids){
1359  // check that the plane and tpc are the correct ones to draw
1360  if (wid.planeID() != pid) continue;
1361 
1362  raw::RawDigit::ADCvector_t const& uncompressed = digit_info.Data();
1363 
1364  //float const pedestal = pedestalRetrievalAlg.PedMean(channel);
1365  // recover the pedestal
1366  float pedestal = 0;
1367  if (rawopt->fPedestalOption == 0)
1368  {
1369  pedestal = pedestalRetrievalAlg.PedMean(channel);
1370  }
1371  else if (rawopt->fPedestalOption == 1)
1372  {
1373  pedestal = hit.GetPedestal();
1374  }
1375  else if (rawopt->fPedestalOption == 2)
1376  {
1377  pedestal = 0;
1378  }
1379  else
1380  {
1381  mf::LogWarning ("RawDataDrawer") << " PedestalOption is not understood: " << rawopt->fPedestalOption << ". Pedestals not subtracted.";
1382  }
1383 
1384  for(short d: uncompressed)
1385  histo->Fill(float(d) - pedestal); //pedestals[plane]); //hit.GetPedestal());
1386 
1387  // this channel is on the correct plane, don't double count the raw signal
1388  // if there are more than one wids for the channel
1389  break;
1390  }// end loop over wids
1391  }//end loop over raw hits
1392 
1393  }
float GetPedestal() const
Definition: RawDigit.h:213
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:68
int fDrawRawDataOrCalibWires
0 for raw
art::InputTag fRawDataLabel
module label that made the raw digits, default is daq
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:211
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:72
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
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:237
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
::util::PlaneDataChangeTracker_t CacheID_t
Definition: RawDataDrawer.h:35
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:27
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 1396 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::fRawDataLabel, evd::RawDrawingOptions::fSeeBadChannels, raw::RawDigit::GetPedestal(), GetRawDigits(), raw::isValidChannelID(), geo::GeometryCore::PlaneWireToChannel(), and ProcessChannelWithStatus().

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

1400  {
1401 
1402  // Check if we're supposed to draw raw hits at all
1404  if (rawopt->fDrawRawDataOrCalibWires==1) return;
1405 
1406  // make sure we have the raw digits cached
1407  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1408  details::CacheID_t NewCacheID(evt, rawopt->fRawDataLabel, pid);
1409  GetRawDigits(evt, NewCacheID);
1410 
1411  if (digit_cache->empty()) return;
1412 
1413  geo::WireID const wireid(pid, wire);
1414 
1415  // find the channel
1417  raw::ChannelID_t const channel = geom->PlaneWireToChannel(wireid);
1418  if (!raw::isValidChannelID(channel)) { // no channel, empty histogram
1419  mf::LogError("RawDataDrawer") << __func__ << ": no channel associated to "
1420  << std::string(wireid);
1421  return;
1422  } // if no channel
1423 
1424  // check the channel status; bad channels are still ok.
1425  lariov::ChannelStatusProvider const& channelStatus
1427 
1428  if (!channelStatus.IsPresent(channel)) return;
1429 
1430  // The following test is meant to be temporary until the "correct" solution is implemented
1431  if (!ProcessChannelWithStatus(channelStatus.Status(channel))) return;
1432 
1433 
1434  // we accept to see the content of a bad channel, so this is commented out:
1435  if (!rawopt->fSeeBadChannels && channelStatus.IsBad(channel)) return;
1436 
1437  //get pedestal conditions
1438  const lariov::DetPedestalProvider& pedestalRetrievalAlg = art::ServiceHandle<lariov::DetPedestalService>()->GetPedestalProvider();
1439 
1440  // find the raw digit
1441  // (iDigit is an iterator to a evd::details::RawDigitInfo_t)
1442  evd::details::RawDigitInfo_t const* pDigit
1443  = digit_cache->FindChannel(channel);
1444  if (!pDigit) { // this is weird...
1445  mf::LogWarning("RawDataDrawer") << __func__
1446  << ": can't find raw digit for channel #" << channel
1447  << " (" << std::string(wireid) << ")";
1448  return;
1449  }
1450 
1451  raw::RawDigit::ADCvector_t const& uncompressed = pDigit->Data();
1452 
1453 
1454  // recover the pedestal
1455  float pedestal = 0;
1456  if (rawopt->fPedestalOption == 0)
1457  {
1458  pedestal = pedestalRetrievalAlg.PedMean(channel);
1459  }
1460  else if (rawopt->fPedestalOption == 1)
1461  {
1462  pedestal = pDigit->DigitPtr()->GetPedestal();
1463  }
1464  else if (rawopt->fPedestalOption == 2)
1465  {
1466  pedestal = 0;
1467  }
1468  else
1469  {
1470  mf::LogWarning ("RawDataDrawer") << " PedestalOption is not understood: " << rawopt->fPedestalOption << ". Pedestals not subtracted.";
1471  }
1472 
1473  for(size_t j = 0; j < uncompressed.size(); ++j)
1474  histo->Fill(float(j), float(uncompressed[j]) - pedestal); //pedestals[plane]); //hit.GetPedestal());
1475 
1476  } // RawDataDrawer::FillTQHisto()
float GetPedestal() const
Definition: RawDigit.h:213
int fDrawRawDataOrCalibWires
0 for raw
art::InputTag fRawDataLabel
module label that made the raw digits, default is daq
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
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:36
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
::util::PlaneDataChangeTracker_t CacheID_t
Definition: RawDataDrawer.h:35
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:27
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 1316 of file RawDataDrawer.cxx.

References fConvertedCharge, and fRawCharge.

1317  {
1318  charge=fRawCharge[plane];
1319  convcharge=fConvertedCharge[plane];
1320 
1321  }
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(), RawDigit2D(), ResetRegionOfInterest(), and RunOperation().

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 1593 of file RawDataDrawer.cxx.

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

1594  {
1595  LOG_DEBUG("RawDataDrawer") << "GetRawDigits() for " << new_timestamp
1596  << " (last for: " << *fCacheID << ")";
1597 
1598  // update cache
1599  digit_cache->Update(evt, new_timestamp);
1600 
1601  // if time stamp is changing, we want to reconsider which region is
1602  // interesting
1603  if (!fCacheID->sameTPC(new_timestamp)) ResetRegionOfInterest();
1604 
1605  // all the caches have been properly updated or invalidated;
1606  // we are now on a new cache state
1607  *fCacheID = new_timestamp;
1608 
1609  } // RawDataDrawer::GetRawDigits()
bool Update(art::Event const &evt, CacheID_t const &new_timestamp)
details::CacheID_t * fCacheID
information about the last processed plane
#define LOG_DEBUG(id)
void ResetRegionOfInterest()
Forgets about the current region of interest.
TCEvent evt
Definition: DataStructs.cxx:5
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 1289 of file RawDataDrawer.cxx.

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

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

1290  {
1292 
1293  if((unsigned int)plane>=fWireMin.size())
1294  {mf::LogWarning ("RawDataDrawer") << " Requested plane " << plane <<" is larger than those available " << std::endl;
1295  return -1;
1296  }
1297 
1298  minw=fWireMin[plane];
1299  maxw=fWireMax[plane];
1300  mint=fTimeMin[plane];
1301  maxt=fTimeMax[plane];
1302 
1303  if ((minw == maxw) || (mint == maxt)) return 1;
1304 
1305  //make values a bit larger, but make sure they don't go out of bounds
1306  minw= (minw-30<0) ? 0 : minw-30;
1307  mint= (mint-10<0) ? 0 : mint-10;
1308 
1309  maxw= (maxw+10>(int)geo->Nwires(plane)) ? geo->Nwires(plane) : maxw+10;
1310  maxt= (maxt+10>TotalClockTicks()) ? TotalClockTicks() : maxt+10;
1311 
1312  return 0;
1313  }
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
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:85
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
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 1569 of file RawDataDrawer.cxx.

References fTimeMax, and fWireMax.

Referenced by RawDigit2D(), and RunRoIextractor().

1569  {
1570 
1571  return (fWireMax[plane] != -1) && (fTimeMax[plane] != -1);
1572 
1573  } // 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 1614 of file RawDataDrawer.cxx.

References evd::RawDrawingOptions::fMaxChannelStatus.

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

1615  {
1616  // if we don't have a valid status, we can't reject the channel
1617  if (!lariov::ChannelStatusProvider::IsValidStatus(channel_status))
1618  return true;
1619 
1620  // is the status "too bad"?
1622  if (channel_status > drawopt->fMaxChannelStatus) return false;
1623  if (channel_status < drawopt->fMinChannelStatus) return false;
1624 
1625  // no reason to reject it...
1626  return true;
1627  } // 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 1010 of file RawDataDrawer.cxx.

References 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, LOG_DEBUG, min, evd::ColorDrawingOptions::RawQ(), RunDrawOperation(), and geo::GeometryCore::SignalType().

1015  {
1016  //
1017  // All the information is now collected in BoxInfo.
1018  // Make boxes out of it.
1019  //
1020  evd::RawDrawingOptions const& rawopt
1022 
1023  LOG_DEBUG("RawDataDrawer")
1024  << "Filling " << BoxInfo.size() << " boxes to be rendered";
1025 
1026  // drawing options:
1027  float const MinSignal = rawopt.fMinSignal;
1028  bool const bScaleDigitsByCharge = rawopt.fScaleDigitsByCharge;
1029 
1031 
1033  geo::SigType_t const sigType = geom.SignalType(pid);
1034  evdb::ColorScale const& ColorSet = cst->RawQ(sigType);
1035  size_t const nBoxes = BoxInfo.size();
1036  unsigned int nDrawnBoxes = 0;
1037  for (size_t iBox = 0; iBox < nBoxes; ++iBox) {
1038  BoxInfo_t const& info = BoxInfo[iBox];
1039 
1040  // too little signal, don't bother drawing
1041  if(info.good && (std::abs(info.adc) < MinSignal)) continue;
1042 
1043  // skip the bad cells
1044  if (!info.good) continue;
1045 
1046  // box color, proportional to the ADC count
1047  int const color = ColorSet.GetColor(info.adc);
1048 
1049  // scale factor, proportional to ADC count (optional)
1050  constexpr float q0 = 1000.;
1051  float const sf = bScaleDigitsByCharge
1052  ? std::min(std::sqrt((float) info.adc / q0), 1.0F)
1053  : 1.;
1054 
1055  // coordinates of the cell box
1056  float min_wire, max_wire, min_tick, max_tick;
1057  std::tie(min_wire, min_tick, max_wire, max_tick)
1058  = fDrawingRange->GetCellBox(iBox);
1059  /*
1060  LOG_TRACE("RawDataDrawer")
1061  << "Wires ( " << min_wire << " - " << max_wire << " ) ticks ("
1062  << min_tick << " - " << max_tick << " ) for cell " << iBox;
1063  */
1064  if (sf != 1.) { // need to shrink the box
1065  float const nsf = 1. - sf; // negation of scale factor
1066  float const half_box_wires = (max_wire - min_wire) / 2.,
1067  half_box_ticks = (max_tick - min_tick) / 2.;
1068 
1069  // shrink the box:
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;
1074  } // if scaling
1075 
1076  // allocate the box on the view;
1077  // the order of the coordinates depends on the orientation
1078  TBox* pBox;
1079  if (rawopt.fAxisOrientation < 1)
1080  pBox = &(view->AddBox(min_wire, min_tick, max_wire, max_tick));
1081  else
1082  pBox = &(view->AddBox(min_tick, min_wire, max_tick, max_wire));
1083 
1084  pBox->SetFillStyle(1001);
1085  pBox->SetFillColor(color);
1086  pBox->SetBit(kCannotPick);
1087 
1088  ++nDrawnBoxes;
1089  } // for (iBox)
1090 
1091  LOG_DEBUG("RawDataDrawer")
1092  << "Sent " << nDrawnBoxes << "/" << BoxInfo.size()
1093  << " boxes to be rendered";
1094  } // RawDataDrawer::QueueDrawingBoxes()
int fScaleDigitsByCharge
scale the size of the digit by the charge
Display parameters for the raw data.
int GetColor(double x) const
Definition: ColorScale.cxx:126
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
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.
std::size_t color(std::string const &procname)
Int_t min
Definition: plot.C:26
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
#define LOG_DEBUG(id)
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,
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 1195 of file RawDataDrawer.cxx.

References evd::RawDataDrawer::ManyOperations::AddOperation(), BoxDrawer, evd::RawDrawingOptions::CurrentTPC(), evd::RawDrawingOptions::fDrawRawDataOrCalibWires, evd::RawDrawingOptions::fRawDataLabel, fTimeMax, fTimeMin, fWireMax, fWireMin, GetRawDigits(), hasRegionOfInterest(), LOG_DEBUG, RoIextractorClass, RunOperation(), SetDrawingLimitsFromRoI(), and art::errors::Unknown.

1199  {
1200 
1202  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1203 
1204  bool const bDraw = (rawopt->fDrawRawDataOrCalibWires != 1);
1205  // if we don't need to draw, don't bother doing anything;
1206  // if the region of interest is required, RunRoIextractor() should be called
1207  // (ok, now it's private, but it could be exposed)
1208  if (!bDraw) return;
1209 
1210  // make sure we reset what needs to be reset
1211  // before the operations are initialized;
1212  // we call for reading raw digits; they will be cached, so it's not a waste
1213  details::CacheID_t NewCacheID(evt, rawopt->fRawDataLabel, pid);
1214  GetRawDigits(evt, NewCacheID);
1215 
1216  bool const hasRoI = hasRegionOfInterest(plane);
1217 
1218  // - if we don't have a RoI yet, we want to get it while we draw
1219  // * if we are zooming into it now, we have to extract it first, then draw
1220  // * if we are not zooming, we can do both at the same time
1221  // - if we have a RoI, we don't want to extract it again
1222  if (!bZoomToRoI) { // we are not required to zoom to the RoI
1223 
1224  std::unique_ptr<OperationBaseClass> operation;
1225 
1226  // we will do the drawing in one pass
1227  LOG_DEBUG("RawDataDrawer")
1228  << __func__ << "() setting up one-pass drawing";
1229  operation.reset(new BoxDrawer(pid, this, view));
1230 
1231  if (!hasRoI) { // we don't have any RoI; since it's cheap, let's get it
1232  LOG_DEBUG("RawDataDrawer") << __func__ << "() adding RoI extraction";
1233 
1234  // swap cards: operation becomes a multiple operation:
1235  // - prepare the two operations (one is there already, somehow)
1236  std::unique_ptr<OperationBaseClass> drawer(std::move(operation));
1237  std::unique_ptr<OperationBaseClass> extractor
1238  (new RoIextractorClass(pid, this));
1239  // - create a new composite operation and give it the sub-ops
1240  operation.reset(new ManyOperations(pid, this));
1241  ManyOperations* pManyOps
1242  = static_cast<ManyOperations*>(operation.get());
1243  pManyOps->AddOperation(std::move(drawer));
1244  pManyOps->AddOperation(std::move(extractor));
1245  }
1246 
1247  if (!RunOperation(evt, operation.get())) {
1249  << "RawDataDrawer::RunDrawOperation(): "
1250  "somewhere something went somehow wrong";
1251  }
1252  }
1253  else { // we are zooming to RoI
1254  // first, we want the RoI extracted; the extractor will update this object
1255  if (!hasRoI) {
1256  LOG_DEBUG("RawDataDrawer") << __func__
1257  << "() setting up RoI extraction for " << pid;
1258  RoIextractorClass extractor(pid, this);
1259  if (!RunOperation(evt, &extractor)) {
1261  << "RawDataDrawer::RunDrawOperation():"
1262  " something went somehow wrong while extracting RoI";
1263  }
1264  }
1265  else {
1266  LOG_DEBUG("RawDataDrawer") << __func__
1267  << "() using existing RoI for " << pid
1268  << ": wires ( " << fWireMin[plane] << " - " << fWireMax[plane]
1269  << " ), ticks ( " << fTimeMin[plane] << " - " << fTimeMax[plane]
1270  << " )";
1271  }
1272 
1273  // adopt the drawing limits information from the wire/time limits
1275 
1276  // then we draw
1277  LOG_DEBUG("RawDataDrawer") << __func__ << "() setting up drawing";
1278  BoxDrawer drawer(pid, this, view);
1279  if (!RunOperation(evt, &drawer)) {
1281  << "RawDataDrawer::RunDrawOperation():"
1282  " something went somehow wrong while drawing";
1283  }
1284  }
1285  } // RawDataDrawer::RawDigit2D()
int fDrawRawDataOrCalibWires
0 for raw
void SetDrawingLimitsFromRoI(geo::PlaneID::PlaneID_t plane)
art::InputTag fRawDataLabel
module label that made the raw digits, default is daq
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
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.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool hasRegionOfInterest(geo::PlaneID::PlaneID_t plane) const
friend class BoxDrawer
#define LOG_DEBUG(id)
std::vector< int > fTimeMin
lowest time in interesting region for each plane
::util::PlaneDataChangeTracker_t CacheID_t
Definition: RawDataDrawer.h:35
TCEvent evt
Definition: DataStructs.cxx:5
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 1577 of file RawDataDrawer.cxx.

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

Referenced by GetRawDigits().

1577  {
1578 
1579  LOG_DEBUG("RawDataDrawer") << "RawDataDrawer[" << ((void*) this)
1580  << "]: resetting the region of interest";
1581 
1582  std::fill(fWireMin.begin(), fWireMin.end(), -1);
1583  std::fill(fWireMax.begin(), fWireMax.end(), -1);
1584  std::fill(fTimeMin.begin(), fTimeMin.end(), -1);
1585  std::fill(fTimeMax.begin(), fTimeMax.end(), -1);
1586 
1587  } // 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 LOG_DEBUG(id)
std::vector< int > fTimeMin
lowest time in interesting region for each plane
void evd::RawDataDrawer::RunDrawOperation ( art::Event const &  evt,
evdb::View2D view,
unsigned int  plane 
)
private

Definition at line 1098 of file RawDataDrawer.cxx.

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

Referenced by QueueDrawingBoxes().

1099  {
1100 
1101  // Check if we're supposed to draw raw hits at all
1103  if (rawopt->fDrawRawDataOrCalibWires == 1) return;
1104 
1105  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1106  BoxDrawer drawer(pid, this, view);
1107  if (!RunOperation(evt, &drawer)) {
1109  << "RawDataDrawer::RunDrawOperation(): "
1110  "somewhere something went somehow wrong";
1111  }
1112 
1113  } // RawDataDrawer::RunDrawOperation()
int fDrawRawDataOrCalibWires
0 for raw
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
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:5
bool RunOperation(art::Event const &evt, OperationBaseClass *operation)
bool evd::RawDataDrawer::RunOperation ( art::Event const &  evt,
OperationBaseClass operation 
)
private

Definition at line 811 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::fRawDataLabel, evd::RawDrawingOptions::fSeeBadChannels, fStartTick, fTicks, raw::RawDigit::GetPedestal(), GetRawDigits(), evd::RawDataDrawer::OperationBaseClass::Initialize(), LOG_DEBUG, min, evd::RawDataDrawer::OperationBaseClass::Name(), evd::RawDataDrawer::OperationBaseClass::Operate(), evd::RawDataDrawer::OperationBaseClass::PlaneID(), ProcessChannelWithStatus(), evd::RawDataDrawer::OperationBaseClass::ProcessTick(), and evd::RawDataDrawer::OperationBaseClass::ProcessWire().

Referenced by evd::RawDataDrawer::ManyOperations::AddOperation(), RawDigit2D(), RunDrawOperation(), and RunRoIextractor().

812  {
813  geo::PlaneID const& pid = operation->PlaneID();
814 
816  details::CacheID_t NewCacheID(evt, rawopt->fRawDataLabel, pid);
817  GetRawDigits(evt, NewCacheID);
818 
819  if(digit_cache->empty()) return true;
820 
821  LOG_DEBUG("RawDataDrawer") << "RawDataDrawer::RunOperation() running "
822  << operation->Name();
823 
824  // if we have an initialization failure, return false immediately;
825  // but it's way better if the failure throws an exception
826  if (!operation->Initialize()) return false;
827 
828  lariov::ChannelStatusProvider const& channelStatus
830 
831  //get pedestal conditions
832  const lariov::DetPedestalProvider& pedestalRetrievalAlg = *(lar::providerFrom<lariov::DetPedestalService>());
833 
834  geo::GeometryCore const& geom = *(lar::providerFrom<geo::Geometry>());
835 
836  // loop over all the channels/raw digits
837  for (evd::details::RawDigitInfo_t const& digit_info: *digit_cache) {
838  raw::RawDigit const& hit = digit_info.Digit();
839  raw::ChannelID_t const channel = hit.Channel();
840 
841  // skip the bad channels
842  if (!channelStatus.IsPresent(channel)) continue;
843  // The following test is meant to be temporary until the "correct" solution is implemented
844  if (!ProcessChannelWithStatus(channelStatus.Status(channel))) continue;
845 
846  // we have a list of all channels, but we are drawing only on one plane;
847  // most of the channels will not contribute to this plane,
848  // and before we start querying databases, unpacking data etc.
849  // we want to know it's for something
850 
851  std::vector<geo::WireID> WireIDs = geom.ChannelToWire(channel);
852 
853  bool bDrawChannel = false;
854  for (geo::WireID const& wireID: WireIDs){
855  if (wireID.planeID() != pid) continue; // not us!
856  bDrawChannel = true;
857  break;
858  } // for wires
859  if (!bDrawChannel) continue;
860 
861  // collect bad channels
862  bool const bGood = rawopt->fSeeBadChannels || !channelStatus.IsBad(channel);
863 
864  // nothing else to be done if the channel is not good:
865  // cells are marked bad by default and if any good channel falls in any of
866  // them, they become good
867  if (!bGood) continue;
868 
869  // at this point we know we have to process this channel
870  raw::RawDigit::ADCvector_t const& uncompressed = digit_info.Data();
871 
872  // recover the pedestal
873  float pedestal = 0;
874  if (rawopt->fPedestalOption == 0)
875  {
876  pedestal = pedestalRetrievalAlg.PedMean(channel);
877  }
878  else if (rawopt->fPedestalOption == 1)
879  {
880  pedestal = hit.GetPedestal();
881  }
882  else if (rawopt->fPedestalOption == 2)
883  {
884  pedestal = 0;
885  }
886  else
887  {
888  mf::LogWarning ("RawDataDrawer") << " PedestalOption is not understood: " << rawopt->fPedestalOption << ". Pedestals not subtracted.";
889  }
890 
891  // loop over all the wires that are covered by this channel;
892  // without knowing better, we have to draw into all of them
893  for (geo::WireID const& wireID: WireIDs){
894  // check that the plane and tpc are the correct ones to draw
895  if (wireID.planeID() != pid) continue; // not us!
896 
897  // do we have anything to do with this wire?
898  if (!operation->ProcessWire(wireID)) continue;
899 
900  // get an iterator over the adc values
901  // accumulate all the data of this wire in our "cells"
902  size_t const max_tick = std::min({
903  uncompressed.size(),
904  size_t(fStartTick + fTicks)
905  });
906 
907  for (size_t iTick = fStartTick; iTick < max_tick; ++iTick) {
908 
909  // do we have anything to do with this wire?
910  if (!operation->ProcessTick(iTick)) continue;
911 
912  float const adc = uncompressed[iTick] - pedestal;
913  //std::cout << "adc, pedestal: " << adc << " " << pedestal << std::endl;
914 
915  if (!operation->Operate(wireID, iTick, adc)) return false;
916 
917  } // if good
918  } // for wires
919  } // for channels
920 
921  return operation->Finish();
922  } // ChannelLooper()
float GetPedestal() const
Definition: RawDigit.h:213
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:68
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.
Definition: geo_types.h:250
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:211
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:72
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
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
void GetRawDigits(art::Event const &evt)
Reads raw::RawDigits; also triggers Reset()
Description of geometry of one entire detector.
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.
Int_t min
Definition: plot.C:26
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
#define LOG_DEBUG(id)
::util::PlaneDataChangeTracker_t CacheID_t
Definition: RawDataDrawer.h:35
TCEvent evt
Definition: DataStructs.cxx:5
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:27
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 1172 of file RawDataDrawer.cxx.

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

1173  {
1175  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1176 
1177  // if we have no region of interest, prepare to extract it
1178  bool const bExtractRoI = !hasRegionOfInterest(plane);
1179  LOG_TRACE("RawDataDrawer") << "Region of interest for " << pid
1180  << (bExtractRoI? " extracted": " not extracted") << " on this draw";
1181 
1182  if (!bExtractRoI) return;
1183 
1184  RoIextractorClass Extractor(pid, this);
1185  if (!RunOperation(evt, &Extractor)) {
1186  throw std::runtime_error
1187  ("RawDataDrawer::RunRoIextractor(): somewhere something went somehow wrong");
1188  }
1189 
1190  } // RawDataDrawer::RunRoIextractor()
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
friend class RoIextractorClass
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
bool hasRegionOfInterest(geo::PlaneID::PlaneID_t plane) const
TCEvent evt
Definition: DataStructs.cxx:5
bool RunOperation(art::Event const &evt, OperationBaseClass *operation)
#define LOG_TRACE(id)
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 603 of file RawDataDrawer.cxx.

References fDrawingRange, evd::RawDataDrawer::PadResolution_t::height, LOG_DEBUG, PadResolution, SetDrawingLimitsFromRoI(), 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(), and ~RawDataDrawer().

604  {
605  LOG_DEBUG("RawDataDrawer") << __func__
606  << "() setting drawing range as wires ( "
607  << low_wire << " - " << high_wire
608  << " ), ticks ( " << low_tdc << " - " << high_tdc << " )";
609 
610  // we need to set the minimum cell size to 1, otherwise some cell will not
611  // cover any wire/tick and they will be always empty
612  if (PadResolution) {
613  // TODO implement support for swapping axes here
614  unsigned int wire_pixels = PadResolution.width;
615  unsigned int tdc_pixels = PadResolution.height;
616  fDrawingRange->SetWireRange(low_wire, high_wire, wire_pixels, 1.F);
617  fDrawingRange->SetTDCRange(low_tdc, high_tdc, tdc_pixels, 1.F);
618  }
619  else {
620  LOG_DEBUG("RawDataDrawer")
621  << "Pad size not available -- using existing cell size";
622  fDrawingRange->SetWireRange(low_wire, high_wire);
624  fDrawingRange->SetTDCRange(low_tdc, high_tdc);
626  }
627 
628  } // 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 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 632 of file RawDataDrawer.cxx.

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

Referenced by RawDigit2D(), and SetDrawingLimits().

633  {
635  (fWireMin[plane], fWireMax[plane], fTimeMin[plane], fTimeMax[plane]);
636  } // 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 211 of file RawDataDrawer.h.

References geo::PlaneID::Plane.

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

Definition at line 84 of file RawDataDrawer.h.

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

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

Definition at line 85 of file RawDataDrawer.h.

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

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

Friends And Related Function Documentation

friend class BoxDrawer
friend

Definition at line 134 of file RawDataDrawer.h.

Referenced by RawDigit2D().

friend class RoIextractorClass
friend

Definition at line 144 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 148 of file RawDataDrawer.h.

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

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

Empty collection, used in return value of invalid digits.

Definition at line 215 of file RawDataDrawer.h.

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

information about the last processed plane

Definition at line 175 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 171 of file RawDataDrawer.h.

Referenced by GetChargeSum(), and RawDataDrawer().

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

information about the viewport

Definition at line 178 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 170 of file RawDataDrawer.h.

Referenced by GetChargeSum(), and RawDataDrawer().

double evd::RawDataDrawer::fStartTick
private

low tick

Definition at line 162 of file RawDataDrawer.h.

Referenced by RawDataDrawer(), and RunOperation().

double evd::RawDataDrawer::fTicks
private

number of ticks of the clock

Definition at line 163 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 168 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 167 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 166 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 165 of file RawDataDrawer.h.

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

PadResolution_t evd::RawDataDrawer::PadResolution
private

stored pad resolution

Definition at line 173 of file RawDataDrawer.h.

Referenced by ExtractRange(), and SetDrawingLimits().


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