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);
55 catch(
const JException& error) {
61 JPosition3D pos(0.0, 0.0, 0.0);
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();
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);
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);
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
General purpose messaging.
then JCookie sh JDataQuality D $DETECTOR_ID R
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
do set_variable DETECTOR_TXT $WORKDIR detector