Geant4  10.02.p03
ExN02DetectorConstruction Class Reference

#include <ExN02DetectorConstruction.hh>

Inheritance diagram for ExN02DetectorConstruction:
Collaboration diagram for ExN02DetectorConstruction:

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
 

Private Attributes

G4BoxsolidWorld
 
G4LogicalVolumelogicWorld
 
G4VPhysicalVolumephysiWorld
 
G4BoxsolidTarget
 
G4LogicalVolumelogicTarget
 
G4VPhysicalVolumephysiTarget
 
G4BoxsolidTracker
 
G4LogicalVolumelogicTracker
 
G4VPhysicalVolumephysiTracker
 
G4BoxsolidChamber
 
G4LogicalVolumelogicChamber
 
G4VPhysicalVolumephysiChamber
 
G4MaterialTargetMater
 
G4MaterialChamberMater
 
G4VPVParameterisationchamberParam
 
G4UserLimitsstepLimit
 
ExN02MagneticFieldfpMagField
 
ExN02DetectorMessengerdetectorMessenger
 
G4double fWorldLength
 
G4double fTargetLength
 
G4double fTrackerLength
 
G4int NbOfChambers
 
G4double ChamberWidth
 
G4double ChamberSpacing
 

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::ExN02DetectorConstruction ( )

Definition at line 60 of file ExN02DetectorConstruction.cc.

61 :solidWorld(0), logicWorld(0), physiWorld(0),
66  stepLimit(0), fpMagField(0),
69 {
72 }
G4VPVParameterisation * chamberParam
ExN02DetectorMessenger * detectorMessenger

◆ ~ExN02DetectorConstruction()

ExN02DetectorConstruction::~ExN02DetectorConstruction ( )

Definition at line 76 of file ExN02DetectorConstruction.cc.

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

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * ExN02DetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 86 of file ExN02DetectorConstruction.cc.

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 
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 
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  //
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);
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 }
static const double cm
Definition: G4SIunits.hh:118
G4Material * Air
Definition: TRTMaterials.hh:57
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
void SetUserLimits(G4UserLimits *pULimits)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
G4double GetSurfaceTolerance() const
static const double mg
Definition: G4SIunits.hh:181
void SetWorldMaximumExtent(G4double worldExtent)
int G4int
Definition: G4Types.hh:78
G4VPVParameterisation * chamberParam
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5206
G4GLOB_DLL std::ostream G4cout
static const double cm3
Definition: G4SIunits.hh:120
static const double perCent
Definition: G4SIunits.hh:329
static G4GeometryManager * GetInstance()
static const double kelvin
Definition: G4SIunits.hh:278
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
static const double atmosphere
Definition: G4SIunits.hh:234
static const double mole
Definition: G4SIunits.hh:283
#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:364
double G4double
Definition: G4Types.hh:76
const G4String & GetName() const
Definition: G4Material.hh:178
static const double mm
Definition: G4SIunits.hh:114
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
G4int nel
Definition: TRTMaterials.hh:41
static G4GeometryTolerance * GetInstance()
Here is the call graph for this function:

◆ GetTargetFullLength()

G4double ExN02DetectorConstruction::GetTargetFullLength ( )
inline

Definition at line 66 of file ExN02DetectorConstruction.hh.

◆ GetTracker()

const G4VPhysicalVolume* ExN02DetectorConstruction::GetTracker ( )
inline

Definition at line 64 of file ExN02DetectorConstruction.hh.

64 {return physiTracker;};

◆ GetTrackerFullLength()

G4double ExN02DetectorConstruction::GetTrackerFullLength ( )
inline

Definition at line 65 of file ExN02DetectorConstruction.hh.

◆ GetWorldFullLength()

G4double ExN02DetectorConstruction::GetWorldFullLength ( )
inline

Definition at line 67 of file ExN02DetectorConstruction.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChamberMaterial()

void ExN02DetectorConstruction::setChamberMaterial ( G4String  materialName)

Definition at line 289 of file ExN02DetectorConstruction.cc.

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 const double cm
Definition: G4SIunits.hh:118
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:604
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void SetMaterial(G4Material *pMaterial)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetMagField()

void ExN02DetectorConstruction::SetMagField ( G4double  fieldValue)

Definition at line 303 of file ExN02DetectorConstruction.cc.

304 {
305  fpMagField->SetMagFieldValue(fieldValue);
306 }
void SetMagFieldValue(G4double fieldValue)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetMaxStep()

void ExN02DetectorConstruction::SetMaxStep ( G4double  maxStep)

