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

#include <ExN02DetectorConstruction.hh>

Inheritance diagram for ExN02DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 ExN02DetectorConstruction ()
 
 ~ExN02DetectorConstruction ()
 
G4VPhysicalVolumeConstruct ()
 
const G4VPhysicalVolumeGetTracker ()
 
G4double GetTrackerFullLength ()
 
G4double GetTargetFullLength ()
 
G4double GetWorldFullLength ()
 
void setTargetMaterial (G4String)
 
void setChamberMaterial (G4String)
 
void SetMagField (G4double)
 
void SetMaxStep (G4double)
 
- 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 52 of file ExN02DetectorConstruction.hh.

Constructor & Destructor Documentation

ExN02DetectorConstruction::ExN02DetectorConstruction ( )

Definition at line 60 of file ExN02DetectorConstruction.cc.

61 :solidWorld(0), logicWorld(0), physiWorld(0),
62  solidTarget(0), logicTarget(0), physiTarget(0),
63  solidTracker(0),logicTracker(0),physiTracker(0),
64  solidChamber(0),logicChamber(0),physiChamber(0),
65  TargetMater(0), ChamberMater(0),chamberParam(0),
66  stepLimit(0), fpMagField(0),
67  fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.),
68  NbOfChambers(0) , ChamberWidth(0.), ChamberSpacing(0.)
69 {
70  fpMagField = new ExN02MagneticField();
71  detectorMessenger = new ExN02DetectorMessenger(this);
72 }
ExN02DetectorConstruction::~ExN02DetectorConstruction ( )

Definition at line 76 of file ExN02DetectorConstruction.cc.

77 {
78  delete fpMagField;
79  delete stepLimit;
80  delete chamberParam;
81  delete detectorMessenger;
82 }

Member Function Documentation

G4VPhysicalVolume * ExN02DetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 86 of file ExN02DetectorConstruction.cc.

References test::a, G4Material::AddElement(), G4SDManager::AddNewDetector(), Air, python.hepunit::atmosphere, python.hepunit::cm, python.hepunit::cm3, density, g(), G4cout, G4endl, G4GeometryTolerance::GetInstance(), G4GeometryManager::GetInstance(), G4Material::GetMaterialTable(), G4Material::GetName(), G4SDManager::GetSDMpointer(), G4GeometryTolerance::GetSurfaceTolerance(), python.hepunit::kelvin, kStateGas, kZAxis, python.hepunit::mg, python.hepunit::mm, python.hepunit::mole, N, nel, python.hepunit::perCent, G4LogicalVolume::SetSensitiveDetector(), G4LogicalVolume::SetUserLimits(), G4LogicalVolume::SetVisAttributes(), G4GeometryManager::SetWorldMaximumExtent(), and z.

