Message: Re: Subtraction of G4Cons from G4Sphere crashes the visualisation | Not Logged In (login) |
If this helps - here is the relevant part of the code from DetectorConstruction.cc file. Creates Sphere, conical hole, 10 rotation matrices and subtracts conical hole from sphere in 10 places. I limited here subtraction to only 1 place as already this makes a crash at the start of OGL graphic interface. G4double DetSourceDist=15.*cm; G4double phi_z[18]; G4double phi[18]; memset (phi,0,sizeof(phi)); for (int j=0; j<DETNUM; j++) {phi[j]=(j*36.)*deg; G4cout<<"Angle: "<<phi[j]/deg <<G4endl ;}; for (int j=0; j<18; j++) phi_z[j]=90.*deg; G4RotationMatrix* rm[18]; //*******************LeadBall****************************// G4VSolid*asolidBall = new G4Sphere("solidBall", 2.0*cm, DetSourceDist-.2*cm, 0.0*deg, 360.0*deg, 0.0*deg, 360.0*deg); G4VSolid *asolidHole =new G4Cons("solidHole", 0.*cm, 1.0*cm, 0.*cm, hole_rad*cm, (DetSourceDist-0.6*cm)/2, 0.*deg, 360.*deg); G4VSolid* SolidBall[11]; SolidBall[0]=asolidBall; //*******************End LeadBall****************************// for (int i=0; i<10;i++) { if (detectors[i]==FALSE) continue; rm[i] = new G4RotationMatrix; rm[i]->rotateX(-90.*deg);//-90 rm[i]->rotateY(90.*deg-phi[i]); rm[i]->rotateZ(0.*deg); G4cout << "Rot matrix created" << G4endl; //*******Subtraction of the hole in the LeadBall***********************************// if (i<1) { //i<100 SolidBall[i+1]= new G4SubtractionSolid("LeadBallSubtracted", SolidBall[i], asolidHole, rm[i], G4ThreeVector(((DetSourceDist-0.15*cm)/2)*cos(phi[i]), ((DetSourceDist-0.15*cm)/2)*sin(phi[i]), ((DetSourceDist+1.0*cm)/2)*cos(phi_z[i]))); } } //************End of Subtraction*************************************************// //placement of the LeadBall with subtracted holes if(shielding) { G4LogicalVolume* alogicBall = new G4LogicalVolume(SolidBall[10], Mat("G4_Pb"), "logicBall",0,0,0); G4VisAttributes *visBall = new G4VisAttributes( G4Colour(0.0, 0.5, 1.0) ); visBall->SetVisibility(true); alogicBall->SetVisAttributes( visBall ); G4PVPlacement *physicBall = new G4PVPlacement (0, G4ThreeVector(0.*cm, 0.*cm, 0.*cm), alogicBall, "physicShield", world->getLogic(), false, 0); } |
Inline Depth: | Outline Depth: | Add message: |
to: |