LArSoft  v10_04_05
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 41 of file RawDataDrawer.h.

Constructor & Destructor Documentation

evd::RawDataDrawer::RawDataDrawer ( )

Definition at line 532 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 Get.

533  : digit_cache(new details::RawDigitCacheDataClass)
534  , fStartTick(0)
535  , fTicks(2048)
537  , fDrawingRange(new details::CellGridClass)
538  {
540  geo::TPCID tpcid(rawopt->fCryostat, rawopt->fTPC);
541 
542  fStartTick = rawopt->fStartTick;
543  fTicks = rawopt->fTicks;
544 
545  // set the list of bad channels in this detector
546  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
547  unsigned int nplanes = wireReadoutGeom.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
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
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:306
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:36
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.
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 1261 of file RawDataDrawer.cxx.

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

1262  {
1263 
1264  // Check if we're supposed to draw raw hits at all
1266  if (rawopt->fDrawRawDataOrCalibWires == 1) return;
1267 
1268  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
1269 
1270  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1271 
1272  for (const auto& rawDataLabel : rawopt->fRawDataLabels) {
1273  details::CacheID_t NewCacheID(evt, rawDataLabel, pid);
1274  GetRawDigits(evt, NewCacheID);
1275 
1276  lariov::ChannelStatusProvider const& channelStatus =
1278 
1279  //get pedestal conditions
1280  const lariov::DetPedestalProvider& pedestalRetrievalAlg =
1282 
1283  for (evd::details::RawDigitInfo_t const& digit_info : *digit_cache) {
1284  raw::RawDigit const& hit = digit_info.Digit();
1285  raw::ChannelID_t const channel = hit.Channel();
1286 
1287  if (!channelStatus.IsPresent(channel)) continue;
1288 
1289  // The following test is meant to be temporary until the "correct" solution is implemented
1290  if (!ProcessChannelWithStatus(channelStatus.Status(channel))) continue;
1291 
1292  // to be explicit: we don't cound bad channels in
1293  if (!rawopt->fSeeBadChannels && channelStatus.IsBad(channel)) continue;
1294 
1295  std::vector<geo::WireID> wireids = wireReadoutGeom.ChannelToWire(channel);
1296  for (auto const& wid : wireids) {
1297  // check that the plane and tpc are the correct ones to draw
1298  if (wid.planeID() != pid) continue;
1299 
1300  raw::RawDigit::ADCvector_t const& uncompressed = digit_info.Data();
1301 
1302  //float const pedestal = pedestalRetrievalAlg.PedMean(channel);
1303  // recover the pedestal
1304  float pedestal = 0;
1305  if (rawopt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.PedMean(channel); }
1306  else if (rawopt->fPedestalOption == 1) {
1307  pedestal = hit.GetPedestal();
1308  }
1309  else if (rawopt->fPedestalOption == 2) {
1310  pedestal = 0;
1311  }
1312  else {
1313  mf::LogWarning("RawDataDrawer")
1314  << " PedestalOption is not understood: " << rawopt->fPedestalOption
1315  << ". Pedestals not subtracted.";
1316  }
1317 
1318  for (short d : uncompressed)
1319  histo->Fill(float(d) - pedestal);
1320 
1321  // this channel is on the correct plane, don't double count the raw signal
1322  // if there are more than one wids for the channel
1323  break;
1324  } // end loop over wids
1325  } //end loop over raw hits
1326  } //end loop over labels
1327  }
float GetPedestal() const
Definition: RawDigit.h:221
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:68
int fDrawRawDataOrCalibWires
0 for raw
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
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
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
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:36
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::FillTQHisto ( const art::Event evt,
unsigned int  plane,
unsigned int  wire,
TH1F *  histo 
)

Definition at line 1330 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, Get, raw::RawDigit::GetPedestal(), GetRawDigits(), raw::isValidChannelID(), and ProcessChannelWithStatus().

1334  {
1335  // Check if we're supposed to draw raw hits at all
1337  if (rawopt->fDrawRawDataOrCalibWires == 1) return;
1338 
1339  // make sure we have the raw digits cached
1340  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1341 
1342  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
1343 
1344  // loop over labels
1345  for (const auto& rawDataLabel : rawopt->fRawDataLabels) {
1346  details::CacheID_t NewCacheID(evt, rawDataLabel, pid);
1347  GetRawDigits(evt, NewCacheID);
1348 
1349  if (digit_cache->empty()) return;
1350 
1351  geo::WireID const wireid(pid, wire);
1352 
1353  // find the channel
1354  raw::ChannelID_t const channel = wireReadoutGeom.PlaneWireToChannel(wireid);
1355  if (!raw::isValidChannelID(channel)) { // no channel, empty histogram
1356  mf::LogError("RawDataDrawer")
1357  << __func__ << ": no channel associated to " << std::string(wireid);
1358  return;
1359  } // if no channel
1360 
1361  // check the channel status; bad channels are still ok.
1362  lariov::ChannelStatusProvider const& channelStatus =
1364 
1365  if (!channelStatus.IsPresent(channel)) return;
1366 
1367  // The following test is meant to be temporary until the "correct" solution is implemented
1368  if (!ProcessChannelWithStatus(channelStatus.Status(channel))) return;
1369 
1370  // we accept to see the content of a bad channel, so this is commented out:
1371  if (!rawopt->fSeeBadChannels && channelStatus.IsBad(channel)) return;
1372 
1373  //get pedestal conditions
1374  const lariov::DetPedestalProvider& pedestalRetrievalAlg =
1376 
1377  // find the raw digit
1378  // (iDigit is an iterator to a evd::details::RawDigitInfo_t)
1379  evd::details::RawDigitInfo_t const* pDigit = digit_cache->FindChannel(channel);
1380 
1381  if (
1382  !pDigit) { // this is weird... actually no, this can happen if the RawDigits are per TPC (or something)
1383  continue;
1384  }
1385 
1386  raw::RawDigit::ADCvector_t const& uncompressed = pDigit->Data();
1387 
1388  // recover the pedestal
1389  float pedestal = 0;
1390  if (rawopt->fPedestalOption == 0) { pedestal = pedestalRetrievalAlg.PedMean(channel); }
1391  else if (rawopt->fPedestalOption == 1) {
1392  pedestal = pDigit->DigitPtr()->GetPedestal();
1393  }
1394  else if (rawopt->fPedestalOption == 2) {
1395  pedestal = 0;
1396  }
1397  else {
1398  mf::LogWarning("RawDataDrawer")
1399  << " PedestalOption is not understood: " << rawopt->fPedestalOption
1400  << ". Pedestals not subtracted.";
1401  }
1402 
1403  for (size_t j = 0; j < uncompressed.size(); ++j)
1404  histo->Fill(float(j), float(uncompressed[j]) - pedestal);
1405  }
1406 
1407  } // 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:364
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:72
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
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)
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:36
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 1254 of file RawDataDrawer.cxx.