87 {
88 //--------- Material definition ---------
89 
90  G4double a, z;
91  G4double density, temperature, pressure;
92  G4int nel;
93 
94  //Air
95  G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
96  G4Element* O = new G4Element("Oxygen" , "O", z=8., a= 16.00*g/mole);
97 
98  G4Material* Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
99  Air->AddElement(N, 70*perCent);
100  Air->AddElement(O, 30*perCent);
101 
102  //Lead
103  G4Material* Pb =
104  new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
105 
106  //Xenon gas
107  G4Material* Xenon =
108  new G4Material("XenonGas", z=54., a=131.29*g/mole, density= 5.458*mg/cm3,
109  kStateGas, temperature= 293.15*kelvin, pressure= 1*atmosphere);
110 
111  // Print all the materials defined.
112  //
113  G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
114  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
115 
116 //--------- Sizes of the principal geometrical components (solids) ---------
117 
118  NbOfChambers = 5;
119  ChamberWidth = 20*cm;
120  ChamberSpacing = 80*cm;
121 
122  fTrackerLength = (NbOfChambers+1)*ChamberSpacing; // Full length of Tracker
123  fTargetLength = 5.0 * cm; // Full length of Target
124 
125  TargetMater = Pb;
126  ChamberMater = Xenon;
127 
128  fWorldLength= 1.2 *(fTargetLength+fTrackerLength);
129 
130  G4double targetSize = 0.5*fTargetLength; // Half length of the Target
131  G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker
132 
133 //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
134 
135  //------------------------------
136  // World
137  //------------------------------
138 
139  G4double HalfWorldLength = 0.5*fWorldLength;
140 
142  G4cout << "Computed tolerance = "
144  << " mm" << G4endl;
145 
146  solidWorld= new G4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength);
147  logicWorld= new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0);
148 
149  // Must place the World Physical volume unrotated at (0,0,0).
150  //
151  physiWorld = new G4PVPlacement(0, // no rotation
152  G4ThreeVector(), // at (0,0,0)
153  logicWorld, // its logical volume
154  "World", // its name
155  0, // its mother volume
156  false, // no boolean operations
157  0); // copy number
158 
159  //------------------------------
160  // Target
161  //------------------------------
162 
163  G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetSize+trackerSize));
164 
165  solidTarget = new G4Box("target",targetSize,targetSize,targetSize);
166  logicTarget = new G4LogicalVolume(solidTarget,TargetMater,"Target",0,0,0);
167  physiTarget = new G4PVPlacement(0, // no rotation
168  positionTarget, // at (x,y,z)
169  logicTarget, // its logical volume
170  "Target", // its name
171  logicWorld, // its mother volume
172  false, // no boolean operations
173  0); // copy number
174 
175  G4cout << "Target is " << fTargetLength/cm << " cm of "
176  << TargetMater->GetName() << G4endl;
177 
178  //------------------------------
179  // Tracker
180  //------------------------------
181 
182  G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
183 
184  solidTracker = new G4Box("tracker",trackerSize,trackerSize,trackerSize);
185  logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0);
186  physiTracker = new G4PVPlacement(0, // no rotation
187  positionTracker, // at (x,y,z)
188  logicTracker, // its logical volume
189  "Tracker", // its name
190  logicWorld, // its mother volume
191  false, // no boolean operations
192  0); // copy number
193 
194  //------------------------------
195  // Tracker segments
196  //------------------------------
197  //
198  // An example of Parameterised volumes
199  // dummy values for G4Box -- modified by parameterised volume
200 
201  solidChamber = new G4Box("chamber", 100*cm, 100*cm, 10*cm);
202  logicChamber = new G4LogicalVolume(solidChamber,ChamberMater,"Chamber",0,0,0);
203 
204  G4double firstPosition = -trackerSize + 0.5*ChamberWidth;
205  G4double firstLength = fTrackerLength/10;
206  G4double lastLength = fTrackerLength;
207 
208  chamberParam = new ExN02ChamberParameterisation(
209  NbOfChambers, // NoChambers
210  firstPosition, // Z of center of first
211  ChamberSpacing, // Z spacing of centers
212  ChamberWidth, // Width Chamber
213  firstLength, // lengthInitial
214  lastLength); // lengthFinal
215 
216  // dummy value : kZAxis -- modified by parameterised volume
217  //
218  physiChamber = new G4PVParameterised(
219  "Chamber", // their name
220  logicChamber, // their logical volume
221  logicTracker, // Mother logical volume
222  kZAxis, // Are placed along this axis
223  NbOfChambers, // Number of chambers
224  chamberParam); // The parametrisation
225 
226  G4cout << "There are " << NbOfChambers << " chambers in the tracker region. "
227  << "The chambers are " << ChamberWidth/mm << " mm of "
228  << ChamberMater->GetName() << "\n The distance between chamber is "
229  << ChamberSpacing/cm << " cm" << G4endl;
230 
231  //------------------------------------------------
232  // Sensitive detectors
233  //------------------------------------------------
234 
236 
237  G4String trackerChamberSDname = "ExN02/TrackerChamberSD";
238  ExN02TrackerSD* aTrackerSD = new ExN02TrackerSD( trackerChamberSDname );
239  SDman->AddNewDetector( aTrackerSD );
240  logicChamber->SetSensitiveDetector( aTrackerSD );
241 
242 //--------- Visualization attributes -------------------------------
243 
244  G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
245  logicWorld ->SetVisAttributes(BoxVisAtt);
246  logicTarget ->SetVisAttributes(BoxVisAtt);
247  logicTracker->SetVisAttributes(BoxVisAtt);
248 
249  G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
250  logicChamber->SetVisAttributes(ChamberVisAtt);
251 
252 //--------- example of User Limits -------------------------------
253 
254  // below is an example of how to set tracking constraints in a given
255  // logical volume(see also in N02PhysicsList how to setup the processes
256  // G4StepLimiter or G4UserSpecialCuts).
257 
258  // Sets a max Step length in the tracker region, with G4StepLimiter
259  //
260  G4double maxStep = 0.5*ChamberWidth;
261  stepLimit = new G4UserLimits(maxStep);
262  logicTracker->SetUserLimits(stepLimit);
263 
264  // Set additional contraints on the track, with G4UserSpecialCuts
265  //
266  // G4double maxLength = 2*fTrackerLength, maxTime = 0.1*ns, minEkin = 10*MeV;
267  // logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
268  // minEkin));
269 
270  return physiWorld;
271 }
G4Material * Air
Definition: TRTMaterials.hh:57
CLHEP::Hep3Vector G4ThreeVector
G4double z
Definition: TRTMaterials.hh:39
Definition: G4Box.hh:63
const G4String & GetName() const
Definition: G4Material.hh:176
void SetUserLimits(G4UserLimits *pULimits)
G4double GetSurfaceTolerance() const
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
int atmosphere
Definition: hepunit.py:151
void SetWorldMaximumExtent(G4double worldExtent)
int G4int
Definition: G4Types.hh:78
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4GLOB_DLL std::ostream G4cout
static G4GeometryManager * GetInstance()
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:67
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
float perCent
Definition: hepunit.py:239
#define G4endl
Definition: G4ios.hh:61
**D E S C R I P T I O N
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:345
double G4double
Definition: G4Types.hh:76
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
G4int nel
Definition: TRTMaterials.hh:41
static G4GeometryTolerance * GetInstance()
G4double ExN02DetectorConstruction::GetTargetFullLength ( )
inline

