RawDataDrawer.cxx
Go to the documentation of this file.
1 ///
2 /// \file RawDataDrawer.cxx
3 /// \brief Class to aid in the rendering of RawData objects
4 /// \author messier@indiana.edu
5 /// \version $Id: RawDataDrawer.cxx,v 1.30 2012-08-28 22:00:57 denis Exp $
6 ///
7 #include <cmath>
8 
9 #include "TBox.h"
10 #include "TLine.h"
11 #include "TText.h"
12 #include "TH1F.h"
13 #include "TMarker3DBox.h"
14 #include "TPolyLine3D.h"
15 #include "TPolyMarker3D.h"
16 
20 
23 
24 #include "DAQChannelMap/HardwareDisplay.h"
27 #include "EventDisplay/HitTower.h"
34 #include "Geometry/Geometry.h"
36 #include "RawData/RawDigit.h"
37 #include "RecoBase/CellHit.h"
38 #include "RawData/RawTrigger.h"
39 #include "Calibrator/Calibrator.h"
41 
42 namespace {
43  // Utility function to make uniform error messages.
44  void writeErrMsg(const char* fcn,
45  cet::exception const& e)
46  {
47  std::cout << "RawDataDrawer::" << fcn
48  << " failed with message:\n"
49  << e
50  << std::endl;
51  }
52 }
53 
54 namespace evd
55 {
56  //
57  // Conversion constant from NOvA clock ticks to micro-seconds
58  //
59  static double kUSEC_PER_TDC = 1.e6/64000000.0;
60 
61  //.....................................................................
62 
64 
65  //......................................................................
66 
68 
69  //......................................................................
70 
72  TH1F* thisto,
73  TH1F* qhisto)
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  }
99 
100  //......................................................................
101  ///
102  /// Draw raw data according to hardware address
103  ///
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  }
232 
233  //......................................................................
234 
236  evdb::View2D* xzview,
237  evdb::View2D* yzview)
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  }
373 
374  //......................................................................
375 
376  void RawDataDrawer::
377  Draw3DHitBoxes(std::vector<const rawdata::RawDigit*>& rawhits,
378  const std::set<std::pair<uint32_t, int16_t>>& unfiltHits,
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  }
427 
428  //....................................................................
429 
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  }
470 
471  //......................................................................
472 
473  void RawDataDrawer::GetLimits(double* xmin, double* xmax,
474  double* ymin, double* ymax,
475  double* zmin, double* zmax)
476  {
477  *xmin = fXmin;
478  *xmax = fXmax;
479  *ymin = fYmin;
480  *ymax = fYmax;
481  *zmin = fZmin;
482  *zmax = fZmax;
483  }
484 
485  //......................................................................
486 
487  template<class T> bool RawDataDrawer::
489  const std::string& which,
490  const std::string& instance,
491  std::vector<const rawdata::RawDigit*>& rawhits)
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  }
519 
520  //......................................................................
521 
522  bool RawDataDrawer::
524  std::vector<const rawdata::RawDigit*>& rawhits)
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  }
553 
554  //......................................................................
555 
557  std::vector<const rawdata::RawDigit*>& rawhits)
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  }
598 
599  //......................................................................
600 
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  }
627 
628  //......................................................................
629 
630  ///
631  /// Determine the color to use for the hit. If the hit is flagged
632  /// to be ghosted out by either its time or charge, ghost the hit
633  ///
635  const std::set<std::pair<uint32_t, int16_t>>& unfiltered,
636  int* ghosted)
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  }
674 
675  //......................................................................
676 
677 
679  const std::set<std::pair<uint32_t, int16_t>>& unfiltered)
680  {
682  if(!nav->DimHits() && !nav->DimOthers() ) return false;
683 
684  return unfiltered.count(std::make_pair(hit->Channel(), hit->TDC())) == 0;
685  }
686 
687  //......................................................................
688 
689  ///
690  /// Determine the scale factor to use when rendering hit cells
691  ///
692  double RawDataDrawer::ScaleFactor(double /*t*/, double q)
693  {
695 
696  double sf = drawopt->fScaleFactor;
697  double q0 = 4096.0;
699  sf *= 3.0*sqrt(q/q0);
700  }
701  return sf;
702  }
703 
704  ///
705  /// Draw a stick figure to scale
706  ///
708  double x,
709  double y,
710  double z)
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  }
804 
805 } // end namespace evd
806 ////////////////////////////////////////////////////////////////////////
bool DimFiltered(const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered)
void RawDigitHardware(const art::Event &evt, evdb::View2D *view)
std::vector< float > fTimeRange
enum BeamMode kOrange
static const int kSUPPRESS_GHOSTED_HITS
diblock
print "ROW IS " print row
Definition: geo2elec.py:31
double HalfD() const
Definition: CellGeo.cxx:205
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
unsigned int fXmax
Width of entire view.
std::map< std::string, double > xmax
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
void RawDigit2D(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
double fXmax
X range spanned by the hits.
Definition: RawDataDrawer.h:84
unsigned int fNdcmSide
Number of DMC&#39;s per diblock on side of detector.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
void swap(PtrVector &other)
Definition: PtrVector.h:522
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
void GetLimits(double *xmin, double *xmax, double *ymin, double *ymax, double *zmin, double *zmax)
TF1 * fcn
Definition: warp_gsimple.C:35
TLine & AddLine(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:187
bool DimOthers() const
string body
Definition: readPickles.py:54
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
const char * p
Definition: xmltok.h:285
T sqrt(T number)
Definition: d0nt_math.hpp:156
Define a color scale for displaying numeric data.
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
bool InBounds(double x) const
Definition: ColorScale.cxx:113
OStream cerr
Definition: OStream.cxx:7
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::vector< std::string > fCellHitsModules
A collection of drawable 2-D objects.
static const int kSCALE_HITS_BY_CHARGE
int GetColor(double x) const
Definition: ColorScale.cxx:126
void DAQToXY(unsigned int db, unsigned int dcm, unsigned int feb, unsigned int pix, unsigned int *ix, unsigned int *iy)
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
const PlaneGeo * Plane(unsigned int i) const
void RawDigit3D(const art::Event &evt, evdb::View3D *view)
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
void CellInfo(unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
static const int kSUPPRESS_DIMMED_HITS
Double_t ymax
Definition: plot.C:25
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
static const int kCOLOR_BY_TIME
TBox & AddBox(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:263
unsigned int fNdiblocks
Number of diblocks in detector.
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
int colors[6]
Definition: tools.h:1
double dy[NP][NC]
std::vector< std::string > fRawDigitsModules
double dx[NP][NC]
nova event display
int Background(int i=0)
double dz[NP][NC]
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
std::vector< std::string > fRawDigitsInstances
void GetRawDigitsAllLabels(const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
unsigned int fNfebRows
Number of FEB rows in a DCM.
const double a
int GetRawTrigger(const art::Event &evt, art::PtrVector< rawdata::RawTrigger > &rawtrigger)
ColorScale & Scale(const std::string &nm)
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
int evt
TText & AddText(double x, double y, const char *text)
Definition: View2D.cxx:286
void FillTQHisto(const art::Event &evt, TH1F *thisto, TH1F *qhisto)
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: DataViewImpl.h:446
unsigned int fNdcmTop
Number of DMC&#39;s per diblock on top of detector.
unsigned short GetPlane(const rawdata::RawDigit *dig)
Definition: CMap.cxx:285
double ScaleFactor(double t, double q)
static const int kCOLOR_BY_CHARGE
double DetHalfHeight() const
z
Definition: test.py:28
void StickFigure(evdb::View3D *view, double x, double y, double z)
size_type size() const
Definition: PtrVector.h:308
Class to aid in the rendering of RawData objects.
static double kUSEC_PER_TDC
unsigned int fYmax
Height of entire view.
OStream cout
Definition: OStream.cxx:6
static const int kMASK_BAD_CHANNELS
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
double fYmax
Y range spanned by the hits.
Definition: RawDataDrawer.h:85
double DetHalfWidth() const
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
Plot hits (Raw, Calib, ...) as a tower in 3D.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Definition: structs.h:12
void geom(int which=0)
Definition: geom.C:163
unsigned int fNfebCols
Number of FEB columns in a DCM.
int Apply(art::PtrVector< rawdata::RawDigit > &rd)
const hit & b
Definition: hits.cxx:21
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
TRandom3 r(0)
unsigned short GetCell(const rawdata::RawDigit *dig)
Definition: CMap.cxx:327
Global drawing options that apply to all displays.
Double_t ymin
Definition: plot.C:24
double fZmax
Z range spanned by the hits.
Definition: RawDataDrawer.h:86
A collection of 3D drawable objects.
double T
Definition: Xdiff_gwt.C:5
bool GetRawDigits(const art::Event &evt, const std::string &which, const std::string &instance, std::vector< const rawdata::RawDigit * > &rawhits)
unsigned int NPlanes() const
unsigned int fNpixCols
Number of pixel columns in an FEB.
static const int kRAW_HITS
Float_t e
Definition: plot.C:35
Encapsulate the cell geometry.
Definition: CellGeo.h:25
std::vector< std::string > fCellHitsInstances
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
void clear()
Definition: PtrVector.h:537
Definition: fwd.h:28
unsigned int fNpixRows
Number of pixel rows in an FEB.
Encapsulate the geometry of one entire detector (near, far, ndos)
static void XYZ(double *xyz)
std::vector< const rb::Cluster * > SlicesToNavigate(const art::Event &evt)
bool failedToGet() const
Definition: Handle.h:196
int fOutline
Which outlines to draw.
Global drawing options that apply to all displays.
bool GetRawDigitsMulti(const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
enum BeamMode string