Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
 

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

Definition at line 58 of file ExP01DetectorConstruction.cc.

60  fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
61  fSolidTarget(0), fLogicTarget(0), fPhysiTarget(0),
62  fSolidTracker(0), fLogicTracker(0), fPhysiTracker(0),
63  fSolidChamber(0), fLogicChamber(0), fPhysiChamber(0),
64  fTargetMater(0), fChamberMater(0), fPMagField(0), fDetectorMessenger(0),
65  fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.),
66  fNbOfChambers(0), fChamberWidth(0.), fChamberSpacing(0.)
67 {
68  fPMagField = new ExP01MagneticField();
69  fDetectorMessenger = new ExP01DetectorMessenger(this);
70 }
Detector messenger for the persistency example.
Magnetic field for the persistency example.
ExP01DetectorConstruction::~ExP01DetectorConstruction ( )

Definition at line 74 of file ExP01DetectorConstruction.cc.

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

Member Function Documentation

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 
124  fWorldLength= 1.2 *(fTargetLength+fTrackerLength);
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);
157  fLogicTarget = new G4LogicalVolume(fSolidTarget,fTargetMater,"Target",0,0,0);
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);
193  fLogicChamber = new G4LogicalVolume(fSolidChamber, fChamberMater,"Chamber",0,0,0);
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  //
209  fPhysiChamber = new G4PVParameterised(
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;
252  fLogicTracker->SetUserLimits(new G4UserLimits(maxStep));
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 constexpr double mm
Definition: G4SIunits.hh:115
static constexpr double mg
Definition: G4SIunits.hh:184
CLHEP::Hep3Vector G4ThreeVector
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
Definition: G4Box.hh:64
static constexpr double perCent
Definition: G4SIunits.hh:332
const G4String & GetName() const
Definition: G4Material.hh:178
void SetUserLimits(G4UserLimits *pULimits)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
Chamber parameterisation for the persistency example.
int G4int
Definition: G4Types.hh:78
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4GLOB_DLL std::ostream G4cout
static constexpr double cm
Definition: G4SIunits.hh:119
static constexpr double kelvin
Definition: G4SIunits.hh:281
static constexpr double cm3
Definition: G4SIunits.hh:121
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
tuple z
Definition: test.py:28
#define G4endl
Definition: G4ios.hh:61
**D E S C R I P T I O N
Definition: HEPEvtcom.cc:77
Sensitive detector implementation for the ROOT hits persistency example.
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:362
double G4double
Definition: G4Types.hh:76
static constexpr double atmosphere
Definition: G4SIunits.hh:237
static constexpr double mole
Definition: G4SIunits.hh:286
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)

Here is the call graph for this function:

G4double ExP01DetectorConstruction::GetTargetFullLength ( )
inline

Definition at line 66 of file ExP01DetectorConstruction.hh.

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

Definition at line 64 of file ExP01DetectorConstruction.hh.

64 {return fPhysiTracker;};
G4double ExP01DetectorConstruction::GetTrackerFullLength ( )
inline

Definition at line 65 of file ExP01DetectorConstruction.hh.

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

Definition at line 67 of file ExP01DetectorConstruction.hh.

67 {return fWorldLength;};

Here is the caller graph for this function:

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 G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:602
G4GLOB_DLL std::ostream G4cout
static constexpr double cm
Definition: G4SIunits.hh:119
#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:

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:

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 G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:602
G4GLOB_DLL std::ostream G4cout
static constexpr double cm
Definition: G4SIunits.hh:119
#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:


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