Definition at line 66 of file ExN02DetectorConstruction.hh.

66 {return fTargetLength;};
const G4VPhysicalVolume* ExN02DetectorConstruction::GetTracker ( )
inline

Definition at line 64 of file ExN02DetectorConstruction.hh.

64 {return physiTracker;};
G4double ExN02DetectorConstruction::GetTrackerFullLength ( )
inline

Definition at line 65 of file ExN02DetectorConstruction.hh.

65 {return fTrackerLength;};
G4double ExN02DetectorConstruction::GetWorldFullLength ( )
inline

Definition at line 67 of file ExN02DetectorConstruction.hh.

Referenced by ExN02PrimaryGeneratorAction::GeneratePrimaries().

67 {return fWorldLength;};
void ExN02DetectorConstruction::setChamberMaterial ( G4String  materialName)

Definition at line 289 of file ExN02DetectorConstruction.cc.

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

Referenced by ExN02DetectorMessenger::SetNewValue().

290 {
291  // search the material by its name
292  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
293  if (pttoMaterial)
294  {ChamberMater = pttoMaterial;
295  logicChamber->SetMaterial(pttoMaterial);
296  G4cout << "\n----> The chambers are " << ChamberWidth/cm << " cm of "
297  << materialName << G4endl;
298  }
299 }
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 ExN02DetectorConstruction::SetMagField ( G4double  fieldValue)

Definition at line 303 of file ExN02DetectorConstruction.cc.

References ExN02MagneticField::SetMagFieldValue().

Referenced by ExN02DetectorMessenger::SetNewValue().

304 {
305  fpMagField->SetMagFieldValue(fieldValue);
306 }
void SetMagFieldValue(G4double fieldValue)
void ExN02DetectorConstruction::SetMaxStep ( G4double  maxStep)

Definition at line 310 of file ExN02DetectorConstruction.cc.

References G4UserLimits::SetMaxAllowedStep().

Referenced by ExN02DetectorMessenger::SetNewValue().

311 {
312  if ((stepLimit)&&(maxStep>0.)) stepLimit->SetMaxAllowedStep(maxStep);
313 }
virtual void SetMaxAllowedStep(G4double ustepMax)
void ExN02DetectorConstruction::setTargetMaterial ( G4String  materialName)

Definition at line 275 of file ExN02DetectorConstruction.cc.

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

Referenced by ExN02DetectorMessenger::SetNewValue().

276 {
277  // search the material by its name
278  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
279  if (pttoMaterial)
280  {TargetMater = pttoMaterial;
281  logicTarget->SetMaterial(pttoMaterial);
282  G4cout << "\n----> The target is " << fTargetLength/cm << " cm of "
283  << materialName << G4endl;
284  }
285 }
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)

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