Message: Re: Subtraction of G4Cons from G4Sphere crashes the visualisation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Subtraction of G4Cons from G4Sphere crashes the visualisation 

Forum: Geometry
Re: None Subtraction of G4Cons from G4Sphere crashes the visualisation
Date: 06 Jul, 2016
From: <Dmytro>

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:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 More: Re: Subtraction of G4Cons from G4Sphere crashes the visualisation   (Gabriele Cosmo - 06 Jul, 2016)
(_ None: Re: Subtraction of G4Cons from G4Sphere crashes the visualisation   (John Allison - 06 Jul, 2016)
(_ None: Re: Subtraction of G4Cons from G4Sphere crashes the visualisation   (Dmytro - 08 Jul, 2016)
 Add Message Add Message
to: "Re: Subtraction of G4Cons from G4Sphere crashes the visualisation"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]