#include #include #include #include #include #include #include #include #include using namespace RAT; using namespace std; void AcrylicTileFactory::Construct( DBLinkPtr table, const bool checkOverlaps ) { const string name = table->GetIndex(); vector tiles = table->GetSArray( "tiles" ); const string bondSphere = table->GetS( "bond" ); DB* db = DB::Get(); G4VSolid* fullSolid = GeoSolid::ConstructSolid( name + "_solid", db->GetLink( "SOLID", bondSphere ) ); for( size_t iTile = 0; iTile < tiles.size(); iTile++ ) { G4VSolid* tileSolid = GeoSolid::ConstructSolid( tiles[iTile], db->GetLink( "SOLID", tiles[iTile] ) ); fullSolid = new G4SubtractionSolid( name + "_" + tiles[iTile] + "_solid", fullSolid, tileSolid, NULL, G4ThreeVector( 0.0, 0.0, 0.0 ) ); } G4LogicalVolume* logicalVolume = new G4LogicalVolume( fullSolid, G4Material::GetMaterial( table->GetS( "material" ) ), name + "_logical" ); try // Optionally disable voxel optimization, GEANT4 default is to always optimize { if( table->GetI("optimize") == 0 ) logicalVolume->SetOptimisation( false ); } catch (DBNotFoundError &e) { }; logicalVolume->SetVisAttributes( LoadVisualisation( table ) ); string motherName = table->GetS( "mother" ); G4LogicalVolume* mother = Detector::FindLogicalVolume( motherName ); // Now place the logical volume in the mother pair< G4ThreeVector, G4RotationMatrix* > translation = LoadTranslation( table ); new G4PVPlacement( translation.second, translation.first, logicalVolume, name, mother, false, 0, checkOverlaps ); // Latter arguments are single vol, copy 0 }