10 #include "TApplication.h" 
   57     JPoint_t(
const std::string& title,
 
   58              const JPosition2D& pos,
 
   59              const TAttMarker&  marker,
 
   61              const double       offset) :
 
   63       offset(offset * cos(
text.GetTextAngle()),
 
   64              offset * sin(
text.GetTextAngle()))
 
   66       static_cast<TAttMarker&
>(this->marker) = marker;
 
   67       static_cast<TAttText&
>  (this->
text)   = text;
 
   69       this->text.SetTitle(title.c_str());
 
   70       this->text.SetTextAngle(0.0);                                 
 
   71       this->text.SetTextColor(marker.GetMarkerColor());             
 
   80     void add(
const double x, 
const double y)
 
   82       static_cast<JPosition2D&
>(*this).add(JPosition2D(
x,
y));
 
   93     void sub(
const double x, 
const double y)
 
   95       static_cast<JPosition2D&
>(*this).sub(JPosition2D(
x,
y));
 
  114       this->marker.SetX(this->getX());
 
  115       this->marker.SetY(this->getY());
 
  116       this->text  .SetX(this->getX() + offset.getX());
 
  117       this->text  .SetY(this->getY() + offset.getY());
 
  140     void add(
const double x, 
const double y)
 
  142       for (iterator i = begin(); i != end(); ++i) {
 
  153     void sub(
const double x, 
const double y)
 
  155       for (iterator i = begin(); i != end(); ++i) {
 
  165       for (iterator i = begin(); i != end(); ++i) {
 
  204     properties[
"focus"]   =  focus;
 
  206     JParser<> zap(
"Auxiliary program to draw the footprint of detector(s).");
 
  208     zap[
'w'] = 
make_field(canvas,           
"size of canvas <nx>x<ny> [pixels]")  = 
JCanvas(500, 500);
 
  214     zap[
'L'] = 
make_field(legend,           
"position legend e.g. TR")            = 
"", 
"TL", 
"TR", 
"BR", 
"BL";
 
  215     zap[
'S'] = 
make_field(markerSize,       
"marker size")                        = 1.0;
 
  216     zap[
's'] = 
make_field(textSize,         
"text size")                          = 0.02;
 
  217     zap[
'C'] = 
make_field(drawCircle,       
"draw smallest enclosing cicrle");
 
  218     zap[
'A'] = 
make_field(all,              
"draw all modules");
 
  219     zap[
'B'] = 
make_field(batch,            
"batch processing");
 
  224   catch(
const exception &error) {
 
  225     FATAL(error.what() << endl);
 
  229   if (detectorFile.empty() && tripodsFile.empty()) {
 
  230     FATAL(
"No detector elements." << endl);
 
  234   gROOT->SetBatch(batch);
 
  236   gErrorIgnoreLevel = kWarning;
 
  238   TApplication* tp = 
new TApplication(
"user", NULL, NULL);
 
  239   TCanvas*      cv = 
new TCanvas(
"detector", 
"", canvas.
x, canvas.
y);
 
  243   gROOT->SetStyle(
"gplot");
 
  246   cv->SetFillStyle(4000);
 
  247   cv->SetFillColor(kWhite);
 
  254     TAttText(kHAlignLeft  + kVAlignBottom, 0.25*
PI, kBlack, 62, textSize),
 
  255     TAttText(kHAlignRight + kVAlignBottom, 0.75*
PI, kBlack, 62, textSize),
 
  256     TAttText(kHAlignRight + kVAlignTop,    1.25*
PI, kBlack, 62, textSize),
 
  257     TAttText(kHAlignLeft  + kVAlignTop,    1.75*
PI, kBlack, 62, textSize)
 
  264   for (
size_t i = 0; i != detectorFile.size(); ++i) {
 
  275     position = 
detector.getUTMPosition();
 
  278     const TAttText&   
text   =  text_attributes[(0+i)%text_attributes.size()];
 
  287     for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {      
 
  289       if (module->getFloor() == 0) {
 
  291         buffer.push_back(JPoint_t(
MAKE_STRING(module->getString()),
 
  292                                   JPosition2D(module->getX(), module->getY()),
 
  297         counter.insert(module->getString());
 
  301     for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {      
 
  303       const bool status = (counter.count(module->getString()) == 0);
 
  307         buffer.push_back(JPoint_t((status ? 
MAKE_STRING(module->getString()) : 
""),
 
  308                                   JPosition2D(module->getX(), module->getY()),
 
  313         counter.insert(module->getString());
 
  318   for (
size_t i = 0; i != tripodsFile.size(); ++i) {
 
  322     tripods.
load(tripodsFile[i].c_str());
 
  325     const TAttText&   
text   =  text_attributes[(0+i)%text_attributes.size()];
 
  332     for (tripods_container::iterator i = tripods.begin(); i != tripods.end(); ++i) {
 
  342   if (!transmittersFile.empty()) { 
 
  344     if (transmittersFile.size() == detectorFile.size()) {
 
  346       for (
size_t i = 0; i != transmittersFile.size(); ++i) {
 
  350         transmitters.
load(transmittersFile[i].c_str());
 
  357         const TAttText&   
text   =  text_attributes[(2+i)%text_attributes.size()];
 
  361           offset =  3.0 * textSize * 
JCircle2D(transmitters.begin(), transmitters.end()).
getRadius();
 
  364         for (transmitters_container::iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
 
  369                                     JPosition2D(pos.
getX() + i->getX(), pos.
getY() + i->getY()),
 
  378       FATAL(
"Tranmitter files and detector files should match one-to-one." << endl);
 
  385     copy(i->second.begin(), i->second.end(), back_inserter(buffer));
 
  388   JCircle2D circle(buffer.begin(), buffer.end());              
 
  399     i->second.sub(circle.
getX(), circle.
getY());
 
  411   const Double_t ymin  =  circle.
getY()  -  1.15 * circle.
getRadius();
 
  412   const Double_t ymax  =  circle.
getY()  +  1.15 * circle.
getRadius();
 
  414   TH2D h2(
"h2", 
"", 200, 
xmin, 
xmax, 200, ymin, ymax);
 
  416   h2.GetXaxis()->SetTitle(
"x [m]");
 
  417   h2.GetYaxis()->SetTitle(
"y [m]");
 
  419   h2.GetXaxis()->CenterTitle(
true);
 
  420   h2.GetYaxis()->CenterTitle(
true);
 
  438     Ssiz_t height = 
data.size();
 
  442       width = max(width, (Ssiz_t) i->first.size());
 
  445     TLegend* lg = 
getLegend(width, height, legend);
 
  447     lg->SetTextSize(textSize);
 
  450       if (!i->second.empty()) {
 
  451         lg->AddEntry(&i->second[0].marker, i->first.c_str(), 
"P"); 
 
Data structure for detector geometry and calibration.
 
int main(int argc, char **argv)
 
General purpose messaging.
 
Utility class to parse command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
#define MAKE_STRING(A)
Make string.
 
Utility class to parse parameter values.
 
Data structure for transmitter.
 
Data structure for tripod.
 
Utility class to parse parameter values.
 
Data structure for circle in two dimensions.
 
double getRadius() const
Get radius.
 
Data structure for position in two dimensions.
 
const JPosition2D & getPosition() const
Get position.
 
JVector2D & sub(const JVector2D &vector)
Subtract vector.
 
double getY() const
Get y position.
 
double getX() const
Get x position.
 
Data structure for position in three dimensions.
 
double getY() const
Get y position.
 
double getX() const
Get x position.
 
The template JSinglePointer class can be used to hold a pointer to an object.
 
Utility class to parse command line options.
 
Data structure for size of TCanvas.
 
int y
number of pixels in Y
 
int x
number of pixels in X
 
Wrapper class around ROOT TStyle.
 
Data structure for UTM position.
 
double getUTMNorth() const
Get UTM north.
 
double getUTMEast() const
Get UTM east.
 
void copy(const Head &from, JHead &to)
Copy header from from to to.
 
JContainer< std::vector< JTripod > > tripods_container
 
JContainer< std::vector< JTransmitter > > transmitters_container
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
 
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
 
T & getInstance(const T &object)
Get static instance from temporary object.
 
static const double PI
Mathematical constants.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
TLegend * getLegend(const Int_t width, const Int_t height, const std::string option, const Double_t factor=1.0)
Get legend.
 
Auxiliary data structure for floating point format specification.
 
Auxiliary wrapper for I/O of container with optional comment (see JComment).
 
void load(const char *file_name)
Load from input file.
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...