203 properties[
"focus"] = focus;
205 JParser<> zap(
"Auxiliary program to draw the footprint of detector(s).");
207 zap[
'w'] =
make_field(canvas,
"size of canvas <nx>x<ny> [pixels]") = JCanvas(500, 500);
213 zap[
'L'] =
make_field(legend,
"position legend e.g. TR") =
"",
"TL",
"TR",
"BR",
"BL";
214 zap[
'S'] =
make_field(markerSize,
"marker size") = 1.0;
215 zap[
's'] =
make_field(textSize,
"text size") = 0.02;
216 zap[
'C'] =
make_field(drawCircle,
"draw smallest enclosing cicrle");
217 zap[
'B'] =
make_field(batch,
"batch processing");
222 catch(
const exception &error) {
223 FATAL(error.what() << endl);
227 if (detectorFile.empty() && tripodsFile.empty()) {
228 FATAL(
"No detector elements." << endl);
232 gROOT->SetBatch(batch);
234 gErrorIgnoreLevel = kWarning;
236 TApplication* tp =
new TApplication(
"user", NULL, NULL);
237 TCanvas* cv =
new TCanvas(
"detector",
"", canvas.x, canvas.y);
239 JSinglePointer<TStyle> gStyle(
new JStyle(
"gplot", cv->GetWw(), cv->GetWh()));
241 gROOT->SetStyle(
"gplot");
244 cv->SetFillStyle(4000);
245 cv->SetFillColor(kWhite);
252 TAttText(kHAlignLeft + kVAlignBottom, 0.25*
PI, kBlack, 62, textSize),
253 TAttText(kHAlignRight + kVAlignBottom, 0.75*
PI, kBlack, 62, textSize),
254 TAttText(kHAlignRight + kVAlignTop, 1.25*
PI, kBlack, 62, textSize),
255 TAttText(kHAlignLeft + kVAlignTop, 1.75*
PI, kBlack, 62, textSize)
259 JUTMPosition position;
262 for (
size_t i = 0;
i != detectorFile.size(); ++
i) {
267 load(detectorFile[
i], detector);
269 catch(
const JException& error) {
273 position = detector.getUTMPosition();
276 const TAttText&
text = text_attributes[(0+
i)%text_attributes.size()];
280 offset = 3.0 * textSize * JCircle2D(detector.begin(), detector.end()).getRadius();
285 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
287 if (counter.count(module->getString()) == 0) {
289 buffer.push_back(JPoint_t(
MAKE_STRING(module->getString()),
290 JPosition2D(module->getX(), module->getY()),
295 counter.insert(module->getString());
300 for (
size_t i = 0;
i != tripodsFile.size(); ++
i) {
304 tripods.load(tripodsFile[
i].c_str());
307 const TAttText& text = text_attributes[(0+
i)%text_attributes.size()];
311 offset = 3.0 * textSize * JCircle2D(tripods.begin(), tripods.end()).getRadius();
314 for (tripods_container::iterator
i = tripods.begin();
i != tripods.end(); ++
i) {
317 JPosition2D(
i->getUTMEast() - position.getUTMEast(),
i->getUTMNorth() - position.getUTMNorth()),
324 if (!transmittersFile.empty()) {
326 if (transmittersFile.size() == detectorFile.size()) {
328 for (
size_t i = 0;
i != transmittersFile.size(); ++
i) {
332 transmitters.
load(transmittersFile[
i].c_str());
336 load(detectorFile[
i], detector);
339 const TAttText& text = text_attributes[(2+
i)%text_attributes.size()];
343 offset = 3.0 * textSize * JCircle2D(transmitters.begin(), transmitters.end()).getRadius();
346 for (transmitters_container::iterator
i = transmitters.begin();
i != transmitters.end(); ++
i) {
348 const JPosition3D pos = detector.getModule(
i->getLocation()).
getPosition();
351 JPosition2D(pos.getX() +
i->getX(), pos.getY() +
i->getY()),
360 FATAL(
"Tranmitter files and detector files should match one-to-one." << endl);
367 copy(
i->second.begin(),
i->second.end(), back_inserter(buffer));
370 JCircle2D circle(buffer.begin(), buffer.end());
372 if (focus.getRadius() > 0.0) {
376 NOTICE(
"focus = " <<
FIXED(12,3) << circle.getX() <<
' ' <<
FIXED(12,3) << circle.getY() <<
' ' <<
FIXED(9,3) << circle.getRadius() << endl);
381 i->second.sub(circle.getX(), circle.getY());
384 circle.sub(circle.getPosition());
391 const Double_t
xmin = circle.getX() - 1.15 * circle.getRadius();
392 const Double_t
xmax = circle.getX() + 1.15 * circle.getRadius();
393 const Double_t ymin = circle.getY() - 1.15 * circle.getRadius();
394 const Double_t ymax = circle.getY() + 1.15 * circle.getRadius();
396 TH2D h2(
"h2",
"", 1,
xmin,
xmax, 1, ymin, ymax);
398 h2.GetXaxis()->SetTitle(
"x [m]");
399 h2.GetYaxis()->SetTitle(
"y [m]");
401 h2.GetXaxis()->CenterTitle(
true);
402 h2.GetYaxis()->CenterTitle(
true);
408 TEllipse ellipse(circle.getX(), circle.getY(), circle.getRadius());
420 Ssiz_t height =
data.size();
424 width = max(width, (Ssiz_t)
i->first.size());
427 TLegend* lg =
getLegend(width, height, legend);
429 lg->SetTextSize(textSize);
432 if (!
i->second.empty()) {
433 lg->AddEntry(&
i->second[0].marker,
i->first.c_str(),
"P");
Utility class to parse command line options.
JContainer< std::vector< JTransmitter > > transmitters_container
Utility class to parse parameter values.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
#define MAKE_STRING(A)
Make string.
T & getInstance(const T &object)
Get static instance from temporary object.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
TLegend * getLegend(const Int_t width, const Int_t height, const std::string option, const Double_t factor=1.0)
Get legend.
JPosition3D getPosition(const Vec &pos)
Get position.
static const double PI
Mathematical constants.
JContainer< std::vector< JTripod > > tripods_container
void load(const char *file_name)
Load from input file.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void copy(const Head &from, JHead &to)
Copy header from from to to.
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