Geant4  10.02.p03
B2bDetectorConstruction Class Reference

#include <B2bDetectorConstruction.hh>

Inheritance diagram for B2bDetectorConstruction:
Collaboration diagram for B2bDetectorConstruction:

Public Member Functions

 B2bDetectorConstruction ()
 
virtual ~B2bDetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
virtual void ConstructSDandField ()
 
void SetTargetMaterial (G4String)
 
void SetChamberMaterial (G4String)
 
void SetMaxStep (G4double)
 
void SetCheckOverlaps (G4bool)
 
 B2bDetectorConstruction ()
 
virtual ~B2bDetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
virtual void ConstructSDandField ()
 
void SetTargetMaterial (G4String)
 
void SetChamberMaterial (G4String)
 
void SetMaxStep (G4double)
 
void SetCheckOverlaps (G4bool)
 
- Public Member Functions inherited from G4VUserDetectorConstruction
 G4VUserDetectorConstruction ()
 
virtual ~G4VUserDetectorConstruction ()
 
virtual void CloneSD ()
 
virtual void CloneF ()
 
void RegisterParallelWorld (G4VUserParallelWorld *)
 
G4int ConstructParallelGeometries ()
 
void ConstructParallelSD ()
 
G4int GetNumberOfParallelWorld () const
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 

Private Member Functions

void DefineMaterials ()
 
G4VPhysicalVolumeDefineVolumes ()
 
void DefineMaterials ()
 
G4VPhysicalVolumeDefineVolumes ()
 

Private Attributes

G4LogicalVolumefLogicTarget
 
G4LogicalVolumefLogicChamber
 
G4MaterialfTargetMaterial
 
G4MaterialfChamberMaterial
 
G4UserLimitsfStepLimit
 
B2bDetectorMessengerfMessenger
 
G4bool fCheckOverlaps
 

Static Private Attributes

static G4ThreadLocal G4GlobalMagFieldMessengerfMagFieldMessenger = 0
 

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 class to define materials, geometry and global uniform magnetic field.

Definition at line 49 of file basic/B2/B2b/include/B2bDetectorConstruction.hh.

Constructor & Destructor Documentation

◆ B2bDetectorConstruction() [1/2]

◆ ~B2bDetectorConstruction() [1/2]

B2bDetectorConstruction::~B2bDetectorConstruction ( )
virtual

◆ B2bDetectorConstruction() [2/2]

B2bDetectorConstruction::B2bDetectorConstruction ( )

◆ ~B2bDetectorConstruction() [2/2]

virtual B2bDetectorConstruction::~B2bDetectorConstruction ( )
virtual

Member Function Documentation

◆ Construct() [1/2]

G4VPhysicalVolume * B2bDetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 82 of file basic/B2/B2b/src/B2bDetectorConstruction.cc.

83 {
84  // Define materials
86 
87  // Define volumes
88  return DefineVolumes();
89 }
Here is the call graph for this function:

◆ Construct() [2/2]

virtual G4VPhysicalVolume* B2bDetectorConstruction::Construct ( )
virtual

◆ ConstructSDandField() [1/2]

void B2bDetectorConstruction::ConstructSDandField ( )
virtual

Reimplemented from G4VUserDetectorConstruction.

Definition at line 279 of file basic/B2/B2b/src/B2bDetectorConstruction.cc.

280 {
281  // Sensitive detectors
282 
283  G4String trackerChamberSDname = "B2/TrackerChamberSD";
284  B2TrackerSD* aTrackerSD = new B2TrackerSD(trackerChamberSDname,
285  "TrackerHitsCollection");
286  SetSensitiveDetector( fLogicChamber, aTrackerSD );
287 
288  // Create global magnetic field messenger.
289  // Uniform magnetic field is then created automatically if
290  // the field value is not zero.
291  G4ThreeVector fieldValue = G4ThreeVector();
294 
295  // Register the field messenger for deleting
297 }
void SetVerboseLevel(G4int verboseLevel)
CLHEP::Hep3Vector G4ThreeVector
void Register(T *inst)
Definition: G4AutoDelete.hh:65
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
static G4ThreadLocal G4GlobalMagFieldMessenger * fMagFieldMessenger
Here is the call graph for this function:

