12 #include <Geant4/G4LogicalVolume.hh>
13 #include <Geant4/G4NistManager.hh>
14 #include <Geant4/G4Box.hh>
15 #include <Geant4/G4SystemOfUnits.hh>
16 #include <Geant4/G4PVPlacement.hh>
17 #include <Geant4/G4FieldManager.hh>
18 #include <Geant4/G4UniformMagField.hh>
19 #include <Geant4/G4VisAttributes.hh>
25 G4Material *mat = G4NistManager::Instance()->FindOrBuildMaterial(
"G4_Galactic");
29 G4double xysiz = 10*
cm;
31 G4String nam =
"Magnet";
32 G4Box *mshape =
new G4Box(nam, xysiz, xysiz, dz/2.);
33 G4LogicalVolume *mvol =
new G4LogicalVolume(mshape, mat, nam);
35 G4VisAttributes *vis =
new G4VisAttributes();
37 vis->SetColor(1, 0, 1);
39 mvol->SetVisAttributes(vis);
42 G4UniformMagField *field =
new G4UniformMagField(G4ThreeVector(0.5*tesla, 0, 0));
43 G4FieldManager *fman =
new G4FieldManager();
44 fman->SetDetectorField(field);
45 fman->CreateChordFinder(field);
47 mvol->SetFieldManager(fman,
true);
49 new G4PVPlacement(0, G4ThreeVector(0, 0, zpos-dz/2.), mvol, nam, top,
false, 0);