Analysis Software
Documentation for sPHENIX simulation 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 // cppcheck-suppress unknownMacro
37 R__LOAD_LIBRARY(libphgeom.so)
38 R__LOAD_LIBRARY(libg4dst.so)
39 R__LOAD_LIBRARY(libfun4all.so)
40 
41 
44 void
45 PHGeom_DSTInspection(string DST_file_name = "G4sPHENIX.root",
46  bool do_clip = true)
47 {
48  TEveManager::Create();
49 
51  se->Verbosity(1);
53  rc->set_IntFlag("RUNNUMBER", 12345);
54 
55  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
56  hitsin->fileopen(DST_file_name);
57  se->registerInputManager(hitsin);
58 
59  // run one event as example
60  se->run(1);
61 
63 
64  assert(gGeoManager);
65 
66  if (!gROOT->GetListOfGeometries()->FindObject(gGeoManager))
67  gROOT->GetListOfGeometries()->Add(gGeoManager);
68  if (!gROOT->GetListOfBrowsables()->FindObject(gGeoManager))
69  gROOT->GetListOfBrowsables()->Add(gGeoManager);
70 // gGeoManager->UpdateElements();
71 
72  TGeoNode *current = gGeoManager->GetCurrentNode();
73  //Alternate drawing
74  //current->GetVolume()->Draw("ogl");
75  //Print the list of daughters
76  //current->PrintCandidates();
77  for (int igeom = 0; igeom < current->GetNdaughters(); igeom++)
78  {
79  TGeoNode *geo_node = (TGeoNode*) current->GetNodes()->UncheckedAt(igeom);
80  geo_node->GetVolume()->VisibleDaughters(kFALSE);
81  geo_node->GetVolume()->SetTransparency(2);
82  //Keep the pipe visible all the time
83  if (string(geo_node->GetName()).find("PIPE") != string::npos)
84  geo_node->GetVolume()->SetTransparency(0);
85  }
86  TEveGeoTopNode* eve_node = new TEveGeoTopNode(gGeoManager, current);
87  eve_node->SetVisLevel(6);
88  gEve->AddGlobalElement(eve_node);
89  gEve->FullRedraw3D(kTRUE);
90 
91  // EClipType not exported to CINT (see TGLUtil.h):
92  // 0 - no clip, 1 - clip plane, 2 - clip box
93  TGLViewer *v = gEve->GetDefaultGLViewer();
94  if (do_clip)
95  {
96  v->GetClipSet()->SetClipType( TGLClip::kClipPlane );
97  }
98 // v->ColorSet().Background().SetColor(kMagenta + 4);
99  v->SetGuideState(TGLUtil::kAxesEdge, kTRUE, kFALSE, 0);
100  v->RefreshPadEditor(v);
101 
102  v->CurrentCamera().RotateRad(-1.6,0.);
103  v->DoDraw();
104 
105 }
106