References fConvertedCharge, and fRawCharge.

1255  {
1256  charge = fRawCharge[plane];
1257  convcharge = fConvertedCharge[plane];
1258  }
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 1433 of file RawDataDrawer.cxx.

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

1434  {
1435  MF_LOG_DEBUG("RawDataDrawer") << "GetRawDigits() for " << new_timestamp
1436  << " (last for: " << *fCacheID << ")";
1437 
1438  // update cache
1439  digit_cache->Update(evt, new_timestamp);
1440 
1441  // if time stamp is changing, we want to reconsider which region is
1442  // interesting
1443  if (!fCacheID->sameTPC(new_timestamp)) ResetRegionOfInterest();
1444 
1445  // all the caches have been properly updated or invalidated;
1446  // we are now on a new cache state
1447  *fCacheID = new_timestamp;
1448 
1449  } // 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 1225 of file RawDataDrawer.cxx.

References fTimeMax, fTimeMin, fWireMax, fWireMin, Get, and TotalClockTicks().

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

1226  {
1227  if ((unsigned int)plane >= fWireMin.size()) {
1228  mf::LogWarning("RawDataDrawer")
1229  << " Requested plane " << plane << " is larger than those available " << std::endl;
1230  return -1;
1231  }
1232 
1233  minw = fWireMin[plane];
1234  maxw = fWireMax[plane];
1235  mint = fTimeMin[plane];
1236  maxt = fTimeMax[plane];
1237 
1238  if ((minw == maxw) || (mint == maxt)) return 1;
1239 
1240  //make values a bit larger, but make sure they don't go out of bounds
1241  minw = (minw - 30 < 0) ? 0 : minw - 30;
1242  mint = (mint - 10 < 0) ? 0 : mint - 10;
1243 
1244  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout>()->Get();
1245  geo::PlaneID const planeid(0, 0, plane);
1246  maxw = (maxw + 10 > (int)wireReadoutGeom.Nwires(planeid)) ? wireReadoutGeom.Nwires(planeid) :
1247  maxw + 10;
1248  maxt = (maxt + 10 > TotalClockTicks()) ? TotalClockTicks() : maxt + 10;
1249 
1250  return 0;
1251  }
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
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:78
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< int > fTimeMin
lowest time in interesting region for each plane
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 1410 of file RawDataDrawer.cxx.

References fTimeMax, and fWireMax.

Referenced by RawDigit2D(), and RunRoIextractor().

1411  {
1412 
1413  return (fWireMax[plane] != -1) && (fTimeMax[plane] != -1);
1414 
1415  } // 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 1452 of file RawDataDrawer.cxx.

References evd::RawDrawingOptions::fMaxChannelStatus.

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

1454  {
1455  // if we don't have a valid status, we can't reject the channel
1456  if (!lariov::ChannelStatusProvider::IsValidStatus(channel_status)) return true;
1457 
1458  // is the status "too bad"?
1460  if (channel_status > drawopt->fMaxChannelStatus) return false;
1461  if (channel_status < drawopt->fMinChannelStatus) return false;
1462 
1463  // no reason to reject it...
1464  return true;
1465  } // 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, Get, evd::details::CellGridClass::GetCellBox(), evdb::ColorScale::GetColor(), evd::RawDataDrawer::BoxInfo_t::good, MF_LOG_DEBUG, and evd::ColorDrawingOptions::RawQ().

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 
964  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
965 
966  geo::SigType_t const sigType = wireReadoutGeom.SignalType(pid);
967  evdb::ColorScale const& ColorSet = cst->RawQ(sigType);
968  size_t const nBoxes = BoxInfo.size();
969  unsigned int nDrawnBoxes = 0;
970  for (size_t iBox = 0; iBox < nBoxes; ++iBox) {
971  BoxInfo_t const& info = BoxInfo[iBox];
972 
973  // too little signal, don't bother drawing
974  if (info.good && (std::abs(info.adc) < MinSignal)) continue;
975 
976  // skip the bad cells
977  if (!info.good) continue;
978 
979  // box color, proportional to the ADC count
980  int const color = ColorSet.GetColor(info.adc);
981 
982  // scale factor, proportional to ADC count (optional)
983  constexpr float q0 = 1000.;
984  float const sf = bScaleDigitsByCharge ? std::min(std::sqrt((float)info.adc / q0), 1.0F) : 1.;
985 
986  // coordinates of the cell box
987  float min_wire, max_wire, min_tick, max_tick;
988  std::tie(min_wire, min_tick, max_wire, max_tick) = fDrawingRange->GetCellBox(iBox);
989  if (sf != 1.) { // need to shrink the box
990  float const nsf = 1. - sf; // negation of scale factor
991  float const half_box_wires = (max_wire - min_wire) / 2.,
992  half_box_ticks = (max_tick - min_tick) / 2.;
993 
994  // shrink the box:
995  min_wire += nsf * half_box_wires;
996  max_wire -= nsf * half_box_wires;
997  min_tick += nsf * half_box_ticks;
998  max_tick -= nsf * half_box_ticks;
999  } // if scaling
1000 
1001  // allocate the box on the view;
1002  // the order of the coordinates depends on the orientation
1003  TBox* pBox;
1004  if (rawopt.fAxisOrientation < 1)
1005  pBox = &(view->AddBox(min_wire, min_tick, max_wire, max_tick));
1006  else
1007  pBox = &(view->AddBox(min_tick, min_wire, max_tick, max_wire));
1008 
1009  pBox->SetFillStyle(1001);
1010  pBox->SetFillColor(color);
1011  pBox->SetBit(kCannotPick);
1012 
1013  ++nDrawnBoxes;
1014  } // for (iBox)
1015 
1016  MF_LOG_DEBUG("RawDataDrawer") << "Sent " << nDrawnBoxes << "/" << BoxInfo.size()
1017  << " boxes to be rendered";
1018  } // 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.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
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
std::size_t color(std::string const &procname)
#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 1111 of file RawDataDrawer.cxx.

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

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

