Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:56

0001 //--------------------------------------------------------------------------
0002 //  AIDA Detector description implementation for LCD
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 //  \author  Markus Frank
0011 //  \date    2018-05-31
0012 //  \version 1.0
0013 //
0014 //==========================================================================
0015 #include "TGLViewer.h"
0016 #include "TGLUtil.h"
0017 #include "TSystem.h"
0018 #include <stdexcept>
0019 #include <string>
0020 
0021 void apply_draw_opts(TGLClip::EType clip_typ, TGLUtil::EAxesType axis_typ)   {
0022   TGLViewer *v = (TGLViewer*)gPad->GetViewer3D();
0023   if ( v )   {
0024     v->SetCurrentCamera(TGLViewer::kCameraPerspXOZ);
0025     v->GetClipSet()->SetClipType(clip_typ);
0026     v->GetClipSet()->SetAutoUpdate(kTRUE);
0027     v->GetClipSet()->SetShowClip(kTRUE);
0028     v->SetGuideState(axis_typ, kTRUE, kFALSE, 0);
0029     v->GetClipSet()->GetCurrentClip()->SetDiffuseColor(0xFFFF,0xff);
0030   }
0031 }
0032 
0033 void clip_plane()    {  apply_draw_opts(TGLClip::kClipPlane, TGLUtil::kAxesOrigin);   }
0034 void clip_box()      {  apply_draw_opts(TGLClip::kClipBox,   TGLUtil::kAxesOrigin);   }
0035 void clip_none()     {  apply_draw_opts(TGLClip::kClipNone,  TGLUtil::kAxesOrigin);   }
0036 
0037 std::string install_dir()   {
0038   const char* env = gSystem->Getenv("DD4hepINSTALL");
0039   if ( env )   {
0040     string dir = env;
0041     dir += "/examples/DDCodex";
0042     return dir;
0043   }
0044   throw std::runtime_error("The environment DD4hepINSTALL is not set. No actions taken!");
0045 }
0046 std::string geo_file()   {
0047   return install_dir()+"/Upgrade.root";
0048 }
0049 std::string codex_file()   {
0050   return install_dir()+"/compact/CODEX-b.xml";
0051 }
0052 
0053 void load_geo()     {
0054   std::string fn = geo_file();
0055   gDD4hepUI->importROOT(geo_file().c_str());
0056 }
0057 
0058 void load_codex()   {
0059   gDD4hepUI->importROOT(geo_file().c_str());
0060   gDD4hepUI->fromXML(codex_file().c_str());
0061   gDD4hepUI->draw();
0062   clip_plane();
0063 }
0064 
0065 void dumpVP()    {
0066   const void* args[] = {
0067     "-detector", "/world/LHCb/BeforeMagnetRegion/VP",
0068     "-path",
0069     "-shapes",
0070     "-positions",
0071     "-materials",
0072     "-topstats", 0};
0073   gDD4hepUI->dumpVols(sizeof(args)/sizeof(args[0])-1, (char**)args);
0074 }
0075 
0076 void display()    {  
0077 }