Message: Use a dynamic choice for material (2nd argument) of G4LogicalVolume ? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Use a dynamic choice for material (2nd argument) of G4LogicalVolume ? 

Forum: Geometry
Date: 09 Sep, 2013
From: Jacques Goldberg <Jacques Goldberg>

Hello

In the code below I wish to optionally insert into Geometry several boxes defined in "data cards" (some input stream of course; box not introduced if volume is 0)

I do not know how to convert the G4String rmat (submitted for example as Fe in the data card) into the G4Material object (Fe for Iron in the example) required as second parameter of G4LogicalVolume, otherwise than using a lookup table.

I guess I fail due to lack of C++ expertise... Thanks in advance

// box1
  rundata >> rx >> ry >> rx >> rcx >> rcy >> rcz >> rmat ;
  if ( abs(rx+ry+rz) > 0.001 ) {
  G4cout << "Box1: "<< rx << ry << rz << rcx << rcy << rcz << rmat<< G4endl;
  G4double box1_x = 0.5*rx*mm ;
  G4double box1_y = 0.5*ry*mm ;
  G4double box1_z = 0.5*rz*mm ;
  G4double locbox1_x = rcx*mm;
  G4double locbox1_y = rcy*mm;
  G4double locbox1_z = rcz*mm;

 G4Box* box1 = new G4Box("box1",box1_x,box1_y,box1_z);
 box1_log = new G4LogicalVolume(box1,Fe,"box1_log",0,0,0);
 box1_p = new G4PVPlacement(0,G4ThreeVector(locbox1_x,locbox1_y,locbox1_z),box1_log,"box1",wall_log,false,0,CheckOverlaps);
 } ;

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

1 None: Re: Use a dynamic choice for material (2nd argument) of G4LogicalVolume ?   (John Allison - 09 Sep, 2013)
(_ Ok: Re: Use a dynamic choice for material (2nd argument) of G4LogicalVolume ?   (Jacques Goldberg - 09 Sep, 2013)
 Add Message Add Message
to: "Use a dynamic choice for material (2nd argument) of G4LogicalVolume ?"

 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 ]