1117  {
1119  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1120 
1121  bool const bDraw = (rawopt->fDrawRawDataOrCalibWires != 1);
1122 
1123  // if we don't need to draw, don't bother doing anything;
1124  // if the region of interest is required, RunRoIextractor() should be called
1125  // (ok, now it's private, but it could be exposed)
1126  if (!bDraw) return;
1127 
1128  // Need to loop over the labels, but we don't want to zap existing cached RawDigits that are valid
1129  // So... do the painful search to make sure the RawDigits we recover at those we are searching for.
1130  bool theDroidIAmLookingFor = false;
1131 
1132  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
1133 
1134  // Loop over labels
1135  for (const auto& rawDataLabel : rawopt->fRawDataLabels) {
1136  // make sure we reset what needs to be reset
1137  // before the operations are initialized;
1138  // we call for reading raw digits; they will be cached, so it's not a waste
1139  details::CacheID_t NewCacheID(evt, rawDataLabel, pid);
1140  GetRawDigits(evt, NewCacheID);
1141 
1142  // Painful check to see if these RawDigits contain the droids we are looking for
1143  for (const auto& rawDigit : digit_cache->Digits()) {
1144  std::vector<geo::WireID> WireIDs = wireReadoutGeom.ChannelToWire(rawDigit.Channel());
1145 
1146  for (geo::WireID const& wireID : WireIDs) {
1147  if (wireID.planeID() != pid) continue; // not us!
1148  theDroidIAmLookingFor = true;
1149  break;
1150  } // for wires
1151 
1152  if (theDroidIAmLookingFor) break;
1153  }
1154 
1155  if (theDroidIAmLookingFor) break;
1156  }
1157 
1158  if (!theDroidIAmLookingFor) return;
1159 
1160  bool const hasRoI = hasRegionOfInterest(plane);
1161 
1162  // - if we don't have a RoI yet, we want to get it while we draw
1163  // * if we are zooming into it now, we have to extract it first, then draw
1164  // * if we are not zooming, we can do both at the same time
1165  // - if we have a RoI, we don't want to extract it again
1166  if (!bZoomToRoI) { // we are not required to zoom to the RoI
1167 
1168  std::unique_ptr<OperationBaseClass> operation;
1169 
1170  // we will do the drawing in one pass
1171  MF_LOG_DEBUG("RawDataDrawer") << __func__ << "() setting up one-pass drawing";
1172  operation.reset(new BoxDrawer(detProp, pid, this, view));
1173 
1174  if (!hasRoI) { // we don't have any RoI; since it's cheap, let's get it
1175  MF_LOG_DEBUG("RawDataDrawer") << __func__ << "() adding RoI extraction";
1176 
1177  // swap cards: operation becomes a multiple operation:
1178  // - prepare the two operations (one is there already, somehow)
1179  std::unique_ptr<OperationBaseClass> drawer(std::move(operation));
1180  std::unique_ptr<OperationBaseClass> extractor(new RoIextractorClass(pid, this));
1181  // - create a new composite operation and give it the sub-ops
1182  operation.reset(new ManyOperations(pid, this));
1183  ManyOperations* pManyOps = static_cast<ManyOperations*>(operation.get());
1184  pManyOps->AddOperation(std::move(drawer));
1185  pManyOps->AddOperation(std::move(extractor));
1186  }
1187 
1188  if (!RunOperation(evt, operation.get())) {
1189  throw art::Exception(art::errors::Unknown) << "RawDataDrawer::RunDrawOperation(): "
1190  "somewhere something went somehow wrong";
1191  }
1192  }
1193  else { // we are zooming to RoI
1194  // first, we want the RoI extracted; the extractor will update this object
1195  if (!hasRoI) {
1196  MF_LOG_DEBUG("RawDataDrawer") << __func__ << "() setting up RoI extraction for " << pid;
1197  RoIextractorClass extractor(pid, this);
1198  if (!RunOperation(evt, &extractor)) {
1200  << "RawDataDrawer::RunDrawOperation():"
1201  " something went somehow wrong while extracting RoI";
1202  }
1203  }
1204  else {
1205  MF_LOG_DEBUG("RawDataDrawer")
1206  << __func__ << "() using existing RoI for " << pid << ": wires ( " << fWireMin[plane]
1207  << " - " << fWireMax[plane] << " ), ticks ( " << fTimeMin[plane] << " - "
1208  << fTimeMax[plane] << " )";
1209  }
1210 
1211  // adopt the drawing limits information from the wire/time limits
1213 
1214  // then we draw
1215  MF_LOG_DEBUG("RawDataDrawer") << __func__ << "() setting up drawing";
1216  BoxDrawer drawer(detProp, pid, this, view);
1217  if (!RunOperation(evt, &drawer)) {
1218  throw art::Exception(art::errors::Unknown) << "RawDataDrawer::RunDrawOperation():"
1219  " something went somehow wrong while drawing";
1220  }
1221  }
1222  } // RawDataDrawer::RawDigit2D()
int fDrawRawDataOrCalibWires
0 for raw
void SetDrawingLimitsFromRoI(geo::PlaneID::PlaneID_t plane)
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
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:36
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 1418 of file RawDataDrawer.cxx.

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

