EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHGeom_DSTInspection.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHGeom_DSTInspection.C
1 // $Id: $
2 
11 #include <fun4all/SubsysReco.h>
12 #include <fun4all/Fun4AllServer.h>
19 #include <phool/recoConsts.h>
20 #include <phgeom/PHGeomUtility.h>
21 
22 #include <TEveManager.h>
23 #include <TGLViewer.h>
24 #include <TGLUtil.h>
25 #include <TGLClip.h>
26 #include <TGeoManager.h>
27 #include <TROOT.h>
28 #include <TGeoManager.h>
29 #include <TEveGeoNode.h>
30 
31 #include <cassert>
32 #include <string>
33 
34 using namespace std;
35 
36 R__LOAD_LIBRARY(libphgeom.so)
37 R__LOAD_LIBRARY(libg4dst.so)
38 R__LOAD_LIBRARY(libfun4all.so)
39 
40 
43 void
44 PHGeom_DSTInspection(string DST_file_name = "G4sPHENIX.root",
45  bool do_clip = true)
46 {
47  TEveManager::Create();
48 
50  se->Verbosity(1);
52  rc->set_IntFlag("RUNNUMBER", 12345);
53 
54  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
55  hitsin->fileopen(DST_file_name);
56  se->registerInputManager(hitsin);
57 
58  // run one event as example
59  se->run(1);
60 
62 
63  assert(gGeoManager);
64 
65  if (!gROOT->GetListOfGeometries()->FindObject(gGeoManager))
66  gROOT->GetListOfGeometries()->Add(gGeoManager);
67  if (!gROOT->GetListOfBrowsables()->FindObject(gGeoManager))
68  gROOT->GetListOfBrowsables()->Add(gGeoManager);
69 // gGeoManager->UpdateElements();
70 
71  TGeoNode *current = gGeoManager->GetCurrentNode();
72  //Alternate drawing
73  //current->GetVolume()->Draw("ogl");
74  //Print the list of daughters
75  //current->PrintCandidates();
76  for (int igeom = 0; igeom < current->GetNdaughters(); igeom++)
77  {
78  TGeoNode *geo_node = (TGeoNode*) current->GetNodes()->UncheckedAt(igeom);
79  geo_node->GetVolume()->VisibleDaughters(kFALSE);
80  geo_node->GetVolume()->SetTransparency(2);
81  //Keep the pipe visible all the time
82  if (string(geo_node->GetName()).find("PIPE") != string::npos)
83  geo_node->GetVolume()->SetTransparency(0);
84  }
85  TEveGeoTopNode* eve_node = new TEveGeoTopNode(gGeoManager, current);
86  eve_node->SetVisLevel(6);
87  gEve->AddGlobalElement(eve_node);
88  gEve->FullRedraw3D(kTRUE);
89 
90  // EClipType not exported to CINT (see TGLUtil.h):
91  // 0 - no clip, 1 - clip plane, 2 - clip box
92  TGLViewer *v = gEve->GetDefaultGLViewer();
93  if (do_clip)
94  {
95  v->GetClipSet()->SetClipType( TGLClip::kClipPlane );
96  }
97 // v->ColorSet().Background().SetColor(kMagenta + 4);
98  v->SetGuideState(TGLUtil::kAxesEdge, kTRUE, kFALSE, 0);
99  v->RefreshPadEditor(v);
100 
101  v->CurrentCamera().RotateRad(-1.6,0.);
102  v->DoDraw();
103 
104 }
105