Geant4  10.02.p03
ExP01DetectorConstruction Class Reference

Detector Construction for the persistency example. More...

#include <ExP01DetectorConstruction.hh>

Inheritance diagram for ExP01DetectorConstruction:
Collaboration diagram for ExP01DetectorConstruction:

Public Member Functions

 ExP01DetectorConstruction ()
 
 ~ExP01DetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
const G4VPhysicalVolumeGetTracker ()
 
G4double GetTrackerFullLength ()
 
G4double GetTargetFullLength ()
 
G4double GetWorldFullLength ()
 
void setTargetMaterial (G4String)
 
void setChamberMaterial (G4String)
 
void SetMagField (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

G4BoxfSolidWorld
 
G4LogicalVolumefLogicWorld
 
G4VPhysicalVolumefPhysiWorld
 
G4BoxfSolidTarget
 
G4LogicalVolumefLogicTarget
 
G4VPhysicalVolumefPhysiTarget
 
G4BoxfSolidTracker
 
G4LogicalVolumefLogicTracker
 
G4VPhysicalVolumefPhysiTracker
 
G4BoxfSolidChamber
 
G4LogicalVolumefLogicChamber
 
G4VPhysicalVolumefPhysiChamber
 
G4MaterialfTargetMater
 
G4MaterialfChamberMater
 
ExP01MagneticFieldfPMagField
 
ExP01DetectorMessengerfDetectorMessenger
 
G4double fWorldLength
 
G4double fTargetLength
 
G4double fTrackerLength
 
G4int fNbOfChambers
 
G4double fChamberWidth
 
G4double fChamberSpacing
 

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

Detector Construction for the persistency example.

Definition at line 52 of file ExP01DetectorConstruction.hh.

Constructor & Destructor Documentation

◆ ExP01DetectorConstruction()

ExP01DetectorConstruction::ExP01DetectorConstruction ( )

Definition at line 58 of file ExP01DetectorConstruction.cc.

67 {
70 }
Detector messenger for the persistency example.
Magnetic field for the persistency example.
ExP01DetectorMessenger * fDetectorMessenger

◆ ~ExP01DetectorConstruction()

ExP01DetectorConstruction::~ExP01DetectorConstruction ( )

Definition at line 74 of file ExP01DetectorConstruction.cc.

75 {
76  delete fPMagField;
77  delete fDetectorMessenger;
78 }
ExP01DetectorMessenger * fDetectorMessenger

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * ExP01DetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 82 of file ExP01DetectorConstruction.cc.

83 {
84 //--------- Material definition ---------
85 
86  G4double a, z;
87  G4double density, temperature, pressure;
88  G4int nel;
89 
90  //Air
91  G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
92  G4Element* O = new G4Element("Oxygen" , "O", z=8., a= 16.00*g/mole);
93 
94  G4Material* Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
95  Air->AddElement(N, 70*perCent);
96  Air->AddElement(O, 30*perCent);
97 
98  //Lead
99  G4Material* Pb =
100  new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
101 
102  //Xenon gas
103  G4Material* Xenon =
104  new G4Material("XenonGas", z=54., a=131.29*g/mole, density= 5.458*mg/cm3,
105  kStateGas, temperature= 293.15*kelvin, pressure= 1*atmosphere);
106 
107  // Print all the materials defined.
108  //
109  G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
110  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
111 
112 //--------- Sizes of the principal geometrical components (solids) ---------
113 
114  fNbOfChambers = 5;
115  fChamberWidth = 20*cm;
116  fChamberSpacing = 80*cm;
117 
118  fTrackerLength = (fNbOfChambers+1)*fChamberSpacing; // Full length of Tracker
119  fTargetLength = 5.0 * cm; // Full length of Target
120 
121  fTargetMater = Pb;
122  fChamberMater = Xenon;
123 
125 
126  G4double targetSize = 0.5*fTargetLength; // Half length of the Target
127  G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker
128 
129 //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
130 
131  //------------------------------
132  // World
133  //------------------------------
134 
135  G4double HalfWorldLength = 0.5*fWorldLength;
136 
137  fSolidWorld= new G4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength);
138  fLogicWorld= new G4LogicalVolume( fSolidWorld, Air, "World", 0, 0, 0);
139 
140  // Must place the World Physical volume unrotated at (0,0,0).
141  //
142  fPhysiWorld = new G4PVPlacement(0, // no rotation
143  G4ThreeVector(), // at (0,0,0)
144  fLogicWorld, // its logical volume
145  "World", // its name
146  0, // its mother volume
147  false, // no boolean operations
148  0); // copy number
149 
150  //------------------------------
151  // Target
152  //------------------------------
153 
154  G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetSize+trackerSize));
155 
156  fSolidTarget = new G4Box("target",targetSize,targetSize,targetSize);
158  fPhysiTarget = new G4PVPlacement(0, // no rotation
159  positionTarget, // at (x,y,z)
160  fLogicTarget, // its logical volume
161  "Target", // its name
162  fLogicWorld, // its mother volume
163  false, // no boolean operations
164  0); // copy number
165 
166  G4cout << "Target is " << fTargetLength/cm << " cm of "
167  << fTargetMater->GetName() << G4endl;
168 
169  //------------------------------
170  // Tracker
171  //------------------------------
172 
173  G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
174 
175  fSolidTracker = new G4Box("tracker",trackerSize,trackerSize,trackerSize);
176  fLogicTracker = new G4LogicalVolume(fSolidTracker , Air, "Tracker",0,0,0);
177  fPhysiTracker = new G4PVPlacement(0, // no rotation
178  positionTracker, // at (x,y,z)
179  fLogicTracker, // its logical volume
180  "Tracker", // its name
181  fLogicWorld, // its mother volume
182  false, // no boolean operations
183  0); // copy number
184 
185  //------------------------------
186  // Tracker segments
187  //------------------------------
188  //
189  // An example of Parameterised volumes
190  // dummy values for G4Box -- modified by parameterised volume
191 
192  fSolidChamber = new G4Box("chamber", 100*cm, 100*cm, 10*cm);
194 
195  G4double firstPosition = -trackerSize + 0.5*fChamberWidth;
196  G4double firstLength = fTrackerLength/10;
197  G4double lastLength = fTrackerLength;
198 
200  fNbOfChambers, // NoChambers
201  firstPosition, // Z of center of first
202  fChamberSpacing, // Z spacing of centers
203  fChamberWidth, // Width Chamber
204  firstLength, // lengthInitial
205  lastLength); // lengthFinal
206 
207  // dummy value : kZAxis -- modified by parameterised volume
208  //
210  "Chamber", // their name
211  fLogicChamber, // their logical volume
212  fLogicTracker, // Mother logical volume
213  kZAxis, // Are placed along this axis
214  fNbOfChambers, // Number of chambers
215  chamberParam); // The parametrisation
216 
217  G4cout << "There are " << fNbOfChambers << " chambers in the tracker region. "
218  << "The chambers are " << fChamberWidth/mm << " mm of "
219  << fChamberMater->GetName() << "\n The distance between chamber is "
220  << fChamberSpacing/cm << " cm" << G4endl;
221 
222  //------------------------------------------------
223  // Sensitive detectors
224  //------------------------------------------------
225 
227 
228  G4String trackerChamberSDname = "ExP01/TrackerChamberSD";
229  ExP01TrackerSD* aTrackerSD = new ExP01TrackerSD( trackerChamberSDname );
230  SDman->AddNewDetector( aTrackerSD );
231  fLogicChamber->SetSensitiveDetector( aTrackerSD );
232 
233 //--------- Visualization attributes -------------------------------
234 
235  G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
236  fLogicWorld ->SetVisAttributes(BoxVisAtt);
237  fLogicTarget ->SetVisAttributes(BoxVisAtt);
238  fLogicTracker->SetVisAttributes(BoxVisAtt);
239 
240  G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
241  fLogicChamber->SetVisAttributes(ChamberVisAtt);
242 
243 //--------- example of User Limits -------------------------------
244 
245  // below is an example of how to set tracking constraints in a given
246  // logical volume(see also in N02PhysicsList how to setup the processes
247  // G4StepLimiter or G4UserSpecialCuts).
248 
249  // Sets a max Step length in the tracker region, with G4StepLimiter
250  //
251  G4double maxStep = 0.5*fChamberWidth;
253 
254  // Set additional contraints on the track, with G4UserSpecialCuts
255  //
256  // G4double maxLength = 2*fTrackerLength, maxTime = 0.1*ns, minEkin = 10*MeV;
257  // logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
258  // minEkin));
259 
260  return fPhysiWorld;
261 }
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
static const double mg
Definition: G4SIunits.hh:181
Chamber parameterisation for the persistency example.
int G4int
Definition: G4Types.hh:78
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 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
Sensitive detector implementation for the ROOT hits persistency example.
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
Here is the call graph for this function:

◆ GetTargetFullLength()

G4double ExP01DetectorConstruction::GetTargetFullLength ( )
inline

Definition at line 66 of file ExP01DetectorConstruction.hh.

◆ GetTracker()

const G4VPhysicalVolume* ExP01DetectorConstruction::GetTracker ( )
inline

Definition at line 64 of file ExP01DetectorConstruction.hh.

64 {return fPhysiTracker;};

◆ GetTrackerFullLength()

G4double ExP01DetectorConstruction::GetTrackerFullLength ( )
inline

Definition at line 65 of file ExP01DetectorConstruction.hh.

◆ GetWorldFullLength()

G4double ExP01DetectorConstruction::GetWorldFullLength ( )
inline

Definition at line 67 of file ExP01DetectorConstruction.hh.

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

◆ setChamberMaterial()

void ExP01DetectorConstruction::setChamberMaterial ( G4String  materialName)

Definition at line 279 of file ExP01DetectorConstruction.cc.

280 {
281  // search the material by its name
282  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
283  if (pttoMaterial)
284  {fChamberMater = pttoMaterial;
285  fLogicChamber->SetMaterial(pttoMaterial);
286  G4cout << "\n----> The chambers are " << fChamberWidth/cm << " cm of "
287  << materialName << G4endl;
288  }
289 }
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 ExP01DetectorConstruction::SetMagField ( G4double  fieldValue)

