#include #include #include #include #include using namespace RAT; using namespace RAT::geo; #include #include #include using namespace CLHEP; using namespace std; G4VSolid* NCDRing::Construct( const std::string& name, DBLinkPtr table ) const { const double rMin = table->GetD( "r_min" ) * mm; const double rMax = table->GetD( "r_max" ) * mm; const double height = table->GetD( "height" ) * mm; G4Tubs* mainRing = new G4Tubs( name + "_main_solid", rMin, rMax, height, 0.0, twopi ); const double rMinExtra = table->GetD( "extra_r_min" ) * mm; const double thetaExtra = table->GetD( "extra_theta_min" ) * deg; const double thetaDeltaExtra = table->GetD( "extra_theta_delta" ) * deg; G4Tubs* extraRing = new G4Tubs( name + "_extra_solid", rMinExtra, rMin, height, thetaExtra, thetaDeltaExtra ); G4VSolid* fullRing = new G4UnionSolid( name + "_ring_solid", mainRing, extraRing, NULL, G4ThreeVector( 0, 0, 0 ) ); const vector rHole = table->GetDArray( "hole_r_pos" ); const vector thetaHole = table->GetDArray( "hole_theta_pos" ); const vector holeRadius = table->GetDArray( "hole_r" ); Log::Assert( rHole.size() == thetaHole.size() && rHole.size() == holeRadius.size(), "NCDRing::Construct: Hole coordinate sizes do not match." ); for( size_t iHole = 0; iHole < rHole.size(); iHole++ ) { G4Tubs* hole = new G4Tubs( name + "_hole_" + ::to_string( iHole ) + "_solid", 0.0, holeRadius[iHole] * mm, 2.0 * height, 0.0, twopi ); const G4ThreeVector position( cos( thetaHole[iHole] * deg ) * rHole[iHole] * mm, sin( thetaHole[iHole] * deg ) * rHole[iHole] * mm, height / 2.0 ); fullRing = new G4SubtractionSolid( name + "_minus_hole_" + ::to_string( iHole ) + "_solid", fullRing, hole, NULL, position ); } return fullRing; }