Functions
showGeometry.cpp File Reference
#include "TGeoManager.h"
#include "TGLViewer.h"
#include "TPad.h"
#include "TApplication.h"
#include <iostream>
#include <stdlib.h>

Go to the source code of this file.

Functions

void showGeometry (std::string file, int vislevel, bool checkOverlaps)
 
int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 32 of file showGeometry.cpp.

33 {
34  if(argc < 4)
35  {
36  std::cout << "./showGeometry <file> <vislevel: 1 to 7> <checkOverlaps: 0 or 1>" << std::endl;
37  return -1;
38  }
39 
40  bool checkOverlaps = false;
41  std::string file = argv[1];
42  std::cout << "Geometry file " << file << std::endl;
43  int vislevel = std::atoi(argv[2]);
44  if(vislevel < 1 || vislevel > 7){
45  std::cout << "Set Visibility level to default" << std::endl;
46  vislevel = 5;
47  }
48  std::cout << "VisLevel set to " << vislevel << std::endl;
49  std::string checkOverlaps_str = argv[3];
50  if( (checkOverlaps_str != "0" && checkOverlaps_str != "1") || checkOverlaps_str == "0" )
51  std::cout << "Check for Overlaps set to false" << std::endl;
52  else{
53  std::cout << "Check for Overlaps set to true" << std::endl;
54  checkOverlaps = true;
55  }
56 
57  TApplication theApp("theApp", &argc, argv) ;
58  showGeometry(file, vislevel, checkOverlaps);
59  theApp.Run();
60 
61  return 0;
62 }
std::string string
Definition: nybbler.cc:12
QTextStream & endl(QTextStream &s)
void showGeometry(std::string file, int vislevel, bool checkOverlaps)
Definition: showGeometry.cpp:9
void showGeometry ( std::string  file,
int  vislevel,
bool  checkOverlaps 
)

Definition at line 9 of file showGeometry.cpp.

10 {
11  TGeoManager *geo = new TGeoManager();
12  geo->Import(file.c_str());
13  geo->DefaultColors();
14 
15  if(checkOverlaps){
16  geo->CheckOverlaps(1e-5,"d100000000");
17  geo->PrintOverlaps();
18  }
19 
20  geo->SetVisOption(1);
21  geo->SetVisLevel(vislevel);
22 
23  geo->GetTopVolume()->Draw("ogl");
24 
25  TGLViewer * v = (TGLViewer *)gPad->GetViewer3D();
26  v->SetStyle(TGLRnrCtx::kOutline);
27  v->SetSmoothPoints(kTRUE);
28  v->SetLineScale(0.5);
29  v->UpdateScene();
30 }
const double e
LArSoft geometry interface.
Definition: ChannelGeo.h:16