Definition at line 293 of file ExP01DetectorConstruction.cc.

294 {
295  fPMagField->SetFieldValue(fieldValue);
296 }
void SetFieldValue(G4double fieldValue)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTargetMaterial()

void ExP01DetectorConstruction::setTargetMaterial ( G4String  materialName)

Definition at line 265 of file ExP01DetectorConstruction.cc.

266 {
267  // search the material by its name
268  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
269  if (pttoMaterial)
270  {fTargetMater = pttoMaterial;
271  fLogicTarget->SetMaterial(pttoMaterial);
272  G4cout << "\n----> The target is " << fTargetLength/cm << " cm of "
273  << materialName << G4endl;
274  }
275 }
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

◆ fChamberMater

G4Material* ExP01DetectorConstruction::fChamberMater
private

Definition at line 92 of file ExP01DetectorConstruction.hh.

◆ fChamberSpacing

G4double ExP01DetectorConstruction::fChamberSpacing
private

Definition at line 102 of file ExP01DetectorConstruction.hh.

◆ fChamberWidth

G4double ExP01DetectorConstruction::fChamberWidth
private

Definition at line 101 of file ExP01DetectorConstruction.hh.

◆ fDetectorMessenger

ExP01DetectorMessenger* ExP01DetectorConstruction::fDetectorMessenger
private

Definition at line 95 of file ExP01DetectorConstruction.hh.

◆ fLogicChamber

G4LogicalVolume* ExP01DetectorConstruction::fLogicChamber
private

Definition at line 88 of file ExP01DetectorConstruction.hh.

◆ fLogicTarget

G4LogicalVolume* ExP01DetectorConstruction::fLogicTarget
private

Definition at line 80 of file ExP01DetectorConstruction.hh.

◆ fLogicTracker

G4LogicalVolume* ExP01DetectorConstruction::fLogicTracker
private

Definition at line 84 of file ExP01DetectorConstruction.hh.

◆ fLogicWorld

G4LogicalVolume* ExP01DetectorConstruction::fLogicWorld
private

Definition at line 76 of file ExP01DetectorConstruction.hh.

◆ fNbOfChambers

G4int ExP01DetectorConstruction::fNbOfChambers
private

Definition at line 100 of file ExP01DetectorConstruction.hh.

◆ fPhysiChamber

G4VPhysicalVolume* ExP01DetectorConstruction::fPhysiChamber
private

Definition at line 89 of file ExP01DetectorConstruction.hh.

◆ fPhysiTarget

G4VPhysicalVolume* ExP01DetectorConstruction::fPhysiTarget
private

Definition at line 81 of file ExP01DetectorConstruction.hh.

◆ fPhysiTracker

G4VPhysicalVolume* ExP01DetectorConstruction::fPhysiTracker
private

Definition at line 85 of file ExP01DetectorConstruction.hh.

◆ fPhysiWorld

G4VPhysicalVolume* ExP01DetectorConstruction::fPhysiWorld
private

Definition at line 77 of file ExP01DetectorConstruction.hh.

◆ fPMagField

ExP01MagneticField* ExP01DetectorConstruction::fPMagField
private

Definition at line 93 of file ExP01DetectorConstruction.hh.

◆ fSolidChamber

G4Box* ExP01DetectorConstruction::fSolidChamber
private

Definition at line 87 of file ExP01DetectorConstruction.hh.

◆ fSolidTarget

G4Box* ExP01DetectorConstruction::fSolidTarget
private

Definition at line 79 of file ExP01DetectorConstruction.hh.

◆ fSolidTracker

G4Box* ExP01DetectorConstruction::fSolidTracker
private

Definition at line 83 of file ExP01DetectorConstruction.hh.

◆ fSolidWorld

G4Box* ExP01DetectorConstruction::fSolidWorld
private

Definition at line 75 of file ExP01DetectorConstruction.hh.

◆ fTargetLength

G4double ExP01DetectorConstruction::fTargetLength
private

Definition at line 98 of file ExP01DetectorConstruction.hh.

◆ fTargetMater

G4Material* ExP01DetectorConstruction::fTargetMater
private

Definition at line 91 of file ExP01DetectorConstruction.hh.

◆ fTrackerLength

G4double ExP01DetectorConstruction::fTrackerLength
private

Definition at line 99 of file ExP01DetectorConstruction.hh.

◆ fWorldLength

G4double ExP01DetectorConstruction::fWorldLength
private

Definition at line 97 of file ExP01DetectorConstruction.hh.


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