LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
TWQMultiTPCProjection.cxx
Go to the documentation of this file.
1 //
6 #include "TCanvas.h"
7 #include "TFrame.h"
8 #include "TGFrame.h" // For TGMainFrame, TGHorizontalFrame
9 #include "TGLayout.h" // For TGLayoutHints
10 #include "TGDimension.h"
11 #include "TGNumberEntry.h"
12 #include "TGLabel.h"
13 #include "TMath.h"
14 #include "TString.h"
15 #include "TRootEmbeddedCanvas.h"
16 #include "TLine.h"
17 #include "Buttons.h"
18 #include "TGTextView.h"
19 #include "TROOT.h"
20 #include "sstream"
21 
37 
45 
46 //#include "EventDisplay/InfoTransfer.h"
48 
49 namespace evd{
50 
51  static unsigned int kPlane;
52  static unsigned int kWire;
53  static double kDistance;
54  static int curr_zooming_plane;
55  static const char* zoom_opt=0;
56 
57  static int shift_lock;
58 
59 
60  //......................................................................
62  : evdb::Canvas(mf)
63  {
64 
66 
67  // first make pads for things that don't depend on the number of
68  // planes in the detector
69  // bottom left corner is (0.,0.), top right is (1., 1.)
70 
71  evdb::Canvas::fCanvas->cd();
72  fHeaderPad = new HeaderPad("fHeaderPadMultiTPC","Header",0.0,0.0,0.15,0.13,"");
73  fHeaderPad->Draw();
74 
75  evdb::Canvas::fCanvas->cd();
76  fMC = new MCBriefPad("fMCPadMultiTPC","MC Info.",0.15,0.13,1.0,0.17,"");
77  fMC->Draw();
78 
79  evdb::Canvas::fCanvas->cd();
80  fWireQ = new TQPad("fWireQPadMultiTPC", "ADCvsTime",0.15,0.0,1.0,0.13,"TQ", 0, 0);
81  fWireQ->Pad()->SetBit(TPad::kCannotMove,true);
82  fWireQ->Draw();
83 
84 
85  // add new "meta frame" to hold the GUI Canvas and a side frame (vframe)
86  fMetaFrame = new TGCompositeFrame(mf, 60, 60, kHorizontalFrame);
87  fMetaFrame->SetBit(TPad::kCannotMove,true);
88 
89  //new frame organizing the buttons on the left of the canvas.
90  fVFrame = new TGCompositeFrame(fMetaFrame, 60, 60, kVerticalFrame);
91  // Define a layout for placing the canvas within the frame.
92  fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX |
93  kLHintsExpandY, 5, 5, 5, 5);
94 
95  mf->RemoveFrame((TGFrame *)fEmbCanvas);
96  mf->RemoveFrame(fFrame);
97 
98  fEmbCanvas->ReparentWindow( fMetaFrame, fXsize, fYsize);
99 
100 
101  fMetaFrame->AddFrame(fVFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY));
102  fMetaFrame->AddFrame(fEmbCanvas, fLayout);
103 
104 
105  mf->AddFrame(fMetaFrame,fLayout);
106  mf->AddFrame(fFrame);
107 
108  // plane number entry
109  fPlaneEntry = new TGNumberEntry(fFrame,
110  0,2,-1,
111  TGNumberFormat::kNESInteger,
112  TGNumberFormat::kNEAAnyNumber,
113  TGNumberFormat::kNELLimitMinMax,
114  0, geo->Nplanes()-1 );
115 
116  kPlane = 0;
117  kWire = TMath::Nint(0.5*geo->Nwires(0));
118  kDistance=1.5;
119  fWireQ->SetPlaneWire(kPlane, kWire);
120 
121  // Initial value
122  fPlaneEntry->SetNumber( kPlane );
123 
124  // There are two "signals" to which a TGNumberEntry may respond:
125  // when the user clicks on the arrows, or when the user types in a
126  // new number in the text field.
127  fPlaneEntry->Connect("ValueSet(Long_t)", "evd::TWQMultiTPCProjectionView", this, "SetPlane()");
128  fPlaneEntry->GetNumberEntry()->Connect("ReturnPressed()", "evd::TWQMultiTPCProjectionView", this, "SetPlane()");
129  // Text label for this numeric field.
130  fPlaneLabel= new TGLabel(fFrame,"Plane");
131 
132  // wire number entry
133  fWireEntry = new TGNumberEntry(fFrame,0,6,-1,
134  TGNumberFormat::kNESInteger,
135  TGNumberFormat::kNEAAnyNumber,
136  TGNumberFormat::kNELLimitMinMax,
137  0, geo->Nwires(0)-1 );
138  // Initial value
139  fWireEntry->SetNumber( kWire );
140 
141  // There are two "signals" to which a TGNumberEntry may respond:
142  // when the user clicks on the arrows, or when the user types in a
143  // new number in the text field.
144  fWireEntry->Connect("ValueSet(Long_t)", "evd::TWQMultiTPCProjectionView", this, "SetWire()");
145  fWireEntry->GetNumberEntry()->Connect("ReturnPressed()", "evd::TWQMultiTPCProjectionView", this, "SetWire()");
146 
147  // Text label for this numeric field.
148  fWireLabel= new TGLabel(fFrame,"Wire");
149 
150  // adc threshold number entry
151  fThresEntry = new TGNumberEntry(fFrame,0,6,-1,
152  TGNumberFormat::kNESInteger,
153  TGNumberFormat::kNEAAnyNumber,
154  TGNumberFormat::kNELLimitMinMax,
155  0 , geo->Nwires(0)-1 );
156  // Initial value
161 
162 
163  fThresEntry->SetNumber( rawopt->fMinSignal );
164 
165  // There are two "signals" to which a TGNumberEntry may respond:
166  // when the user clicks on the arrows, or when the user types in a
167  // new number in the text field.
168  fThresEntry->Connect("ValueSet(Long_t)", "evd::TWQMultiTPCProjectionView", this, "SetThreshold()");
169  fThresEntry->GetNumberEntry()->Connect("ReturnPressed()", "evd::TWQMultiTPCProjectionView", this, "SetThreshold()");
170 
171  // Text label for this numeric field.
172  fThresLabel= new TGLabel(fFrame,"ADC Threshold");
173 
174  // check button to toggle color vs grey
175  fGreyScale = new TGCheckButton(fFrame,"Grayscale",1);
176  fGreyScale->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "SetGreyscale()");
177  if(cst->fColorOrGray == 1) fGreyScale->SetState(kButtonDown);
178 
179  // check button to toggle MC information
180  if(evdlayoutopt->fEnableMCTruthCheckBox){
181  fMCOn = new TGCheckButton(fFrame,"MC Truth",5);
182  fMCOn->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "SetMCInfo()");
183  if(sdo->fShowMCTruthText == 1) fMCOn->SetState(kButtonDown);
184  }
185 
186  // radio buttons to toggle drawing raw vs calibrated information
187  fRawCalibDraw = new TGRadioButton(fFrame,"Both", 2);
188  fCalibDraw = new TGRadioButton(fFrame,"Reconstructed", 3);
189  fRawDraw = new TGRadioButton(fFrame,"Raw", 4);
190  fRawDraw ->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "SetRawCalib()");
191  fCalibDraw ->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "SetRawCalib()");
192  fRawCalibDraw->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "SetRawCalib()");
193  if(rawopt->fDrawRawDataOrCalibWires == 0) fRawDraw->SetState(kButtonDown);
194  else if(rawopt->fDrawRawDataOrCalibWires == 1) fCalibDraw->SetState(kButtonDown);
195  else if(rawopt->fDrawRawDataOrCalibWires == 2) fRawCalibDraw->SetState(kButtonDown);
196 
197  // Put all these widgets into the frame. The last
198  // four numbers in each TGLayoutHint are padleft, padright,
199  // padtop, padbottom.
200  if(evdlayoutopt->fEnableMCTruthCheckBox){
201  fFrame->AddFrame(fMCOn, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
202  }
203  fFrame->AddFrame(fGreyScale, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
204  fFrame->AddFrame(fRawCalibDraw, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
205  fFrame->AddFrame(fCalibDraw, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
206  fFrame->AddFrame(fRawDraw, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
207  fFrame->AddFrame(fPlaneEntry, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 2, 1 ) );
208  fFrame->AddFrame(fPlaneLabel, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
209  fFrame->AddFrame(fWireEntry, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 2, 1 ) );
210  fFrame->AddFrame(fWireLabel, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
211  fFrame->AddFrame(fThresEntry, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 2, 1 ) );
212  fFrame->AddFrame(fThresLabel, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
213 
214  if(evdlayoutopt->fShowSideBar)
215  SetUpSideBar();
216  else
217  evdlayoutopt->fShowEndPointSection=0; // zero it to avoid a misconfiguration in the fcl file.
218 
219  //zero the ppoints queue.
220  ppoints.clear();
221  pline.clear();
222 
223  // geometry to figure out the number of TPCs
224  unsigned int ntpc = geo->NTPC();
225 
226  // geometry to figure out the number of planes
227  unsigned int nplanes = geo->Nplanes();
228 
229  // now determine the positions of all the time vs wire number
230  // and charge histograms for the planes
231  for(unsigned int t = 0; t < ntpc; ++t){
232  for(unsigned int i = 0; i < nplanes; ++i){
233  double twx1 = 0. + t*0.97/(1.*ntpc);
234  double twx2 = t*0.97/(1.*ntpc);
235  double twx3 = 1.0;
236  double twy1 = 0.17 + (i)*(1.0-0.171)/(1.*nplanes);
237  double twy2 = 0.17 + (i+1)*(1.0-0.171)/(1.*nplanes);
238 
239  TString padname = "fWireProjTPC";
240  padname += t;
241  padname += "Plane";
242  padname += i;
243 
244  TString padtitle = "TPC";
245  padtitle += t;
246  padtitle += "Plane";
247  padtitle += i;
248 
249  evdb::Canvas::fCanvas->cd();
250 
251  mf::LogVerbatim("MultiTPC") << "make new plane ";
252  fPlanes.push_back(new TWireProjPad(padname, padtitle, twx1, twy1, twx2, twy2, i+t*nplanes));
253  fPlanes.back()->Draw();
254 // fPlanes.back()->Pad()->AddExec("mousedispatch",
255 // Form("evd::TWQMultiTPCProjectionView::MouseDispatch(%d, (void*)%d)",
256 // i+t*nplanes, this)
257 // );
258  fPlanes.back()->Pad()->AddExec("mousedispatch",
259  Form("evd::TWQMultiTPCProjectionView::MouseDispatch(%d, (void*)%lu)",
260  i+t*nplanes, (unsigned long) this)
261  );
262 
263  mf::LogVerbatim("MultiTPC") << "size of planes vec is now " << fPlanes.size();
264 
265  if(t+1 == ntpc){
266  padname = "fQPadTPC";
267  padname += t;
268  padname += "Plane";
269  padname += i;
270 
271  padtitle = "QTPC";
272  padtitle += t;
273  padname += "Plane";
274  padname += i;
275 
276  evdb::Canvas::fCanvas->cd();
277  fPlaneQ.push_back(new TQPad(padname, padtitle, twx2, twy1, twx3, twy2, "Q", i, 0));
278  fPlaneQ[i]->Draw();
279  }
280  }// end loop to draw pads
281  }
282 
283  evdb::Canvas::fCanvas->Update();
284 
285  }
286 
287  //......................................................................
289  {
290  if (fHeaderPad) { delete fHeaderPad; fHeaderPad = 0; }
291  if (fMC) { delete fMC; fMC = 0; }
292  if (fWireQ) { delete fWireQ; fWireQ = 0; }
293  if (fPlaneEntry){ delete fPlaneEntry; fPlaneEntry = 0; }
294  if (fWireEntry) { delete fWireEntry; fWireEntry = 0; }
295  if (fPlaneLabel){ delete fPlaneLabel; fPlaneLabel = 0; }
296  if (fWireLabel) { delete fWireLabel; fWireLabel = 0; }
297  for(unsigned int i = 0; i < fPlanes.size(); ++i){
298  if(fPlanes[i]){ delete fPlanes[i]; fPlanes[i] = 0; }
299  if(fPlaneQ[i]){ delete fPlaneQ[i]; fPlaneQ[i] = 0; }
300  }
301  fPlanes.clear();
302  fPlaneQ.clear();
303  }
304 
305  //......................................................................
306  void TWQMultiTPCProjectionView::DrawPads(const char* /*opt*/)
307  {
308  for(unsigned int i=0; i<fPlanes.size();++i){
309  fPlanes[i]->Draw();
310  fPlanes[i]->Pad()->Update();
311  fPlanes[i]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,true);
312  }
313  for(unsigned int j=0;j<fPlaneQ.size();++j){
314  fPlaneQ[j]->Draw();
315  fPlaneQ[j]->Pad()->Update();
316  fPlaneQ[j]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,true);
317  }
318  }
319  //......................................................................
320  void TWQMultiTPCProjectionView::Draw(const char* opt)
321  {
323 
324  fPrevZoomOpt.clear();
325 
326  evdb::Canvas::fCanvas->cd();
327  zoom_opt=0;
328  fHeaderPad->Draw();
329  fMC ->Draw();
330  fWireQ->Draw();
331 
333 
334  if(evdlayoutopt->fPrintTotalCharge) PrintCharge();
335 
336  //clear queue of selected points
337  ppoints.clear();
338  pline.clear();
339  // Reset current zooming plane - since it's not currently zooming.
340  curr_zooming_plane=-1;
341 
342  // double Charge=0, ConvCharge=0;
343  for(size_t i = 0; i < fPlanes.size(); ++i){
344  fPlanes[i]->Draw(opt);
345  fPlanes[i]->Pad()->Update();
346  fPlanes[i]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,true);
347  fPlaneQ[i]->Draw();
348  std::vector<double> ZoomParams = fPlanes[i]->GetCurrentZoom();
349  fZoomOpt.wmin[i] = ZoomParams[0];
350  fZoomOpt.wmax[i] = ZoomParams[1];
351  fZoomOpt.tmin[i] = ZoomParams[2];
352  fZoomOpt.tmax[i] = ZoomParams[3];
353  }
354 
355  // Reset any text boxes which are enabled
356  if(fXYZPosition)
357  fXYZPosition->SetForegroundColor(kBlack);
358 
359  if(fAngleInfo)
360  fAngleInfo->SetForegroundColor(kBlack);
361 
362  evdb::Canvas::fCanvas->Update();
363  }
364 
365  // comment out this method as for now we don't want to change every
366  // plane to have the same range in wire number because wire numbers
367  // don't necessarily overlap from plane to plane, ie the same range
368  // isn't appropriate for every plane
369  //......................................................................
370  // void TWQMultiTPCProjectionView::RangeChanged()
371  // {
372  // static int ilolast = -1;
373  // static int ihilast = -1;
374  //
375  // int ilo;
376  // int ihi;
377  // std::vector<int> lo;
378  // std::vector<int> hi;
379  // std::vector<bool> axischanged;
380  // for(unsigned int i = 0; i < fPlanes.size(); ++i){
381  // fPlanes[i]->GetWireRange(&ilo, &ihi);
382  // lo.push_back(ilo);
383  // hi.push_back(ihi);
384  // axischanged.push_back((ilo != ilolast) || (ihi != ihilast));
385  // }
386  //
387  // TVirtualPad* ori = gPad;
388  //
389  // // loop over the bools to see which axes need to change
390  // for(unsigned int i = 0; i < axischanged.size(); ++i){
391  // if (axischanged[i]) {
392  // fPlanes[i]->SetWireRange(ilo, ihi);
393  // fPlanes[i]->Pad()->cd();
394  // fPlanes[i]->Pad()->Modified();
395  // fPlanes[i]->Pad()->Update();
396  //
397  // ilolast = ilo;
398  // ihilast = ihi;
399  // }
400  // }
401  //
402  // evdb::Canvas::fCanvas->cd();
403  // evdb::Canvas::fCanvas->Modified();
404  // evdb::Canvas::fCanvas->Update();
405  // ori->cd();
406  // }
407  //......................................................................
408  //......................................................................
410  {
411 
414 
415  geo::TPCID tpcid = rawopt->CurrentTPC();
416 
417  for(size_t iplane = 0; iplane < fPlanes.size(); ++iplane){
418  if(geo->SignalType(geo::PlaneID(tpcid, iplane))==geo::kCollection){
419  double ch=0,convch=0;
420  if(rawopt->fDrawRawDataOrCalibWires == 0){
421  fPlanes[iplane]->RawDataDraw()->GetChargeSum(iplane,ch,convch);
422  mf::LogVerbatim("TWQMultiTPCProjectionView") << "Warning! Calculating for RawData! ";
423  }
424  else{
425  fPlanes[iplane]->RecoBaseDraw()->GetChargeSum(iplane,ch,convch);
426  }
427 
428  mf::LogVerbatim("TWQMultiTPCProjectionView") << "\ncharge collected at collection plane: "
429  << iplane << " " << ch << " " << convch;
430  }
431  }
432 
433 
434  }
435 
436  //-------------------------------------------------------------------
437  //......................................................................
438  void TWQMultiTPCProjectionView::MouseDispatch(int plane, void * wqpv)
439  {
440  //initial check for a mouse click on a TBox object
441  int event = gPad->GetEvent();
444 
445  switch (event){
446 
447  case kButton1Shift:
448  shift_lock=1;
449  // TWQMultiTPCProjectionView::SelectHit() is undefined
450  //if(evdlayoutopt->fMakeClusters==1){wqpp->SelectHit(plane);}
451  //else {wqpp->SelectPoint(plane);}
452  wqpp->SelectPoint(plane);
453  break;
454  case kButton1Up:
455  if(shift_lock==1) break;
456  if(evdlayoutopt-> fChangeWire==1) wqpp->ChangeWire(plane);
457  case kButton1Down: shift_lock=0;
458  case kButton1Motion:
459  wqpp->SetMouseZoomRegion(plane);
460  break;
461  // default:
462  }
463  }
464 
465 
466  //......................................................................
468  {
469  //initial check for a mouse click on a TBox object
470  int event = gPad->GetEvent();
471  int px = gPad->GetEventX();
472  if(event!=11) return;
473  TObject *select = gPad->GetSelected();
474  if(!select) return;
475  if(!select->InheritsFrom("TBox")) return;
476 
477  //now find wire that was clicked on
478  float xx = gPad->AbsPixeltoX(px);
479  float x = gPad->PadtoX(xx);
480 
481 
482  kPlane = plane;
483  kWire = (unsigned int)TMath::Nint(x);
484 
485  this->SetPlaneWire();
486 
487  return;
488 
489  }
490 
491  //......................................................................
493  {
494  //initial check for a mouse click on a TBox object
495  int event = gPad->GetEvent();
496 
497  if(event!=7) return;
498 
500  if(evdlayoutopt->fShowEndPointSection!=1)
501  return;
502  //struct planepoint;
503  int px = gPad->GetEventX();
504  double w0 = gPad->AbsPixeltoX(px);
505  double x = gPad->PadtoX(w0);
506 
507  int py = gPad->GetEventY();
508  double t0 = gPad->AbsPixeltoY(py);
509  double y = gPad->PadtoY(t0);
510 
511  util::PxPoint ppx(plane,x,y);
512  curr_zooming_plane=-1;
513 
514  // check if not clicking on a plane that is already in the ppoints list:
515  int repeat_plane=-1;
516  for(size_t ii = 0; ii < this->ppoints.size(); ++ii)
517  if(ppx.plane==this->ppoints[ii].plane){
518  this->ppoints[ii]=ppx;
519  //clear View and draw new Marker
520  this->fPlanes[this->ppoints[ii].plane]->View()->Clear();
521  if(evdlayoutopt->fShowEndPointMarkers)
522  this->fPlanes[this->ppoints[ii].plane]->View()->AddMarker(ppx.w, ppx.t, kRed, 29, 2.0);
523  else
524  this->fPlanes[plane]->View()->AddMarker(0.0,0.0,2,1,0.1);
525  this->fPlanes[this->ppoints[ii].plane]->View()->Draw();
526  repeat_plane=this->ppoints[ii].plane;
527  break;
528  }
529 
530  //if plane does not repeat and size of list is larger than 2 pop_front
531  // and delete its marker. Otherwise just push_back.
532  if(repeat_plane==-1){
533  if( this->ppoints.size()>=2){
534  this->fPlanes[this->ppoints[0].plane]->Pad()->cd();
535  this->fPlanes[this->ppoints[0].plane]->View()->Clear();
536  this->fPlanes[this->ppoints[0].plane]->View()->Draw();
537  this->ppoints.pop_front();
538  }
539  this->ppoints.push_back(ppx);
540  this->fPlanes[plane]->Pad()->cd();
541  this->fPlanes[plane]->View()->Clear();
542  if(evdlayoutopt->fShowEndPointMarkers)
543  this->fPlanes[plane]->View()->AddMarker(ppx.w, ppx.t, kRed, 29, 2.0);
544  else
545  this->fPlanes[plane]->View()->AddMarker(0.0,0.0,2,1,0.1);
546  this->fPlanes[plane]->View()->Draw();
547  }
548 
549 
550  return;
551 
552  }
553 
554  //......................................................................
556  {
557  for (size_t x = 0; x < fPlanes.size(); ++x){
558  fPlanes[x]->Pad()->cd();
559  fPlanes[x]->View()->Clear();
560  fPlanes[x]->View()->AddMarker(0.0,0.0,2,1,0.1);
561  fPlanes[x]->Pad()->Update();
562  fPlanes[x]->View()->Draw();
563  }
564  ppoints.clear();
565  gPad->Modified();
566  gPad->Update();
567  gPad->cd();
568 
569  }
570 
571 
572  //......................................................................
574  {
575  // if list is larger than or equal to two, can project to XYZ and extrapolate to third plane (if exists)
576 
578  // for(unsigned int ix=0;ix<ppoints.size();ix++)
579  // std::cout << "ppoints, planes,x,y :" << ix << " " << ppoints[ix].plane << " " << ppoints[ix].x << " " << ppoints[ix].y << std::endl;
580 
581  if(pline.size() >= 2){
582 
583  double xyz_vertex_fit[3];
584  double second_time;
585  double pos[3];
586  const double origin[3] = {0.,0.,0.};
587  double xx0 = 0., yy0 = 0., zz0 = 0.;
588  double xx1 = 0., yy1 = 0., zz1 = 0.;
589  double length;
590 
591  double y,z;
592 
594  const detinfo::DetectorProperties* detp = lar::providerFrom<detinfo::DetectorPropertiesService>();
596  double ftimetick = detp->SamplingRate()/1000.;
597  double larv = detp->DriftVelocity(detp->Efield(), detp->Temperature());
598 
599  //find channels corresponding to found wires.
600  int chan1 = geom->PlaneWireToChannel(pline[0].plane,pline[0].w0, rawOpt->fTPC, rawOpt->fCryostat);
601  int chan2 = geom->PlaneWireToChannel(pline[1].plane,pline[1].w0, rawOpt->fTPC, rawOpt->fCryostat);
602 
603  bool wires_cross=false;
604  bool time_good=false;
605 
606  if(fabs(pline[0].t0-pline[1].t0) < 200){
607  wires_cross= geom->ChannelsIntersect(chan1,chan2,y,z);
608  time_good=true;
609  }
610  else{
611  TGText *tt=new TGText("too big");
612  tt->InsLine(1,"time distance");
613  fXYZPosition->SetText(tt);
614  fXYZPosition->Update();
615  // return; //not returning, because may need to delete marker from wplane
616  }
617 
618  if(wires_cross){
619  TGText *tt=new TGText("wires cross");
620  fXYZPosition->SetText(tt);
621  fXYZPosition->Update();
622  xyz_vertex_fit[1]=y;
623  xyz_vertex_fit[2]=z;
624  geom->Plane(pline[0].plane).LocalToWorld(origin, pos);
625  xyz_vertex_fit[0]=(pline[0].t0-detp->TriggerOffset())*larv*ftimetick+pos[0];
626  geom->Plane(pline[1].plane).LocalToWorld(origin, pos);
627  second_time=(pline[1].t0-detp->TriggerOffset())*larv*ftimetick+pos[0];
628 
629  xx0=(xyz_vertex_fit[0]+second_time)/2;
630  yy0=y;
631  zz0=z;
632 
634  }
635  else{
636  if(time_good){ //otherwise the wires_cross are false by default
637  TGText *tt=new TGText("cross");
638  tt->InsLine(1,"wires do not");
639  fXYZPosition->SetText(tt);
640  fXYZPosition->Update();
641  }
642  // return; //not returning, because may need to delete marker from wplanereturn;
643  }
644  //find channels corresponding to found wires AT END OF LINE.
645  chan1 = geom->PlaneWireToChannel(pline[0].plane,pline[0].w1, rawOpt->fTPC, rawOpt->fCryostat);
646  chan2 = geom->PlaneWireToChannel(pline[1].plane,pline[1].w1, rawOpt->fTPC, rawOpt->fCryostat);
647 
648  wires_cross=false;
649  time_good=false;
650 
651  if(fabs(pline[0].t1-pline[1].t1) < 200){
652  wires_cross= geom->ChannelsIntersect(chan1,chan2,y,z);
653  time_good=true;
654  }
655  else{
656  TGText *tt=new TGText("too big");
657  tt->InsLine(1,"time distance");
658  fXYZPosition->SetText(tt);
659  fXYZPosition->Update();
660  // return; //not returning, because may need to delete marker from wplane
661  }
662 
663  if(wires_cross){
664  TGText *tt=new TGText("wires do cross");
665  fXYZPosition->SetText(tt);
666  fXYZPosition->Update();
667  xyz_vertex_fit[1]=y;
668  xyz_vertex_fit[2]=z;
669  geom->Plane(pline[0].plane).LocalToWorld(origin, pos);
670  xyz_vertex_fit[0]=(pline[0].t1-detp->TriggerOffset())*larv*ftimetick+pos[0];
671  geom->Plane(pline[1].plane).LocalToWorld(origin, pos);
672  second_time=(pline[1].t1-detp->TriggerOffset())*larv*ftimetick+pos[0];
673 
674  xx1=(xyz_vertex_fit[0]+second_time)/2;
675  yy1=y;
676  zz1=z;
677 
678  }
679  else{
680  if(time_good){ //otherwise the wires_cross are false by default
681  TGText *tt=new TGText("cross");
682  tt->InsLine(1,"wires do not");
683  fXYZPosition->SetText(tt);
684  fXYZPosition->Update();
685  }
686  // return; //not returning, because may need to delete marker from wplanereturn;
687  }
688  //update pad?
689  gPad->Modified();
690  gPad->Update();
691  gPad->cd();
692 
693  length=pow(xx0-xx1,2)+pow(yy0-yy1,2)+pow(zz0-zz1,2);
694  length=pow(length,0.5);
695  return length;
696  } // end if( this->ppoints.size()>=2)
697 
698  else{
699  TGText *tt=new TGText("selected points");
700  tt->InsLine(1,"not enough");
701  fXYZPosition->SetText(tt);
702  fXYZPosition->Update();
703  }
704 
705 
706 
707  return -99;
708  }
709 
710  //......................................................................
712  {
713  // if list is larger than or equal to two, can project to XYZ and extrapolate to third plane (if exists)
714 
715  if(ppoints.size()>=2 ){
716 
717  double xyz_vertex_fit[3] = {0.};
718  double second_time = 0.;
719  double pos[3] = {0.};
720  const double origin[3] = {0.,0.,0.};
721  double y = 0.;
722  double z = 0.;
723 
725  const detinfo::DetectorProperties* detp = lar::providerFrom<detinfo::DetectorPropertiesService>();
727  double ftimetick = detp->SamplingRate()/1000.;
728  double larv = detp->DriftVelocity(detp->Efield(), detp->Temperature());
729 
730  //find channels corresponding to found wires.
731  int chan1 = geom->PlaneWireToChannel(ppoints[0].plane,ppoints[0].w, rawOpt->fTPC, rawOpt->fCryostat);
732  int chan2 = geom->PlaneWireToChannel(ppoints[1].plane,ppoints[1].w, rawOpt->fTPC, rawOpt->fCryostat);
733 
734  bool wires_cross=false;
735  bool time_good=false;
736 
737  if(fabs(ppoints[0].t-ppoints[1].t) < 200){
738  wires_cross= geom->ChannelsIntersect(chan1,chan2,y,z);
739  time_good=true;
740  }
741  else{
742  TGText *tt=new TGText("too big");
743  tt->InsLine(1,"time distance");
744  fXYZPosition->SetText(tt);
745  fXYZPosition->Update();
746  // return; //not returning, because may need to delete marker from wplane
747  }
748 
749  if(wires_cross){
750  xyz_vertex_fit[1]=y;
751  xyz_vertex_fit[2]=z;
752  geom->Plane(ppoints[0].plane).LocalToWorld(origin, pos);
753  xyz_vertex_fit[0]=(ppoints[0].t-detp->TriggerOffset())*larv*ftimetick+pos[0];
754  geom->Plane(ppoints[1].plane).LocalToWorld(origin, pos);
755  second_time=(ppoints[1].t-detp->TriggerOffset())*larv*ftimetick+pos[0];
756 
757  TGText *tt=new TGText(Form("z:%4.1f",z));
758  tt->InsLine(1,Form("x:%4.1f,",(xyz_vertex_fit[0]+second_time)/2));
759  tt->InsLine(1,Form("y:%4.1f,",y));
760  fXYZPosition->SetText(tt);
761  fXYZPosition->Update();
763 
764  }
765  else{
766  if(time_good){ //otherwise the wires_cross are false by default
767  TGText *tt=new TGText("cross");
768  tt->InsLine(1,"wires do not");
769  fXYZPosition->SetText(tt);
770  fXYZPosition->Update();
771  }
772  // return; //not returning, because may need to delete marker from wplanereturn;
773  }
774  // extrapolate third point only if there are enough planes
775  if(fPlanes.size() > 2){
776 
777  unsigned int wplane = 0;
778  unsigned int wirevertex = 0;
780 
781  for(size_t xx = 0; xx < fPlanes.size(); ++xx){
782  wplane = 0;
783  for(int yy = 0; yy < 2; ++yy)
784  if(ppoints[yy].plane == xx)
785  ++wplane;
786 
787  if(!wplane){
788  wplane = xx;
789  break;
790  }
791  }
792 
793 
794  geom->Plane(wplane).LocalToWorld(origin, pos);
795  pos[1]=xyz_vertex_fit[1];
796  pos[2]=xyz_vertex_fit[2];
797 
798  wirevertex = geom->NearestWire(pos, wplane, rawOpt->fTPC, rawOpt->fCryostat);
799 
800  double drifttick=((xyz_vertex_fit[0])/detp->DriftVelocity(detp->Efield(),detp->Temperature()))*(1./ftimetick);
801  double timestart=drifttick-(pos[0]/detp->DriftVelocity(detp->Efield(),detp->Temperature()))*(1./ftimetick)+detp->TriggerOffset();
802 
803  fPlanes[wplane]->Pad()->cd();
804  fPlanes[wplane]->View()->Clear();
805  if(wires_cross && evdlayoutopt->fShowEndPointMarkers) //only Draw if it makes sense
806  fPlanes[wplane]->View()->AddMarker(wirevertex, timestart, kMagenta, 29, 2.0);
807  else //draw dummy marker to delete old one
808  fPlanes[wplane]->View()->AddMarker(0.0,0.0,2,1,0.1);
809  fPlanes[wplane]->Pad()->Update();
810  fPlanes[wplane]->View()->Draw();
811  }// end if(fPlanes.size()>2)
812  //update pad?
813  gPad->Modified();
814  gPad->Update();
815  gPad->cd();
816  } // end if( this->ppoints.size()>=2)
817  else{
818  TGText *tt=new TGText("selected points");
819  tt->InsLine(1,"not enough");
820  fXYZPosition->SetText(tt);
821  fXYZPosition->Update();
822  }
823 
824  return;
825  }
826 
827  //.......................................................................
829  {
830  //*-*-*-*-*-*-*-*-*-*-*Create a new arrow in this pad*-*-*-*-*-*-*-*-*-*-*-*-*
831  //*-* ==============================
832  //
833  TObject *select = gPad->GetSelected();
834  if(!select) return;
835  if(!select->InheritsFrom("TBox")) return;
836 
837  static Float_t w0=-1, t0=-1, w1=-1, t1=-1;
838 
839  static Int_t pxold, pyold;
840  static Int_t pw0, pt0;
841  static Int_t linedrawn;
842  //static int curr_plane;
843  //TLine *line;
844 
845  static int wstart,wend;
846  static float tstart,tend;
847 
848  int event = gPad->GetEvent();
849  int px = gPad->GetEventX();
850  int py = gPad->GetEventY();
851 
852  switch (event){
853 
854  case kButton1Down:{
855  gVirtualX->SetLineColor(-1);
856  w0 = gPad->AbsPixeltoX(px);
857  t0 = gPad->AbsPixeltoY(py);
858  pw0 = px; pt0 = py;
859  pxold = px; pyold = py;
860  linedrawn = 0;
861  float x = gPad->PadtoX(w0);
862  tstart = gPad->PadtoY(t0);
863 
864  wstart = (unsigned int)TMath::Nint(x);
865  curr_zooming_plane=plane;
866  break;
867  }
868  case kButton1Motion:{
869  int lx,hx,ly,hy;
870  if (pw0 < pxold){
871  lx=pw0;
872  hx=pxold;
873  }
874  else{
875  lx=pxold;
876  hx=pw0;
877  }
878 
879  if (pt0 < pyold){
880  ly=pt0;
881  hy=pyold;
882  }
883  else{
884  ly=pyold;
885  hy=pt0;
886  }
887 
888  if (linedrawn) gVirtualX->DrawBox(lx, ly, hx, hy,TVirtualX::kHollow);
889  pxold = px;
890  pyold = py;
891  linedrawn = 1;
892 
893  if (pw0 < pxold){
894  lx=pw0;
895  hx=pxold;
896  }
897  else{
898  lx=pxold;
899  hx=pw0;
900  }
901 
902  if (pt0 < pyold){
903  ly=pt0;
904  hy=pyold;
905  }
906  else{
907  ly=pyold;
908  hy=pt0;
909  }
910 
911  gVirtualX->DrawBox(lx, ly, hx, hy,TVirtualX::kHollow);
912  break;
913  }
914  case kButton1Up:{
915  if (px == pw0 && py == pt0) break;
916  w1 = gPad->AbsPixeltoX(px);
917  t1 = gPad->AbsPixeltoY(py);
918  gPad->Modified(kTRUE);
919 
920  // line = new TLine(w0,t0,w1,t1);
921  // line->Draw();
922 
923  float x = gPad->PadtoX(w1);
924  tend = gPad->PadtoY(t1);
925  wend = (unsigned int)TMath::Nint(x);
926 
927  gROOT->SetEditorMode();
928 
929  //make sure the box is significantly big to avoid accidental zooms on nothing.
930  double xx1,yy1,xx2,yy2;
931 
932  gPad->GetRangeAxis(xx1, yy1, xx2, yy2);
933 
934  if(wstart != 0 && tstart != 0 &&
935  ( fabs(wend-wstart ) > 0.01*(xx2-xx1) ) &&
936  ( fabs(tend-tstart ) > 0.01*(yy2-yy1) &&
937  curr_zooming_plane==plane ) ){
938 
939  this->SetZoom(plane,wstart,wend,tstart,tend);
940  wstart=-1;
941  tstart=-1;
942  }
943  break;
944  }
945  }// end switch
946  }
947 
948 
949  //......................................................................
950  // if flag is true then zoom. If flag is false then unzoom.
952  {
953  mf::LogVerbatim("TWQMultiTPCProjectionView") <<"ZoomInterest called";
954 
955  if(flag==true) zoom_opt="1";
956  else zoom_opt="0";
957 
960 
962  // mf::LogVerbatim("TWQMultiTPCProjectionView") <<"Zoom interest pushing back zoom options"<<std::endl;
963  fPrevZoomOpt.push_back(fZoomOpt);
964 
965 
966  for(size_t iplane = 0; iplane < fPlanes.size(); ++iplane){
967  int minw,maxw,mint,maxt;
968  if(flag){
969  int test=0;
970  if(rawopt->fDrawRawDataOrCalibWires == 0)
971  fPlanes[iplane]->RawDataDraw()->GetRegionOfInterest(iplane,minw,maxw,mint,maxt);
972  else
973  fPlanes[iplane]->RecoBaseDraw()->GetRegionOfInterest(iplane,minw,maxw,mint,maxt);
974 
975  if(test==-1)
976  continue;
977  }
978  else{
979  minw = -0.005*(geo->Nwires(iplane)-1);
980  maxw = 1.005*(geo->Nwires(iplane)-1);
981  mint = -0.005*fPlanes[iplane]->RawDataDraw()->TotalClockTicks();
982  maxt = 1.01*fPlanes[iplane]->RawDataDraw()->TotalClockTicks();
983  }
984 
985  SetZoom(iplane,minw,maxw,mint,maxt,false);
986  zo.wmin[iplane]=minw;
987  zo.tmin[iplane]=mint;
988  zo.wmax[iplane]=maxw;
989  zo.tmax[iplane]=maxt;
990  zo.OnlyPlaneChanged=-1;
991  }
992  fZoomOpt=zo;
993 
994  }
995 
996  //......................................................................
998  {
1001  }
1002 
1003  //......................................................................
1005  {
1007  evdlayoutopt->fAutoZoomInterest = fToggleAutoZoom->GetState();
1008  }
1009 
1010  //......................................................................
1012  {
1014  evdlayoutopt->fShowEndPointMarkers= fToggleShowMarkers->GetState();
1015  }
1016 
1017  //......................................................................
1019  {
1020  // enter zoom buttons
1022 
1023  fZoomInterest=new TGTextButton(fVFrame,"&Zoom Interest",150);
1024  fZoomInterest->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "ZoomInterest()");
1025 
1026 
1027 
1028  fUnZoomInterest=new TGTextButton(fVFrame,"&UnZoom Interest",150);
1029  fUnZoomInterest->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "ZoomInterest(=false)");
1030 
1031 
1032  fZoomBack=new TGTextButton(fVFrame,"&Zoom Back",150);
1033  fZoomBack->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "ZoomBack()");
1034 
1035 
1036  fToggleAutoZoom=new TGCheckButton(fVFrame,"AutoZoom",0);;
1037  fToggleAutoZoom->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "SetZoomInterest()");
1038  if(evdlayoutopt->fAutoZoomInterest == 1) fToggleAutoZoom->SetState(kButtonDown);
1039 
1040  fVFrame->AddFrame(fZoomInterest, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1 ) );
1041  fVFrame->AddFrame(fUnZoomInterest, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1 ) );
1042 
1043  fVFrame->AddFrame(fZoomBack, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1 ) );
1044 
1045  fVFrame->AddFrame(fToggleAutoZoom, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1 ) );
1046  }
1047 
1048 
1049  //----------------------------------------------------------------------------
1051  {
1053  if(parameter==1 || parameter == 2){
1054  fToggleZoom->SetState(kButtonUp);
1055  }
1056 
1057  }
1058 
1059  //......................................................................
1061  {
1062  // enter zoom buttons
1064  if(!evdlayoutopt->fShowEndPointSection)
1065  return;
1066 
1067  // int fShowEndPointMarkers; ///< Draw EndPoint Markers if clicked.
1068 
1069  fFindEndpoint=new TGTextButton(fVFrame,"&Find XYZ",150);
1070  fFindEndpoint->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "FindEndPoint()");
1071 
1072  fXYZPosition=new TGTextView(fVFrame,100,55,999,TGView::kNoHSB | TGView::kNoVSB);
1073  fXYZPosition->SetEditable("false");
1074  TGText *tt=new TGText("x,y,z");
1075  fXYZPosition->SetText(tt);
1076 
1077 
1078  fClearPPoints=new TGTextButton(fVFrame,"&Clear Points",150);
1079  fClearPPoints->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "ClearEndPoints()"); // ?
1080 
1081  fToggleShowMarkers=new TGCheckButton(fVFrame,"ShowMarkers",0);
1082  fToggleShowMarkers->Connect("Clicked()", "evd::TWQMultiTPCProjectionView", this, "ToggleEndPointMarkers()");
1083  if(evdlayoutopt->fShowEndPointMarkers == 1) fToggleShowMarkers->SetState(kButtonDown);
1084 
1085  fVFrame->AddFrame(fFindEndpoint, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1 ) );
1086  fVFrame->AddFrame(fXYZPosition, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1 ) );
1087  fVFrame->AddFrame(fClearPPoints, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1 ) );
1088  fVFrame->AddFrame(fToggleShowMarkers, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1 ) );
1089  }
1090 
1091 
1093  // Go back one step in zoom
1094 
1096  {
1097  if(fPrevZoomOpt.size()>0){
1098  ZoomOptionsMultiTPC ThePrevZoomOpt = fPrevZoomOpt.at(fPrevZoomOpt.size()-1);
1099  int plane = fZoomOpt.OnlyPlaneChanged;
1100  if(plane != -1){
1101  SetZoom(plane,
1102  ThePrevZoomOpt.wmin[plane],
1103  ThePrevZoomOpt.wmax[plane],
1104  ThePrevZoomOpt.tmin[plane],
1105  ThePrevZoomOpt.tmax[plane],
1106  false);
1107  }
1108  else{
1109  for( size_t iplane = 0; iplane != fPlanes.size(); ++iplane){
1110  SetZoom(iplane,
1111  ThePrevZoomOpt.wmin[iplane],
1112  ThePrevZoomOpt.wmax[iplane],
1113  ThePrevZoomOpt.tmin[iplane],
1114  ThePrevZoomOpt.tmax[iplane],
1115  false);
1116 
1117  }
1118  }
1119 
1120  fPrevZoomOpt.pop_back();
1121  }
1122  else
1123  mf::LogVerbatim("TWQMultiTPCProjectionView") <<"unable to unzoom further - no zoom settings left on stack"<<std::endl;
1124  }
1125 
1126  //------------------------------------
1128  int wirelow,
1129  int wirehi,
1130  int timelow,
1131  int timehi,
1132  bool StoreZoom)
1133  {
1134 
1135  if(StoreZoom){
1136  fPrevZoomOpt.push_back(fZoomOpt);
1137  fZoomOpt.OnlyPlaneChanged = plane;
1138  }
1139 
1140  fZoomOpt.wmin[plane] = wirelow;
1141  fZoomOpt.wmax[plane] = wirehi;
1142  fZoomOpt.tmin[plane] = timelow;
1143  fZoomOpt.tmax[plane] = timehi;
1144 
1145 
1146  TVirtualPad *ori = gPad;
1147  zoom_opt="1";
1148 
1149  // error checking - useful for the mouse zoom.
1150  if(wirehi<wirelow){
1151  int temp=wirelow;
1152  wirelow=wirehi;
1153  wirehi=temp;
1154  }
1155 
1156  if(timehi<timelow){
1157  int temp=timelow;
1158  timelow=timehi;
1159  timehi=temp;
1160  }
1161 
1162  //if drawing, then currently not zooming
1163  curr_zooming_plane=-1;
1164 
1165  fPlanes[plane]->SetZoomRange(wirelow, wirehi,timelow,timehi);
1166  fPlanes[plane]->Draw("1");
1167  fPlanes[plane]->UpdatePad();
1168 
1169  evdb::Canvas::fCanvas->cd();
1170  evdb::Canvas::fCanvas->Modified();
1171  evdb::Canvas::fCanvas->Update();
1172 
1173  // UpdateSeedCurve();
1174 
1175  ori->cd();
1176 
1177  return;
1178  }
1179 
1180  //-----------------------------------------------------------------
1182  {
1183  TVirtualPad *ori = gPad;
1184 
1185  fWireQ->SetPlaneWire(kPlane, kWire);
1186 
1187  fWireQ->Draw();
1188  fWireQ->Pad()->cd();
1189  fWireQ->Pad()->Modified();
1190  fWireQ->Pad()->Update();
1191  fWireQ->Pad()->SetBit(TPad::kCannotMove,true);
1192  fWireQ->Pad()->GetFrame()->SetBit(TPad::kCannotMove,true);
1193 
1194  fPlaneEntry->SetNumber(kPlane);
1195  fWireEntry->SetNumber(kWire);
1196 
1197  evdb::Canvas::fCanvas->cd();
1198  evdb::Canvas::fCanvas->Modified();
1199  evdb::Canvas::fCanvas->Update();
1200 
1201  ori->cd();
1202  }
1203 
1204  //-----------------------------------------------------------------
1206  {
1207  kPlane = (unsigned int)fPlaneEntry->GetNumberEntry()->GetNumber();
1208 
1209  this->SetPlaneWire();
1210  }
1211 
1212  //-----------------------------------------------------------------
1214  {
1215  kWire = (unsigned int)fWireEntry->GetNumberEntry()->GetNumber();
1216 
1217  this->SetPlaneWire();
1218  }
1219 
1220  //-----------------------------------------------------------------
1222  {
1223  kDistance = (double)fDistance->GetNumberEntry()->GetNumber();
1224  }
1225 
1226  //-----------------------------------------------------------------
1228  {
1229  double threshold = fThresEntry->GetNumberEntry()->GetNumber();
1230 
1232  rawopt->fMinSignal = threshold;
1233 
1234  TVirtualPad *ori = gPad;
1235  this->DrawPads(zoom_opt);
1236  evdb::Canvas::fCanvas->cd();
1237  evdb::Canvas::fCanvas->Modified();
1238  evdb::Canvas::fCanvas->Update();
1239 
1240  ori->cd();
1241 
1242  return;
1243  }
1244 
1245  //-----------------------------------------------------------------
1247  {
1249 
1250  TGButton *b = (TGButton *)gTQSender;
1251  if(b->GetState() == kButtonDown){
1252  cst->fColorOrGray = 1;
1253  }
1254  else{
1255  cst->fColorOrGray = 0;
1256  }
1257 
1258  TVirtualPad *ori = gPad;
1259  this->DrawPads(zoom_opt);
1260  evdb::Canvas::fCanvas->cd();
1261  evdb::Canvas::fCanvas->Modified();
1262  evdb::Canvas::fCanvas->Update();
1263 
1264  ori->cd();
1265 
1266  return;
1267  }
1268 
1269  //-----------------------------------------------------------------
1271  {
1273 
1274  TGButton *b = (TGButton *)gTQSender;
1275  int id = b->WidgetId();
1276 
1277  // id values are set in lines 125 - 127
1278  if(id == 4){
1279  rawopt->fDrawRawDataOrCalibWires = 0;
1280  fRawDraw->SetState(kButtonDown);
1281  fCalibDraw->SetState(kButtonUp);
1282  fRawCalibDraw->SetState(kButtonUp);
1283  }
1284  else if(id == 3){
1285  rawopt->fDrawRawDataOrCalibWires = 1;
1286  fRawDraw->SetState(kButtonUp);
1287  fCalibDraw->SetState(kButtonDown);
1288  fRawCalibDraw->SetState(kButtonUp);
1289  }
1290  else if(id == 2){
1291  rawopt->fDrawRawDataOrCalibWires = 2;
1292  fRawDraw->SetState(kButtonUp);
1293  fCalibDraw->SetState(kButtonUp);
1294  fRawCalibDraw->SetState(kButtonDown);
1295  }
1296 
1297  TVirtualPad *ori = gPad;
1298 
1299  fWireQ->Draw();
1300  fWireQ->Pad()->cd();
1301  fWireQ->Pad()->Modified();
1302  fWireQ->Pad()->Update();
1303 
1304  this->DrawPads(zoom_opt);
1305  evdb::Canvas::fCanvas->cd();
1306  evdb::Canvas::fCanvas->Modified();
1307  evdb::Canvas::fCanvas->Update();
1308 
1309  ori->cd();
1310 
1311  return;
1312  }
1313 
1314  //-----------------------------------------------------------------
1316  {
1318 
1319  TGButton *b = (TGButton *)gTQSender;
1320  if(b->GetState() == kButtonDown){
1321  sdo->fShowMCTruthText = 1;
1322  sdo->fShowMCTruthVectors = 1;
1323  }
1324  else{
1325  sdo->fShowMCTruthText = 0;
1326  sdo->fShowMCTruthVectors = 0;
1327  }
1328 
1329  TVirtualPad *ori = gPad;
1330 
1331  fMC->Draw();
1332  evdb::Canvas::fCanvas->cd();
1333  evdb::Canvas::fCanvas->Modified();
1334  evdb::Canvas::fCanvas->Update();
1335 
1336  ori->cd();
1337  }
1338 
1339 
1340 }// namespace
Float_t x
Definition: compare.C:6
code to link reconstructed objects back to the MC truth information
TGRadioButton * fCalibDraw
Draw calibrated information only.
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
TQPad * fWireQ
Histogram of charge vs time on selected wire.
Double_t xx
Definition: macro.C:12
int fEnableMCTruthCheckBox
1 to have the check box appear, 0 otherwise
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
TTree * t1
Definition: plottest35.C:26
static unsigned int kWire
virtual int TriggerOffset() const =0
Drawing pad for short summary of an MC event.
Drawing pad showing a single X-Z or Y-Z projection of an event.
TGCompositeFrame * fVFrame
needed for the side frame
int fDrawRawDataOrCalibWires
0 for raw
TGCompositeFrame * fFrame
Graphics frame.
Definition: Canvas.h:39
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
Drawing pad for time or charge histograms.
TGNumberEntry * fThresEntry
ADC threshold to display.
std::map< int, double > tmin
bool ChannelsIntersect(raw::ChannelID_t c1, raw::ChannelID_t c2, double &y, double &z) const
Returns an intersection point of two channels.
virtual double SamplingRate() const =0
Returns the period of the TPC readout electronics clock.
static unsigned int kPlane
TCanvas * fCanvas
The ROOT drawing canvas.
Definition: Canvas.h:42
A collection of drawable 2-D objects.
void Draw()
Definition: TQPad.cxx:111
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
TGTextButton * fUnZoomInterest
Unzoom on iteresting region.
TGRadioButton * fRawCalibDraw
Draw raw and calibrated information.
TGLayoutHints * fLayout
Layout hints for frame.
Definition: Canvas.h:40
Manage all things related to colors for the event display.
std::vector< TWireProjPad * > fPlanes
time vs wire projection for each plane
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
MCBriefPad * fMC
Short summary of MC event.
static double kDistance
TGNumberEntry * fPlaneEntry
Plane number displayed.
int fShowEndPointSection
Show section corresponding to EndPoint finding.
The color scales used by the event display.
HeaderPad * fHeaderPad
Show header information.
std::deque< util::PxPoint > ppoints
list of points in each WireProjPad used for x,y,z finding
TGTextButton * fFindEndpoint
Calculate XYZ position of two points in wire planes.
Drawing pad for time or charge histograms.
Definition: type_traits.h:56
TGCheckButton * fMCOn
Display MC truth information.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
int fShowSideBar
1 to show, 0 don&#39;t show
TGTextButton * fZoomBack
Unzoom on iteresting region.
LArSoft includes.
unsigned short fXsize
Size of the canvas;.
Definition: Canvas.h:44
A drawing pad for time vs wire.
Definition: TWireProjPad.h:32
int fAutoZoomInterest
Set the automatic zoom to the interest region.
TGCheckButton * fToggleAutoZoom
Toggle the autozoom setting.
TGTextButton * fClearPPoints
Clear current list of End Points.
Class to perform operations needed to select hits and pass them to a cluster.
std::vector< TQPad * > fPlaneQ
charge on each plane
double t
Definition: PxUtils.h:11
virtual double Temperature() const =0
static int curr_zooming_plane
geo::WireID::WireID_t NearestWire(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the index of wire closest to position in the specified TPC.
int fShowEndPointMarkers
Draw EndPoint Markers if clicked.
double fMinSignal
minimum ADC count to display a time bin
TGTextView * fXYZPosition
Display the xyz position.
TGRadioButton * fRawDraw
Draw Raw information only.
TPad * Pad()
Definition: DrawingPad.h:37
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
static int shift_lock
The data type to uniquely identify a TPC.
Definition: geo_types.h:195
TGCompositeFrame * fMetaFrame
needed for the side frame
Class to aid in the rendering of RecoBase objects.
Class to aid in the rendering of RawData objects.
double w
Definition: PxUtils.h:10
unsigned short fYsize
Size of the canvas;.
Definition: Canvas.h:45
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
void Draw(const char *opt="")
Definition: HeaderPad.cxx:42
std::map< int, double > wmax
TGTextButton * fZoomInterest
Zoom on iteresting region.
static void MouseDispatch(int plane, void *wqpv)
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
Encapsulate the construction of a single detector plane.
TGRadioButton * fToggleZoom
Use zoom setting.
virtual double DriftVelocity(double efield=0., double temperature=0.) const =0
TGCheckButton * fGreyScale
Display gray or color scale.
int fColorOrGray
0 = color, 1 = gray
static const char * zoom_opt
std::vector< ZoomOptionsMultiTPC > fPrevZoomOpt
int fPrintTotalCharge
Print out the total charge in an event.
std::deque< util::PxLine > pline
list of lines in each WireProjPad used for calculating 2d and 3d angles
std::map< int, double > wmin
void SetZoom(int plane, int wirelow, int wirehi, int timelo, int timehi, bool StoreZoom=true)
TGNumberEntry * fWireEntry
Wire number displayed.
std::map< int, double > tmax
virtual double Efield(unsigned int planegap=0) const =0
Returns the nominal electric field in the specified volume.
Namespace collecting geometry-related classes utilities.
Float_t w
Definition: plot.C:23
TRootEmbeddedCanvas * fEmbCanvas
Embedded canvas.
Definition: Canvas.h:41
void LocalToWorld(const double *plane, double *world) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1124
art framework interface to geometry description
unsigned int plane
Definition: PxUtils.h:12
TGNumberEntry * fDistance
Distance from line to find hits in cluster.
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
Event finding and building.
TGCheckButton * fToggleShowMarkers
Toggle the ShowEndPointMarkersSetting.
Signal from collection planes.
Definition: geo_types.h:93
void SetPlaneWire(unsigned int plane=0, unsigned int wire=0)
Definition: TQPad.h:24