◆ ConstructSDandField() [2/2]

virtual void B2bDetectorConstruction::ConstructSDandField ( )
virtual

Reimplemented from G4VUserDetectorConstruction.

◆ DefineMaterials() [1/2]

void B2bDetectorConstruction::DefineMaterials ( )
private

Definition at line 93 of file basic/B2/B2b/src/B2bDetectorConstruction.cc.

94 {
95  // Material definition
96 
97  G4NistManager* nistManager = G4NistManager::Instance();
98 
99  // Air defined using NIST Manager
100  nistManager->FindOrBuildMaterial("G4_AIR");
101 
102  // Lead defined using NIST Manager
103  fTargetMaterial = nistManager->FindOrBuildMaterial("G4_Pb");
104 
105  // Xenon gas defined using NIST Manager
106  fChamberMaterial = nistManager->FindOrBuildMaterial("G4_Xe");
107 
108  // Print materials
110 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
static G4NistManager * Instance()
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DefineMaterials() [2/2]

void B2bDetectorConstruction::DefineMaterials ( )
private

◆ DefineVolumes() [1/2]

G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes ( )
private

◆ DefineVolumes() [2/2]

G4VPhysicalVolume * B2bDetectorConstruction::DefineVolumes ( )
private

Set additional contraints on the track, with G4UserSpecialCuts

G4double maxLength = 2*trackerLength, maxTime = 0.1*ns, minEkin = 10*MeV; trackerLV->SetUserLimits(new G4UserLimits(maxStep, maxLength, maxTime, minEkin));

Definition at line 114 of file basic/B2/B2b/src/B2bDetectorConstruction.cc.

115 {
116  G4Material* air = G4Material::GetMaterial("G4_AIR");
117 
118  // Sizes of the principal geometrical components (solids)
119 
120  G4int NbOfChambers = 5;
121  G4double chamberSpacing = 80*cm; // from chamber center to center!
122 
123  G4double chamberWidth = 20.0*cm; // width of the chambers
124  G4double targetLength = 5.0*cm; // full length of Target
125 
126  G4double trackerLength = (NbOfChambers+1)*chamberSpacing;
127 
128  G4double worldLength = 1.2 * (2*targetLength + trackerLength);
129 
130  G4double targetRadius = 0.5*targetLength; // Radius of Target
131  targetLength = 0.5*targetLength; // Half length of the Target
132  G4double trackerSize = 0.5*trackerLength; // Half length of the Tracker
133 
134  // Definitions of Solids, Logical Volumes, Physical Volumes
135 
136  // World
137 
139 
140  G4cout << "Computed tolerance = "
142  << " mm" << G4endl;
143 
144  G4Box* worldS
145  = new G4Box("world", //its name
146  worldLength/2,worldLength/2,worldLength/2); //its size
147  G4LogicalVolume* worldLV
148  = new G4LogicalVolume(
149  worldS, //its solid
150  air, //its material
151  "World"); //its name
152 
153  // Must place the World Physical volume unrotated at (0,0,0).
154  //
155  G4VPhysicalVolume* worldPV
156  = new G4PVPlacement(
157  0, // no rotation
158  G4ThreeVector(), // at (0,0,0)
159  worldLV, // its logical volume
160  "World", // its name
161  0, // its mother volume
162  false, // no boolean operations
163  0, // copy number
164  fCheckOverlaps); // checking overlaps
165 
166  // Target
167 
168  G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetLength+trackerSize));
169 
170  G4Tubs* targetS
171  = new G4Tubs("target",0.,targetRadius,targetLength,0.*deg,360.*deg);
173  = new G4LogicalVolume(targetS, fTargetMaterial,"Target",0,0,0);
174  new G4PVPlacement(0, // no rotation
175  positionTarget, // at (x,y,z)
176  fLogicTarget, // its logical volume
177  "Target", // its name
178  worldLV, // its mother volume
179  false, // no boolean operations
180  0, // copy number
181  fCheckOverlaps); // checking overlaps
182 
183  G4cout << "Target is " << 2*targetLength/cm << " cm of "
184  << fTargetMaterial->GetName() << G4endl;
185 
186  // Tracker
187 
188  G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
189 
190  G4Tubs* trackerS
191  = new G4Tubs("tracker",0,trackerSize,trackerSize, 0.*deg, 360.*deg);
192  G4LogicalVolume* trackerLV
193  = new G4LogicalVolume(trackerS, air, "Tracker",0,0,0);
194  new G4PVPlacement(0, // no rotation
195  positionTracker, // at (x,y,z)
196  trackerLV, // its logical volume
197  "Tracker", // its name
198  worldLV, // its mother volume
199  false, // no boolean operations
200  0, // copy number
201  fCheckOverlaps); // checking overlaps
202 
203  // Tracker segments
204 
205  // An example of Parameterised volumes
206  // Dummy values for G4Tubs -- modified by parameterised volume
207 
208  G4Tubs* chamberS
209  = new G4Tubs("tracker",0, 100*cm, 100*cm, 0.*deg, 360.*deg);
211  = new G4LogicalVolume(chamberS,fChamberMaterial,"Chamber",0,0,0);
212 
213  G4double firstPosition = -trackerSize + chamberSpacing;
214  G4double firstLength = trackerLength/10;
215  G4double lastLength = trackerLength;
216 
217  G4VPVParameterisation* chamberParam =
219  NbOfChambers, // NoChambers
220  firstPosition, // Z of center of first
221  chamberSpacing, // Z spacing of centers
222  chamberWidth, // chamber width
223  firstLength, // initial length
224  lastLength); // final length
225 
226  // dummy value : kZAxis -- modified by parameterised volume
227 
228  new G4PVParameterised("Chamber", // their name
229  fLogicChamber, // their logical volume
230  trackerLV, // Mother logical volume
231  kZAxis, // Are placed along this axis
232  NbOfChambers, // Number of chambers
233  chamberParam, // The parametrisation
234  fCheckOverlaps); // checking overlaps
235 
236  G4cout << "There are " << NbOfChambers << " chambers in the tracker region. "
237  << G4endl
238  << "The chambers are " << chamberWidth/cm << " cm of "
239  << fChamberMaterial->GetName() << G4endl
240  << "The distance between chamber is " << chamberSpacing/cm << " cm"
241  << G4endl;
242 
243  // Visualization attributes
244 
245  G4VisAttributes* boxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
246  worldLV ->SetVisAttributes(boxVisAtt);
247  fLogicTarget ->SetVisAttributes(boxVisAtt);
248  trackerLV ->SetVisAttributes(boxVisAtt);
249 
250  G4VisAttributes* chamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
251  fLogicChamber->SetVisAttributes(chamberVisAtt);
252 
253  // Example of User Limits
254  //
255  // Below is an example of how to set tracking constraints in a given
256  // logical volume
257  //
258  // Sets a max step length in the tracker region, with G4StepLimiter
259 
260  G4double maxStep = 0.5*chamberWidth;
261  fStepLimit = new G4UserLimits(maxStep);
262  trackerLV->SetUserLimits(fStepLimit);
263 
271 
272  // Always return the physical world
273 
274  return worldPV;
275 }
static const double cm
Definition: G4SIunits.hh:118
CLHEP::Hep3Vector G4ThreeVector
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:604
Definition: G4Box.hh:64
void SetUserLimits(G4UserLimits *pULimits)
Definition: G4Tubs.hh:85
G4double GetSurfaceTolerance() const
void SetWorldMaximumExtent(G4double worldExtent)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static const double deg
Definition: G4SIunits.hh:151
static G4GeometryManager * GetInstance()
#define G4endl
Definition: G4ios.hh:61
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)
static G4GeometryTolerance * GetInstance()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetChamberMaterial() [1/2]

