Geant4-11
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
ExN03DetectorConstruction Class Reference

#include <ExN03DetectorConstruction.hh>

Inheritance diagram for ExN03DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

virtual void CloneF ()
 
virtual void CloneSD ()
 
G4VPhysicalVolumeConstruct ()
 
G4int ConstructParallelGeometries ()
 
void ConstructParallelSD ()
 
virtual void ConstructSDandField ()
 
 ExN03DetectorConstruction ()
 
const G4VPhysicalVolumeGetAbsorber ()
 
G4MaterialGetAbsorberMaterial ()
 
G4double GetAbsorberThickness ()
 
G4double GetCalorSizeYZ ()
 
G4double GetCalorThickness ()
 
const G4VPhysicalVolumeGetGap ()
 
G4MaterialGetGapMaterial ()
 
G4double GetGapThickness ()
 
G4int GetNbOfLayers ()
 
G4int GetNumberOfParallelWorld () const
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 
const G4VPhysicalVolumeGetphysiWorld ()
 
G4double GetWorldSizeX ()
 
G4double GetWorldSizeYZ ()
 
void PrintCalorParameters ()
 
void RegisterParallelWorld (G4VUserParallelWorld *)
 
void SetAbsorberMaterial (G4String)
 
void SetAbsorberThickness (G4double)
 
void SetCalorSizeYZ (G4double)
 
void SetGapMaterial (G4String)
 
void SetGapThickness (G4double)
 
void SetMagField (G4double)
 
void SetNbOfLayers (G4int)
 
void UpdateGeometry ()
 
 ~ExN03DetectorConstruction ()
 

Protected Member Functions

void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 

Private Member Functions

void ComputeCalorParameters ()
 
G4VPhysicalVolumeConstructCalorimeter ()
 
void DefineMaterials ()
 

Private Attributes

G4MaterialAbsorberMaterial
 
G4double AbsorberThickness
 
G4double CalorSizeYZ
 
G4double CalorThickness
 
G4MaterialdefaultMaterial
 
ExN03DetectorMessengerdetectorMessenger
 
G4MaterialGapMaterial
 
G4double GapThickness
 
G4double LayerThickness
 
G4LogicalVolumelogicAbsorber
 
G4LogicalVolumelogicCalor
 
G4LogicalVolumelogicGap
 
G4LogicalVolumelogicLayer
 
G4LogicalVolumelogicWorld
 
G4UniformMagFieldmagField
 
G4int NbOfLayers
 
std::vector< G4VUserParallelWorld * > parallelWorld
 
G4VPhysicalVolumephysiAbsorber
 
G4VPhysicalVolumephysiCalor
 
G4VPhysicalVolumephysiGap
 
G4VPhysicalVolumephysiLayer
 
G4VPhysicalVolumephysiWorld
 
G4BoxsolidAbsorber
 
G4BoxsolidCalor
 
G4BoxsolidGap
 
G4BoxsolidLayer
 
G4BoxsolidWorld
 
G4double WorldSizeX
 
G4double WorldSizeYZ
 

Detailed Description

Definition at line 48 of file ExN03DetectorConstruction.hh.

Constructor & Destructor Documentation

◆ ExN03DetectorConstruction()

ExN03DetectorConstruction::ExN03DetectorConstruction ( )

Definition at line 55 of file ExN03DetectorConstruction.cc.

61 solidGap (0),logicGap (0),physiGap (0),
62 magField(0)
63{
64 // default parameter values of the calorimeter
66 GapThickness = 5.*mm;
67 NbOfLayers = 10;
68 CalorSizeYZ = 10.*cm;
70
71 // materials
73 SetAbsorberMaterial("Lead");
74 SetGapMaterial("liquidArgon");
75
76 // create commands for interactive definition of the calorimeter
78}
static constexpr double mm
Definition: G4SIunits.hh:95
static constexpr double cm
Definition: G4SIunits.hh:99
ExN03DetectorMessenger * detectorMessenger

References AbsorberThickness, CalorSizeYZ, cm, ComputeCalorParameters(), DefineMaterials(), detectorMessenger, GapThickness, mm, NbOfLayers, SetAbsorberMaterial(), and SetGapMaterial().

◆ ~ExN03DetectorConstruction()

ExN03DetectorConstruction::~ExN03DetectorConstruction ( )

Definition at line 82 of file ExN03DetectorConstruction.cc.

83{ delete detectorMessenger;}

References detectorMessenger.

Member Function Documentation

◆ CloneF()

void G4VUserDetectorConstruction::CloneF ( )
virtualinherited

Definition at line 126 of file G4VUserDetectorConstruction.cc.

127{
128 using FMtoFMmap = std::map<G4FieldManager*, G4FieldManager*>;
129 using FMpair = std::pair<G4FieldManager*, G4FieldManager*>;
130
131 FMtoFMmap masterToWorker;
133 for(auto it = logVolStore->cbegin(); it != logVolStore->cend(); ++it)
134 {
135 G4LogicalVolume* g4LogicalVolume = *it;
136 // Use shadow of master to get instance of FM
137 G4FieldManager* masterFM = nullptr; // g4LogicalVolume->fFieldManager;
138 G4FieldManager* clonedFM = nullptr;
139 if(masterFM != nullptr)
140 {
141 auto fmFound = masterToWorker.find(masterFM);
142 if(fmFound == masterToWorker.cend())
143 {
144 // First time we see this SD, let's clone and remember...
145 try
146 {
147 auto insertedEl =
148 masterToWorker.insert(FMpair(masterFM, masterFM->Clone()));
149 clonedFM = (insertedEl.first)->second;
150 } catch(...)
151 {
153 msg << "Cloning of G4FieldManager failed."
154 << " But derived class does not implement cloning. Cannot "
155 "continue.";
156 G4Exception("G4VUserDetectorConstruction::CloneSD()", "Run0053",
157 FatalException, msg);
158 }
159 }
160 else
161 {
162 // We have already seen this SD attached to a different LogicalVolume,
163 // let's re-use previous clone
164 clonedFM = (*fmFound).second;
165 }
166 } // masterFM != 0
167 // Note that we do not push FM to daughters (false argument), however, since
168 // we area looping on all logical volumes and we implemented the "trick" of
169 // the map master<->cloned the final effect is the same as using here the
170 // correct Boolean flag: log-volumes that originally were sharing the same
171 // FM they will have cloned ones
172 g4LogicalVolume->SetFieldManager(clonedFM, false);
173 }
174}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static constexpr double second
Definition: G4SIunits.hh:137
virtual G4FieldManager * Clone() const
static G4LogicalVolumeStore * GetInstance()
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters)

References G4FieldManager::Clone(), FatalException, G4Exception(), G4LogicalVolumeStore::GetInstance(), second, and G4LogicalVolume::SetFieldManager().

◆ CloneSD()

void G4VUserDetectorConstruction::CloneSD ( )
virtualinherited

Definition at line 177 of file G4VUserDetectorConstruction.cc.

178{
179 // Loop on ALL logial volumes to search for attached SD
181
182 using SDtoSDmap = std::map<G4VSensitiveDetector*, G4VSensitiveDetector*>;
183 using SDpair = std::pair<G4VSensitiveDetector*, G4VSensitiveDetector*>;
184 SDtoSDmap masterToWorker;
185
186 for(auto it = logVolStore->cbegin(); it != logVolStore->cend(); ++it)
187 {
188 G4LogicalVolume* g4LogicalVolume = *it;
189 // Use shadow of master to get the instance of SD
190 G4VSensitiveDetector* masterSD = nullptr;
191 G4VSensitiveDetector* clonedSD = nullptr;
192 if(masterSD != nullptr)
193 {
194 auto sdFound = masterToWorker.find(masterSD);
195 if(sdFound == masterToWorker.cend())
196 {
197 // First time we see this SD, let's clone and remember...
198 try
199 {
200 auto insertedEl =
201 masterToWorker.insert(SDpair(masterSD, masterSD->Clone()));
202 clonedSD = (insertedEl.first)->second;
203 } catch(...)
204 {
206 msg << "Cloning of G4VSensitiveDetector requested for:"
207 << masterSD->GetName() << "\n"
208#ifndef WIN32
209 << " (full path name: " << masterSD->GetFullPathName() << ").\n"
210#endif
211 << " But derived class does not implement cloning. Cannot "
212 "continue.";
213 G4Exception("G4VUserDetectorConstruction::CloneSD()", "Run0053",
214 FatalException, msg);
215 }
216 }
217 else
218 {
219 // We have already seen this SD attached to a different LogicalVolume,
220 // let's re-use previous clone
221 clonedSD = (*sdFound).second;
222 }
223 } // masterSD!=0
224 g4LogicalVolume->SetSensitiveDetector(clonedSD);
225 }
226}
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
virtual G4VSensitiveDetector * Clone() const
G4String GetFullPathName() const

References G4VSensitiveDetector::Clone(), FatalException, G4Exception(), G4VSensitiveDetector::GetFullPathName(), G4LogicalVolumeStore::GetInstance(), G4VSensitiveDetector::GetName(), second, and G4LogicalVolume::SetSensitiveDetector().

◆ ComputeCalorParameters()

void ExN03DetectorConstruction::ComputeCalorParameters ( )
inlineprivate

◆ Construct()

G4VPhysicalVolume * ExN03DetectorConstruction::Construct ( )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 87 of file ExN03DetectorConstruction.cc.

88{
89 return ConstructCalorimeter();
90}
G4VPhysicalVolume * ConstructCalorimeter()

References ConstructCalorimeter().

◆ ConstructCalorimeter()

G4VPhysicalVolume * ExN03DetectorConstruction::ConstructCalorimeter ( )
private

Definition at line 217 of file ExN03DetectorConstruction.cc.

218{
219
220 // Clean old geometry, if any
221 //
226
227 // complete the Calor parameters definition
229
230 //
231 // World
232 //
233 solidWorld = new G4Box("World", //its name
234 WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2); //its size
235
236 logicWorld = new G4LogicalVolume(solidWorld, //its solid
237 defaultMaterial, //its material
238 "World"); //its name
239
240 physiWorld = new G4PVPlacement(0, //no rotation
241 G4ThreeVector(), //at (0,0,0)
242 logicWorld, //its logical volume
243 "World", //its name
244 0, //its mother volume
245 false, //no boolean operation
246 0); //copy number
247
248 //
249 // Calorimeter
250 //
253
254 if (CalorThickness > 0.)
255 { solidCalor = new G4Box("Calorimeter", //its name
257
258 logicCalor = new G4LogicalVolume(solidCalor, //its solid
259 defaultMaterial, //its material
260 "Calorimeter"); //its name
261
262 physiCalor = new G4PVPlacement(0, //no rotation
263 G4ThreeVector(), //at (0,0,0)
264 logicCalor, //its logical volume
265 "Calorimeter", //its name
266 logicWorld, //its mother volume
267 false, //no boolean operation
268 0); //copy number
269
270 //
271 // Layer
272 //
273 solidLayer = new G4Box("Layer", //its name
275
276 logicLayer = new G4LogicalVolume(solidLayer, //its solid
277 defaultMaterial, //its material
278 "Layer"); //its name
279 if (NbOfLayers > 1)
280 physiLayer = new G4PVReplica("Layer", //its name
281 logicLayer, //its logical volume
282 logicCalor, //its mother
283 kXAxis, //axis of replication
284 NbOfLayers, //number of replica
285 LayerThickness); //witdth of replica
286 else
287 physiLayer = new G4PVPlacement(0, //no rotation
288 G4ThreeVector(), //at (0,0,0)
289 logicLayer, //its logical volume
290 "Layer", //its name
291 logicCalor, //its mother volume
292 false, //no boolean operation
293 0); //copy number
294 }
295
296 //
297 // Absorber
298 //
300
301 if (AbsorberThickness > 0.)
302 { solidAbsorber = new G4Box("Absorber", //its name
304
306 AbsorberMaterial, //its material
307 AbsorberMaterial->GetName()); //name
308
309 physiAbsorber = new G4PVPlacement(0, //no rotation
310 G4ThreeVector(-GapThickness/2,0.,0.), //its position
311 logicAbsorber, //its logical volume
312 AbsorberMaterial->GetName(), //its name
313 logicLayer, //its mother
314 false, //no boulean operat
315 0); //copy number
316
317 }
318
319 //
320 // Gap
321 //
322 solidGap=0; logicGap=0; physiGap=0;
323
324 if (GapThickness > 0.)
325 { solidGap = new G4Box("Gap",
327
331
332 physiGap = new G4PVPlacement(0, //no rotation
333 G4ThreeVector(AbsorberThickness/2,0.,0.), //its position
334 logicGap, //its logical volume
335 GapMaterial->GetName(), //its name
336 logicLayer, //its mother
337 false, //no boulean operat
338 0); //copy number
339 }
340
342
343 //
344 // Visualization attributes
345 //
347
348 G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
349 simpleBoxVisAtt->SetVisibility(true);
350 logicCalor->SetVisAttributes(simpleBoxVisAtt);
351
352 /*
353 // Below are vis attributes that permits someone to test / play
354 // with the interactive expansion / contraction geometry system of the
355 // vis/OpenInventor driver :
356 {G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,0.0));
357 simpleBoxVisAtt->SetVisibility(true);
358 delete logicCalor->GetVisAttributes();
359 logicCalor->SetVisAttributes(simpleBoxVisAtt);}
360
361 {G4VisAttributes* atb= new G4VisAttributes(G4Colour(1.0,0.0,0.0));
362 logicLayer->SetVisAttributes(atb);}
363
364 {G4VisAttributes* atb= new G4VisAttributes(G4Colour(0.0,1.0,0.0));
365 atb->SetForceSolid(true);
366 logicAbsorber->SetVisAttributes(atb);}
367
368 {//Set opacity = 0.2 then transparency = 1 - 0.2 = 0.8
369 G4VisAttributes* atb= new G4VisAttributes(G4Colour(0.0,0.0,1.0,0.2));
370 atb->SetForceSolid(true);
371 logicGap->SetVisAttributes(atb);}
372 */
373
374 //
375 //always return the physical World
376 //
377 return physiWorld;
378}
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:56
static G4GeometryManager * GetInstance()
void OpenGeometry(G4VPhysicalVolume *vol=nullptr)
void SetVisAttributes(const G4VisAttributes *pVA)
const G4String & GetName() const
Definition: G4Material.hh:173
static G4PhysicalVolumeStore * GetInstance()
static void Clean()
Definition: G4SolidStore.cc:74
static G4SolidStore * GetInstance()
void SetVisibility(G4bool=true)
static const G4VisAttributes & GetInvisible()
@ kXAxis
Definition: geomdefs.hh:55

References AbsorberMaterial, AbsorberThickness, CalorSizeYZ, CalorThickness, G4LogicalVolumeStore::Clean(), G4PhysicalVolumeStore::Clean(), G4SolidStore::Clean(), ComputeCalorParameters(), defaultMaterial, GapMaterial, GapThickness, G4GeometryManager::GetInstance(), G4LogicalVolumeStore::GetInstance(), G4PhysicalVolumeStore::GetInstance(), G4SolidStore::GetInstance(), G4VisAttributes::GetInvisible(), G4Material::GetName(), kXAxis, LayerThickness, logicAbsorber, logicCalor, logicGap, logicLayer, logicWorld, NbOfLayers, G4GeometryManager::OpenGeometry(), physiAbsorber, physiCalor, physiGap, physiLayer, physiWorld, PrintCalorParameters(), G4LogicalVolume::SetVisAttributes(), G4VisAttributes::SetVisibility(), solidAbsorber, solidCalor, solidGap, solidLayer, solidWorld, WorldSizeX, and WorldSizeYZ.

Referenced by Construct(), and UpdateGeometry().

◆ ConstructParallelGeometries()

G4int G4VUserDetectorConstruction::ConstructParallelGeometries ( )
inherited

Definition at line 73 of file G4VUserDetectorConstruction.cc.

74{
75 G4int nP = 0;
76 for(auto pwItr = parallelWorld.cbegin();
77 pwItr != parallelWorld.cend(); ++pwItr)
78 {
79 (*pwItr)->Construct();
80 ++nP;
81 }
82 return nP;
83}
int G4int
Definition: G4Types.hh:85
std::vector< G4VUserParallelWorld * > parallelWorld

References G4VUserDetectorConstruction::parallelWorld.

Referenced by G4RunManager::InitializeGeometry().

◆ ConstructParallelSD()

void G4VUserDetectorConstruction::ConstructParallelSD ( )
inherited

Definition at line 86 of file G4VUserDetectorConstruction.cc.

87{
88 for(auto pwItr = parallelWorld.cbegin();
89 pwItr != parallelWorld.cend(); ++pwItr)
90 {
91 (*pwItr)->ConstructSD();
92 }
93}

References G4VUserDetectorConstruction::parallelWorld.

Referenced by G4RunManager::InitializeGeometry(), and G4WorkerRunManager::InitializeGeometry().

◆ ConstructSDandField()

void G4VUserDetectorConstruction::ConstructSDandField ( )
virtualinherited

Definition at line 111 of file G4VUserDetectorConstruction.cc.

112{
113 // G4RunManager::RMType rmtype =
114 // G4RunManager::GetRunManager()->GetRunManagerType(); if(rmtype !=
115 // G4RunManager::sequentialRM)
116 // {
117 // G4cout
118 // << "User-derived detector construction class does not implement \n"
119 // << "ConstructSDandFiled method: workers will not have SD and fields!\n"
120 // << "The user can safely ignore this message if (s)he has no sensitive\n"
121 // << "detector or field in her/his application." << G4endl;
122 // }
123}

Referenced by G4RunManager::InitializeGeometry(), and G4WorkerRunManager::InitializeGeometry().

◆ DefineMaterials()

void ExN03DetectorConstruction::DefineMaterials ( )
private

Definition at line 94 of file ExN03DetectorConstruction.cc.

95{
96 //This function illustrates the possible ways to define materials
97
98G4String symbol; //a=mass of a mole;
99G4double a, z, density; //z=mean number of protons;
100G4int iz, n; //iz=number of protons in an isotope;
101 // n=number of nucleons in an isotope;
102
103G4int ncomponents, natoms;
104G4double abundance, fractionmass;
105
106//
107// define Elements
108//
109
110G4Element* H = new G4Element("Hydrogen",symbol="H" , z= 1., a= 1.01*g/mole);
111G4Element* C = new G4Element("Carbon" ,symbol="C" , z= 6., a= 12.01*g/mole);
112G4Element* N = new G4Element("Nitrogen",symbol="N" , z= 7., a= 14.01*g/mole);
113G4Element* O = new G4Element("Oxygen" ,symbol="O" , z= 8., a= 16.00*g/mole);
114G4Element* Si = new G4Element("Silicon",symbol="Si" , z= 14., a= 28.09*g/mole);
115
116//
117// define an Element from isotopes, by relative abundance
118//
119
120G4Isotope* U5 = new G4Isotope("U235", iz=92, n=235, a=235.01*g/mole);
121G4Isotope* U8 = new G4Isotope("U238", iz=92, n=238, a=238.03*g/mole);
122
123G4Element* U = new G4Element("enriched Uranium",symbol="U",ncomponents=2);
124U->AddIsotope(U5, abundance= 90.*perCent);
125U->AddIsotope(U8, abundance= 10.*perCent);
126
127//
128// define simple materials
129//
130
131new G4Material("Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3);
132new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
133new G4Material("Lead" , z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
134
135//
136// define a material from elements. case 1: chemical molecule
137//
138
139G4Material* H2O =
140new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
141H2O->AddElement(H, natoms=2);
142H2O->AddElement(O, natoms=1);
143// overwrite computed meanExcitationEnergy with ICRU recommended value
145
146G4Material* Sci =
147new G4Material("Scintillator", density= 1.032*g/cm3, ncomponents=2);
148Sci->AddElement(C, natoms=9);
149Sci->AddElement(H, natoms=10);
150
151G4Material* Myl =
152new G4Material("Mylar", density= 1.397*g/cm3, ncomponents=3);
153Myl->AddElement(C, natoms=10);
154Myl->AddElement(H, natoms= 8);
155Myl->AddElement(O, natoms= 4);
156
157G4Material* SiO2 =
158new G4Material("quartz",density= 2.200*g/cm3, ncomponents=2);
159SiO2->AddElement(Si, natoms=1);
160SiO2->AddElement(O , natoms=2);
161
162//
163// define a material from elements. case 2: mixture by fractional mass
164//
165
166G4Material* Air =
167new G4Material("Air" , density= 1.290*mg/cm3, ncomponents=2);
168Air->AddElement(N, fractionmass=0.7);
169Air->AddElement(O, fractionmass=0.3);
170
171//
172// define a material from elements and/or others materials (mixture of mixtures)
173//
174
175G4Material* Aerog =
176new G4Material("Aerogel", density= 0.200*g/cm3, ncomponents=3);
177Aerog->AddMaterial(SiO2, fractionmass=62.5*perCent);
178Aerog->AddMaterial(H2O , fractionmass=37.4*perCent);
179Aerog->AddElement (C , fractionmass= 0.1*perCent);
180
181//
182// examples of gas in non STP conditions
183//
184
185G4Material* CO2 =
186new G4Material("CarbonicGas", density= 27.*mg/cm3, ncomponents=2,
187 kStateGas, 325.*kelvin, 50.*atmosphere);
188CO2->AddElement(C, natoms=1);
189CO2->AddElement(O, natoms=2);
190
191G4Material* steam =
192new G4Material("WaterSteam", density= 0.3*mg/cm3, ncomponents=1,
193 kStateGas, 500.*kelvin, 2.*atmosphere);
194steam->AddMaterial(H2O, fractionmass=1.);
195
196//
197// examples of vacuum
198//
199
200G4Material* Vacuum =
201new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
202 kStateGas, 2.73*kelvin, 3.e-18*pascal);
203
204G4Material* beam =
205new G4Material("Beam", density= 1.e-5*g/cm3, ncomponents=1,
207beam->AddMaterial(Air, fractionmass=1.);
208
210
211//default materials of the World
212defaultMaterial = Vacuum;
213}
G4double C(G4double temp)
@ kStateGas
Definition: G4Material.hh:111
static constexpr double kelvin
Definition: G4SIunits.hh:274
static constexpr double perCent
Definition: G4SIunits.hh:325
static constexpr double mole
Definition: G4SIunits.hh:279
static constexpr double cm3
Definition: G4SIunits.hh:101
static constexpr double atmosphere
Definition: G4SIunits.hh:225
static constexpr double eV
Definition: G4SIunits.hh:201
static constexpr double g
Definition: G4SIunits.hh:168
static constexpr double mg
Definition: G4SIunits.hh:169
static constexpr double bar
Definition: G4SIunits.hh:224
double G4double
Definition: G4Types.hh:83
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define pascal
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
Definition: G4Element.cc:151
void SetMeanExcitationEnergy(G4double value)
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:222
void AddElement(G4Element *elm, G4int nAtoms)
Definition: G4Material.hh:157
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:672
void AddMaterial(G4Material *material, G4double fraction)
Definition: G4Material.cc:496
int universe_mean_density
Definition: hepunit.py:306
float STP_Temperature
Definition: hepunit.py:301

References G4Material::AddElement(), G4Element::AddIsotope(), G4Material::AddMaterial(), atmosphere, bar, C(), cm3, defaultMaterial, eV, g, G4cout, G4endl, G4Material::GetIonisation(), G4Material::GetMaterialTable(), kelvin, kStateGas, mg, mole, CLHEP::detail::n, pascal, perCent, G4IonisParamMat::SetMeanExcitationEnergy(), source.hepunit::STP_Temperature, and source.hepunit::universe_mean_density.

Referenced by ExN03DetectorConstruction().

◆ GetAbsorber()

const G4VPhysicalVolume * ExN03DetectorConstruction::GetAbsorber ( )
inline

Definition at line 91 of file ExN03DetectorConstruction.hh.

91{return physiAbsorber;};

References physiAbsorber.

◆ GetAbsorberMaterial()

G4Material * ExN03DetectorConstruction::GetAbsorberMaterial ( )
inline

Definition at line 84 of file ExN03DetectorConstruction.hh.

84{return AbsorberMaterial;};

References AbsorberMaterial.

◆ GetAbsorberThickness()

G4double ExN03DetectorConstruction::GetAbsorberThickness ( )
inline

Definition at line 85 of file ExN03DetectorConstruction.hh.

85{return AbsorberThickness;};

References AbsorberThickness.

◆ GetCalorSizeYZ()

G4double ExN03DetectorConstruction::GetCalorSizeYZ ( )
inline

Definition at line 80 of file ExN03DetectorConstruction.hh.

80{return CalorSizeYZ;};

References CalorSizeYZ.

◆ GetCalorThickness()

G4double ExN03DetectorConstruction::GetCalorThickness ( )
inline

Definition at line 79 of file ExN03DetectorConstruction.hh.

79{return CalorThickness;};

References CalorThickness.

◆ GetGap()

const G4VPhysicalVolume * ExN03DetectorConstruction::GetGap ( )
inline

Definition at line 92 of file ExN03DetectorConstruction.hh.

92{return physiGap;};

References physiGap.

◆ GetGapMaterial()

G4Material * ExN03DetectorConstruction::GetGapMaterial ( )
inline

Definition at line 87 of file ExN03DetectorConstruction.hh.

87{return GapMaterial;};

References GapMaterial.

◆ GetGapThickness()

G4double ExN03DetectorConstruction::GetGapThickness ( )
inline

Definition at line 88 of file ExN03DetectorConstruction.hh.

88{return GapThickness;};

References GapThickness.

◆ GetNbOfLayers()

G4int ExN03DetectorConstruction::GetNbOfLayers ( )
inline

Definition at line 82 of file ExN03DetectorConstruction.hh.

82{return NbOfLayers;};

References NbOfLayers.

◆ GetNumberOfParallelWorld()

G4int G4VUserDetectorConstruction::GetNumberOfParallelWorld ( ) const
inherited

◆ GetParallelWorld()

G4VUserParallelWorld * G4VUserDetectorConstruction::GetParallelWorld ( G4int  i) const
inherited

Definition at line 103 of file G4VUserDetectorConstruction.cc.

104{
105 if(i < 0 || i >= GetNumberOfParallelWorld())
106 return nullptr;
107 return parallelWorld[i];
108}

References G4VUserDetectorConstruction::GetNumberOfParallelWorld(), and G4VUserDetectorConstruction::parallelWorld.

◆ GetphysiWorld()

const G4VPhysicalVolume * ExN03DetectorConstruction::GetphysiWorld ( )
inline

Definition at line 90 of file ExN03DetectorConstruction.hh.

90{return physiWorld;};

References physiWorld.

◆ GetWorldSizeX()

G4double ExN03DetectorConstruction::GetWorldSizeX ( )
inline

Definition at line 76 of file ExN03DetectorConstruction.hh.

76{return WorldSizeX;};

References WorldSizeX.

◆ GetWorldSizeYZ()

G4double ExN03DetectorConstruction::GetWorldSizeYZ ( )
inline

Definition at line 77 of file ExN03DetectorConstruction.hh.

77{return WorldSizeYZ;};

References WorldSizeYZ.

◆ PrintCalorParameters()

void ExN03DetectorConstruction::PrintCalorParameters ( )

Definition at line 382 of file ExN03DetectorConstruction.cc.

383{
384 G4cout << "\n------------------------------------------------------------"
385 << "\n---> The calorimeter is " << NbOfLayers << " layers of: [ "
386 << AbsorberThickness/mm << "mm of " << AbsorberMaterial->GetName()
387 << " + "
388 << GapThickness/mm << "mm of " << GapMaterial->GetName() << " ] "
389 << "\n------------------------------------------------------------\n";
390}

References AbsorberMaterial, AbsorberThickness, G4cout, GapMaterial, GapThickness, G4Material::GetName(), mm, and NbOfLayers.

Referenced by ConstructCalorimeter().

◆ RegisterParallelWorld()

void G4VUserDetectorConstruction::RegisterParallelWorld ( G4VUserParallelWorld aPW)
inherited

Definition at line 57 of file G4VUserDetectorConstruction.cc.

59{
60 auto pwItr = std::find(parallelWorld.cbegin(), parallelWorld.cend(), aPW);
61 if (pwItr != parallelWorld.cend())
62 {
63 G4String eM = "A parallel world <";
64 eM += aPW->GetName();
65 eM += "> is already registered to the user detector construction.";
66 G4Exception("G4VUserDetectorConstruction::RegisterParallelWorld",
67 "Run0051", FatalErrorInArgument, eM);
68 }
69 parallelWorld.push_back(aPW);
70}
@ FatalErrorInArgument
const G4String & GetName()

References FatalErrorInArgument, G4Exception(), G4VUserParallelWorld::GetName(), and G4VUserDetectorConstruction::parallelWorld.

◆ SetAbsorberMaterial()

void ExN03DetectorConstruction::SetAbsorberMaterial ( G4String  materialChoice)

Definition at line 394 of file ExN03DetectorConstruction.cc.

395{
396 // search the material by its name
397 G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
398 if (pttoMaterial) AbsorberMaterial = pttoMaterial;
399}
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:686

References AbsorberMaterial, and G4Material::GetMaterial().

Referenced by ExN03DetectorConstruction(), and ExN03DetectorMessenger::SetNewValue().

◆ SetAbsorberThickness()

void ExN03DetectorConstruction::SetAbsorberThickness ( G4double  val)

Definition at line 412 of file ExN03DetectorConstruction.cc.

413{
414 // change Absorber thickness and recompute the calorimeter parameters
415 AbsorberThickness = val;
416}

References AbsorberThickness.

Referenced by ExN03DetectorMessenger::SetNewValue().

◆ SetCalorSizeYZ()

void ExN03DetectorConstruction::SetCalorSizeYZ ( G4double  val)

Definition at line 428 of file ExN03DetectorConstruction.cc.

429{
430 // change the transverse size and recompute the calorimeter parameters
431 CalorSizeYZ = val;
432}

References CalorSizeYZ.

Referenced by ExN03DetectorMessenger::SetNewValue().

◆ SetGapMaterial()

void ExN03DetectorConstruction::SetGapMaterial ( G4String  materialChoice)

Definition at line 403 of file ExN03DetectorConstruction.cc.

404{
405 // search the material by its name
406 G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
407 if (pttoMaterial) GapMaterial = pttoMaterial;
408}

References GapMaterial, and G4Material::GetMaterial().

Referenced by ExN03DetectorConstruction(), and ExN03DetectorMessenger::SetNewValue().

◆ SetGapThickness()

void ExN03DetectorConstruction::SetGapThickness ( G4double  val)

Definition at line 420 of file ExN03DetectorConstruction.cc.

421{
422 // change Gap thickness and recompute the calorimeter parameters
423 GapThickness = val;
424}

References GapThickness.

Referenced by ExN03DetectorMessenger::SetNewValue().

◆ SetMagField()

void ExN03DetectorConstruction::SetMagField ( G4double  fieldValue)

Definition at line 446 of file ExN03DetectorConstruction.cc.

447{
448 //apply a global uniform magnetic field along Z axis
449 G4FieldManager* fieldMgr
451
452 if(magField) delete magField; //delete the existing magn field
453
454 if(fieldValue!=0.) // create a new one if non nul
455 { magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
456 fieldMgr->SetDetectorField(magField);
457 fieldMgr->CreateChordFinder(magField);
458 } else {
459 magField = 0;
460 fieldMgr->SetDetectorField(magField);
461 }
462}
G4bool SetDetectorField(G4Field *detectorField, G4int failMode=0)
void CreateChordFinder(G4MagneticField *detectorMagField)
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const

References G4FieldManager::CreateChordFinder(), G4TransportationManager::GetFieldManager(), G4TransportationManager::GetTransportationManager(), magField, and G4FieldManager::SetDetectorField().

Referenced by ExN03DetectorMessenger::SetNewValue().

◆ SetNbOfLayers()

void ExN03DetectorConstruction::SetNbOfLayers ( G4int  val)

Definition at line 436 of file ExN03DetectorConstruction.cc.

437{
438 NbOfLayers = val;
439}

References NbOfLayers.

Referenced by ExN03DetectorMessenger::SetNewValue().

◆ SetSensitiveDetector() [1/2]

void G4VUserDetectorConstruction::SetSensitiveDetector ( const G4String logVolName,
G4VSensitiveDetector aSD,
G4bool  multi = false 
)
protectedinherited

Definition at line 229 of file G4VUserDetectorConstruction.cc.

232{
233 G4bool found = false;
235 auto volmap = store->GetMap();
236 auto pos = volmap.find(logVolName);
237 if(pos != volmap.cend())
238 {
239 if ((pos->second.size()>1) && !multi)
240 {
241 G4String eM = "More than one logical volumes of name <";
242 eM += pos->first;
243 eM += "> are found and thus the sensitive detector <";
244 eM += aSD->GetName();
245 eM += "> cannot be uniquely assigned.";
246 G4Exception("G4VUserDetectorConstruction::SetSensitiveDetector()",
247 "Run0052", FatalErrorInArgument, eM);
248 }
249 found = true;
250 for (std::size_t i = 0; i < pos->second.size(); ++i)
251 {
252 SetSensitiveDetector(pos->second[i], aSD);
253 }
254 }
255 if(!found)
256 {
257 G4String eM2 = "No logical volume of name <";
258 eM2 += logVolName;
259 eM2 += "> is found. The specified sensitive detector <";
260 eM2 += aSD->GetName();
261 eM2 += "> couldn't be assigned to any volume.";
262 G4Exception("G4VUserDetectorConstruction::SetSensitiveDetector()",
263 "Run0053", FatalErrorInArgument, eM2);
264 }
265}
static const G4double pos
bool G4bool
Definition: G4Types.hh:86
const std::map< G4String, std::vector< G4LogicalVolume * > > & GetMap() const
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)

References FatalErrorInArgument, G4Exception(), G4LogicalVolumeStore::GetInstance(), G4LogicalVolumeStore::GetMap(), G4VSensitiveDetector::GetName(), pos, and G4VUserDetectorConstruction::SetSensitiveDetector().

Referenced by MyDetectorConstruction::SetSDtoScoreVoxel(), and G4VUserDetectorConstruction::SetSensitiveDetector().

◆ SetSensitiveDetector() [2/2]

void G4VUserDetectorConstruction::SetSensitiveDetector ( G4LogicalVolume logVol,
G4VSensitiveDetector aSD 
)
protectedinherited

Definition at line 268 of file G4VUserDetectorConstruction.cc.

270{
271 assert(logVol != nullptr && aSD != nullptr);
272
273 // The aSD has already been added by user to the manager if needed
274 // G4SDManager::GetSDMpointer()->AddNewDetector(aSD);
275
276 // New Logic: allow for "multiple" SDs being attached to a single LV.
277 // To do that we use a special proxy SD called G4MultiSensitiveDetector
278
279 // Get existing SD if already set and check if it is of the special type
280 G4VSensitiveDetector* originalSD = logVol->GetSensitiveDetector();
281 if(originalSD == aSD)
282 {
284 msg << "Attempting to add multiple times the same sensitive detector (\"";
285 msg << originalSD->GetName() << "\") is not allowed, skipping.";
286 G4Exception("G4VUserDetectorConstruction::SetSensitiveDetector", "Run0054",
287 JustWarning, msg);
288 return;
289 }
290 if(originalSD == nullptr)
291 {
292 logVol->SetSensitiveDetector(aSD);
293 }
294 else
295 {
297 dynamic_cast<G4MultiSensitiveDetector*>(originalSD);
298 if(msd != nullptr)
299 {
300 msd->AddSD(aSD);
301 }
302 else
303 {
304 std::ostringstream mn;
305 mn << "/MultiSD_" << logVol->GetName() << "_" << logVol;
306 const G4String msdname = mn.str();
307 msd = new G4MultiSensitiveDetector(msdname);
308 // We need to register the proxy to have correct handling of IDs
310 msd->AddSD(originalSD);
311 msd->AddSD(aSD);
312 logVol->SetSensitiveDetector(msd);
313 }
314 }
315}
@ JustWarning
G4VSensitiveDetector * GetSensitiveDetector() const
const G4String & GetName() const
void AddSD(G4VSensitiveDetector *sd)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:38
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:70

References G4SDManager::AddNewDetector(), G4MultiSensitiveDetector::AddSD(), G4Exception(), G4VSensitiveDetector::GetName(), G4LogicalVolume::GetName(), G4SDManager::GetSDMpointer(), G4LogicalVolume::GetSensitiveDetector(), JustWarning, and G4LogicalVolume::SetSensitiveDetector().

◆ UpdateGeometry()

void ExN03DetectorConstruction::UpdateGeometry ( )

Definition at line 468 of file ExN03DetectorConstruction.cc.

469{
471}
static G4RunManager * GetRunManager()
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)

References ConstructCalorimeter(), G4RunManager::DefineWorldVolume(), and G4RunManager::GetRunManager().

Referenced by ExN03DetectorMessenger::SetNewValue().

Field Documentation

◆ AbsorberMaterial

G4Material* ExN03DetectorConstruction::AbsorberMaterial
private

◆ AbsorberThickness

G4double ExN03DetectorConstruction::AbsorberThickness
private

◆ CalorSizeYZ

G4double ExN03DetectorConstruction::CalorSizeYZ
private

◆ CalorThickness

G4double ExN03DetectorConstruction::CalorThickness
private

◆ defaultMaterial

G4Material* ExN03DetectorConstruction::defaultMaterial
private

Definition at line 108 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter(), and DefineMaterials().

◆ detectorMessenger

ExN03DetectorMessenger* ExN03DetectorConstruction::detectorMessenger
private

◆ GapMaterial

G4Material* ExN03DetectorConstruction::GapMaterial
private

◆ GapThickness

G4double ExN03DetectorConstruction::GapThickness
private

◆ LayerThickness

G4double ExN03DetectorConstruction::LayerThickness
private

Definition at line 103 of file ExN03DetectorConstruction.hh.

Referenced by ComputeCalorParameters(), and ConstructCalorimeter().

◆ logicAbsorber

G4LogicalVolume* ExN03DetectorConstruction::logicAbsorber
private

Definition at line 125 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ logicCalor

G4LogicalVolume* ExN03DetectorConstruction::logicCalor
private

Definition at line 117 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ logicGap

G4LogicalVolume* ExN03DetectorConstruction::logicGap
private

Definition at line 129 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ logicLayer

G4LogicalVolume* ExN03DetectorConstruction::logicLayer
private

Definition at line 121 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ logicWorld

G4LogicalVolume* ExN03DetectorConstruction::logicWorld
private

Definition at line 113 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ magField

G4UniformMagField* ExN03DetectorConstruction::magField
private

Definition at line 132 of file ExN03DetectorConstruction.hh.

Referenced by SetMagField().

◆ NbOfLayers

G4int ExN03DetectorConstruction::NbOfLayers
private

◆ parallelWorld

std::vector<G4VUserParallelWorld*> G4VUserDetectorConstruction::parallelWorld
privateinherited

◆ physiAbsorber

G4VPhysicalVolume* ExN03DetectorConstruction::physiAbsorber
private

Definition at line 126 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter(), and GetAbsorber().

◆ physiCalor

G4VPhysicalVolume* ExN03DetectorConstruction::physiCalor
private

Definition at line 118 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ physiGap

G4VPhysicalVolume* ExN03DetectorConstruction::physiGap
private

Definition at line 130 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter(), and GetGap().

◆ physiLayer

G4VPhysicalVolume* ExN03DetectorConstruction::physiLayer
private

Definition at line 122 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ physiWorld

G4VPhysicalVolume* ExN03DetectorConstruction::physiWorld
private

Definition at line 114 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter(), and GetphysiWorld().

◆ solidAbsorber

G4Box* ExN03DetectorConstruction::solidAbsorber
private

Definition at line 124 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ solidCalor

G4Box* ExN03DetectorConstruction::solidCalor
private

Definition at line 116 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ solidGap

G4Box* ExN03DetectorConstruction::solidGap
private

Definition at line 128 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ solidLayer

G4Box* ExN03DetectorConstruction::solidLayer
private

Definition at line 120 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ solidWorld

G4Box* ExN03DetectorConstruction::solidWorld
private

Definition at line 112 of file ExN03DetectorConstruction.hh.

Referenced by ConstructCalorimeter().

◆ WorldSizeX

G4double ExN03DetectorConstruction::WorldSizeX
private

◆ WorldSizeYZ

G4double ExN03DetectorConstruction::WorldSizeYZ
private

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