8 #include "TApplication.h"
31 int main(
int argc,
char**argv)
42 JParser<> zap(
"Auxiliary program to draw the footprint of detector(s).");
51 catch(
const exception &error) {
52 FATAL(error.what() << endl);
80 ERROR(
"Empty detector." << endl);
85 TGraph* graph =
new TGraph(
detector.size());
87 graph->SetTitle(file_name->c_str());
91 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i, ++
n) {
95 graph->GetX()[
n] = i->getX();
96 graph->GetY()[
n] = i->getY();
101 buffer.push_back(graph);
106 FATAL(
"No detector elements." << endl);
110 DEBUG(
"Detector (x,y,R): " << circle.
getX() <<
' ' << circle.
getY() <<
' ' << circle.
getRadius() << endl);
113 for (
int i = 0; i != (*graph)->GetN(); ++i) {
114 (*graph)->GetX()[i] -= circle.
getX();
115 (*graph)->GetY()[i] -= circle.
getY();
127 Double_t xmin = circle.
getX() - R;
128 Double_t xmax = circle.
getX() + R;
129 Double_t ymin = circle.
getY() - R;
130 Double_t ymax = circle.
getY() + R;
133 TApplication* tp =
new TApplication(
"user", NULL, NULL);
136 TCanvas cv(
"detector",
"", 400, 400);
138 cv.SetFillStyle(4000);
144 const Double_t dx = (xmax - xmin);
145 const Double_t dy = (ymax - ymin);
153 TH2D h2(
"h2",
"", 1, xmin, xmax, 1, ymin, ymax);
155 h2.GetXaxis()->SetTitle(
"x [m]");
156 h2.GetYaxis()->SetTitle(
"y [m]");
158 h2.GetXaxis()->CenterTitle(
true);
159 h2.GetYaxis()->CenterTitle(
true);
176 const Double_t x2 = gPad->GetX2() - gStyle->GetPadRightMargin();
177 const Double_t y2 = gPad->GetY2() - gStyle->GetPadTopMargin();
180 Double_t font_size = 0.03;
183 length = max(length, strlen((*graph)->GetTitle()));
186 TLegend* legend =
new TLegend(x2 - length * font_size * 0.65 - 0.02,
187 y2 - buffer.size() * font_size,
192 legend->SetFillColor(0);
193 legend->SetBorderSize(0);
194 legend->SetTextSize(font_size);
197 legend->AddEntry(*graph, (*graph)->GetTitle(),
"P");