diff --git a/examples/AlignDet/compact/DDEveAlephTPC.xml b/examples/AlignDet/compact/DDEveAlephTPC.xml new file mode 100644 index 0000000000000000000000000000000000000000..d6d82b078f0142c21d8710ea8c31b53bdb40a65f --- /dev/null +++ b/examples/AlignDet/compact/DDEveAlephTPC.xml @@ -0,0 +1,6 @@ +<ddeve> + <view name="3D TPC" type="View3D" structure="true" sensitive="true"> + <detelement name="TPC" load_geo="5" show="5" alpha="0.5"/> + </view> + <include ref="AlephTPC.xml"/> +</ddeve> diff --git a/examples/ClientTests/scripts/Trap_DDFORHEP_5.C b/examples/ClientTests/scripts/Trap_DDFORHEP_5.C new file mode 100644 index 0000000000000000000000000000000000000000..205e962a699526b6448bfa3e691a0865c141bb2d --- /dev/null +++ b/examples/ClientTests/scripts/Trap_DDFORHEP_5.C @@ -0,0 +1,38 @@ +#include "TGeoManager.h" +#include "TGeoArb8.h" +#include "TGeoVolume.h" +#include "TGeoBoolNode.h" +#include "TGeoCompositeShape.h" +#include <iostream> + +void Trap_DDFORHEP_5(int arg=0) { + TGeoManager* mgr = gGeoManager; + if ( !mgr ) mgr = new TGeoManager(); + + TGeoVolume* world = new TGeoVolume("World",new TGeoBBox(30,30,30),mgr->GetMedium("Air")); + TGeoBBox* box = new TGeoBBox("World",10, 10, 1); + TGeoShape* hole_shape = arg + ? new TGeoTrap(4.2, 0., 0., 2., 4., 3., 0., 2., 4., 3., 0.) + // Ill defined trap: ? new TGeoTrap(4.2, 0., 0., 2., 4., 3., 0., 0., 2., 4., 3.) + : new TGeoBBox(3, 3, 1.01); + // Construct subtraction + TGeoSubtraction* sub = new TGeoSubtraction(box, hole_shape, gGeoIdentity, gGeoIdentity); + TGeoCompositeShape* comp = new TGeoCompositeShape("composite",sub); + TGeoVolume* vol = new TGeoVolume("Test_composites",comp,mgr->GetMedium("Iron")); + + world->AddNode(vol,1); + + // Show the hole as a seperate volume in the world + TGeoVolume* hole_seperate = new TGeoVolume("Hole",hole_shape,mgr->GetMedium("Iron")); + world->AddNode(hole_seperate,2,new TGeoTranslation(20,0,0)); + + std::cout << "Test subtraction of a " << hole_shape->IsA()->GetName() + << " shape from a box." << std::endl; + + // Close geometry and display + mgr->SetTopVolume(world); + mgr->CloseGeometry(); + mgr->SetVisLevel(4); + mgr->SetVisOption(1); + mgr->GetTopNode()->Draw("ogl"); +} diff --git a/examples/firstExample/src/TestBox_geo.cpp b/examples/firstExample/src/TestBox_geo.cpp index dfb3cbb6dc1045858b678f0e21cbaf4bcfd7944d..d3fe8e6dec7952728658e69bfabe7e5b852337a9 100644 --- a/examples/firstExample/src/TestBox_geo.cpp +++ b/examples/firstExample/src/TestBox_geo.cpp @@ -37,7 +37,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // a simple box Box box( 10, 10, 1) ; -//#define debug_hole +#define debug_hole 1 #ifdef debug_hole // -------- debug code for subtraction solid ----------------- @@ -45,12 +45,23 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { Box hole( 3, 3, 1.01 ) ; // not z slightly larger than original #else +#if franks_trap + // This trap is ill defined. and does not work! // cut out a trap Trap hole( 4.2, 0., 0., 2., 4., 3., 0. , 0. , 2., 4., 3.) ; +#else + // Fixed version from Andrei. This works + // cut out a trap + Trap hole( 4.2, + 0., 0., + 2., 4., 3., + 0. , + 2., 4., 3., 0) ; +#endif #endif SubtractionSolid solid( box, hole , Transform3D() ) ;