Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ExP01DetectorConstruction Class Reference

Detector Construction for the persistency example. More...

#include <Doxymodules_persistency.h>

Inheritance diagram for ExP01DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 ExP01DetectorConstruction ()
 
 ~ExP01DetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
const G4VPhysicalVolumeGetTracker ()
 
G4double GetTrackerFullLength ()
 
G4double GetTargetFullLength ()
 
G4double GetWorldFullLength ()
 
void SetTargetMaterial (G4String)
 
void SetChamberMaterial (G4String)
 
void SetMagField (G4double)
 

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
 

Detailed Description

Detector Construction for the persistency example.

Definition at line 80 of file Doxymodules_persistency.h.

Constructor & Destructor Documentation

◆ ExP01DetectorConstruction()

ExP01DetectorConstruction::ExP01DetectorConstruction ( )

Definition at line 57 of file ExP01DetectorConstruction.cc.

66{
69}
ExP01DetectorMessenger * fDetectorMessenger
Detector messenger for the persistency example.
Magnetic field for the persistency example.

◆ ~ExP01DetectorConstruction()

ExP01DetectorConstruction::~ExP01DetectorConstruction ( )

Definition at line 73 of file ExP01DetectorConstruction.cc.

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

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * ExP01DetectorConstruction::Construct ( )
virtual

Definition at line 81 of file ExP01DetectorConstruction.cc.

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

◆ GetTracker()

const G4VPhysicalVolume * ExP01DetectorConstruction::GetTracker ( )
inline

Definition at line 63 of file ExP01DetectorConstruction.hh.

63{return fPhysiTracker;};

◆ GetTrackerFullLength()

G4double ExP01DetectorConstruction::GetTrackerFullLength ( )
inline

Definition at line 64 of file ExP01DetectorConstruction.hh.

64{return fTrackerLength;};

◆ GetTargetFullLength()

G4double ExP01DetectorConstruction::GetTargetFullLength ( )
inline

Definition at line 65 of file ExP01DetectorConstruction.hh.

65{return fTargetLength;};

◆ GetWorldFullLength()

G4double ExP01DetectorConstruction::GetWorldFullLength ( )
inline

Definition at line 66 of file ExP01DetectorConstruction.hh.

66{return fWorldLength;};

◆ SetTargetMaterial()

void ExP01DetectorConstruction::SetTargetMaterial ( G4String  materialName)

Definition at line 264 of file ExP01DetectorConstruction.cc.

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

◆ SetChamberMaterial()

void ExP01DetectorConstruction::SetChamberMaterial ( G4String  materialName)

Definition at line 278 of file ExP01DetectorConstruction.cc.

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

◆ SetMagField()

void ExP01DetectorConstruction::SetMagField ( G4double  fieldValue)

Definition at line 292 of file ExP01DetectorConstruction.cc.

293{
294 fPMagField->SetFieldValue(fieldValue);
295}
void SetFieldValue(G4double fieldValue)

Member Data Documentation

◆ fSolidWorld

G4Box* ExP01DetectorConstruction::fSolidWorld
private

Definition at line 74 of file ExP01DetectorConstruction.hh.

◆ fLogicWorld

G4LogicalVolume* ExP01DetectorConstruction::fLogicWorld
private

Definition at line 75 of file ExP01DetectorConstruction.hh.

◆ fPhysiWorld

G4VPhysicalVolume* ExP01DetectorConstruction::fPhysiWorld
private

Definition at line 76 of file ExP01DetectorConstruction.hh.

◆ fSolidTarget

G4Box* ExP01DetectorConstruction::fSolidTarget
private

Definition at line 78 of file ExP01DetectorConstruction.hh.

◆ fLogicTarget

G4LogicalVolume* ExP01DetectorConstruction::fLogicTarget
private

Definition at line 79 of file ExP01DetectorConstruction.hh.

◆ fPhysiTarget

G4VPhysicalVolume* ExP01DetectorConstruction::fPhysiTarget
private

Definition at line 80 of file ExP01DetectorConstruction.hh.

◆ fSolidTracker

G4Box* ExP01DetectorConstruction::fSolidTracker
private

Definition at line 82 of file ExP01DetectorConstruction.hh.

◆ fLogicTracker

G4LogicalVolume* ExP01DetectorConstruction::fLogicTracker
private

Definition at line 83 of file ExP01DetectorConstruction.hh.

◆ fPhysiTracker

G4VPhysicalVolume* ExP01DetectorConstruction::fPhysiTracker
private

Definition at line 84 of file ExP01DetectorConstruction.hh.

◆ fSolidChamber

G4Box* ExP01DetectorConstruction::fSolidChamber
private

Definition at line 86 of file ExP01DetectorConstruction.hh.

◆ fLogicChamber

G4LogicalVolume* ExP01DetectorConstruction::fLogicChamber
private

Definition at line 87 of file ExP01DetectorConstruction.hh.

◆ fPhysiChamber

G4VPhysicalVolume* ExP01DetectorConstruction::fPhysiChamber
private

Definition at line 88 of file ExP01DetectorConstruction.hh.

◆ fTargetMater

G4Material* ExP01DetectorConstruction::fTargetMater
private

Definition at line 90 of file ExP01DetectorConstruction.hh.

◆ fChamberMater

G4Material* ExP01DetectorConstruction::fChamberMater
private

Definition at line 91 of file ExP01DetectorConstruction.hh.

◆ fPMagField

ExP01MagneticField* ExP01DetectorConstruction::fPMagField
private

Definition at line 92 of file ExP01DetectorConstruction.hh.

◆ fDetectorMessenger

ExP01DetectorMessenger* ExP01DetectorConstruction::fDetectorMessenger
private

Definition at line 94 of file ExP01DetectorConstruction.hh.

◆ fWorldLength

G4double ExP01DetectorConstruction::fWorldLength
private

Definition at line 96 of file ExP01DetectorConstruction.hh.

◆ fTargetLength

G4double ExP01DetectorConstruction::fTargetLength
private

Definition at line 97 of file ExP01DetectorConstruction.hh.

◆ fTrackerLength

G4double ExP01DetectorConstruction::fTrackerLength
private

Definition at line 98 of file ExP01DetectorConstruction.hh.

◆ fNbOfChambers

G4int ExP01DetectorConstruction::fNbOfChambers
private

Definition at line 99 of file ExP01DetectorConstruction.hh.

◆ fChamberWidth

G4double ExP01DetectorConstruction::fChamberWidth
private

Definition at line 100 of file ExP01DetectorConstruction.hh.

◆ fChamberSpacing

G4double ExP01DetectorConstruction::fChamberSpacing
private

Definition at line 101 of file ExP01DetectorConstruction.hh.


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

Applications | User Support | Publications | Collaboration