Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
exrdmDetectorConstruction Class Reference

#include <exrdmDetectorConstruction.hh>

Inheritance diagram for exrdmDetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 exrdmDetectorConstruction ()
 
virtual ~exrdmDetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
const G4VPhysicalVolumeGetDetector ()
 
G4double GetDetectoFullLength ()
 
G4double GetTargetFullLength ()
 
G4double GetWorldFullLength ()
 
G4double GetDetectorThickness ()
 
G4double GetTargetRadius ()
 
G4double GetWorldRadius ()
 
void SetTargetMaterial (G4String)
 
void SetDetectorMaterial (G4String)
 
void SetTargetRadius (G4double value)
 
void SetDetectorThickness (G4double value)
 
void SetTargetLength (G4double value)
 
void SetDetectorLength (G4double value)
 
- Public Member Functions inherited from G4VUserDetectorConstruction
 G4VUserDetectorConstruction ()
 
virtual ~G4VUserDetectorConstruction ()
 
virtual void ConstructSDandField ()
 
virtual void CloneSD ()
 
virtual void CloneF ()
 
void RegisterParallelWorld (G4VUserParallelWorld *)
 
G4int ConstructParallelGeometries ()
 
void ConstructParallelSD ()
 
G4int GetNumberOfParallelWorld () const
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VUserDetectorConstruction
void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 

Detailed Description

Definition at line 48 of file exrdmDetectorConstruction.hh.

Constructor & Destructor Documentation

exrdmDetectorConstruction::exrdmDetectorConstruction ( )

Definition at line 54 of file exrdmDetectorConstruction.cc.

56  fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
57  fSolidTarget(0), fLogicTarget(0), fPhysiTarget(0),
58  fSolidDetector(0),fLogicDetector(0),fPhysiDetector(0),
59  fDetectorMessenger(0),
60  fMaterialsManager(0),
61  fDefaultMater(0),fTargetMater(0),fDetectorMater(0),
62  fTargetLength (1.*cm), fTargetRadius(0.5*cm),
63  fDetectorLength(5.0 * cm), fDetectorThickness(2.0 * cm),
64  fWorldLength (std::max(fTargetLength,fDetectorLength)),
65  fWorldRadius (fTargetRadius + fDetectorThickness),
66  fTargetRegion(0), fDetectorRegion(0)
67 {
68  fDetectorMessenger = new exrdmDetectorMessenger(this);
69  DefineMaterials();
70 }
T max(const T t1, const T t2)
brief Return the largest of the two arguments
exrdmDetectorConstruction::~exrdmDetectorConstruction ( )
virtual

Definition at line 74 of file exrdmDetectorConstruction.cc.

75 {
76  delete fDetectorMessenger;
77 }

Member Function Documentation

G4VPhysicalVolume * exrdmDetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 103 of file exrdmDetectorConstruction.cc.

References G4Region::AddRootLogicalVolume(), G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4VisAttributes::Invisible, G4INCL::Math::max(), G4LogicalVolume::SetVisAttributes(), and python.hepunit::twopi.

