10 #include "TApplication.h" 
   56     JPoint_t(
const std::string& title,
 
   58              const TAttMarker&  marker,
 
   60              const double       offset) :
 
   62       offset(offset * cos(text.GetTextAngle()),
 
   63              offset * sin(text.GetTextAngle()))
 
   65       static_cast<TAttMarker&
>(this->marker) = marker;
 
   66       static_cast<TAttText&
>  (this->
text)   = text;
 
   68       this->text.SetTitle(title.c_str());
 
   69       this->text.SetTextAngle(0.0);                                 
 
   70       this->text.SetTextColor(marker.GetMarkerColor());             
 
   79     void add(
const double x, 
const double y)
 
   92     void sub(
const double x, 
const double y)
 
  113       this->marker.SetX(this->
getX());
 
  114       this->marker.SetY(this->
getY());
 
  115       this->text  .SetX(this->
getX() + offset.getX());
 
  116       this->text  .SetY(this->
getY() + offset.getY());
 
  139     void add(
const double x, 
const double y)
 
  141       for (
iterator i = begin(); i != end(); ++i) {
 
  152     void sub(
const double x, 
const double y)
 
  154       for (
iterator i = begin(); i != end(); ++i) {
 
  164       for (
iterator i = begin(); i != end(); ++i) {
 
  199     JParser<> zap(
"Auxiliary program to draw the footprint of detector(s).");
 
  201     zap[
'w'] = 
make_field(canvas,           
"size of canvas <nx>x<ny> [pixels]")  = 
JCanvas(500, 500);
 
  206     zap[
'L'] = 
make_field(legend,           
"position legend e.g. TR")            = 
"", 
"TL", 
"TR", 
"BR", 
"BL";
 
  207     zap[
'S'] = 
make_field(markerSize,       
"marker size")                        = 1.0;
 
  208     zap[
's'] = 
make_field(textSize,         
"text size")                          = 0.02;
 
  209     zap[
'C'] = 
make_field(drawCircle,       
"draw smallest enclosing cicrle");
 
  210     zap[
'B'] = 
make_field(batch,            
"batch processing");
 
  215   catch(
const exception &error) {
 
  216     FATAL(error.what() << endl);
 
  220   if (detectorFile.empty() && tripodsFile.empty()) {
 
  221     FATAL(
"No detector elements." << endl);
 
  225   gROOT->SetBatch(batch);
 
  227   gErrorIgnoreLevel = kWarning;
 
  229   TApplication* tp = 
new TApplication(
"user", NULL, NULL);
 
  230   TCanvas*      cv = 
new TCanvas(
"detector", 
"", canvas.x, canvas.y);
 
  234   gROOT->SetStyle(
"gplot");
 
  237   cv->SetFillStyle(4000);
 
  238   cv->SetFillColor(kWhite);
 
  245     TAttText(kHAlignLeft  + kVAlignBottom, 0.25*
PI, kBlack, 62, textSize),
 
  246     TAttText(kHAlignRight + kVAlignBottom, 0.75*
PI, kBlack, 62, textSize),
 
  247     TAttText(kHAlignRight + kVAlignTop,    1.25*
PI, kBlack, 62, textSize),
 
  248     TAttText(kHAlignLeft  + kVAlignTop,    1.75*
PI, kBlack, 62, textSize)
 
  255   for (
size_t i = 0; i != detectorFile.size(); ++i) {
 
  260       load(detectorFile[i], detector);
 
  269     const TAttText&   text   =  text_attributes[(0+i)%text_attributes.size()];
 
  273       offset =  3.0 * textSize * 
JCircle2D(detector.begin(), detector.end()).getRadius();
 
  278     for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {      
 
  280       if (counter.count(module->getString()) == 0) {
 
  282         buffer.push_back(JPoint_t(
MAKE_STRING(module->getString()),
 
  288         counter.insert(module->getString());
 
  293   for (
size_t i = 0; i != tripodsFile.size(); ++i) {
 
  297     tripods.load(tripodsFile[i].c_str());
 
  300     const TAttText&   text   =  text_attributes[(0+i)%text_attributes.size()];
 
  304       offset =  3.0 * textSize * 
JCircle2D(tripods.begin(), tripods.end()).getRadius();
 
  307     for (tripods_container::iterator i = tripods.begin(); i != tripods.end(); ++i) {
 
  310                                 JPosition2D(i->getUTMEast() - position.getUTMEast(), i->getUTMNorth() - position.getUTMNorth()),
 
  317   if (!transmittersFile.empty()) { 
 
  319     if (transmittersFile.size() == detectorFile.size()) {
 
  321       for (
size_t i = 0; i != transmittersFile.size(); ++i) {
 
  323         transmitters_container transmitters;
 
  325         transmitters.load(transmittersFile[i].c_str());
 
  329         load(detectorFile[i], detector);
 
  332         const TAttText&   text   =  text_attributes[(2+i)%text_attributes.size()];
 
  336           offset =  3.0 * textSize * 
JCircle2D(transmitters.begin(), transmitters.end()).getRadius();
 
  339         for (transmitters_container::iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
 
  353       FATAL(
"Tranmitter files and detector files should match one-to-one." << endl);
 
  360     copy(i->second.begin(), i->second.end(), back_inserter(buffer));
 
  363   JCircle2D circle(buffer.begin(), buffer.end());              
 
  365   DEBUG(
"Detector (x,y,R): " << 
FIXED(12,3) << circle.getX() << 
' ' << 
FIXED(12,3) << circle.getY() << 
' ' << 
FIXED(9,3) << circle.getRadius() << endl);
 
  370     i->second.sub(circle.getX(), circle.getY());
 
  373   circle.sub(circle.getPosition());
 
  380   const Double_t 
xmin  =  circle.getX()  -  1.15 * circle.getRadius();
 
  381   const Double_t 
xmax  =  circle.getX()  +  1.15 * circle.getRadius();
 
  382   const Double_t ymin  =  circle.getY()  -  1.15 * circle.getRadius();
 
  383   const Double_t ymax  =  circle.getY()  +  1.15 * circle.getRadius();
 
  385   TH2D h2(
"h2", 
"", 1, 
xmin, 
xmax, 1, ymin, ymax);
 
  387   h2.GetXaxis()->SetTitle(
"x [m]");
 
  388   h2.GetYaxis()->SetTitle(
"y [m]");
 
  390   h2.GetXaxis()->CenterTitle(
true);
 
  391   h2.GetYaxis()->CenterTitle(
true);
 
  397   TEllipse ellipse(circle.getX(), circle.getY(), circle.getRadius());
 
  409     Ssiz_t height = data.size();
 
  413       width = max(width, (Ssiz_t) i->first.size());
 
  416     TLegend* lg = 
getLegend(width, height, legend);
 
  418     lg->SetTextSize(textSize);
 
  421       if (!i->second.empty()) {
 
  422         lg->AddEntry(&i->second[0].marker, i->first.c_str(), 
"P"); 
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
JPosition2D()
Default constructor. 
 
const JUTMPosition & getUTMPosition() const 
Get UTM position. 
 
Data structure for circle in two dimensions. 
 
Data structure for graph data. 
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Auxiliary data structure for floating point format specification. 
 
double getY() const 
Get y position. 
 
Data structure for detector geometry and calibration. 
 
Data structure for UTM position. 
 
#define MAKE_STRING(A)
Make string. 
 
JVector2D & sub(const JVector2D &vector)
Subtract vector. 
 
The template JSinglePointer class can be used to hold a pointer to an object. 
 
Data structure for transmitter. 
 
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 
 
double getX() const 
Get x position. 
 
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. 
 
double getY() const 
Get y position. 
 
General purpose messaging. 
 
const JModule & getModule(const JModuleAddress &address) const 
Get module parameters. 
 
Data structure for position in two dimensions. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
JVector2D & add(const JVector2D &vector)
Add vector. 
 
Utility class to parse command line options. 
 
double getX() const 
Get x position. 
 
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. 
 
Data structure for position in three dimensions. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
Data structure for tripod. 
 
Wrapper class around ROOT TStyle. 
 
Data structure for size of TCanvas. 
 
#define DEBUG(A)
Message macros.