6 #include "TApplication.h" 
   10 #include "TGeoManager.h" 
   11 #include "TGeoMatrix.h" 
   12 #include "TGeoMaterial.h" 
   13 #include "TGeoMedium.h" 
   14 #include "TGeoVolume.h" 
   27 int main(
int argc, 
char**argv)
 
   36     JParser<> zap(
"Auxiliary program to draw the detector in 3D.");
 
   43   catch(
const exception &error) {
 
   44     FATAL(error.what() << endl);
 
   63     for (JDetector::const_iterator i = 
detector.begin(); i != 
detector.end(); ++i) {
 
   69     NOTICE(
"Detector center: " << pos.
getX() << 
' ' << pos.
getY() << 
' ' << pos.
getZ() << endl);
 
   71     double zmin = numeric_limits<double>::max();
 
   72     double zmax = numeric_limits<double>::lowest();
 
   76     for (JDetector::const_iterator i = 
detector.begin(); i != 
detector.end(); ++i) {
 
   78       const double x = i->getX() - pos.
getX();
 
   79       const double y = i->getY() - pos.
getY();
 
   80       const double z = i->getZ() - pos.
getZ();
 
   82       const double R = sqrt(x*x + y*y);
 
   84       if (z < zmin) zmin = z;
 
   85       if (z > zmax) zmax = z;
 
   87       if (R > radius) radius = 
R;
 
   90     NOTICE(
"can: " << zmin << 
' ' << zmax << 
' ' << radius << endl);
 
   98   for (JDetector::const_iterator i = 
detector.begin(); i != 
detector.end(); ++i) {
 
   99     if (i->getX() > xmax) xmax = i->getX();
 
  100     if (i->getY() > ymax) ymax = i->getY();
 
  101     if (i->getZ() > zmax) zmax = i->getZ();
 
  109   TApplication* tapple = 
new TApplication(
"user", NULL, NULL);
 
  110   TCanvas*      canvas = 
new TCanvas(
"a", detectorFile.c_str(), 1200, 1200);
 
  112   canvas->SetFillColor(0);
 
  114   TGeoManager*  geom     = 
new TGeoManager (
"geometry", 
"");
 
  115   TGeoMaterial* material = 
new TGeoMaterial(
"vacuum", 0, 0, 0);
 
  116   TGeoMedium*   medium   = 
new TGeoMedium  (
"vacuum", 1, material);
 
  117   TGeoVolume*   top      = geom->MakeBox   (
"Top",    medium, xmax, ymax, zmax);
 
  118   TGeoVolume*   shape    = geom->MakeSphere(
"Module", medium, 0.4, 0.5); 
 
  120   shape->SetLineColor(kBlue);
 
  124   for (JDetector::const_iterator i = 
detector.begin(); i != 
detector.end(); ++i) {
 
  125     top->AddNode(shape, 
N++, 
new TGeoTranslation(i->getX(), i->getY(), i->getZ()));
 
  128   geom->SetTopVolume(top);
 
  129   geom->CloseGeometry();
 
  134   canvas->GetView()->ShowAxis();
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
Data structure for detector geometry and calibration. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
double getY() const 
Get y position. 
 
then usage $script[distance] fi case set_variable R
 
General purpose messaging. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
Utility class to parse command line options. 
 
double getX() const 
Get x position. 
 
Data structure for position in three dimensions. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
then usage $script[input file[working directory[option]]] nWhere option can be N
 
double getZ() const 
Get z position.