void B2bDetectorConstruction::SetChamberMaterial ( G4String  materialName)

Definition at line 326 of file basic/B2/B2b/src/B2bDetectorConstruction.cc.

327 {
328  G4NistManager* nistManager = G4NistManager::Instance();
329 
330  G4Material* pttoMaterial =
331  nistManager->FindOrBuildMaterial(materialName);
332 
333  if (fChamberMaterial != pttoMaterial) {
334  if ( pttoMaterial ) {
335  fChamberMaterial = pttoMaterial;
337  G4cout
338  << G4endl
339  << "----> The chambers are made of " << materialName << G4endl;
340  } else {
341  G4cout
342  << G4endl
343  << "--> WARNING from SetChamberMaterial : "
344  << materialName << " not found" << G4endl;
345  }
346  }
347 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4NistManager * Instance()
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:

◆ SetChamberMaterial() [2/2]

void B2bDetectorConstruction::SetChamberMaterial ( G4String  )

◆ SetCheckOverlaps() [1/2]

void B2bDetectorConstruction::SetCheckOverlaps ( G4bool  )

◆ SetCheckOverlaps() [2/2]

void B2bDetectorConstruction::SetCheckOverlaps ( G4bool  )

◆ SetMaxStep() [1/2]

void B2bDetectorConstruction::SetMaxStep ( G4double  maxStep)

Definition at line 351 of file basic/B2/B2b/src/B2bDetectorConstruction.cc.

352 {
353  if ((fStepLimit)&&(maxStep>0.)) fStepLimit->SetMaxAllowedStep(maxStep);
354 }
virtual void SetMaxAllowedStep(G4double ustepMax)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetMaxStep() [2/2]

void B2bDetectorConstruction::SetMaxStep ( G4double  )

◆ SetTargetMaterial() [1/2]

void B2bDetectorConstruction::SetTargetMaterial ( G4String  materialName)

Definition at line 301 of file basic/B2/B2b/src/B2bDetectorConstruction.cc.

302 {
303  G4NistManager* nistManager = G4NistManager::Instance();
304 
305  G4Material* pttoMaterial =
306  nistManager->FindOrBuildMaterial(materialName);
307 
308  if (fTargetMaterial != pttoMaterial) {
309  if ( pttoMaterial ) {
310  fTargetMaterial = pttoMaterial;
312  G4cout
313  << G4endl
314  << "----> The target is made of " << materialName << G4endl;
315  } else {
316  G4cout
317  << G4endl
318  << "--> WARNING from SetTargetMaterial : "
319  << materialName << " not found" << G4endl;
320  }
321  }
322 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4NistManager * Instance()
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:

◆ SetTargetMaterial() [2/2]

void B2bDetectorConstruction::SetTargetMaterial ( G4String  )

Member Data Documentation

◆ fChamberMaterial

G4Material * B2bDetectorConstruction::fChamberMaterial
private

◆ fCheckOverlaps

G4bool B2bDetectorConstruction::fCheckOverlaps
private

◆ fLogicChamber

G4LogicalVolume * B2bDetectorConstruction::fLogicChamber
private

◆ fLogicTarget

G4LogicalVolume * B2bDetectorConstruction::fLogicTarget
private

◆ fMagFieldMessenger

G4ThreadLocal G4GlobalMagFieldMessenger * B2bDetectorConstruction::fMagFieldMessenger = 0
staticprivate

◆ fMessenger

B2bDetectorMessenger * B2bDetectorConstruction::fMessenger
private

◆ fStepLimit

G4UserLimits * B2bDetectorConstruction::fStepLimit
private

◆ fTargetMaterial

G4Material * B2bDetectorConstruction::fTargetMaterial
private

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