Referenced by GetRawDigits().

1419  {
1420 
1421  MF_LOG_DEBUG("RawDataDrawer") << "RawDataDrawer[" << ((void*)this)
1422  << "]: resetting the region of interest";
1423 
1424  std::fill(fWireMin.begin(), fWireMin.end(), -1);
1425  std::fill(fWireMax.begin(), fWireMax.end(), -1);
1426  std::fill(fTimeMin.begin(), fTimeMin.end(), -1);
1427  std::fill(fTimeMax.begin(), fTimeMax.end(), -1);
1428 
1429  } // 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 1020 of file RawDataDrawer.cxx.

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

1024  {
1025 
1026  // Check if we're supposed to draw raw hits at all
1028  if (rawopt->fDrawRawDataOrCalibWires == 1) return;
1029 
1030  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1031  BoxDrawer drawer(detProp, pid, this, view);
1032  if (!RunOperation(evt, &drawer)) {
1033  throw art::Exception(art::errors::Unknown) << "RawDataDrawer::RunDrawOperation(): "
1034  "somewhere something went somehow wrong";
1035  }
1036 
1037  } // RawDataDrawer::RunDrawOperation()
int fDrawRawDataOrCalibWires
0 for raw
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
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(), digit_cache, evd::details::RawDigitCacheDataClass::empty(), evd::RawDataDrawer::OperationBaseClass::Finish(), evd::RawDrawingOptions::fPedestalOption, evd::RawDrawingOptions::fSeeBadChannels, fStartTick, fTicks, Get, 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  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
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 = wireReadoutGeom.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
double fStartTick
low tick
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
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
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
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
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 1088 of file RawDataDrawer.cxx.

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

1089  {
1091  geo::PlaneID const pid(rawopt->CurrentTPC(), plane);
1092 
1093  // if we have no region of interest, prepare to extract it
1094  bool const bExtractRoI = !hasRegionOfInterest(plane);
1095  MF_LOG_TRACE("RawDataDrawer") << "Region of interest for " << pid
1096  << (bExtractRoI ? " extracted" : " not extracted")
1097  << " on this draw";
1098 
1099  if (!bExtractRoI) return;
1100 
1101  RoIextractorClass Extractor(pid, this);
1102  if (!RunOperation(evt, &Extractor)) {
1103  throw std::runtime_error(
1104  "RawDataDrawer::RunRoIextractor(): somewhere something went somehow wrong");
1105  }
1106 
1107  } // RawDataDrawer::RunRoIextractor()
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
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 193 of file RawDataDrawer.h.

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

Referenced by SetDrawingLimitsFromRoI().

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

Definition at line 77 of file RawDataDrawer.h.

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

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

Definition at line 78 of file RawDataDrawer.h.

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

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

Friends And Related Function Documentation

friend class BoxDrawer
friend

Definition at line 119 of file RawDataDrawer.h.

Referenced by RawDigit2D().

friend class RoIextractorClass
friend

Definition at line 129 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 133 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 196 of file RawDataDrawer.h.

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

information about the last processed plane

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

Referenced by GetChargeSum(), and RawDataDrawer().

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

information about the viewport

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

Referenced by GetChargeSum(), and RawDataDrawer().

double evd::RawDataDrawer::fStartTick
private

low tick

Definition at line 146 of file RawDataDrawer.h.

Referenced by RawDataDrawer(), and RunOperation().

double evd::RawDataDrawer::fTicks
private

number of ticks of the clock

Definition at line 147 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 152 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 151 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 150 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 149 of file RawDataDrawer.h.

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

PadResolution_t evd::RawDataDrawer::PadResolution
private

stored pad resolution

Definition at line 157 of file RawDataDrawer.h.

Referenced by ExtractRange(), and SetDrawingLimits().


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