Message: Tube and Extruded Solid sizing Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Tube and Extruded Solid sizing 

Forum: Geometry
Date: 08 Jul, 2010
From: Marlin Mixon <Marlin Mixon>

Hi, I'm creating an RFQ Linac with rod-shaped electrodes. First I created a hollow Tube (created with G4Tubs) and placed a couple of electrodes in it (both created with G4ExtrudedSolid). I wanted the Tube object to be the same length as the electrode objects (2 meters). But when I run the basic visualization the electrodes appear exactly twice as long as the tube. As you can see in my detector construction code below my zsection positions for the G4ExtrudedSolid run from 0 to 200 cm (array waveZ) and likewise my G4Tubs "heightOfTheTube" is set to 2.0*m as well. I also just now experimented with moving the *cm's from the array initialization to the initialization of the zsection arrays (sineWave and cosineWave) but to no avail. Anybody have any ideas? I appreciate any assistance.


  //------------------------------ a mainBody tube

  G4double innerRadiusOfTheTube = 58.*cm;
  G4double outerRadiusOfTheTube = 60.*cm;
  G4double heightOfTheTube = 2.0*m;
  G4double startAngleOfTheTube = 0.*deg;
  G4double spanningAngleOfTheTube = 360.*deg;
  G4Tubs* main_body = new G4Tubs("main_body",innerRadiusOfTheTube,
  mainBody_log = new G4LogicalVolume(main_body,Cu,"mainBody_log",0,0,0);
  G4double mainBodyPos_x = 0.0*m;
  G4double mainBodyPos_y = 0.*m;
  G4double mainBodyPos_z = 0.*m;   
  G4RotationMatrix  *MainBody_rot = 
     new G4RotationMatrix(G4ThreeVector(0.0,1.0,0.0),-90.0*deg);
  mainBody_phys = new G4PVPlacement(MainBody_rot, // rotation 

//-------------------------------- electrode
  std::vector<G4TwoVector> cross_section; 
  cross_section.push_back( G4TwoVector(0*cm, 0*mm) );
  cross_section.push_back( G4TwoVector(0*cm, 2*mm) );
  cross_section.push_back( G4TwoVector(0.75*mm, 2*mm) );
  cross_section.push_back( G4TwoVector(0.75*mm, 0*mm) );

  std::vector<G4ExtrudedSolid::ZSection> sineWave, cosineWave;
  int i;
G4double waveZ[1001], sinArr[1001], cosArr[1001];
  waveZ[0] = 0*cm; sinArr[0] = 0*cm; cosArr[0] = 2.5000*cm;
  waveZ[1] = 0.2000*cm; sinArr[1] = 0.7725*cm; cosArr[1] = 2.3776*cm;

  /* Hundreds of array initialization lines removed here */

  waveZ[998] = 199.6000*cm; sinArr[998] = -1.4695*cm; cosArr[998] = 2.0225*cm;
  waveZ[999] = 199.8000*cm; sinArr[999] = -0.7725*cm; cosArr[999] = 2.3776*cm;
  waveZ[1000] = 200.0000*cm; sinArr[1000] = 0.0000*cm; cosArr[1000] = 2.5000*cm;

  for (i=0;i<1001;i++) {
    G4TwoVector offset1 = G4TwoVector(0*cm, sinArr[i]);
    G4TwoVector offset2 = G4TwoVector(0*cm, cosArr[i]);
    sineWave.push_back( G4ExtrudedSolid::ZSection(waveZ[i], offset1, 1.0) );
    cosineWave.push_back( G4ExtrudedSolid::ZSection(waveZ[i], offset2, 1.0) );

  G4ExtrudedSolid* electrode1 = new G4ExtrudedSolid( "electrode1", cross_section, sineWave);
  G4ExtrudedSolid* electrode3 = new G4ExtrudedSolid( "electrode3", cross_section, cosineWave);

  electrode1_log = new G4LogicalVolume(electrode1,
  electrode3_log = new G4LogicalVolume(electrode3,

  G4double electrodePos_x = 0.0*m;
  G4double electrodePos_y = 4.0*cm;
  G4double electrodePos_z = -4.0*cm; 
  electrode1_phys = new G4PVPlacement(MainBody_rot,
  electrodePos_x = 0.0*m;
  electrodePos_y = -4.0*cm;
  electrodePos_z = -4.0*cm; 
  electrode3_phys = new G4PVPlacement(MainBody_rot,

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Note: Re: Tube and Extruded Solid sizing   (Tom Roberts - 08 Jul, 2010)
(_ None: Re: Tube and Extruded Solid sizing   (Marlin Mixon - 08 Jul, 2010)
 Add Message Add Message
to: "Tube and Extruded Solid sizing"

 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 ]