LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
evd::TWireProjPad Class Reference

A drawing pad for time vs wire. More...

#include "TWireProjPad.h"

Inheritance diagram for evd::TWireProjPad:
evd::DrawingPad

Classes

struct  DrawOptions_t
 

Public Member Functions

 TWireProjPad (const char *nm, const char *ti, double x1, double y1, double x2, double y2, unsigned int plane)
 
 ~TWireProjPad ()
 
void Draw (const char *opt=0)
 
void GetWireRange (int *i1, int *i2) const
 
void SetWireRange (int i1, int i2)
 
void SetZoomRange (int i1, int i2, int y1, int y2)
 
DrawOptions_t const & GetDrawOptions () const
 Return the current draw options. More...
 
void SetDrawOptions (DrawOptions_t const &opt)
 Receive the full set of draw options. More...
 
void SetZoomToRoI (bool bZoomToRoI)
 Sets the draw option about zooming to the region of interest. More...
 
void SetZoomFromView ()
 Sets the zoom parameters from the current histogram view. More...
 
void SaveHitList (double i1, double i2, double y1, double y2, double distance, const char *zoom_opt, bool good_plane=true)
 
double SaveSeedList (std::vector< util::PxLine > seedlines, double distance)
 
void ClearHitList ()
 
void SelectOneHit (double x, double y, const char *zoom_opt)
 
unsigned int GetPlane () const
 
void ClearandUpdatePad ()
 
void UpdatePad ()
 
void DrawLinesinView (std::vector< util::PxLine > lines, bool deleting=false, const char *zoom_opt=0)
 
void ShowFull (int override=0)
 
double UpdateSeedCurve (std::vector< recob::Seed > SeedVec, int plane)
 
evdb::View2DView () const
 
std::vector< double > const & GetCurrentZoom () const
 
TPad * Pad ()
 
HeaderDrawerHeaderDraw ()
 
evd_tool::IExperimentDrawerGeometryDraw ()
 
SimulationDrawerSimulationDraw ()
 
RawDataDrawerRawDataDraw ()
 
RecoBaseDrawerRecoBaseDraw ()
 
AnalysisBaseDrawerAnalysisBaseDraw ()
 
HitSelectorHitSelectorGet ()
 

Protected Types

using IExperimentDrawerPtr = std::unique_ptr< evd_tool::IExperimentDrawer >
 

Protected Attributes

TPad * fPad
 The ROOT graphics pad. More...
 
HeaderDrawerfHeaderDraw
 Drawer for event header info. More...
 
IExperimentDrawerPtr fGeometryDraw
 Drawer for detector geometry. More...
 
SimulationDrawerfSimulationDraw
 Drawer for simulation objects. More...
 
RawDataDrawerfRawDataDraw
 Drawer for raw data. More...
 
RecoBaseDrawerfRecoBaseDraw
 Drawer for recobase objects. More...
 
AnalysisBaseDrawerfAnalysisBaseDraw
 Drawer for analysisbase objects. More...
 

Private Attributes

std::vector< double > fCurrentZoom
 
DrawOptions_t fDrawOpts
 set of current draw options More...
 
unsigned int fPlane
 Which plane in the detector. More...
 
TH1F * fHisto
 Histogram to draw object on. More...
 
evdb::View2DfView
 Collection of graphics objects to render. More...
 
double fXLo
 Low value of x axis. More...
 
double fXHi
 High value of x axis. More...
 
double fYLo
 Low value of y axis. More...
 
double fYHi
 High value of y axis. More...
 
int fOri
 Orientation of the axes - see RawDrawingOptions for values. More...
 

Detailed Description

A drawing pad for time vs wire.

Definition at line 32 of file TWireProjPad.h.

Member Typedef Documentation

using evd::DrawingPad::IExperimentDrawerPtr = std::unique_ptr<evd_tool::IExperimentDrawer>
protectedinherited

Definition at line 51 of file DrawingPad.h.

Constructor & Destructor Documentation

evd::TWireProjPad::TWireProjPad ( const char *  nm,
const char *  ti,
double  x1,
double  x2,
double  y1,
double  y2,
unsigned int  plane 
)

Create a pad showing a single X-Z or Y-Z projection of the detector

Parameters
nm: Name of the pad
ti: Title of the pad
x1: Location of left edge of pad (0-1)
x2: Location of right edge of pad (0-1)
y1: Location of bottom edge of pad (0-1)
y2: Location of top edge of pad (0-1)
plane: plane number of view

Definition at line 109 of file TWireProjPad.cxx.

References evd::RawDrawingOptions::CurrentTPC(), evd::RawDrawingOptions::fAxisOrientation, fCurrentZoom, fHisto, fOri, evd::DrawingPad::fPad, fPlane, fView, fXHi, fXLo, fYHi, fYLo, geo::kCollection, max, min, geo::GeometryCore::Nplanes(), geo::GeometryCore::Nwires(), evd::DrawingPad::Pad(), evd::DrawingPad::RawDataDraw(), SetZoomRange(), geo::GeometryCore::SignalType(), evd::RawDataDrawer::StartTick(), and evd::RawDataDrawer::TotalClockTicks().