Definition at line 310 of file ExN02DetectorConstruction.cc.

311 {
312  if ((stepLimit)&&(maxStep>0.)) stepLimit->SetMaxAllowedStep(maxStep);
313 }
virtual void SetMaxAllowedStep(G4double ustepMax)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTargetMaterial()

void ExN02DetectorConstruction::setTargetMaterial ( G4String  materialName)

Definition at line 275 of file ExN02DetectorConstruction.cc.

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 const double cm
Definition: G4SIunits.hh:118
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:604
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void SetMaterial(G4Material *pMaterial)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ ChamberMater

G4Material* ExN02DetectorConstruction::ChamberMater
private

Definition at line 93 of file ExN02DetectorConstruction.hh.

◆ chamberParam

G4VPVParameterisation* ExN02DetectorConstruction::chamberParam
private

Definition at line 95 of file ExN02DetectorConstruction.hh.

◆ ChamberSpacing

G4double ExN02DetectorConstruction::ChamberSpacing
private

Definition at line 107 of file ExN02DetectorConstruction.hh.

◆ ChamberWidth

G4double ExN02DetectorConstruction::ChamberWidth
private

Definition at line 106 of file ExN02DetectorConstruction.hh.

◆ detectorMessenger

ExN02DetectorMessenger* ExN02DetectorConstruction::detectorMessenger
private

Definition at line 100 of file ExN02DetectorConstruction.hh.

◆ fpMagField

ExN02MagneticField* ExN02DetectorConstruction::fpMagField
private

Definition at line 98 of file ExN02DetectorConstruction.hh.

◆ fTargetLength

G4double ExN02DetectorConstruction::fTargetLength
private

Definition at line 103 of file ExN02DetectorConstruction.hh.

◆ fTrackerLength

G4double ExN02DetectorConstruction::fTrackerLength
private

Definition at line 104 of file ExN02DetectorConstruction.hh.

◆ fWorldLength

G4double ExN02DetectorConstruction::fWorldLength
private

Definition at line 102 of file ExN02DetectorConstruction.hh.

◆ logicChamber

G4LogicalVolume* ExN02DetectorConstruction::logicChamber
private

Definition at line 89 of file ExN02DetectorConstruction.hh.

◆ logicTarget

G4LogicalVolume* ExN02DetectorConstruction::logicTarget
private

Definition at line 81 of file ExN02DetectorConstruction.hh.

◆ logicTracker

G4LogicalVolume* ExN02DetectorConstruction::logicTracker
private

Definition at line 85 of file ExN02DetectorConstruction.hh.

◆ logicWorld

G4LogicalVolume* ExN02DetectorConstruction::logicWorld
private

Definition at line 77 of file ExN02DetectorConstruction.hh.

◆ NbOfChambers

G4int ExN02DetectorConstruction::NbOfChambers
private

Definition at line 105 of file ExN02DetectorConstruction.hh.

◆ physiChamber

G4VPhysicalVolume* ExN02DetectorConstruction::physiChamber
private

Definition at line 90 of file ExN02DetectorConstruction.hh.

◆ physiTarget

G4VPhysicalVolume* ExN02DetectorConstruction::physiTarget
private

Definition at line 82 of file ExN02DetectorConstruction.hh.

◆ physiTracker

G4VPhysicalVolume* ExN02DetectorConstruction::physiTracker
private

Definition at line 86 of file ExN02DetectorConstruction.hh.

◆ physiWorld

G4VPhysicalVolume* ExN02DetectorConstruction::physiWorld
private

Definition at line 78 of file ExN02DetectorConstruction.hh.

◆ solidChamber

G4Box* ExN02DetectorConstruction::solidChamber
private

Definition at line 88 of file ExN02DetectorConstruction.hh.

◆ solidTarget

G4Box* ExN02DetectorConstruction::solidTarget
private

Definition at line 80 of file ExN02DetectorConstruction.hh.

◆ solidTracker

G4Box* ExN02DetectorConstruction::solidTracker
private

Definition at line 84 of file ExN02DetectorConstruction.hh.

◆ solidWorld

G4Box* ExN02DetectorConstruction::solidWorld
private

Definition at line 76 of file ExN02DetectorConstruction.hh.

◆ stepLimit

G4UserLimits* ExN02DetectorConstruction::stepLimit
private

Definition at line 96 of file ExN02DetectorConstruction.hh.

◆ TargetMater

G4Material* ExN02DetectorConstruction::TargetMater
private

Definition at line 92 of file ExN02DetectorConstruction.hh.


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