10 #include "TApplication.h"
52 JPoint_t(
const int id,
55 const TAttMarker& marker,
59 static_cast<TAttMarker&
>(this->marker) = marker;
60 static_cast<TAttText&
> (this->
text) = text;
65 this->text.SetText(x + offset * cos(text.GetTextAngle()),
66 y + offset * sin(text.GetTextAngle()),
71 this->text.SetTextAngle(0.0);
72 this->text.SetTextColor(marker.GetMarkerColor());
81 void add(
const double x,
const double y)
83 this->marker.SetX(this->marker.GetX() + x);
84 this->marker.SetY(this->marker.GetY() + y);
85 this->text .SetX(this->text .GetX() + x);
86 this->text .SetY(this->text .GetY() + y);
95 void sub(
const double x,
const double y)
97 this->marker.SetX(this->marker.GetX() - x);
98 this->marker.SetY(this->marker.GetY() - y);
99 this->text .SetX(this->text .GetX() - x);
100 this->text .SetY(this->text .GetY() - y);
129 void add(
const double x,
const double y)
131 for (
iterator i = begin(); i != end(); ++i) {
142 void sub(
const double x,
const double y)
144 for (
iterator i = begin(); i != end(); ++i) {
154 for (
iterator i = begin(); i != end(); ++i) {
187 JParser<> zap(
"Auxiliary program to draw the footprint of detector(s).");
189 zap[
'w'] =
make_field(canvas,
"size of canvas <nx>x<ny> [pixels]") =
JCanvas(500, 500);
193 zap[
'L'] =
make_field(legend,
"position legend e.g. TR") =
"",
"TL",
"TR",
"BR",
"BL";
194 zap[
'S'] =
make_field(markerSize,
"marker size") = 1.0;
195 zap[
's'] =
make_field(textSize,
"text size") = 0.02;
196 zap[
'C'] =
make_field(drawCircle,
"draw smallest enclosing cicrle");
197 zap[
'B'] =
make_field(batch,
"batch processing");
202 catch(
const exception &error) {
203 FATAL(error.what() << endl);
207 if (detectorFile.empty() && tripodsFile.empty()) {
208 FATAL(
"No detector elements." << endl);
212 gROOT->SetBatch(batch);
214 gErrorIgnoreLevel = kWarning;
216 TApplication* tp =
new TApplication(
"user", NULL, NULL);
217 TCanvas* cv =
new TCanvas(
"detector",
"", canvas.x, canvas.y);
221 gROOT->SetStyle(
"gplot");
224 cv->SetFillStyle(4000);
225 cv->SetFillColor(kWhite);
232 TAttText(kHAlignLeft + kVAlignBottom, 0.25*
PI, kBlack, 62, textSize),
233 TAttText(kHAlignRight + kVAlignBottom, 0.75*
PI, kBlack, 62, textSize),
234 TAttText(kHAlignRight + kVAlignTop, 1.25*
PI, kBlack, 62, textSize),
235 TAttText(kHAlignLeft + kVAlignTop, 1.75*
PI, kBlack, 62, textSize)
242 for (
size_t i = 0; i != detectorFile.size(); ++i) {
247 load(detectorFile[i], detector);
255 if (
c1.getRadius() > circle.getRadius()) {
262 const TAttText& text = text_attributes[i%text_attributes.size()];
268 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
270 if (counter.count(module->getString()) == 0) {
272 buffer.push_back(JPoint_t(module->getString(),
277 3.0 * textSize *
c1.getRadius()));
279 counter.insert(module->getString());
284 for (
size_t i = 0; i != tripodsFile.size(); ++i) {
286 tripods_container tripods;
288 ifstream
in(tripodsFile[i].c_str());
294 if (detectorFile.empty()) {
300 c1.
sub(position.getPosition());
302 if (c1.
getRadius() > circle.getRadius()) {
307 const TAttText& text = text_attributes[i%text_attributes.size()];
311 for (tripods_container::iterator i = tripods.begin(); i != tripods.end(); ++i) {
313 buffer.push_back(JPoint_t(i->getID(),
314 i->getUTMEast() - position.getUTMEast(),
315 i->getUTMNorth() - position.getUTMNorth(),
323 DEBUG(
"Detector (x,y,R): " <<
FIXED(12,3) << circle.getX() <<
' ' <<
FIXED(12,3) << circle.getY() <<
' ' <<
FIXED(9,3) << circle.getRadius() << endl);
328 i->second.sub(circle.getX(), circle.getY());
331 circle.sub(circle.getPosition());
338 const Double_t xmin = circle.getX() - 1.15 * circle.getRadius();
339 const Double_t xmax = circle.getX() + 1.15 * circle.getRadius();
340 const Double_t ymin = circle.getY() - 1.15 * circle.getRadius();
341 const Double_t ymax = circle.getY() + 1.15 * circle.getRadius();
343 TH2D h2(
"h2",
"", 1, xmin, xmax, 1, ymin, ymax);
345 h2.GetXaxis()->SetTitle(
"x [m]");
346 h2.GetYaxis()->SetTitle(
"y [m]");
348 h2.GetXaxis()->CenterTitle(
true);
349 h2.GetYaxis()->CenterTitle(
true);
355 TEllipse ellipse(circle.getX(), circle.getY(), circle.getRadius());
367 Ssiz_t height = data.size();
371 width = max(width, (Ssiz_t) i->first.size());
374 TLegend* lg =
getLegend(width, height, legend);
376 lg->SetTextSize(textSize);
379 if (!i->second.empty()) {
380 lg->AddEntry(&i->second[0].marker, i->first.c_str(),
"P");
Utility class to parse command line options.
double getRadius() const
Get radius.
int main(int argc, char *argv[])
const JUTMPosition & getUTMPosition() const
Get UTM position.
Data structure for circle in two dimensions.
Data structure for graph data.
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average.
#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 detector geometry and calibration.
Data structure for UTM position.
JVector2D & sub(const JVector2D &vector)
Subtract vector.
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
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
JPosition3D getPosition(const Vec &pos)
Get position.
static const double PI
Mathematical constants.
General purpose messaging.
TCanvas * c1
Global variables to handle mouse events.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
TLegend * getLegend(const Int_t width, const Int_t height, const std::string option="TR")
Get legend.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
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
Data structure for tripod.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Wrapper class around ROOT TStyle.
Data structure for size of TCanvas.