46 tripods_container tripods;
56 JParser<> zap(
"Auxiliary program to draw the footprint of detector(s).");
58 zap[
'w'] =
make_field(canvas,
"size of canvas <nx>x<ny> [pixels]") =
JCanvas(500, 500);
62 zap[
'L'] =
make_field(legend,
"optional legend");
63 zap[
'S'] =
make_field(markerSize,
"marker size") = 1.0;
64 zap[
'B'] =
make_field(batch,
"batch processing");
69 catch(
const exception &error) {
70 FATAL(error.what() << endl);
74 if (detectorFile.empty() && tripods.empty()) {
75 FATAL(
"No detector elements." << endl);
79 gROOT->SetBatch(batch);
81 gErrorIgnoreLevel = kWarning;
83 TApplication* tp =
new TApplication(
"user", NULL, NULL);
84 TCanvas* cv =
new TCanvas(
"detector",
"", canvas.x, canvas.y);
88 gROOT->SetStyle(
"gplot");
91 cv->SetFillStyle(4000);
92 cv->SetFillColor(kWhite);
99 int number_of_positions = 0;
111 load(*file_name, detector);
117 if (detector.empty()) {
118 ERROR(
"Empty detector." << endl);
121 circle =
JCircle2D(detector.begin(), detector.end());
124 TGraph* graph =
new TGraph(detector.size());
130 for (JDetector::const_iterator i = detector.begin(); i != detector.end(); ++i, ++
n) {
132 number_of_positions += 1;
134 graph->GetX()[
n] = i->getX();
135 graph->GetY()[
n] = i->getY();
140 buffer.push_back(graph);
143 if (!tripods.empty()) {
145 if (number_of_positions == 0) {
147 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
151 position /= tripods.size();
156 for (tripods_container::iterator i = tripods.begin(); i != tripods.end(); ++i) {
157 zbuf.push_back(*i - position);
160 circle =
JCircle2D(zbuf.begin(), zbuf.end());
162 TGraph* graph =
new TGraph(zbuf.size());
164 graph->SetTitle(
"tripod");
166 for (
size_t i = 0; i != zbuf.size(); ++i) {
167 graph->GetX()[i] = zbuf[i].getPosition().getX();
168 graph->GetY()[i] = zbuf[i].getPosition().getY();
173 buffer.push_back(graph);
176 if (number_of_positions == 0 && tripods.empty()) {
177 FATAL(
"No detector elements." << endl);
181 DEBUG(
"Detector (x,y,R): " <<
FIXED(12,3) << circle.getX() <<
' ' <<
FIXED(12,3) << circle.getY() <<
' ' <<
FIXED(9,3) << circle.getRadius() << endl);
184 for (
int i = 0; i != (*graph)->GetN(); ++i) {
185 (*graph)->GetX()[i] -= circle.getX();
186 (*graph)->GetY()[i] -= circle.getY();
190 circle.sub(circle.getPosition());
192 Double_t
R = circle.getRadius();
198 Double_t xmin = circle.getX() -
R;
199 Double_t xmax = circle.getX() +
R;
200 Double_t ymin = circle.getY() -
R;
201 Double_t ymax = circle.getY() +
R;
204 const Double_t dx = (xmax - xmin);
205 const Double_t dy = (ymax - ymin);
215 TH2D h2(
"h2",
"", 1, xmin, xmax, 1, ymin, ymax);
217 h2.GetXaxis()->SetTitle(
"x [m]");
218 h2.GetYaxis()->SetTitle(
"y [m]");
220 h2.GetXaxis()->CenterTitle(
true);
221 h2.GetYaxis()->CenterTitle(
true);
227 TEllipse ellipse(circle.getX(), circle.getY(), circle.getRadius());
238 const Double_t x2 = gPad->GetX2() - gStyle->GetPadRightMargin();
239 const Double_t y2 = gPad->GetY2() - gStyle->GetPadTopMargin();
242 Double_t font_size = 0.03;
245 length = max(length, strlen((*graph)->GetTitle()));
248 TLegend* legend =
new TLegend(x2 - length * font_size * 0.65 - 0.02,
249 y2 - buffer.size() * font_size,
254 legend->SetFillColor(0);
255 legend->SetBorderSize(0);
256 legend->SetTextSize(font_size);
259 legend->AddEntry(*graph, (*graph)->GetTitle(),
"P");
Utility class to parse command line options.
const JUTMPosition & getUTMPosition() const
Get UTM position.
Data structure for circle in two dimensions.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
Data structure for UTM position.
The template JSinglePointer class can be used to hold a pointer to an object.
T & getInstance(const T &object)
Get static instance from temporary object.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then usage $script[distance] fi case set_variable R
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
alias put_queue eval echo n
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
do set_variable DETECTOR_TXT $WORKDIR detector
Wrapper class around ROOT TStyle.
Data structure for size of TCanvas.
#define DEBUG(A)
Message macros.