47 tripods_container tripods;
58 JParser<> zap(
"Auxiliary program to draw the footprint of detector(s).");
60 zap[
'w'] =
make_field(canvas,
"size of canvas <nx>x<ny> [pixels]") =
JCanvas(500, 500);
64 zap[
'L'] =
make_field(legend,
"optional legend");
65 zap[
'S'] =
make_field(markerSize,
"marker size") = 1.0;
66 zap[
's'] =
make_field(textSize,
"text size") = 0.02;
67 zap[
'B'] =
make_field(batch,
"batch processing");
72 catch(
const exception &error) {
73 FATAL(error.what() << endl);
77 if (detectorFile.empty() && tripods.empty()) {
78 FATAL(
"No detector elements." << endl);
82 gROOT->SetBatch(batch);
84 gErrorIgnoreLevel = kWarning;
86 TApplication* tp =
new TApplication(
"user", NULL, NULL);
87 TCanvas* cv =
new TCanvas(
"detector",
"", canvas.x, canvas.y);
91 gROOT->SetStyle(
"gplot");
94 cv->SetFillStyle(4000);
95 cv->SetFillColor(kWhite);
108 { 0.25*
PI, kHAlignLeft + kVAlignBottom },
109 { 0.75*
PI, kHAlignRight + kVAlignBottom },
110 { 1.25*
PI, kHAlignRight + kVAlignTop },
111 { 1.75*
PI, kHAlignLeft + kVAlignTop }
115 int number_of_positions = 0;
128 load(*file_name, detector);
134 if (detector.empty()) {
135 ERROR(
"Empty detector." << endl);
139 const JCircle2D c1(detector.begin(), detector.end());
141 if (
c1.getRadius() > circle.getRadius()) {
149 TGraph* graph =
new TGraph(detector.size());
153 dynamic_cast<TAttMarker&
>(*graph) = marker;
157 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module, ++
n) {
159 number_of_positions += 1;
161 graph->GetX()[
n] = module->getX();
162 graph->GetY()[
n] = module->getY();
164 if (module->getFloor() == 1) {
166 const alignment& a1 = align[
distance(detectorFile.cbegin(), file_name) % align.size()];
168 text.push_back(
new TText(module->getX() + 3.0 * textSize *
c1.getRadius()*cos(a1.angle),
169 module->getY() + 3.0 * textSize *
c1.getRadius()*sin(a1.angle),
172 (*
text.rbegin())->SetTextSize (textSize);
173 (*
text.rbegin())->SetTextAlign(a1.text);
174 (*
text.rbegin())->SetTextColor(marker.GetMarkerColor());
178 data.push_back(graph);
181 if (!tripods.empty()) {
183 if (number_of_positions == 0) {
185 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
189 position /= tripods.size();
194 for (tripods_container::iterator i = tripods.begin(); i != tripods.end(); ++i) {
195 zbuf.push_back(*i - position);
198 circle =
JCircle2D(zbuf.begin(), zbuf.end());
200 TGraph* graph =
new TGraph(zbuf.size());
202 graph->SetTitle(
"tripod");
204 for (
size_t i = 0; i != zbuf.size(); ++i) {
205 graph->GetX()[i] = zbuf[i].getPosition().getX();
206 graph->GetY()[i] = zbuf[i].getPosition().getY();
211 data.push_back(graph);
214 if (number_of_positions == 0 && tripods.empty()) {
215 FATAL(
"No detector elements." << endl);
219 DEBUG(
"Detector (x,y,R): " <<
FIXED(12,3) << circle.getX() <<
' ' <<
FIXED(12,3) << circle.getY() <<
' ' <<
FIXED(9,3) << circle.getRadius() << endl);
222 for (
int i = 0; i != (*graph)->GetN(); ++i) {
223 (*graph)->GetX()[i] -= circle.getX();
224 (*graph)->GetY()[i] -= circle.getY();
229 (*i)->SetX((*i)->GetX() - circle.getX());
230 (*i)->SetY((*i)->GetY() - circle.getY());
233 circle.sub(circle.getPosition());
235 Double_t
R = circle.getRadius();
241 Double_t xmin = circle.getX() -
R;
242 Double_t xmax = circle.getX() +
R;
243 Double_t ymin = circle.getY() -
R;
244 Double_t ymax = circle.getY() +
R;
247 const Double_t dx = (xmax - xmin);
248 const Double_t dy = (ymax - ymin);
258 TH2D h2(
"h2",
"", 1, xmin, xmax, 1, ymin, ymax);
260 h2.GetXaxis()->SetTitle(
"x [m]");
261 h2.GetYaxis()->SetTitle(
"y [m]");
263 h2.GetXaxis()->CenterTitle(
true);
264 h2.GetYaxis()->CenterTitle(
true);
270 TEllipse ellipse(circle.getX(), circle.getY(), circle.getRadius());
285 const Double_t x2 = gPad->GetX2() - gStyle->GetPadRightMargin();
286 const Double_t y2 = gPad->GetY2() - gStyle->GetPadTopMargin();
289 Double_t font_size = 0.03;
292 length = max(length, strlen((*graph)->GetTitle()));
295 TLegend* legend =
new TLegend(x2 - length * font_size * 0.65 - 0.02,
296 y2 - data.size() * font_size,
301 legend->SetFillColor(0);
302 legend->SetBorderSize(0);
303 legend->SetTextSize(font_size);
306 legend->AddEntry(*graph, (*graph)->GetTitle(),
"P");
Utility class to parse command line options.
const JUTMPosition & getUTMPosition() const
Get UTM position.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Data structure for circle in two dimensions.
#define MAKE_CSTRING(A)
Make C-string.
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
static const double PI
Mathematical constants.
then usage $script[distance] fi case set_variable R
TCanvas * c1
Global variables to handle mouse events.
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.