104 {
105 //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
106  //--------- Sizes of the principal geometrical components (solids) ---------
107 
108  fWorldLength = std::max(fTargetLength,fDetectorLength);
109  fWorldRadius = fTargetRadius + fDetectorThickness;
110 
111  //------------------------------
112  // World
113  //------------------------------
114 
115  fSolidWorld= new G4Tubs("world",0.,fWorldRadius,fWorldLength/2.,0.,twopi);
116  fLogicWorld= new G4LogicalVolume( fSolidWorld, fDefaultMater, "World", 0, 0, 0);
117 
118  // Must place the World Physical volume unrotated at (0,0,0).
119  //
120  fPhysiWorld = new G4PVPlacement(0, // no rotation
121  G4ThreeVector(), // at (0,0,0)
122  fLogicWorld, // its logical volume
123  "World", // its name
124  0, // its mother volume
125  false, // no boolean operations
126  0); // no field specific to volume
127 
128  //------------------------------
129  // Target
130  //------------------------------
131 
132  G4ThreeVector positionTarget = G4ThreeVector(0,0,0);
133 
134  fSolidTarget = new G4Tubs("target",0.,fTargetRadius,fTargetLength/2.,0.,twopi);
135  fLogicTarget = new G4LogicalVolume(fSolidTarget,fTargetMater,"Target",0,0,0);
136  fPhysiTarget = new G4PVPlacement(0, // no rotation
137  positionTarget, // at (x,y,z)
138  fLogicTarget, // its logical volume
139  "Target", // its name
140  fLogicWorld, // its mother volume
141  false, // no boolean operations
142  0); // no particular field
143 
144  // G4cout << "Target is a cylinder with rdius of " << targetradius/cm << " cm of "
145  // << fTargetMater->GetName() << G4endl;
146 
147  //------------------------------
148  // Detector
149  //------------------------------
150 
151  G4ThreeVector positionDetector = G4ThreeVector(0,0,0);
152 
153  fSolidDetector = new G4Tubs("detector",fTargetRadius,fWorldRadius,
154  fDetectorLength/2.,0.,twopi);
155  fLogicDetector = new G4LogicalVolume(fSolidDetector ,fDetectorMater,
156  "Detector",0,0,0);
157  fPhysiDetector = new G4PVPlacement(0, // no rotation
158  positionDetector, // at (x,y,z)
159  fLogicDetector, // its logical volume
160  "Detector", // its name
161  fLogicWorld, // its mother volume
162  false, // no boolean operations
163  0); // no particular field
164 
165  //------------------------------------------------
166  // Sensitive detectors
167  //------------------------------------------------
168 
169  // G4SDManager* SDman = G4SDManager::GetSDMpointer();
170 
171  // G4String detectortargetSDname = "exrdm/DetectorTargetSD";
172  // exrdmDetectorSD* aDetectorSD = new exrdmDetectorSD( detectorTargetSDname );
173  // SDman->AddNewDetector( aDetectorSD );
174  //fLogicTarget->SetSensitiveDetector( aDetectorSD );
175  // fLogicDetector->SetSensitiveDetector( aDetectorSD );
176  //
177  //-------------------------------------------------
178  // regions
179  //
180  // if(fTargetRegion) delete fTargetRegion;
181  // if(fDetectorRegion) delete fDetectorRegion;
182  fTargetRegion = new G4Region("Target");
183  fDetectorRegion = new G4Region("Detector");
184  fTargetRegion->AddRootLogicalVolume(fLogicTarget);
185  fDetectorRegion->AddRootLogicalVolume(fLogicDetector);
186 
187  //--------- Visualization attributes -------------------------------
189  G4VisAttributes* TargetVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
190  fLogicTarget ->SetVisAttributes(TargetVisAtt);
191  G4VisAttributes* DetectorVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,.0));
192  fLogicDetector->SetVisAttributes(DetectorVisAtt);
193 
194 
195  //------------ set the incident position ------
196 
197  // get the pointer to the User Interface manager
198 
200  // UI->ApplyCommand("/run/verbose 1");
201  // UI->ApplyCommand("/event/verbose 2");
202  // UI->ApplyCommand("/tracking/verbose 1");
203 
204  G4double zpos = -fWorldLength/2.;
205  G4String command = "/gps/pos/centre ";
206  std::ostringstream os;
207  os << zpos ;
208  G4String xs = os.str();
209  UI->ApplyCommand(command+"0. 0. "+xs+" mm");
210  UI->ApplyCommand("/gps/pos/type Point");
211  command = "/gps/position ";
212  // UI->ApplyCommand(command+"0. 0. "+xs+" mm");
213  UI->ApplyCommand("/gps/particle proton");
214  UI->ApplyCommand("/gps/direction 0 0 1");
215  UI->ApplyCommand("/gps/energy 100 MeV");
216  //
217 
218  return fPhysiWorld;
219 }
CLHEP::Hep3Vector G4ThreeVector
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:254
Definition: G4Tubs.hh:84
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
T max(const T t1, const T t2)
brief Return the largest of the two arguments
static const G4VisAttributes Invisible
double G4double
Definition: G4Types.hh:76
void SetVisAttributes(const G4VisAttributes *pVA)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
G4double exrdmDetectorConstruction::GetDetectoFullLength ( )
inline