114  : DrawingPad(nm, ti, x1, x2, y1, y2)
115  , fPlane(plane)
116  {
117 
118  fCurrentZoom.resize(4);
119 
121 
122  // this->Pad()->SetBit(kCannotPick); // workaround for issue #16169
123  // this->Pad()->SetBit(TPad::kCannotMove);
124  this->Pad()->cd();
125 
126  this->Pad()->SetLeftMargin (0.070);
127  this->Pad()->SetRightMargin (0.010);
128 
129  // how many planes in the detector and
130  // which plane is this one?
131 
132  unsigned int planes = geo->Nplanes();
133  this->Pad()->SetTopMargin (0.005);
134  this->Pad()->SetBottomMargin(0.110);
135 
136  // there has to be a better way of doing this that does
137  // not have a case for each number of planes in a detector
138  if(planes == 2 && fPlane > 0){
139  this->Pad()->SetTopMargin (0.110);
140  this->Pad()->SetBottomMargin(0.005);
141  }
142  else if(planes > 2){
143  if(fPlane == 1){
144  this->Pad()->SetTopMargin (0.055);
145  this->Pad()->SetBottomMargin(0.055);
146  }
147  else if(fPlane == 2){
148  this->Pad()->SetTopMargin (0.110);
149  this->Pad()->SetBottomMargin(0.005);
150  }
151  }
152 
153  TString planeNo = "fTWirePlane";
154  planeNo += fPlane;
155 
156  // picking the information from the current TPC
158  auto const signalType = geo->SignalType({ rawopt->CurrentTPC(), fPlane });
159  TString xtitle = ";Induction Wire;t (tdc)";
160  if(signalType == geo::kCollection) xtitle = ";Collection Wire;t (tdc)";
161 
162  unsigned int const nWires = geo->Nwires(fPlane);
163  unsigned int const nTicks = RawDataDraw()->TotalClockTicks();
164 
165  fXLo = -0.005 * (nWires - 1);
166  fXHi = 1.005 * (nWires - 1);
167  fYLo = 0.990*(unsigned int)(this->RawDataDraw()->StartTick());
168  fYHi = 1.005*std::min((unsigned int)(this->RawDataDraw()->StartTick()+nTicks), nTicks);
169 
170  fOri = rawopt->fAxisOrientation;
171  if(fOri > 0){
172  fYLo = -0.005 * (nWires - 1);
173  fYHi = 1.005 * (nWires - 1);
174  fYLo = 0.990*(unsigned int)(this->RawDataDraw()->StartTick());
175  fYHi = 1.005*std::min((unsigned int)(this->RawDataDraw()->StartTick()+nTicks), nTicks);
176  fXLo = -0.005 * nTicks;
177  fXHi = 1.010 * nTicks;
178  xtitle = ";t (tdc);InductionWire";
179  if(signalType == geo::kCollection) xtitle = ";t (tdc);Collection Wire";
180  }
181 
182  // make the range of the histogram be the biggest extent
183  // in both directions and then use SetRangeUser() to shrink it down
184  // that will allow us to change the axes on the fly
185  double min = std::min(fXLo, fYLo);
186  double max = std::max(fXHi, fYHi);
187 
188  fHisto = new TH1F(*(fPad->DrawFrame(min, min, max, max)));
189 
190  fHisto->SetTitleOffset(0.5,"Y");
191  fHisto->SetTitleOffset(0.75,"X");
193  fHisto->GetYaxis()->SetLabelSize(0.05);
194  fHisto->GetYaxis()->CenterTitle();
195  fHisto->GetXaxis()->SetLabelSize(0.05);
196  fHisto->GetXaxis()->CenterTitle();
197  fHisto->Draw("AB");
198 
199  fView = new evdb::View2D();
200  }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
double fXLo
Low value of x axis.
Definition: TWireProjPad.h:95
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC 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.
Float_t y2[n_points_geant4]
Definition: compare.C:26
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
Int_t max
Definition: plot.C:27
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:109
int fOri
Orientation of the axes - see RawDrawingOptions for values.
Definition: TWireProjPad.h:99
double fXHi
High value of x axis.
Definition: TWireProjPad.h:96
TPad * Pad()
Definition: DrawingPad.h:37
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
double TotalClockTicks() const
Definition: RawDataDrawer.h:85
double fYLo
Low value of y axis.
Definition: TWireProjPad.h:97
TH1F * fHisto
Histogram to draw object on.
Definition: TWireProjPad.h:92
double StartTick() const
Definition: RawDataDrawer.h:84
Int_t min
Definition: plot.C:26
void SetZoomRange(int i1, int i2, int y1, int y2)
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:53
Float_t x2[n_points_geant4]
Definition: compare.C:26
std::vector< double > fCurrentZoom
Definition: TWireProjPad.h:87
Namespace collecting geometry-related classes utilities.
double fYHi
High value of y axis.
Definition: TWireProjPad.h:98
DrawingPad(const char *nm, const char *ti, double x1, double y1, double y2, double x2)
Definition: DrawingPad.cxx:39
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TWireProjPad.h:93
Signal from collection planes.
Definition: geo_types.h:93
evd::TWireProjPad::~TWireProjPad ( )

Definition at line 203 of file TWireProjPad.cxx.

References fHisto, and fView.

204  {
205  if (fHisto) { delete fHisto; fHisto = 0; }
206  if (fView) { delete fView; fView = 0; }
207  }
TH1F * fHisto
Histogram to draw object on.
Definition: TWireProjPad.h:92
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TWireProjPad.h:93

Member Function Documentation

AnalysisBaseDrawer * evd::DrawingPad::AnalysisBaseDraw ( )
inherited

Provide access to the drawer for AnalysisBase classes

Definition at line 132 of file DrawingPad.cxx.

References evd::DrawingPad::fAnalysisBaseDraw.

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

133  {
134  if (fAnalysisBaseDraw==0) fAnalysisBaseDraw = new AnalysisBaseDrawer();
135  return fAnalysisBaseDraw;
136  }
AnalysisBaseDrawer * fAnalysisBaseDraw
Drawer for analysisbase objects.
Definition: DrawingPad.h:60
void evd::TWireProjPad::ClearandUpdatePad ( )

Definition at line 491 of file TWireProjPad.cxx.

References evd::DrawingPad::fPad, and UpdatePad().

Referenced by Draw().

492  {
493  fPad->Clear();
494  this->UpdatePad();
495 
496  return;
497  }
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:53
void evd::TWireProjPad::ClearHitList ( )

Definition at line 299 of file TWireProjPad.cxx.

References evd::HitSelector::ClearHitList(), Draw(), fPlane, evd::RecoDrawingOptions::fUseHitSelector, and evd::DrawingPad::HitSelectorGet().

300  {
302  if(recoOpt->fUseHitSelector){
304  this->Draw();
305  }
306 
307  return;
308  }
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
void Draw(const char *opt=0)
void ClearHitList(unsigned int plane)
HitSelector * HitSelectorGet()
Definition: DrawingPad.cxx:144
void evd::TWireProjPad::Draw ( const char *  opt = 0)
Todo:
: Why is kSelectedColor hard coded?

Definition at line 210 of file TWireProjPad.cxx.

References evdb::View2D::Clear(), ClearandUpdatePad(), evdb::View2D::Draw(), tca::evt, evd::RawDrawingOptions::fAxisOrientation, fHisto, fOri, evd::DrawingPad::fPad, fPlane, evd::RecoDrawingOptions::fUseHitSelector, fView, fXHi, fXLo, fYHi, fYLo, GetCurrentZoom(), GetDrawOptions(), evdb::EventHolder::GetEvent(), evd::RecoBaseDrawer::Hit2D(), evd::DrawingPad::HitSelectorGet(), evdb::EventHolder::Instance(), LOG_DEBUG, max, evd::SimulationDrawer::MCTruthVectors2D(), min, evd::DrawingPad::RawDataDraw(), evd::DrawingPad::RecoBaseDraw(), SetZoomRange(), ShowFull(), evd::DrawingPad::SimulationDraw(), and UpdatePad().

Referenced by ClearHitList(), evd::TWQProjectionView::Draw(), DrawLinesinView(), SaveHitList(), and SelectOneHit().

211  {
212  // DumpPadsInCanvas(fPad, "TWireProjPad", "Draw()");
213  LOG_DEBUG("TWireProjPad") << "Started to draw plane " << fPlane;
214 
216  int kSelectedColor = 4;
217  fView->Clear();
218 
219  // grab the singleton holding the art::Event
221  if(evt){
223 
224  this->SimulationDraw()->MCTruthVectors2D(*evt, fView, fPlane);
225 
226  // the 2D pads have too much detail to be rendered on screen;
227  // to act smarter, RawDataDrawer needs to know the range being plotted
228  this->RawDataDraw()-> ExtractRange (fPad, &GetCurrentZoom());
229  this->RawDataDraw()-> RawDigit2D
230  (*evt, fView, fPlane, GetDrawOptions().bZoom2DdrawToRoI);
231 
232  this->RecoBaseDraw()-> Wire2D (*evt, fView, fPlane);
233  this->RecoBaseDraw()-> Hit2D (*evt, fView, fPlane);
234 
235  if(recoOpt->fUseHitSelector)
236  this->RecoBaseDraw()->Hit2D(this->HitSelectorGet()->GetSelectedHits(fPlane),
237  kSelectedColor,
238  fView);
239 
240  this->RecoBaseDraw()-> Slice2D (*evt, fView, fPlane);
241  this->RecoBaseDraw()-> Cluster2D (*evt, fView, fPlane);
242  this->RecoBaseDraw()-> EndPoint2D (*evt, fView, fPlane);
243  this->RecoBaseDraw()-> Prong2D (*evt, fView, fPlane);
244  this->RecoBaseDraw()-> Vertex2D (*evt, fView, fPlane);
245  this->RecoBaseDraw()-> Seed2D (*evt, fView, fPlane);
246  this->RecoBaseDraw()-> BezierTrack2D (*evt, fView, fPlane);
247  this->RecoBaseDraw()-> OpFlash2D (*evt, fView, fPlane);
248  this->RecoBaseDraw()-> Event2D (*evt, fView, fPlane);
249  this->RecoBaseDraw()-> DrawTrackVertexAssns2D(*evt, fView, fPlane);
250 
251  // DumpPadsInCanvas(fPad, "TWireProjPad", "Before UpdatePad()");
252  UpdatePad();
253  } // if (evt)
254 
255  // DumpPadsInCanvas(fPad, "TWireProjPad", "Before ClearandUpdatePad()");
257 
258  // DumpPadsInCanvas(fPad, "TWireProjPad", "After ClearandUpdatePad()");
259 
260  // check if we need to swap the axis ranges
262  if(fOri != rawopt->fAxisOrientation){
263  fOri = rawopt->fAxisOrientation;
264  double max = fXHi;
265  double min = fXLo;
266  fXHi = fYHi;
267  fXLo = fYLo;
268  fYHi = max;
269  fYLo = min;
270 
272 
273  TString xtitle = fHisto->GetXaxis()->GetTitle();
274  fHisto->GetXaxis()->SetTitle(fHisto->GetYaxis()->GetTitle());
275  fHisto->GetYaxis()->SetTitle(xtitle);
276  }
277 
278  if (fPlane > 0) fHisto->Draw("X+");
279  else fHisto->Draw("");
280 
281 
282  // Check if we should zoom the displays;
283  // if there is no event, we have no clue about the region of interest
284  // and therefore we don't touch anything
285  if (opt==0 && evt) {
286  // if (drawopt->fAutoZoom) this->AutoZoom();
287  // else this->ShowFull();
288  this->ShowFull();
289  }
290 
291  LOG_DEBUG("TWireProjPad") << "Started rendering plane " << fPlane;
292 
293  fView->Draw();
294 
295  LOG_DEBUG("TWireProjPad") << "Drawing of plane " << fPlane << " completed";
296  }
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
void ShowFull(int override=0)
double fXLo
Low value of x axis.
Definition: TWireProjPad.h:95
void Clear()
Definition: View2D.cxx:109
std::vector< double > const & GetCurrentZoom() const
Definition: TWireProjPad.h:79
Int_t max
Definition: plot.C:27
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:109
void Draw()
Definition: View2D.cxx:89
int fOri
Orientation of the axes - see RawDrawingOptions for values.
Definition: TWireProjPad.h:99
static EventHolder * Instance()
Definition: EventHolder.cxx:15
double fXHi
High value of x axis.
Definition: TWireProjPad.h:96
DrawOptions_t const & GetDrawOptions() const
Return the current draw options.
Definition: TWireProjPad.h:50
RecoBaseDrawer * RecoBaseDraw()
Definition: DrawingPad.cxx:120
int Hit2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
double fYLo
Low value of y axis.
Definition: TWireProjPad.h:97
SimulationDrawer * SimulationDraw()
Definition: DrawingPad.cxx:99
TH1F * fHisto
Histogram to draw object on.
Definition: TWireProjPad.h:92
Int_t min
Definition: plot.C:26
void SetZoomRange(int i1, int i2, int y1, int y2)
HitSelector * HitSelectorGet()
Definition: DrawingPad.cxx:144
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
#define LOG_DEBUG(id)
void MCTruthVectors2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:53
TCEvent evt
Definition: DataStructs.cxx:5
double fYHi
High value of y axis.
Definition: TWireProjPad.h:98
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TWireProjPad.h:93
void evd::TWireProjPad::DrawLinesinView ( std::vector< util::PxLine lines,
bool  deleting = false,
const char *  zoom_opt = 0 
)

