Create a pad to show an orthographic rendering of 3D objcts.
73 art::ServiceHandle<geo::Geometry const> geo;
78 Pad()->SetBit(TPad::kCannotMove);
81 Pad()->SetLeftMargin(0.080);
82 Pad()->SetRightMargin(0.010);
83 Pad()->SetTopMargin(0.010);
84 Pad()->SetBottomMargin(0.10);
94 for (
size_t i = 0; i < geo->NTPC(); ++i) {
95 double local[3] = {0., 0., 0.};
96 double world[3] = {0., 0., 0.};
99 if (minx > world[0] - geo->DetHalfWidth(i)) minx = world[0] - geo->DetHalfWidth(i);
100 if (maxx < world[0] + geo->DetHalfWidth(i)) maxx = world[0] + geo->DetHalfWidth(i);
101 if (miny > world[1] - geo->DetHalfHeight(i)) miny = world[1] - geo->DetHalfHeight(i);
102 if (maxy < world[1] + geo->DetHalfHeight(i)) maxy = world[1] + geo->DetHalfHeight(i);
103 if (minz > world[2] - geo->DetLength(i) / 2.) minz = world[2] - geo->DetLength(i) / 2.;
104 if (maxz < world[2] + geo->DetLength(i) / 2.) maxz = world[2] + geo->DetLength(i) / 2.;
108 TPCBox.push_back(TBox(world[0] - geo->DetHalfWidth(i),
109 world[1] - geo->DetHalfHeight(i),
110 world[0] + geo->DetHalfWidth(i),
111 world[1] + geo->DetHalfHeight(i)));
114 TPCBox.push_back(TBox(world[2] - geo->DetLength(i) / 2.,
115 world[0] - geo->DetHalfWidth(i),
116 world[2] + geo->DetLength(i) / 2.,
117 world[0] + geo->DetHalfWidth(i)));
120 TPCBox.push_back(TBox(world[2] - geo->DetLength(i) / 2.,
121 world[1] - geo->DetHalfHeight(i),
122 world[2] + geo->DetLength(i) / 2.,
123 world[1] + geo->DetHalfHeight(i)));
126 throw cet::exception(
"Ortho3DPad")
127 << __func__ <<
": unwknow projection " << ((int)proj) <<
"\n";
129 TPCBox.back().SetFillStyle(0);
130 TPCBox.back().SetLineStyle(2);
131 TPCBox.back().SetLineWidth(2);
132 TPCBox.back().SetLineColor(16);
155 throw cet::exception(
"Ortho3DPad")
156 << __func__ <<
": unwknow projection " << ((int)proj) <<
"\n";
162 fHisto->SetBit(kCannotPick);
163 fHisto->SetBit(TPad::kCannotMove);
164 fHisto->SetTitleOffset(1.,
"Y");
165 fHisto->SetTitleOffset(1.,
"X");
166 fHisto->GetXaxis()->SetLabelSize(0.04);
167 fHisto->GetXaxis()->SetTitleSize(0.04);
170 fHisto->GetXaxis()->SetTitle(
"x (cm)");
171 fHisto->GetYaxis()->SetTitle(
"y (cm)");
174 fHisto->GetXaxis()->SetTitle(
"z (cm)");
175 fHisto->GetYaxis()->SetTitle(
"x (cm)");
178 fHisto->GetXaxis()->SetTitle(
"z (cm)");
179 fHisto->GetYaxis()->SetTitle(
"y (cm)");
182 throw cet::exception(
"Ortho3DPad")
183 << __func__ <<
": unexpected flow (projection: " << ((int)proj) <<
")\n";
186 fHisto->GetXaxis()->CenterTitle();
187 fHisto->GetYaxis()->SetLabelSize(0.04);
188 fHisto->GetYaxis()->SetTitleSize(0.04);
189 fHisto->GetYaxis()->CenterTitle();
193 fView =
new evdb::View2D();
196 Pad()->SetFillColor(18);
197 Pad()->SetFrameFillColor(18);
198 Pad()->GetPainter()->SetFillColor(18);
204 std::ostringstream ostr;
205 ostr <<
"evd::Ortho3DPad::MouseEvent((evd::Ortho3DPad*)" <<
this <<
")";
206 fPad->AddExec(
"getmousezoom", ostr.str().c_str());
int fPressPy
Poxel location where button 1 was pressed.
double fReleaseX
User location where button 1 was released.
Geometry information for a single TPC.
int fCurrentPy
Current pixel location of mouse.
int fPressPx
Pixel location where button 1 was pressed.
double fReleaseY
User location where button 1 was released.
evd::OrthoProj_t fProj
Projection.
bool fBoxDrawn
Is selection box drawn?
double fPressX
User location where button 1 was pressed.
double fPressY
User location where button 1 was pressed.
int fCurrentPx
Current pixel location of mouse.
std::vector< TBox > TPCBox
TPC box.
TH1F * fHisto
Enclosing histogram.
TPad * fPad
The ROOT graphics pad.
bool fPress
Is button 1 pressed?
TGNumberEntry * fMSizeEntry
For changing marker size.
void LocalToWorld(const double *tpc, double *world) const
Transform point from local TPC frame to world frame.
DrawingPad(const char *nm, const char *ti, double x1, double y1, double y2, double x2)
evdb::View2D * fView
Collection of graphics objects to render.
double fMSize
Marker size.