Message: geometry coding Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None geometry coding 

Forum: Geometry
Date: 28 Jan, 2013
From: Jaegle <Jaegle>

Hi,

I would like to check that I am coding correctly or if not what should be the proper way. For example, should s_Ring and l_Ring be defined as double pointer has p_Ring ? or could be p_Ring be defined as simple pointer ?

The lines bellow describe how 28 rings were implemented each ring has 5 holes.

Thanks in advance

*s_Ring, *l_Ring and **p_Ring were defined in the header file.

  G4VSolid*          s_Ring;
  G4LogicalVolume*   l_Ring;
  G4VPhysicalVolume** p_Ring;

//cu ring
  G4double iR_Ring = 12.1/2.*inch;
  G4double oR_Ring = 13.3/2.*inch;
  G4double h_Ring =  0.1180/2.*inch;
  G4double sA_Ring = 0.*deg;
  G4double spA_Ring = 360.*deg;

  G4double x_Ring = 0;
  G4double y_Ring = 0;
  G4double z_Ring[28];

  G4cout << "h_Ring " << 2. * h_Ring/cm << " cm " << G4endl;

  s_Ring = new G4Tubs("s_Ring",iR_Ring,oR_Ring,h_Ring,sA_Ring,spA_Ring); 

  //subtracting holes  
  G4double iR_HolesInRing = 0.*mm;
  G4double oR_HolesInRing = 0.2640/2.*inch;
  G4double h_HolesInRing = h_Ring;
  G4double sA_HolesInRing = 0.*deg;
  G4double spA_HolesInRing = 360.*deg;

  G4VSolid * s_HolesInRing = new G4Tubs("s_HolesInRing",iR_HolesInRing,oR_HolesInRing,h_HolesInRing,sA_HolesInRing,spA_HolesInRing); 
  for(G4int i=0;i<4;i++){
    sprintf(Name,"s_Ring_%d",i);
    s_Ring = new G4SubtractionSolid (Name,s_Ring,s_HolesInRing,0,G4ThreeVector( x_Rod[i],y_Rod[i],0)); 
  }
  G4double iR_HolesInRings = 0.*mm;
  G4double oR_HolesInRings = 0.2010/2.*inch;
  G4double h_HolesInRings = h_Ring;
  G4double sA_HolesInRings = 0.*deg;
  G4double spA_HolesInRings = 360.*deg;
  G4double x_HolesInRing = 0.5000*inch;
  G4double y_HolesInRing = 6.4064*inch;
  G4VSolid * s_HolesInRings = new G4Tubs("s_HolesInRings",iR_HolesInRings,oR_HolesInRings,h_HolesInRings,sA_HolesInRings,spA_HolesInRings);
  s_Ring = new G4SubtractionSolid ("s_RingHoles",s_Ring,s_HolesInRings,0,G4ThreeVector( x_HolesInRing,y_HolesInRing,0));
  //end subtracting holes

  l_Ring = new G4LogicalVolume(s_Ring,G4Material::GetMaterial("MetalCopper"),"l_Ring");
  for(G4int i=0;i<28;i++){
    //if(i<=26)z_Ring[i] = z_Spacer2Nylon66+h_Spacer2Nylon66+h_Ring+(1.27*3.*mm+2.*0.508*mm)*i; 
    if(i<=26)z_Ring[i] = z_Spacer2Nylon66+h_Spacer2Nylon66+h_Ring+0.7*cm*( (G4double) i) + 2.*i*h_Ring; 
    else if(i==27)z_Ring[i] = z_Ring[26]+2.*h_Ring;
    sprintf(Name,"p_Ring_%d",i);
    p_Ring[i] = new G4PVPlacement(0,G4ThreeVector(x_Ring,y_Ring,z_Ring[i]),l_Ring,Name,l_iGasTPC,false,i);  
  }
  l_Ring->SetVisAttributes(coppercolor);
  //end cu ring

 Add Message Add Message
to: "geometry coding"

 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 ]