Definition at line 62 of file exrdmDetectorConstruction.hh.

62 {return fDetectorLength;};
const G4VPhysicalVolume* exrdmDetectorConstruction::GetDetector ( )
inline

Definition at line 60 of file exrdmDetectorConstruction.hh.

60 {return fPhysiDetector;};
G4double exrdmDetectorConstruction::GetDetectorThickness ( )
inline

Definition at line 65 of file exrdmDetectorConstruction.hh.

65 {return fDetectorThickness;};
G4double exrdmDetectorConstruction::GetTargetFullLength ( )
inline

Definition at line 63 of file exrdmDetectorConstruction.hh.

63 {return fTargetLength;};
G4double exrdmDetectorConstruction::GetTargetRadius ( )
inline

Definition at line 66 of file exrdmDetectorConstruction.hh.

66 {return fTargetRadius;};
G4double exrdmDetectorConstruction::GetWorldFullLength ( )
inline

Definition at line 64 of file exrdmDetectorConstruction.hh.

64 {return fWorldLength;};
G4double exrdmDetectorConstruction::GetWorldRadius ( )
inline

Definition at line 67 of file exrdmDetectorConstruction.hh.

67 {return fWorldRadius;};
void exrdmDetectorConstruction::SetDetectorLength ( G4double  value)
inline

Definition at line 75 of file exrdmDetectorConstruction.hh.

Referenced by exrdmDetectorMessenger::SetNewValue().

75 { fDetectorLength = value;};
const XML_Char int const XML_Char * value
void exrdmDetectorConstruction::SetDetectorMaterial ( G4String  materialName)

Definition at line 238 of file exrdmDetectorConstruction.cc.

References python.hepunit::cm, G4cout, G4endl, G4Material::GetMaterial(), and G4LogicalVolume::SetMaterial().

Referenced by exrdmDetectorMessenger::SetNewValue().

239 {
240  // search the material by its name
241  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
242  if (pttoMaterial)
243  {fDetectorMater = pttoMaterial;
244  if (fLogicDetector) fLogicDetector->SetMaterial(pttoMaterial);
245  G4cout << "\n----> The Deetctor has been changed to" << fDetectorLength/cm
246  << " cm of "
247  << materialName << G4endl;
248  }
249 }
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:578
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void SetMaterial(G4Material *pMaterial)
void exrdmDetectorConstruction::SetDetectorThickness ( G4double  value)
inline

Definition at line 73 of file exrdmDetectorConstruction.hh.

Referenced by exrdmDetectorMessenger::SetNewValue().

73 { fDetectorThickness = value;};
const XML_Char int const XML_Char * value
void exrdmDetectorConstruction::SetTargetLength ( G4double  value)
inline

Definition at line 74 of file exrdmDetectorConstruction.hh.

Referenced by exrdmDetectorMessenger::SetNewValue().

74 { fTargetLength = value; };
const XML_Char int const XML_Char * value
void exrdmDetectorConstruction::SetTargetMaterial ( G4String  materialName)

Definition at line 223 of file exrdmDetectorConstruction.cc.

References python.hepunit::cm, G4cout, G4endl, G4Material::GetMaterial(), and G4LogicalVolume::SetMaterial().

Referenced by exrdmDetectorMessenger::SetNewValue().

224 {
225  // search the material by its name
226  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
227  if (pttoMaterial)
228  {fTargetMater = pttoMaterial;
229  if (fLogicTarget) fLogicTarget->SetMaterial(pttoMaterial);
230  G4cout << "\n----> The target has been changed to " << fTargetLength/cm
231  << " cm of "
232  << materialName << G4endl;
233  }
234 }
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:578
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void SetMaterial(G4Material *pMaterial)
void exrdmDetectorConstruction::SetTargetRadius ( G4double  value)
inline

Definition at line 72 of file exrdmDetectorConstruction.hh.

Referenced by exrdmDetectorMessenger::SetNewValue().

72 { fTargetRadius = value; };
const XML_Char int const XML_Char * value

The documentation for this class was generated from the following files: