118 JParser<> zap(
"Auxiliary program to draw a given module in 3D.");
126 catch(
const exception &error) {
127 FATAL(error.what() << endl);
139 catch(
const JException& error) {
144 FATAL(
"Empty detector.");
150 if (moduleID == -1) {
158 if (!router.hasModule(moduleID)) {
159 FATAL(
"Missing module " << moduleID << endl);
161 module = router.getModule(moduleID);
165 module -= module.getPosition();
169 const JModuleAddressMap& memo = demo.
get(module.getID());
172 TApplication* app =
new TApplication(
"user", NULL, NULL);
174 c1 =
new TCanvas(
"module", detectorFile.c_str(), 600, 600);
175 p1 =
new TPaveText(0.7, 0.9, 1.0, 1.0,
"NB");
180 p1->SetBorderSize(0);
181 p1->SetTextSize(0.03);
183 TGeoManager* gGeoManager =
new TGeoManager(
"geometry",
"");
185 TGeoMaterial* mat =
new TGeoMaterial(
"vacuum", 0, 0, 0);
186 TGeoMedium* med =
new TGeoMedium (
"vacuum", 1, mat);
187 TGeoVolume* top = gGeoManager->MakeBox(
"top", med, 30.0, 30.0, 30.0);
199 const double dz = 3.0;
200 const double R1 = 2.0;
201 const double R2 = 4.0;
204 const Int_t color[] = { kRed, kOrange, kYellow, kGreen, kBlue, kMagenta };
206 for (
unsigned int tdc = 0; tdc != module.size(); ++tdc) {
208 const JPMTAddressTranslator& address = memo.getAddressTranslator(tdc);
209 const int index = address.ring -
'A';
213 os[0] <<
"PMT " << setw(1) << address.ring << setw(1) << address.position;
214 os[1] <<
"TDC " << setw(2) << tdc;
216 TGeoVolumeAssembly* pPMT =
new TGeoVolumeAssembly(
"PMT");
221 for (
int i = 0;
i !=
sizeof(os)/
sizeof(os[0]); ++
i) {
226 pTube->SetLineColor(color[index]);
227 pCone->SetLineColor(color[index]);
229 pPMT->AddNode(pTube, 0,
new TGeoTranslation(0.0, 0.0, -dz));
230 pPMT->AddNode(pCone, 1,
new TGeoTranslation(0.0, 0.0, 0.0));
232 const JPMT& pmt = module.getPMT(tdc);
234 const Double_t
x = pmt.getX() * 100;
235 const Double_t
y = pmt.getY() * 100;
236 const Double_t z = pmt.getZ() * 100;
238 const Double_t theta = pmt.getTheta() * 180.0 /
PI;
239 const Double_t phi = pmt.getPhi() * 180.0 /
PI;
242 << setw(1) << address.ring
243 << setw(1) << address.position <<
" "
245 << setw(2) << tdc <<
" "
246 <<
FIXED(3,0) << x <<
" [cm] "
247 <<
FIXED(3,0) << y <<
" [cm] "
248 <<
FIXED(3,0) << z <<
" [cm] "
249 <<
FIXED(4,0) << theta <<
" [deg] "
250 <<
FIXED(4,0) << phi <<
" [deg] "
253 TGeoRotation* rot =
new TGeoRotation();
258 top->AddNode(pPMT, tdc,
new TGeoCombiTrans(x,y,z,rot));
261 gGeoManager->SetTopVolume(top);
262 gGeoManager->CloseGeometry();
266 c1->GetView()->ShowAxis();
Utility class to parse command line options.
void AddText(const std::string &text)
Add text to buffer.
Auxiliary data structure for floating point format specification.
const JModuleAddressMap & get(const int id) const
Get module address map.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const double PI
Mathematical constants.
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map.
TCanvas * c1
Global variables to handle mouse events.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
do set_variable DETECTOR_TXT $WORKDIR detector
#define DEBUG(A)
Message macros.