Public Member Functions | Private Member Functions | Private Attributes | List of all members
evd::RawDataDrawer Class Reference

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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-28/EventDisplay/RawDataDrawer.h"

Public Member Functions

 RawDataDrawer ()
 
 ~RawDataDrawer ()
 
void FillTQHisto (const art::Event &evt, TH1F *thisto, TH1F *qhisto)
 
void RawDigitHardware (const art::Event &evt, evdb::View2D *view)
 
void RawDigit2D (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 
void RawDigit3D (const art::Event &evt, evdb::View3D *view)
 
void GetLimits (double *xmin, double *xmax, double *ymin, double *ymax, double *zmin, double *zmax)
 

Private Member Functions

template<class T >
bool GetRawDigits (const art::Event &evt, const std::string &which, const std::string &instance, std::vector< const rawdata::RawDigit * > &rawhits)
 
bool GetRawDigitsMulti (const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
 
void GetRawDigitsAllLabels (const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
 
int GetRawTrigger (const art::Event &evt, art::PtrVector< rawdata::RawTrigger > &rawtrigger)
 
int HitColor (const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered, int *ghosted)
 
bool DimFiltered (const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered)
 
void Draw3DHitBoxes (std::vector< const rawdata::RawDigit * > &hits, const std::set< std::pair< uint32_t, int16_t >> &unfiltHits, evdb::View3D *view)
 
double ScaleFactor (double t, double q)
 
void StickFigure (evdb::View3D *view, double x, double y, double z)
 

Private Attributes

double fXmin
 
double fXmax
 X range spanned by the hits. More...
 
double fYmin
 
double fYmax
 Y range spanned by the hits. More...
 
double fZmin
 
double fZmax
 Z range spanned by the hits. More...
 

Detailed Description

Aid in the rendering of RawData objects.

Definition at line 27 of file RawDataDrawer.h.

Constructor & Destructor Documentation

evd::RawDataDrawer::RawDataDrawer ( )

Definition at line 63 of file RawDataDrawer.cxx.

63 { }
evd::RawDataDrawer::~RawDataDrawer ( )

Definition at line 67 of file RawDataDrawer.cxx.

67 { }

Member Function Documentation

bool evd::RawDataDrawer::DimFiltered ( const rawdata::RawDigit hit,
const std::set< std::pair< uint32_t, int16_t >> &  unfiltered 
)
private

Definition at line 678 of file RawDataDrawer.cxx.

References rawdata::RawDigit::Channel(), make_pair(), and rawdata::RawDigit::TDC().

Referenced by HitColor(), and RawDigit2D().

680  {
682  if(!nav->DimHits() && !nav->DimOthers() ) return false;
683 
684  return unfiltered.count(std::make_pair(hit->Channel(), hit->TDC())) == 0;
685  }
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
uint32_t Channel() const
Definition: RawDigit.h:84
void evd::RawDataDrawer::Draw3DHitBoxes ( std::vector< const rawdata::RawDigit * > &  hits,
const std::set< std::pair< uint32_t, int16_t >> &  unfiltHits,
evdb::View3D view 
)
private

Definition at line 377 of file RawDataDrawer.cxx.

References evdb::View3D::AddMarker3DBox(), geo::GeometryBase::CellInfo(), visualisationForPaperMasterPlot::cmap, geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), dx, dy, dz, geom(), cmap::dataprov::CMap::GetCell(), cmap::dataprov::CMap::GetPlane(), make_syst_table_plots::h, HitColor(), MECModelEnuComparisons::i, evd::kUSEC_PER_TDC, geo::kX, m, ScaleFactor(), confusionMatrixTree::t, and registry_explorer::v.

Referenced by RawDigit2D(), and RawDigit3D().

380  {
383  for (unsigned int i=0; i<rawhits.size(); ++i) {
384  double t = 0;
385  double q = 0;
386  t = rawhits[i]->TDC()*kUSEC_PER_TDC;
387  q = rawhits[i]->ADC();
388 
389  // Get the cell geometry for the hit
390  int iplane = cmap->GetPlane(rawhits[i]);
391  int icell = cmap->GetCell(rawhits[i]);
392  double xyz[3];
393  double dxyz[3];
394  geo::View_t v;
395  geom->CellInfo(iplane, icell, &v, xyz, dxyz);
396 
397  int ghosted;
398  int co = this->HitColor(rawhits[i], unfiltHits, &ghosted);
399  if (ghosted) continue;
400 
401  double sf = this->ScaleFactor(t, q);
402  double h = 0.0;
403 
404  double x0, y0, z0;
405  double dx, dy, dz;
406  if (v==geo::kX) {
407  x0 = xyz[0];
408  y0 = geom->DetHalfHeight()+0.5*h;
409  z0 = xyz[2];
410  dx = sf*dxyz[0];
411  dy = 0.5*h;
412  dz = sf*dxyz[2];
413  }
414  else {
415  x0 = geom->DetHalfWidth()+0.5*h;
416  y0 = xyz[1];
417  z0 = xyz[2];
418  dx = 0.5*h;
419  dy = sf*dxyz[1];
420  dz = sf*dxyz[2];
421  }
422  TMarker3DBox& m = view->AddMarker3DBox(x0, y0, z0, dx, dy, dz);
423  m.SetLineStyle(1);
424  m.SetLineColor(co);
425  }
426  }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
TMarker3DBox & AddMarker3DBox(double x, double y, double z, double dx, double dy, double dz, double th=0.0, double ph=0.0)
Definition: View3D.cxx:51
Vertical planes which measure X.
Definition: PlaneGeo.h:28
void CellInfo(unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
double dy[NP][NC]
double dx[NP][NC]
double dz[NP][NC]
unsigned short GetPlane(const rawdata::RawDigit *dig)
Definition: CMap.cxx:285
double ScaleFactor(double t, double q)
double DetHalfHeight() const
static double kUSEC_PER_TDC
double DetHalfWidth() const
void geom(int which=0)
Definition: geom.C:163
unsigned short GetCell(const rawdata::RawDigit *dig)
Definition: CMap.cxx:327
int HitColor(const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered, int *ghosted)
void evd::RawDataDrawer::FillTQHisto ( const art::Event evt,
TH1F *  thisto,
TH1F *  qhisto 
)

Definition at line 71 of file RawDataDrawer.cxx.

References evd::RawDrawingOptions::fTimeRange, evd::RawDrawingOptions::fWhichHits, GetRawDigitsAllLabels(), MECModelEnuComparisons::i, evd::RawDrawingOptions::kRAW_HITS, evd::kUSEC_PER_TDC, and confusionMatrixTree::t.

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

74  {
75  // Check if we're supposed to draw raw hits at all
78  return;
79  }
80 
81  std::vector<const rawdata::RawDigit*> rawhits;
82  this->GetRawDigitsAllLabels(evt, rawhits);
83 
84  for (unsigned int i=0; i<rawhits.size(); ++i) {
85  double t = rawhits[i]->TDC() * kUSEC_PER_TDC;
86  double q = rawhits[i]->ADC();
87  if (thisto!=0) thisto->Fill(t);
88  if (qhisto!=0) {
89  //
90  // Only histogram ADC counts that are in time with the
91  // selected time range
92  //
93  if (t>drawopt->fTimeRange[0] && t<drawopt->fTimeRange[1]) {
94  qhisto->Fill(q);
95  }
96  }
97  }
98  }
std::vector< float > fTimeRange
void GetRawDigitsAllLabels(const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
static double kUSEC_PER_TDC
static const int kRAW_HITS
void evd::RawDataDrawer::GetLimits ( double *  xmin,
double *  xmax,
double *  ymin,
double *  ymax,
double *  zmin,
double *  zmax 
)

Definition at line 473 of file RawDataDrawer.cxx.

References fXmax, fXmin, fYmax, fYmin, fZmax, fZmin, and GetRawDigits().

Referenced by evd::TZProjPad::AutoZoom().

476  {
477  *xmin = fXmin;
478  *xmax = fXmax;
479  *ymin = fYmin;
480  *ymax = fYmax;
481  *zmin = fZmin;
482  *zmax = fZmax;
483  }
std::map< std::string, double > xmax
double fXmax
X range spanned by the hits.
Definition: RawDataDrawer.h:84
Double_t ymax
Definition: plot.C:25
double fYmax
Y range spanned by the hits.
Definition: RawDataDrawer.h:85
Double_t ymin
Definition: plot.C:24
double fZmax
Z range spanned by the hits.
Definition: RawDataDrawer.h:86
template<class T >
bool evd::RawDataDrawer::GetRawDigits ( const art::Event evt,
const std::string which,
const std::string instance,
std::vector< const rawdata::RawDigit * > &  rawhits 
)
private

Definition at line 488 of file RawDataDrawer.cxx.

References chaninfo::BadChanList::Apply(), art::Handle< T >::failedToGet(), evd::RawDrawingOptions::fRawDrawingOpt, art::DataViewImpl::getByLabel(), GetRawDigitsMulti(), evd::RawDrawingOptions::kMASK_BAD_CHANNELS, T, and APDHVSetting::temp.

Referenced by GetLimits().

492  {
493  rawhits.clear();
494 
495  // Temporary vector of rawdigits
496  std::vector<const rawdata::RawDigit*> temp;
497 
499  evt.getByLabel(which, instance, rdcol);
500 
501  if(rdcol.failedToGet()) return false;
502 
503  // Extract rawdigits from Handle
504  temp.reserve(rdcol->size());
505  for(const T& dig: *rdcol) temp.push_back(&dig);
506 
507  // Fill in the temporary vector of rawdigits to output reference rawhits
508  temp.swap(rawhits);
509 
510  // check for bad channels
514  bcl->Apply(rawhits);
515  }
516 
517  return true;
518  }
static const int kMASK_BAD_CHANNELS
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
int Apply(art::PtrVector< rawdata::RawDigit > &rd)
double T
Definition: Xdiff_gwt.C:5
bool failedToGet() const
Definition: Handle.h:196
void evd::RawDataDrawer::GetRawDigitsAllLabels ( const art::Event evt,
std::vector< const rawdata::RawDigit * > &  rawhits 
)
private

Definition at line 556 of file RawDataDrawer.cxx.

References om::cout, allTimeWatchdog::endl, evd::RawDrawingOptions::fCellHitsInstances, evd::RawDrawingOptions::fCellHitsModules, evd::RawDrawingOptions::fRawDigitsInstances, evd::RawDrawingOptions::fRawDigitsModules, GetRawDigitsMulti(), m, and string.

Referenced by FillTQHisto(), RawDigit2D(), RawDigit3D(), and RawDigitHardware().

558  {
560 
561  rawhits.clear();
562 
563  bool any = false;
564  for(unsigned imod = 0; imod < drawopt->fRawDigitsModules.size(); ++imod){
565  std::vector<const rawdata::RawDigit*> digs;
566  if(GetRawDigits<rawdata::RawDigit>(evt,
567  drawopt->fRawDigitsModules[imod],
568  drawopt->fRawDigitsInstances[imod],
569  digs)){
570  any = true;
571  rawhits.insert(rawhits.end(), digs.begin(), digs.end());
572  }
573  }
574  if(any) return;
575 
576  if(GetRawDigitsMulti(evt, rawhits)) return;
577 
578  for(unsigned imod = 0; imod < drawopt->fCellHitsModules.size(); ++imod){
579  std::vector<const rawdata::RawDigit*> digs;
580  if(GetRawDigits<rb::CellHit>(evt,
581  drawopt->fCellHitsModules[imod],
582  drawopt->fCellHitsInstances[imod],
583  digs)){
584  any = true;
585  rawhits.insert(rawhits.end(), digs.begin(), digs.end());
586  }
587  }
588 
589  if(!any){
590  std::cout << __PRETTY_FUNCTION__
591  << ": Could not find any hits. Looked under labels";
592  for(const std::string& m: drawopt->fRawDigitsModules) std::cout << " '" << m << "'";
593  std::cout << " (for RawDigits) and";
594  for(const std::string& m: drawopt->fCellHitsModules) std::cout << " '" << m << "'";
595  std::cout << " (for CellHits)" << std::endl;
596  }
597  }
std::vector< std::string > fCellHitsModules
std::vector< std::string > fRawDigitsModules
std::vector< std::string > fRawDigitsInstances
OStream cout
Definition: OStream.cxx:6
std::vector< std::string > fCellHitsInstances
bool GetRawDigitsMulti(const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
enum BeamMode string
bool evd::RawDataDrawer::GetRawDigitsMulti ( const art::Event evt,
std::vector< const rawdata::RawDigit * > &  rawhits 
)
private

Fill in the temporary vector of rawdigits to output reference rawhits

Definition at line 523 of file RawDataDrawer.cxx.

References chaninfo::BadChanList::Apply(), evd::RawDrawingOptions::fRawDrawingOpt, art::DataViewImpl::getManyByType(), evd::RawDrawingOptions::kMASK_BAD_CHANNELS, and APDHVSetting::temp.

Referenced by GetRawDigits(), and GetRawDigitsAllLabels().

525  {
526  rawhits.clear();
527 
528  // Temporary vector of rawdigits
529  std::vector<const rawdata::RawDigit*> temp;
530 
531  // Try to find digits in other folders
532  std::vector<art::Handle<std::vector<rawdata::RawDigit>>> rdcol_vec;
533  evt.getManyByType(rdcol_vec);
534 
535  if(rdcol_vec.empty()) return false;
536 
537  for(const art::Handle<std::vector<rawdata::RawDigit>>& digs: rdcol_vec)
538  for(const rawdata::RawDigit& dig: *digs)
539  temp.push_back(&dig);
540 
541  /// Fill in the temporary vector of rawdigits to output reference rawhits
542  temp.swap(rawhits);
543 
544  // check for bad channels
548  bcl->Apply(rawhits);
549  }
550 
551  return true;
552  }
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: DataViewImpl.h:446
static const int kMASK_BAD_CHANNELS
int Apply(art::PtrVector< rawdata::RawDigit > &rd)
int evd::RawDataDrawer::GetRawTrigger ( const art::Event evt,
art::PtrVector< rawdata::RawTrigger > &  rawtrigger 
)
private

Definition at line 601 of file RawDataDrawer.cxx.

References art::PtrVector< T >::clear(), art::DataViewImpl::getManyByType(), MECModelEnuComparisons::i, art::PtrVector< T >::push_back(), art::PtrVector< T >::size(), art::PtrVector< T >::swap(), and APDHVSetting::temp.

603  {
604  r.clear();
606 
607  // using getManyByType so that we don't have to specify a module
608  // label
609  std::vector< art::Handle< std::vector<rawdata::RawTrigger> > > rtcol;
610 
611  try{
612  e.getManyByType(rtcol);
613  for(size_t rtc = 0; rtc < rtcol.size(); ++rtc){
614  for(unsigned int i=0; i < rtcol[rtc]->size(); ++i){
615  art::Ptr<rawdata::RawTrigger> rt(rtcol[rtc], i);
616  temp.push_back(rt);
617  }
618  }
619  temp.swap(r);
620  }// end try
621  catch(cet::exception& e) {
622  writeErrMsg("GetRawTrigger", e);
623  }
624 
625  return r.size();
626  }
void swap(PtrVector &other)
Definition: PtrVector.h:522
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
TRandom3 r(0)
Float_t e
Definition: plot.C:35
Definition: fwd.h:28
int evd::RawDataDrawer::HitColor ( const rawdata::RawDigit hit,
const std::set< std::pair< uint32_t, int16_t >> &  unfiltered,
int ghosted 
)
private

Determine the color to use for the hit. If the hit is flagged to be ghosted out by either its time or charge, ghost the hit

Definition at line 634 of file RawDataDrawer.cxx.

References rawdata::RawDigit::ADC(), evdb::Colors::Background(), colors, DimFiltered(), evd::RawDrawingOptions::fColor, evd::RawDrawingOptions::fRawDrawingOpt, evdb::ColorScale::GetColor(), evdb::ColorScale::InBounds(), evd::RawDrawingOptions::kCOLOR_BY_CHARGE, evd::RawDrawingOptions::kCOLOR_BY_TIME, evd::RawDrawingOptions::kSUPPRESS_DIMMED_HITS, evd::kUSEC_PER_TDC, evdb::Colors::Scale(), confusionMatrixTree::t, and rawdata::RawDigit::TDC().

Referenced by Draw3DHitBoxes(), RawDigit2D(), and RawDigitHardware().

637  {
640 
641  int co = 0;
642  double t = hit->TDC() * kUSEC_PER_TDC;
643  double q = hit->ADC();
644 
646  int t_color = colors->Scale("RawT").GetColor(t);
647  int q_color = colors->Scale("RawQ").GetColor(q);
648 
649  *ghosted =
650  !(colors->Scale("RawT").InBounds(t)&&colors->Scale("RawQ").InBounds(q));
651 
652  // Only ghosted hits can be suppressed. Option to "ghost" dimmed
653  // hits to suppress them.
655  DimFiltered(hit, unfiltered) ) *ghosted = 1;
656 
657  if (*ghosted | DimFiltered(hit, unfiltered ) ) {
658  if(colors->Background(0) == kWhite) return 18; else return 12;
659  }
660  else {
661  switch (drawopt->fColor) {
663  co = q_color;
664  break;
666  co = t_color;
667  break;
668  default:
669  co = 1;
670  }
671  }
672  return co;
673  }
bool DimFiltered(const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered)
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
bool InBounds(double x) const
Definition: ColorScale.cxx:113
int GetColor(double x) const
Definition: ColorScale.cxx:126
static const int kSUPPRESS_DIMMED_HITS
static const int kCOLOR_BY_TIME
int colors[6]
Definition: tools.h:1
int Background(int i=0)
ColorScale & Scale(const std::string &nm)
static const int kCOLOR_BY_CHARGE
static double kUSEC_PER_TDC
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
void evd::RawDataDrawer::RawDigit2D ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Definition at line 235 of file RawDataDrawer.cxx.

References evdb::View2D::AddBox(), plot_validation_datamc::c, getBrightness::cell, geo::PlaneGeo::Cell(), om::cerr, rawdata::RawDigit::Channel(), visualisationForPaperMasterPlot::cmap, evd::SliceNavigator::CurrentSliceIndex(), DimFiltered(), evd::SliceNavigator::DimOthers(), Draw3DHitBoxes(), makeHTMLView::dt, dz, allTimeWatchdog::endl, evd::GeometryDrawingOptions::fOutline, evd::RawDrawingOptions::fRawDrawingOpt, evd::SliceNavigator::FullEventMode(), evd::RawDrawingOptions::fWhichHits, fXmax, fXmin, fYmax, fYmin, fZmax, fZmin, cmap::dataprov::CMap::GetCell(), geo::CellGeo::GetCenter(), cmap::dataprov::CMap::GetPlane(), GetRawDigitsAllLabels(), geo::CellGeo::HalfD(), geo::CellGeo::HalfW(), HitColor(), MECModelEnuComparisons::i, evd::GeometryDrawingOptions::kOUTLINE_CELLS, evd::RawDrawingOptions::kRAW_HITS, evd::RawDrawingOptions::kSUPPRESS_GHOSTED_HITS, evd::kUSEC_PER_TDC, geo::kX, geo::kY, getGoodRuns4SAM::n, nc, geo::PlaneGeo::Ncells(), geo::GeometryBase::NPlanes(), geo::GeometryBase::Plane(), NDAPDHVSetting::plane, ScaleFactor(), evd::SliceNavigator::SlicesToNavigate(), confusionMatrixTree::t, rawdata::RawDigit::TDC(), registry_explorer::v, geo::PlaneGeo::View(), and evd::GeoTransform::XYZ().

238  {
239  // Check if we're supposed to draw raw hits at all
241  if (drawopt->fWhichHits!=evd::RawDrawingOptions::kRAW_HITS) return;
242 
247 
248  std::vector<const rb::Cluster*> slicesToNavigate = nav->SlicesToNavigate(evt);
249  std::set<std::pair<uint32_t, int16_t>> unfiltHits;
250 
251  for(int i=0, n = slicesToNavigate.size(); i < n; ++i ){
252  // If DimOthers option is chosen, hits from slices
253  // other than the current slice should be dimmed.
254  if( nav->DimOthers() && !nav->FullEventMode() ){
255  if( i != nav->CurrentSliceIndex() )
256  continue;
257  }
258  for( int c = 0, nc = slicesToNavigate[i]->NCell(); c < nc; ++c){
259  rb::CellHit chit = *(slicesToNavigate[i]->Cell(c));
260  unfiltHits.emplace(chit.Channel(), chit.TDC());
261  }
262  }
263 
264  fXmin = 9.E9;
265  fYmin = 9.E9;
266  fZmin = 9.E9;
267  fXmax = -9.E9;
268  fYmax = -9.E9;
269  fZmax = -9.E9;
270 
271  // Draw the dimmed hits first to ensure selected hits are above them
272  for(bool drawDimmed: {true, false}){
273  std::vector< const rawdata::RawDigit*> rawhits;
274  this->GetRawDigitsAllLabels(evt, rawhits);
275 
276  for (unsigned int i=0; i<rawhits.size(); ++i) {
277  unsigned int plane = cmap->GetPlane(rawhits[i]);
278  unsigned int cell = cmap->GetCell(rawhits[i]);
279 
280  if (plane>=geo->NPlanes()) {
281  std::cerr << "*- Illegal plane number " << plane
282  << " DaqChannel = "
283  << std::hex << rawhits[i]->DaqChannel()
284  << std::endl;
285  std::cerr << std::dec;
286  continue;
287  }
288  const geo::PlaneGeo *p = geo->Plane(plane);
289 
290  if (cell>=p->Ncells()) {
291  std::cerr << "*- Illegal cell number " << cell
292  << " in plane " << plane
293  << "*- DaqChannel = "
294  << std::hex << rawhits[i]->DaqChannel()
295  << std::endl;
296  std::cerr << std::dec;
297  continue;
298  }
299  const geo::CellGeo *c = p->Cell(cell);
300 
301  double xyz[3];
302  double tpos = 0.0, zpos = 0.0;
303  double dt, dz;
304  dz = c->HalfD();
305  dt = c->HalfW();
306  evdb::View2D* v = 0;
307  if (p->View()==geo::kX) {
308  c->GetCenter(xyz);
309  GeoTransform::XYZ(xyz);
310 
311  tpos = xyz[0];
312  zpos = xyz[2];
313 
314  if (tpos<fXmin) fXmin = tpos;
315  if (tpos>fXmax) fXmax = tpos;
316  if (zpos<fZmin) fZmin = zpos;
317  if (zpos>fZmax) fZmax = zpos;
318  }
319  if (p->View()==geo::kY) {
320  c->GetCenter(xyz);
321  GeoTransform::XYZ(xyz);
322 
323  tpos = xyz[1];
324  zpos = xyz[2];
325 
326  if (tpos<fYmin) fYmin = tpos;
327  if (tpos>fYmax) fYmax = tpos;
328  if (zpos<fZmin) fZmin = zpos;
329  if (zpos>fZmax) fZmax = zpos;
330  }
331  // Decide if this hit should be drawn on this view
332  if (p->View()==geo::kX && xzview==0) continue;
333  if (p->View()==geo::kY && yzview==0) continue;
334  if (xzview!=0) v = xzview;
335  if (yzview!=0) v = yzview;
336 
337  double t = 0;
338  double q = 0;
339  t = rawhits[i]->TDC()*kUSEC_PER_TDC;
340  q = rawhits[i]->ADC();
341 
342  // Hack for now...
343  if (q<=0.0) q=100.;
344 
345  //
346  // Draw boxes representing hit cells
347  //
348  if(DimFiltered(rawhits[i], unfiltHits) != drawDimmed) continue;
349 
350  int ghosted;
351  int co = this->HitColor( rawhits[i], unfiltHits, &ghosted);
352  if (drawopt->fRawDrawingOpt &
354  if (ghosted) continue;
355  }
356 
357  double sf = this->ScaleFactor(t, q);
358  TBox& b1 = v->AddBox(zpos-sf*dz,tpos-sf*dt,zpos+sf*dz,tpos+sf*dt);
359  b1.SetFillStyle(1001);
360  b1.SetFillColor(co);
361  b1.SetBit(kCannotPick);
362 
364  TBox& b2 = v->AddBox(zpos-dz,tpos-dt,zpos+dz,tpos+dt);
365  b2.SetFillStyle(0);
366  if (ghosted) b2.SetLineColor(17); // Greyed out hit
367  else b2.SetLineColor(14);
368  b2.SetBit(kCannotPick);
369  }
370  }//end loop over raw hits
371  } // end for drawDimmed
372  }
bool DimFiltered(const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered)
static const int kSUPPRESS_GHOSTED_HITS
double HalfD() const
Definition: CellGeo.cxx:205
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
double fXmax
X range spanned by the hits.
Definition: RawDataDrawer.h:84
bool DimOthers() const
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
double HalfW() const
Definition: CellGeo.cxx:191
OStream cerr
Definition: OStream.cxx:7
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
TBox & AddBox(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:263
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
double dz[NP][NC]
void GetRawDigitsAllLabels(const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
unsigned short GetPlane(const rawdata::RawDigit *dig)
Definition: CMap.cxx:285
double ScaleFactor(double t, double q)
static double kUSEC_PER_TDC
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
double fYmax
Y range spanned by the hits.
Definition: RawDataDrawer.h:85
enum BeamMode nc
uint32_t Channel() const
Definition: RawDigit.h:84
unsigned short GetCell(const rawdata::RawDigit *dig)
Definition: CMap.cxx:327
double fZmax
Z range spanned by the hits.
Definition: RawDataDrawer.h:86
unsigned int NPlanes() const
static const int kRAW_HITS
Encapsulate the cell geometry.
Definition: CellGeo.h:25
int HitColor(const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered, int *ghosted)
Helper for AttenCurve.
Definition: Path.h:10
static void XYZ(double *xyz)
std::vector< const rb::Cluster * > SlicesToNavigate(const art::Event &evt)
int fOutline
Which outlines to draw.
void evd::RawDataDrawer::RawDigit3D ( const art::Event evt,
evdb::View3D view 
)

Definition at line 430 of file RawDataDrawer.cxx.

References plot_validation_datamc::c, rawdata::RawDigit::Channel(), evd::SliceNavigator::CurrentSliceIndex(), geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), evd::SliceNavigator::DimOthers(), Draw3DHitBoxes(), evd::SliceNavigator::FullEventMode(), evd::RawDrawingOptions::fWhichHits, geom(), GetRawDigitsAllLabels(), MECModelEnuComparisons::i, evd::RawDrawingOptions::kRAW_HITS, getGoodRuns4SAM::n, nc, evd::SliceNavigator::SlicesToNavigate(), StickFigure(), and rawdata::RawDigit::TDC().

432  {
433  // Check if we're supposed to draw raw hits at all
435  if (drawopt->fWhichHits!=evd::RawDrawingOptions::kRAW_HITS) return;
436 
439 
440  std::vector<const rb::Cluster*> slicesToNavigate = nav->SlicesToNavigate(evt);
441  std::set<std::pair<uint32_t, int16_t>> unfiltHits;
442 
443  for (int i=0, n = slicesToNavigate.size(); i<n; ++i){
444  //
445  // If DimOthers option is chosen, hits from slices other than
446  // the current slice should be dimmed.
447  //
448  if (nav->DimOthers() && !nav->FullEventMode()) {
449  if (i!=nav->CurrentSliceIndex()) continue;
450  }
451  for(int c=0, nc=slicesToNavigate[i]->NCell(); c<nc; ++c){
452  rb::CellHit chit = *(slicesToNavigate[i]->Cell(c));
453  unfiltHits.emplace(chit.Channel(), chit.TDC());
454  }
455  } // end loop over slices to navigate
456 
457  std::vector< const rawdata::RawDigit*> rawhits;
458  this->GetRawDigitsAllLabels(evt, rawhits);
459 
460  this->Draw3DHitBoxes(rawhits, unfiltHits, view);
461 
462  //
463  // A stick figure for scale
464  //
465  this->StickFigure(view,
466  geom->DetHalfWidth(),
467  -geom->DetHalfHeight(),
468  0.0);
469  }
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
bool DimOthers() const
void GetRawDigitsAllLabels(const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
double DetHalfHeight() const
void StickFigure(evdb::View3D *view, double x, double y, double z)
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
double DetHalfWidth() const
void geom(int which=0)
Definition: geom.C:163
void Draw3DHitBoxes(std::vector< const rawdata::RawDigit * > &hits, const std::set< std::pair< uint32_t, int16_t >> &unfiltHits, evdb::View3D *view)
enum BeamMode nc
uint32_t Channel() const
Definition: RawDigit.h:84
static const int kRAW_HITS
std::vector< const rb::Cluster * > SlicesToNavigate(const art::Event &evt)
void evd::RawDataDrawer::RawDigitHardware ( const art::Event evt,
evdb::View2D view 
)

Draw raw data according to hardware address

Definition at line 104 of file RawDataDrawer.cxx.

References evdb::View2D::AddBox(), evdb::View2D::AddLine(), evdb::View2D::AddText(), plot_validation_datamc::c, rawdata::RawDigit::Channel(), evd::SliceNavigator::CurrentSliceIndex(), daqchannelmap::HardwareDisplay::DAQToXY(), febshutoff_auto::dcm, geo::GeometryBase::DetId(), geo2elec::diblock, evd::SliceNavigator::DimOthers(), APDHVSetting::feb, daqchannelmap::HardwareDisplay::fNdcmSide, daqchannelmap::HardwareDisplay::fNdcmTop, daqchannelmap::HardwareDisplay::fNdiblocks, daqchannelmap::HardwareDisplay::fNfebCols, daqchannelmap::HardwareDisplay::fNfebRows, daqchannelmap::HardwareDisplay::fNpixCols, daqchannelmap::HardwareDisplay::fNpixRows, evd::GeometryDrawingOptions::fOutline, evd::RawDrawingOptions::fRawDrawingOpt, evd::SliceNavigator::FullEventMode(), evd::RawDrawingOptions::fWhichHits, daqchannelmap::HardwareDisplay::fXmax, daqchannelmap::HardwareDisplay::fYmax, GetRawDigitsAllLabels(), hd, HitColor(), MECModelEnuComparisons::i, evd::GeometryDrawingOptions::kOUTLINE_CELLS, evd::RawDrawingOptions::kRAW_HITS, evd::RawDrawingOptions::kSUPPRESS_GHOSTED_HITS, evd::kUSEC_PER_TDC, submit_hadd::l, getGoodRuns4SAM::n, nc, ScaleFactor(), daqchannelmap::HardwareDisplay::SetupDet(), evd::SliceNavigator::SlicesToNavigate(), confusionMatrixTree::t, and rawdata::RawDigit::TDC().

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

106  {
108  if (drawopt->fWhichHits!=evd::RawDrawingOptions::kRAW_HITS) return;
109 
113 
115  hd.SetupDet(geo->DetId());
116 
117  std::vector<const rb::Cluster*> slicesToNavigate = nav->SlicesToNavigate(evt);
118 
119  // channel, tdc
120  std::set<std::pair<uint32_t, int16_t>> unfiltHits;
121 
122  int n = slicesToNavigate.size();
123  for(int i=0 ; i < n; ++i ){
124  // If DimOthers option is chosen, hits from slices
125  // other than the current slice should be dimmed.
126 
127  if( nav->DimOthers() && !nav->FullEventMode() ){
128  if( i != nav->CurrentSliceIndex() )
129  continue;
130  }
131  for( int c = 0, nc = slicesToNavigate[i]->NCell(); c < nc; ++c){
132  rb::CellHit chit = *(slicesToNavigate[i]->Cell(c));
133 
134  unfiltHits.emplace(chit.Channel(), chit.TDC());
135  }
136  }
137 
138  unsigned int ix; // hardware x coordinate
139  unsigned int iy; // hardware y coordinate
140 
141  std::vector< const rawdata::RawDigit*> rawhits;
142  this->GetRawDigitsAllLabels(evt, rawhits);
143 
144  for (unsigned int i=0; i<rawhits.size(); ++i) {
145  unsigned int ch = rawhits[i]->DaqChannel();
146  unsigned int diblock = (ch&0x0FC00000)>>22;
147  unsigned int dcm = (ch&0x003F0000)>>16;
148  unsigned int feb = (ch&0x0000FF00)>>8;
149  unsigned int pix = (ch&0x000000FF)>>0;
150 
151  hd.DAQToXY(diblock, dcm, feb, pix, &ix, &iy);
152  double t = 0;
153  double q = 0;
154 
155  t = rawhits[i]->TDC() * kUSEC_PER_TDC;
156  q = rawhits[i]->ADC();
157  if (q<=0.0) q=1.;
158 
159  //
160  // Draw markers representing hits
161  //
162  int ghosted;
163  int co = this->HitColor(rawhits[i], unfiltHits, &ghosted);
164  if (drawopt->fRawDrawingOpt &
166  if (ghosted) continue;
167  }
168  double sf = this->ScaleFactor(t, q);
169 
170  TBox& b1 = view->AddBox(ix-0.5*sf,iy-0.5*sf,ix+0.5*sf,iy+0.5*sf);
171  b1.SetFillStyle(1001);
172  b1.SetFillColor(co);
173  b1.SetBit(kCannotPick);
174 
176  TBox& b2 = view->AddBox(ix-0.5*sf,iy-0.5*sf,ix+0.5*sf,iy+0.5*sf);
177  b2.SetFillStyle(0);
178  if (ghosted) b2.SetLineColor(17); // Greyed out hit
179  else b2.SetLineColor(14);
180  b2.SetBit(kCannotPick);
181  }
182  }// end loop over hits
183 
184  // Now draw hardware boundaries and labels
185 
186  // Vertical lines marking the FEB boundaries. Also mark diblock
187  // boundaries periodically
188 
189  for (unsigned int i=0; i<=hd.fNdiblocks*hd.fNfebCols; ++i) {
190  int lw = 1;
191  int co = 33;
192  if (i%hd.fNfebCols==0) { lw = 1; co = 38; }
193  TLine& l = view->AddLine(i*hd.fNpixCols-0.5, -0.5,
194  i*hd.fNpixCols-0.5, hd.fYmax-0.5);
195  l.SetLineStyle(1);
196  l.SetLineColor(co);
197  l.SetLineWidth(lw);
198  l.SetBit(kCannotPick);
199  }
200  for (unsigned int i=0; i<(hd.fNdcmTop+hd.fNdcmSide)*hd.fNfebRows; ++i) {
201  int lw = 1;
202  int co = 33;
203  if (i%hd.fNfebRows==0) { lw = 1; co = 38; }
204  TLine& l = view->AddLine(-0.5, i*hd.fNpixRows-0.5,
205  hd.fXmax-0.5,i*hd.fNpixRows-0.5);
206  l.SetLineStyle(1);
207  l.SetLineColor(co);
208  l.SetLineWidth(lw);
209  l.SetBit(kCannotPick);
210  }
211 
212  for (unsigned int i=1; i<=hd.fNdiblocks; ++i) {
213  char buff[128];
214  sprintf(buff,"DB%.2u",i);
215  iy = -hd.fYmax/200;
216  hd.DAQToXY(i,1,0,0,&ix,&iy);
217  TText& t = view->AddText(ix,-1,buff);
218  t.SetTextSize(0.04);
219  t.SetTextAlign(13);
220  }
221 
222  for (unsigned int i=1; i<=hd.fNdcmTop+hd.fNdcmSide; ++i) {
223  char buff[128];
224  sprintf(buff,"DCM%.2u",i);
225  hd.DAQToXY(1,i,32,0,&ix,&iy);
226  ix = -hd.fXmax/200;
227  TText& t = view->AddText(-1,iy,buff);
228  t.SetTextSize(0.04);
229  t.SetTextAlign(31);
230  }
231  }
static const int kSUPPRESS_GHOSTED_HITS
diblock
print "ROW IS " print row
Definition: geo2elec.py:31
unsigned int fXmax
Width of entire view.
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
unsigned int fNdcmSide
Number of DMC&#39;s per diblock on side of detector.
TLine & AddLine(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:187
bool DimOthers() const
void DAQToXY(unsigned int db, unsigned int dcm, unsigned int feb, unsigned int pix, unsigned int *ix, unsigned int *iy)
TBox & AddBox(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:263
unsigned int fNdiblocks
Number of diblocks in detector.
void GetRawDigitsAllLabels(const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
unsigned int fNfebRows
Number of FEB rows in a DCM.
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
TText & AddText(double x, double y, const char *text)
Definition: View2D.cxx:286
unsigned int fNdcmTop
Number of DMC&#39;s per diblock on top of detector.
double ScaleFactor(double t, double q)
static double kUSEC_PER_TDC
unsigned int fYmax
Height of entire view.
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
unsigned int fNfebCols
Number of FEB columns in a DCM.
enum BeamMode nc
uint32_t Channel() const
Definition: RawDigit.h:84
unsigned int fNpixCols
Number of pixel columns in an FEB.
static const int kRAW_HITS
int HitColor(const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered, int *ghosted)
Helper for AttenCurve.
Definition: Path.h:10
TH1F * hd
Definition: Xdiff_gwt.C:57
unsigned int fNpixRows
Number of pixel rows in an FEB.
std::vector< const rb::Cluster * > SlicesToNavigate(const art::Event &evt)
int fOutline
Which outlines to draw.
double evd::RawDataDrawer::ScaleFactor ( double  t,
double  q 
)
private

Determine the scale factor to use when rendering hit cells

Definition at line 692 of file RawDataDrawer.cxx.

References evd::RawDrawingOptions::fRawDrawingOpt, evd::RawDrawingOptions::fScaleFactor, evd::RawDrawingOptions::kSCALE_HITS_BY_CHARGE, and std::sqrt().

Referenced by Draw3DHitBoxes(), RawDigit2D(), and RawDigitHardware().

693  {
695 
696  double sf = drawopt->fScaleFactor;
697  double q0 = 4096.0;
699  sf *= 3.0*sqrt(q/q0);
700  }
701  return sf;
702  }
T sqrt(T number)
Definition: d0nt_math.hpp:156
static const int kSCALE_HITS_BY_CHARGE
void evd::RawDataDrawer::StickFigure ( evdb::View3D view,
double  x,
double  y,
double  z 
)
private

Draw a stick figure to scale

Definition at line 707 of file RawDataDrawer.cxx.

References a, evdb::View3D::AddPolyLine3D(), b, readPickles::body, stan::math::fabs(), make_syst_table_plots::h, MECModelEnuComparisons::i, kOrange, submit_hadd::l, MECModelEnuComparisons::leg, xhi, make_syst_table_plots::xlo, yhi, and ylo.

Referenced by RawDigit3D().

711  {
712  double h = 178.0; // Average height of a man
713  double xlo= 9E9;
714  double xhi=-9E9;
715  double ylo= 9E9;
716  double yhi=-9E9;
717  double leg[8][2] = {
718  {406,-618}, // 0
719  {392,-576}, // 1
720  {481,-509}, // 2
721  {511,-403}, // 3
722  {444,-385}, // 4
723  {451,-495}, // 5
724  {451,-618}, // 6
725  {429,-617} // 7
726  };
727  double arms[8][2] = {
728  {537,-414}, // 0
729  {535,-394}, // 1
730  {552,-309}, // 2
731  {550,-228}, // 3
732  {462,-239}, // 4
733  {401,-290}, // 5
734  {453,-345}, // 6
735  {447,-363} // 7
736  };
737  double body[9][2] = {
738  {479,-394}, // 0
739  {504,-221}, // 1
740  {493,-220}, // 2
741  {478,-212}, // 3
742  {473,-181}, // 4
743  {491,-165}, // 5
744  {521,-174}, // 6
745  {522,-211}, // 7
746  {504,-221} // 8
747  };
748  int i;
749  for (i=0; i<8; ++i) {
750  if (leg[i][0]<xlo) xlo = leg[i][0];
751  if (leg[i][0]>xhi) xhi = leg[i][0];
752  if (leg[i][1]<ylo) ylo = leg[i][1];
753  if (leg[i][1]>yhi) yhi = leg[i][1];
754  }
755  for (i=0; i<8; ++i) {
756  if (arms[i][0]<xlo) xlo = arms[i][0];
757  if (arms[i][0]>xhi) xhi = arms[i][0];
758  if (arms[i][1]<ylo) ylo = arms[i][1];
759  if (arms[i][1]>yhi) yhi = arms[i][1];
760  }
761  for (i=0; i<8; ++i) {
762  if (body[i][0]<xlo) xlo = body[i][0];
763  if (body[i][0]>xhi) xhi = body[i][0];
764  if (body[i][1]<ylo) ylo = body[i][1];
765  if (body[i][1]>yhi) yhi = body[i][1];
766  }
767 
768  double sf = h/fabs(yhi-ylo);
769 
770  double z0 = z-sf*fabs(xhi-xlo)-2.0;
771  double y0 = y+2.0;
772  for (i=0; i<8; ++i) {
773  leg[i][0] = z0+sf*(leg[i][0]-xlo);
774  leg[i][1] = y0+sf*(leg[i][1]-ylo);
775  }
776  for (i=0; i<8; ++i) {
777  arms[i][0] = z0+sf*(arms[i][0]-xlo);
778  arms[i][1] = y0+sf*(arms[i][1]-ylo);
779  }
780  for (i=0; i<9; ++i) {
781  body[i][0] = z0+sf*(body[i][0]-xlo);
782  body[i][1] = y0+sf*(body[i][1]-ylo);
783  }
784 
785  TPolyLine3D& l = view->AddPolyLine3D(8,kOrange-9,1,2);
786  TPolyLine3D& a = view->AddPolyLine3D(8,kOrange-9,1,2);
787  TPolyLine3D& b = view->AddPolyLine3D(9,kOrange-9,1,2);
788  l.SetLineStyle(1);
789  a.SetLineStyle(1);
790  b.SetLineStyle(1);
791  l.SetLineWidth(1);
792  a.SetLineWidth(1);
793  b.SetLineWidth(1);
794  for (i=0; i<8; ++i) {
795  l.SetPoint(i,x,leg[i][1],leg[i][0]);
796  }
797  for (i=0; i<8; ++i) {
798  a.SetPoint(i,x,arms[i][1],arms[i][0]);
799  }
800  for (i=0; i<9; ++i) {
801  b.SetPoint(i,x,body[i][1],body[i][0]);
802  }
803  }
enum BeamMode kOrange
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
string body
Definition: readPickles.py:54
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
const double a
z
Definition: test.py:28
const hit & b
Definition: hits.cxx:21

Member Data Documentation

double evd::RawDataDrawer::fXmax
private

X range spanned by the hits.

Definition at line 84 of file RawDataDrawer.h.

Referenced by GetLimits(), and RawDigit2D().

double evd::RawDataDrawer::fXmin
private

Definition at line 84 of file RawDataDrawer.h.

Referenced by GetLimits(), and RawDigit2D().

double evd::RawDataDrawer::fYmax
private

Y range spanned by the hits.

Definition at line 85 of file RawDataDrawer.h.

Referenced by GetLimits(), and RawDigit2D().

double evd::RawDataDrawer::fYmin
private

Definition at line 85 of file RawDataDrawer.h.

Referenced by GetLimits(), and RawDigit2D().

double evd::RawDataDrawer::fZmax
private

Z range spanned by the hits.

Definition at line 86 of file RawDataDrawer.h.

Referenced by GetLimits(), and RawDigit2D().

double evd::RawDataDrawer::fZmin
private

Definition at line 86 of file RawDataDrawer.h.

Referenced by GetLimits(), and RawDigit2D().


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