Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
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 //==========================================================================
0011 #include "TGeoManager.h"
0012 #include "TGeoArb8.h"
0013 #include "TGeoVolume.h"
0014 #include "TGeoBoolNode.h"
0015 #include "TGeoCompositeShape.h"
0016 #include <iostream>
0017 
0018 void Trap_DDFORHEP_5(int arg=0)   {
0019   TGeoManager* mgr = gGeoManager;
0020   if ( !mgr ) mgr = new TGeoManager();
0021 
0022   TGeoVolume* world = new TGeoVolume("World",new TGeoBBox(30,30,30),mgr->GetMedium("Air"));
0023   TGeoBBox* box = new TGeoBBox("World",10, 10, 1);
0024   TGeoShape* hole_shape = arg 
0025     ? new TGeoTrap(4.2, 0., 0., 2., 4.,  3., 0., 2., 4., 3., 0.) 
0026     // Ill defined trap:  ? new TGeoTrap(4.2, 0., 0., 2., 4.,  3., 0., 0., 2., 4., 3.) 
0027     : new TGeoBBox(3, 3, 1.01);
0028   // Construct subtraction
0029   TGeoSubtraction* sub = new TGeoSubtraction(box, hole_shape, gGeoIdentity, gGeoIdentity);
0030   TGeoCompositeShape* comp = new TGeoCompositeShape("composite",sub);
0031   TGeoVolume* vol = new TGeoVolume("Test_composites",comp,mgr->GetMedium("Iron"));
0032 
0033   world->AddNode(vol,1);
0034 
0035   // Show the hole as a seperate volume in the world
0036   TGeoVolume* hole_seperate = new TGeoVolume("Hole",hole_shape,mgr->GetMedium("Iron"));
0037   world->AddNode(hole_seperate,2,new TGeoTranslation(20,0,0));
0038 
0039   std::cout << "Test subtraction of a " << hole_shape->IsA()->GetName() 
0040         << " shape from a box." << std::endl;
0041 
0042   // Close geometry and display
0043   mgr->SetTopVolume(world);
0044   mgr->CloseGeometry();
0045   mgr->SetVisLevel(4);
0046   mgr->SetVisOption(1);
0047   mgr->GetTopNode()->Draw("ogl");
0048 }