Definition at line 511 of file TWireProjPad.cxx.

References evdb::View2D::AddLine(), evdb::View2D::Clear(), detinfo::DetectorProperties::ConvertTicksToX(), detinfo::DetectorProperties::ConvertXToTicks(), evdb::View2D::Draw(), Draw(), evd::EvdLayoutOptions::fMakeSeeds, evd::DrawingPad::fPad, fPlane, evd::Style::FromPDG(), fView, util::PxLine::plane, util::PxLine::t0, t1, util::PxLine::t1, and UpdatePad().

514  {
515 
517  detinfo::DetectorProperties const* det = lar::providerFrom<detinfo::DetectorPropertiesService>();
518 
519  fPad->cd();
520  if(deleting) {
521  fPad->Clear();
522  this->Draw(zoom_opt);
523  }
524  else {
525  fView->Clear();
526  fView->Draw();
527  }
528 
529  mf::LogVerbatim("TWireProjPad") << "Drawing " << lines.size() <<" lines";
530 
531  for(size_t is = 0; is < lines.size(); ++is){
532  if(fPlane!=lines[is].plane)
533  continue;
534 
535  TLine& l = fView->AddLine(lines[is].w0,lines[is].t0,lines[is].w1,lines[is].t1);
536 
537  fView->Draw();
538  evd::Style::FromPDG(l,11);
539 
540  // In Seed mode, colour of "sealed" seeds to green
541  if(evdlayoutopt->fMakeSeeds){
542  if( ( (lines.size()%3)==0 ) ||
543  ( is < ( lines.size()-(lines.size()%3) ) )) {
544  l.SetLineColor(kGreen);
545  }
546  else
547  l.SetLineColor(kRed);
548  }
549  }
550 
551  // Seed mode guide lines
552 
553  if(evdlayoutopt->fMakeSeeds){
554  TLine &lg1 = fView->AddLine(0,0,0,0);
555  fView->Draw();
556  TLine &lg0 = fView->AddLine(0,0,0,0);
557  fView->Draw();
558  lg1.SetLineStyle(kDashed);
559  lg0.SetLineStyle(kDashed);
560  lg0.SetLineWidth(1);
561  lg1.SetLineWidth(1);
562  lg0.SetLineColor(kGray);
563  lg1.SetLineColor(kGray);
564  lg0.SetBit(kCannotPick);
565  lg1.SetBit(kCannotPick);
566 
567  if((lines.size()%3)==1){
568  mf::LogVerbatim("TWireProjPad") << "adding guide lines";
569  util::PxLine TopLine = lines.at(lines.size()-1);
570  lg0.SetX1(1);
571  lg0.SetX2(5000);
572 
573  double TopT0 = det->ConvertXToTicks(det->ConvertTicksToX(TopLine.t0,TopLine.plane,0,0),fPlane,0,0);
574  double TopT1 = det->ConvertXToTicks(det->ConvertTicksToX(TopLine.t1,TopLine.plane,0,0),fPlane,0,0);
575 
576  lg0.SetY1(TopT0);
577  lg0.SetY2(TopT0);
578 
579  lg1.SetX1(1);
580  lg1.SetX2(5000);
581 
582  lg1.SetY1(TopT1);
583  lg1.SetY2(TopT1);
584 
585 
586  }
587  }
588  fView->Draw();
589  UpdatePad();
590  fView->Draw();
591 
592  return;
593  }
code to link reconstructed objects back to the MC truth information
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
double t1
defined to be the ending t-position (of line or seed depending)
Definition: PxUtils.h:72
TTree * t1
Definition: plottest35.C:26
TLine & AddLine(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:187
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
void Draw(const char *opt=0)
static void FromPDG(TLine &line, int pdgcode)
Definition: Style.cxx:139
void Clear()
Definition: View2D.cxx:109
virtual double ConvertXToTicks(double X, int p, int t, int c) const =0
int fMakeSeeds
Draw two lines to make clusters if clicked.
void Draw()
Definition: View2D.cxx:89
virtual double ConvertTicksToX(double ticks, int p, int t, int c) const =0
static const char * zoom_opt
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:53
unsigned int plane
Definition: PxUtils.h:73
double t0
defined to be the vertex t-position
Definition: PxUtils.h:70
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TWireProjPad.h:93
evd_tool::IExperimentDrawer * evd::DrawingPad::GeometryDraw ( )
inherited

Provide access to the drawer for the detector geometry

Definition at line 84 of file DrawingPad.cxx.

References evd::DrawingPad::fGeometryDraw, evd::EvdLayoutOptions::fParameterSet, and fhicl::ParameterSet::get().

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

85  {
86  if (fGeometryDraw==0)
87  {
89  const fhicl::ParameterSet& pset = layoutOptions->fParameterSet;
90 
91  fGeometryDraw = art::make_tool<evd_tool::IExperimentDrawer>(pset.get<fhicl::ParameterSet>("Experiment3DDrawer"));
92  }
93  return fGeometryDraw.get();
94  }
IExperimentDrawerPtr fGeometryDraw
Drawer for detector geometry.
Definition: DrawingPad.h:56
const fhicl::ParameterSet & fParameterSet
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::vector<double> const& evd::TWireProjPad::GetCurrentZoom ( ) const
inline

Definition at line 79 of file TWireProjPad.h.

Referenced by Draw(), and evd::TWQProjectionView::Draw().

79 {return fCurrentZoom;}
std::vector< double > fCurrentZoom
Definition: TWireProjPad.h:87
DrawOptions_t const& evd::TWireProjPad::GetDrawOptions ( ) const
inline

Return the current draw options.

Definition at line 50 of file TWireProjPad.h.

Referenced by Draw(), and ShowFull().

50 { return fDrawOpts; }
DrawOptions_t fDrawOpts
set of current draw options
Definition: TWireProjPad.h:88
unsigned int evd::TWireProjPad::GetPlane ( ) const
inline

Definition at line 68 of file TWireProjPad.h.

68 { return fPlane; }
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
void evd::TWireProjPad::GetWireRange ( int *  i1,
int *  i2 
) const

Definition at line 374 of file TWireProjPad.cxx.

References fHisto, and fOri.

375  {
376  if(fOri < 1){
377  *i1 = fHisto->GetXaxis()->GetFirst();
378  *i2 = fHisto->GetXaxis()->GetLast();
379  }
380  else{
381  *i1 = fHisto->GetYaxis()->GetFirst();
382  *i2 = fHisto->GetYaxis()->GetLast();
383  }
384 
385  return;
386  }
int fOri
Orientation of the axes - see RawDrawingOptions for values.
Definition: TWireProjPad.h:99
TH1F * fHisto
Histogram to draw object on.
Definition: TWireProjPad.h:92
HeaderDrawer * evd::DrawingPad::HeaderDraw ( )
inherited

Provide access to the drawer for the detector geometry

Definition at line 75 of file DrawingPad.cxx.

References evd::DrawingPad::fHeaderDraw.

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

76  {
77  if (fHeaderDraw==0) fHeaderDraw = new HeaderDrawer();
78  return fHeaderDraw;
79  }
HeaderDrawer * fHeaderDraw
Drawer for event header info.
Definition: DrawingPad.h:54
HitSelector * evd::DrawingPad::HitSelectorGet ( )
inherited

Provide access to the HitSelector

Definition at line 144 of file DrawingPad.cxx.

References evd::gTheHitSelector.

Referenced by ClearHitList(), evd::CalorPad::Draw(), Draw(), SaveHitList(), SaveSeedList(), SelectOneHit(), and evd::Display3DPad::UpdateSeedCurve().

145  {
146  if (gTheHitSelector==0) gTheHitSelector = new HitSelector();
147  return gTheHitSelector;
148  }
HitSelector * gTheHitSelector
Definition: DrawingPad.cxx:28
RawDataDrawer * evd::DrawingPad::RawDataDraw ( )
inherited

Provide access to the drawer for the RawData classes

Definition at line 109 of file DrawingPad.cxx.

References evd::DrawingPad::fRawDataDraw.

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

110  {
111  if (fRawDataDraw==0) fRawDataDraw = new RawDataDrawer();
112  return fRawDataDraw;
113  }
RawDataDrawer * fRawDataDraw
Drawer for raw data.
Definition: DrawingPad.h:58
RecoBaseDrawer * evd::DrawingPad::RecoBaseDraw ( )
inherited

Provide access to the drawer for RecoBase classes

Definition at line 120 of file DrawingPad.cxx.

References evd::DrawingPad::fRecoBaseDraw.

Referenced by evd::TQPad::Draw(), evd::Display3DPad::Draw(), Draw(), evd::Ortho3DPad::Draw(), and ShowFull().

121  {
122  if (fRecoBaseDraw==0) fRecoBaseDraw = new RecoBaseDrawer();
123  return fRecoBaseDraw;
124 
125  }
RecoBaseDrawer * fRecoBaseDraw
Drawer for recobase objects.
Definition: DrawingPad.h:59
void evd::TWireProjPad::SaveHitList ( double  i1,
double  i2,
double  y1,
double  y2,
double  distance,
const char *  zoom_opt,
bool  good_plane = true 
)

Definition at line 436 of file TWireProjPad.cxx.

References Draw(), tca::evt, fPlane, evd::RecoDrawingOptions::fUseHitSelector, fView, evdb::EventHolder::GetEvent(), evd::DrawingPad::HitSelectorGet(), evdb::EventHolder::Instance(), and evd::HitSelector::SaveHits().

443  {
445  if(evt){
447  if(recoopt->fUseHitSelector){
448  this->HitSelectorGet()->SaveHits(*evt, fView, fPlane, i1, i2, y1, y2, distance, good_plane);
449  this->Draw(zoom_opt);
450  }
451  }
452 
453  return;
454  }
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
Float_t y1[n_points_granero]
Definition: compare.C:5
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
void Draw(const char *opt=0)
Float_t y2[n_points_geant4]
Definition: compare.C:26
void SaveHits(const art::Event &evt, evdb::View2D *view, unsigned int plane, double x, double y, double x1, double y1, double distance, bool good_plane=true)
static EventHolder * Instance()
Definition: EventHolder.cxx:15
HitSelector * HitSelectorGet()
Definition: DrawingPad.cxx:144
static const char * zoom_opt
TCEvent evt
Definition: DataStructs.cxx:5
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TWireProjPad.h:93
double evd::TWireProjPad::SaveSeedList ( std::vector< util::PxLine seedlines,
double  distance 
)

Definition at line 459 of file TWireProjPad.cxx.

References tca::evt, evd::RecoDrawingOptions::fUseHitSelector, fView, evdb::EventHolder::GetEvent(), evd::DrawingPad::HitSelectorGet(), evdb::EventHolder::Instance(), util::kBogusD, and evd::HitSelector::SaveSeedLines().

461  {
462  double KineticEnergy = util::kBogusD;
464  if(evt){
466  if(recoopt->fUseHitSelector)
467  KineticEnergy = this->HitSelectorGet()->SaveSeedLines(*evt, fView,seedlines, distance);
468  }
469  return KineticEnergy;
470  }
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
static EventHolder * Instance()
Definition: EventHolder.cxx:15
double SaveSeedLines(const art::Event &evt, evdb::View2D *view, std::vector< util::PxLine > seedline, double distance)
Definition: HitSelector.cxx:56
HitSelector * HitSelectorGet()
Definition: DrawingPad.cxx:144
constexpr double kBogusD
obviously bogus double value
TCEvent evt
Definition: DataStructs.cxx:5
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TWireProjPad.h:93
void evd::TWireProjPad::SelectOneHit ( double  x,
double  y,
const char *  zoom_opt 
)

Definition at line 473 of file TWireProjPad.cxx.

References evd::HitSelector::ChangeHit(), Draw(), tca::evt, fPlane, evd::RecoDrawingOptions::fUseHitSelector, fView, evdb::EventHolder::GetEvent(), evd::DrawingPad::HitSelectorGet(), and evdb::EventHolder::Instance().

476  {
477 
479  if(evt){
481  if(recoopt->fUseHitSelector){
482  this->HitSelectorGet()->ChangeHit(*evt, fView, fPlane,x,y);
483  this->Draw(zoom_opt);
484  }
485  }
486 
487  return;
488  }
Float_t x
Definition: compare.C:6
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
Float_t y
Definition: compare.C:6
void Draw(const char *opt=0)
static EventHolder * Instance()
Definition: EventHolder.cxx:15
HitSelector * HitSelectorGet()
Definition: DrawingPad.cxx:144
static const char * zoom_opt
TCEvent evt
Definition: DataStructs.cxx:5
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TWireProjPad.h:93
void ChangeHit(const art::Event &evt, evdb::View2D *view, unsigned int plane, double x, double y)
void evd::TWireProjPad::SetDrawOptions ( DrawOptions_t const &  opt)
inline

Receive the full set of draw options.

Definition at line 52 of file TWireProjPad.h.

52 { fDrawOpts = opt; }
DrawOptions_t fDrawOpts
set of current draw options
Definition: TWireProjPad.h:88
void evd::TWireProjPad::SetWireRange ( int  i1,
int  i2 
)

Definition at line 391 of file TWireProjPad.cxx.

References fCurrentZoom, fHisto, and fOri.

392  {
393  if(fOri < 1){
394  fHisto->GetXaxis()->SetRange(i1,i2);
395  }
396  else{
397  fHisto->GetYaxis()->SetRange(i1,i2);
398  }
399  fCurrentZoom[0] = i1;
400  fCurrentZoom[1] = i2;
401 
402  return;
403  }
int fOri
Orientation of the axes - see RawDrawingOptions for values.
Definition: TWireProjPad.h:99
TH1F * fHisto
Histogram to draw object on.
Definition: TWireProjPad.h:92
std::vector< double > fCurrentZoom
Definition: TWireProjPad.h:87
void evd::TWireProjPad::SetZoomFromView ( )

Sets the zoom parameters from the current histogram view.

Definition at line 424 of file TWireProjPad.cxx.

References fCurrentZoom, fHisto, fPlane, LOG_DEBUG, and xaxis.

424  {
425  TAxis const& xaxis = *(fHisto->GetXaxis());
426  fCurrentZoom[0] = xaxis.GetBinLowEdge(xaxis.GetFirst());
427  fCurrentZoom[1] = xaxis.GetBinUpEdge(xaxis.GetLast());
428  fCurrentZoom[2] = fHisto->GetMinimum();
429  fCurrentZoom[3] = fHisto->GetMaximum();
430  LOG_DEBUG("TWireProjPad") << "Zoom set to wires ("
431  << fCurrentZoom[0] << "; " << fCurrentZoom[1] << " ), tick ("
432  << fCurrentZoom[2] << "; " << fCurrentZoom[3] << ") for plane #"
433  << fPlane;
434  } // TWireProjPad::SetZoomFromView()
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
TGaxis * xaxis
Definition: plot_hist.C:61
TH1F * fHisto
Histogram to draw object on.
Definition: TWireProjPad.h:92
#define LOG_DEBUG(id)
std::vector< double > fCurrentZoom
Definition: TWireProjPad.h:87
void evd::TWireProjPad::SetZoomRange ( int  i1,
int  i2,
int  y1,
int  y2 
)

Definition at line 408 of file TWireProjPad.cxx.

References fCurrentZoom, fHisto, fPlane, LOG_DEBUG, y1, and y2.

Referenced by Draw(), ShowFull(), and TWireProjPad().

409  {
410  LOG_DEBUG("TWireProjPad")
411  << "SetZoomRange(" << i1 << ", " << i2 << ", " << y1 << ", " << y2
412  << ") on plane #" << fPlane;
413 
414  fHisto->GetXaxis()->SetRangeUser(i1,i2);
415  fHisto->GetYaxis()->SetRangeUser(y1,y2);
416  fCurrentZoom[0]=i1;
417  fCurrentZoom[1]=i2;
418  fCurrentZoom[2]=y1;
419  fCurrentZoom[3]=y2;
420  }
Float_t y1[n_points_granero]
Definition: compare.C:5
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
Float_t y2[n_points_geant4]
Definition: compare.C:26
TH1F * fHisto
Histogram to draw object on.
Definition: TWireProjPad.h:92
#define LOG_DEBUG(id)
std::vector< double > fCurrentZoom
Definition: TWireProjPad.h:87
void evd::TWireProjPad::SetZoomToRoI ( bool  bZoomToRoI)
inline

Sets the draw option about zooming to the region of interest.

Definition at line 55 of file TWireProjPad.h.

References x, y, y1, y2, and evd::zoom_opt.

56  { fDrawOpts.bZoom2DdrawToRoI = bZoomToRoI; }
bool bZoom2DdrawToRoI
whether to force zoom to RoI or not
Definition: TWireProjPad.h:35
DrawOptions_t fDrawOpts
set of current draw options
Definition: TWireProjPad.h:88
void evd::TWireProjPad::ShowFull ( int  override = 0)

Automatically zoom the view to a size just larger than the events. Also ensures that the aspect ratio is the same for the XZ and YZ projections.

Definition at line 345 of file TWireProjPad.cxx.

References evd::RawDrawingOptions::fDrawRawDataOrCalibWires, fPlane, fXHi, fXLo, fYHi, fYLo, GetDrawOptions(), evd::RawDataDrawer::GetRegionOfInterest(), evd::RecoBaseDrawer::GetRegionOfInterest(), evd::DrawingPad::RawDataDraw(), evd::DrawingPad::RecoBaseDraw(), SetZoomRange(), and fhicl::has_insertion_operator_impl::test().

Referenced by Draw().

346  {
348 
349  // x values are wire numbers, y values are ticks of the clock
350  int xmin = fXLo;
351  int xmax = fXHi;
352  int ymax = fYHi;
353  int ymin = fYLo;
354 
357 
358  if(GetDrawOptions().bZoom2DdrawToRoI && !override){
359  int test=0;
360  if(rawopt->fDrawRawDataOrCalibWires == 0)
361  test=RawDataDraw()->GetRegionOfInterest((int)fPlane,xmin,xmax,ymin,ymax);
362  else
363  test=RecoBaseDraw()->GetRegionOfInterest((int)fPlane,xmin,xmax,ymin,ymax);
364 
365  if(test != 0) return;
366  }
367 
368  SetZoomRange(xmin, xmax, ymin, ymax);
369 
370  return;
371  }
int GetRegionOfInterest(int plane, int &minw, int &maxw, int &mint, int &maxt)
int fDrawRawDataOrCalibWires
0 for raw
unsigned int fPlane
Which plane in the detector.
Definition: TWireProjPad.h:91
double fXLo
Low value of x axis.
Definition: TWireProjPad.h:95
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:109
double fXHi
High value of x axis.
Definition: TWireProjPad.h:96
DrawOptions_t const & GetDrawOptions() const
Return the current draw options.
Definition: TWireProjPad.h:50
RecoBaseDrawer * RecoBaseDraw()
Definition: DrawingPad.cxx:120
double fYLo
Low value of y axis.
Definition: TWireProjPad.h:97
void SetZoomRange(int i1, int i2, int y1, int y2)
int GetRegionOfInterest(int plane, int &minw, int &maxw, int &mint, int &maxt)
double fYHi
High value of y axis.
Definition: TWireProjPad.h:98
SimulationDrawer * evd::DrawingPad::SimulationDraw ( )
inherited

Provide access to the drawer for the Simulation classes

Definition at line 99 of file DrawingPad.cxx.

References evd::DrawingPad::fSimulationDraw.

Referenced by evd::MCBriefPad::Draw(), evd::Display3DPad::Draw(), Draw(), and evd::Ortho3DPad::Draw().

100  {
101  if (fSimulationDraw==0) fSimulationDraw = new SimulationDrawer();
102  return fSimulationDraw;
103 
104  }
SimulationDrawer * fSimulationDraw
Drawer for simulation objects.
Definition: DrawingPad.h:57
void evd::TWireProjPad::UpdatePad ( )

Definition at line 500 of file TWireProjPad.cxx.

References evd::DrawingPad::fPad.

Referenced by ClearandUpdatePad(), Draw(), DrawLinesinView(), and UpdateSeedCurve().

500  {
501  fPad->cd();
502  fPad->Modified();
503  fPad->Update();
504  fPad->GetFrame()->SetBit(TPad::kCannotMove,true);
505  fPad->SetBit(TPad::kCannotMove,true);
506 
507  return;
508  }
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:53
double evd::TWireProjPad::UpdateSeedCurve ( std::vector< recob::Seed SeedVec,
int  plane 
)

Definition at line 604 of file TWireProjPad.cxx.

References evdb::View2D::AddMarker(), evdb::View2D::AddPolyLine(), evdb::View2D::Draw(), fView, trkf::BezierTrack::GetLength(), trkf::BezierTrack::GetProjectedPointUVWT(), LOG_DEBUG, UpdatePad(), x, and y.

605  {
606  mf::LogVerbatim("TWireProjPad") <<"running updateseedcurve for plane " << plane;
607  fView->Draw();
608  UpdatePad();
609  int N=100;
610 
611  double ReturnVal=0;
612 
613  // For some reason, this line is needed to prevent lines being drawn twice
614  // TPolyLine& pldummy1 = fView->AddPolyLine(2,kBlue,1,0);
615  // pldummy1.SetPoint(0,0,0);
616  // pldummy1.SetPoint(1,0,0);
617 
618  int c=0; int t=0;
619  int LastGoodValue=0;
620  double ticks[3];
621  double projpt[3];
622 
623  if(SeedVec.size() > 1){
624  TPolyLine& pl = fView->AddPolyLine(N,kOrange+9,2,0);
625  fView->Draw();
626 
627  trkf::BezierTrack BTrack(SeedVec);
628 
629  for(int i = 0; i != N; ++i){
630  try{
631  BTrack.GetProjectedPointUVWT(float(i)/N,projpt,ticks,c,t );
632  LastGoodValue=i;
633  LOG_DEBUG("TWireProjPad") << i << " ";
634  }
635  catch(cet::exception excp){
636  BTrack.GetProjectedPointUVWT(float(LastGoodValue)/N, projpt, ticks, c, t);
637  }
638 
639  double x = projpt[plane];
640  double y = ticks[plane];
641  pl.SetPoint(i,x,y);
642 
643  if(LastGoodValue!=i){
644  TMarker& mrk = fView->AddMarker(x, y, 3, 34, 1.5);
645  mrk.SetMarkerColor(3);
646  }
647  }
648  ReturnVal = BTrack.GetLength();
649  }
650  else
651  ReturnVal=0;
652 
653  fView->Draw();
654  UpdatePad();
655 
656  return ReturnVal;
657  }
Float_t x
Definition: compare.C:6
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
TPolyLine & AddPolyLine(int n, int c, int w, int s)
Definition: View2D.cxx:210
Float_t y
Definition: compare.C:6
void Draw()
Definition: View2D.cxx:89
#define LOG_DEBUG(id)
TMarker & AddMarker(double x, double y, int c, int st, double sz)
Definition: View2D.cxx:124
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TWireProjPad.h:93
evdb::View2D* evd::TWireProjPad::View ( ) const
inline

Definition at line 77 of file TWireProjPad.h.

77 { return fView; }
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TWireProjPad.h:93

Member Data Documentation

AnalysisBaseDrawer* evd::DrawingPad::fAnalysisBaseDraw
protectedinherited

Drawer for analysisbase objects.

Definition at line 60 of file DrawingPad.h.

Referenced by evd::DrawingPad::AnalysisBaseDraw(), and evd::DrawingPad::~DrawingPad().

std::vector<double> evd::TWireProjPad::fCurrentZoom
private

Definition at line 87 of file TWireProjPad.h.

Referenced by SetWireRange(), SetZoomFromView(), SetZoomRange(), and TWireProjPad().

DrawOptions_t evd::TWireProjPad::fDrawOpts
private

set of current draw options

Definition at line 88 of file TWireProjPad.h.

IExperimentDrawerPtr evd::DrawingPad::fGeometryDraw
protectedinherited

Drawer for detector geometry.

Definition at line 56 of file DrawingPad.h.

Referenced by evd::DrawingPad::GeometryDraw().

HeaderDrawer* evd::DrawingPad::fHeaderDraw
protectedinherited

Drawer for event header info.

Definition at line 54 of file DrawingPad.h.

Referenced by evd::DrawingPad::HeaderDraw(), and evd::DrawingPad::~DrawingPad().

TH1F* evd::TWireProjPad::fHisto
private

Histogram to draw object on.

Definition at line 92 of file TWireProjPad.h.

Referenced by Draw(), GetWireRange(), SetWireRange(), SetZoomFromView(), SetZoomRange(), TWireProjPad(), and ~TWireProjPad().

int evd::TWireProjPad::fOri
private

Orientation of the axes - see RawDrawingOptions for values.

Definition at line 99 of file TWireProjPad.h.

Referenced by Draw(), GetWireRange(), SetWireRange(), and TWireProjPad().

unsigned int evd::TWireProjPad::fPlane
private

Which plane in the detector.

Definition at line 91 of file TWireProjPad.h.

Referenced by ClearHitList(), Draw(), DrawLinesinView(), SaveHitList(), SelectOneHit(), SetZoomFromView(), SetZoomRange(), ShowFull(), and TWireProjPad().

RawDataDrawer* evd::DrawingPad::fRawDataDraw
protectedinherited

Drawer for raw data.

Definition at line 58 of file DrawingPad.h.

Referenced by evd::DrawingPad::RawDataDraw(), and evd::DrawingPad::~DrawingPad().

RecoBaseDrawer* evd::DrawingPad::fRecoBaseDraw
protectedinherited

Drawer for recobase objects.

Definition at line 59 of file DrawingPad.h.

Referenced by evd::DrawingPad::RecoBaseDraw(), and evd::DrawingPad::~DrawingPad().

SimulationDrawer* evd::DrawingPad::fSimulationDraw
protectedinherited

Drawer for simulation objects.

Definition at line 57 of file DrawingPad.h.

Referenced by evd::DrawingPad::SimulationDraw(), and evd::DrawingPad::~DrawingPad().

evdb::View2D* evd::TWireProjPad::fView
private

Collection of graphics objects to render.

Definition at line 93 of file TWireProjPad.h.

Referenced by Draw(), DrawLinesinView(), SaveHitList(), SaveSeedList(), SelectOneHit(), TWireProjPad(), UpdateSeedCurve(), and ~TWireProjPad().

double evd::TWireProjPad::fXHi
private

High value of x axis.

Definition at line 96 of file TWireProjPad.h.

Referenced by Draw(), ShowFull(), and TWireProjPad().

double evd::TWireProjPad::fXLo
private

Low value of x axis.

Definition at line 95 of file TWireProjPad.h.

Referenced by Draw(), ShowFull(), and TWireProjPad().

double evd::TWireProjPad::fYHi
private

High value of y axis.

Definition at line 98 of file TWireProjPad.h.

Referenced by Draw(), ShowFull(), and TWireProjPad().

double evd::TWireProjPad::fYLo
private

Low value of y axis.

Definition at line 97 of file TWireProjPad.h.

Referenced by Draw(), ShowFull(), and TWireProjPad().


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