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

Detector construction class to define materials, geometry and global uniform magnetic field. More...

#include <Doxymodules_parallel.h>

Inheritance diagram for B2bDetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 B2bDetectorConstruction ()
 
virtual ~B2bDetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
virtual void ConstructSDandField ()
 
void SetTargetMaterial (G4String)
 
void SetChamberMaterial (G4String)
 
void SetMaxStep (G4double)
 
void SetCheckOverlaps (G4bool)
 

Private Member Functions

void DefineMaterials ()
 
G4VPhysicalVolumeDefineVolumes ()
 

Private Attributes

G4LogicalVolumefLogicTarget
 
G4LogicalVolumefLogicChamber
 
G4MaterialfTargetMaterial
 
G4MaterialfChamberMaterial
 
G4UserLimitsfStepLimit
 
B2bDetectorMessengerfMessenger
 
G4bool fCheckOverlaps
 

Static Private Attributes

static G4ThreadLocal G4GlobalMagFieldMessengerfMagFieldMessenger = 0
 

Detailed Description

Detector construction class to define materials, geometry and global uniform magnetic field.

Definition at line 93 of file Doxymodules_parallel.h.

Constructor & Destructor Documentation

◆ B2bDetectorConstruction()

B2bDetectorConstruction::B2bDetectorConstruction ( )

Definition at line 63 of file B2bDetectorConstruction.cc.

65 fLogicTarget(NULL), fLogicChamber(NULL),
67 fStepLimit(NULL),
68 fCheckOverlaps(true)
69{
71}
B2bDetectorMessenger * fMessenger
Messenger class that defines commands for B2bDetectorConstruction.

◆ ~B2bDetectorConstruction()

B2bDetectorConstruction::~B2bDetectorConstruction ( )
virtual

Definition at line 75 of file B2bDetectorConstruction.cc.

76{
77 delete fStepLimit;
78 delete fMessenger;
79 delete fMagFieldMessenger;
81}
static G4ThreadLocal G4GlobalMagFieldMessenger * fMagFieldMessenger

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * B2bDetectorConstruction::Construct ( )
virtual

Definition at line 85 of file B2bDetectorConstruction.cc.

86{
87 // Define materials
89
90 // Define volumes
91 return DefineVolumes();
92}
G4VPhysicalVolume * DefineVolumes()

◆ ConstructSDandField()

void B2bDetectorConstruction::ConstructSDandField ( )
virtual

Definition at line 280 of file B2bDetectorConstruction.cc.

281{
282 // Sensitive detectors
283
284 G4String trackerChamberSDname = "B2/TrackerChamberSD";
285 B2TrackerSD* aTrackerSD = new B2TrackerSD(trackerChamberSDname,
286 "TrackerHitsCollection");
287 G4SDManager::GetSDMpointer()->AddNewDetector(aTrackerSD);
288 SetSensitiveDetector( fLogicChamber, aTrackerSD );
289
290 // Create global magnetic field messenger.
291 // Uniform magnetic field is then created automatically if
292 // the field value is not zero.
293 G4ThreeVector fieldValue = G4ThreeVector();
295 fMagFieldMessenger->SetVerboseLevel(1);
296}
B2Tracker sensitive detector class.

◆ SetTargetMaterial()

void B2bDetectorConstruction::SetTargetMaterial ( G4String  materialName)

Definition at line 300 of file B2bDetectorConstruction.cc.

301{
302 G4NistManager* nistManager = G4NistManager::Instance();
303
304 G4Material* pttoMaterial =
305 nistManager->FindOrBuildMaterial(materialName);
306
307 if (fTargetMaterial != pttoMaterial) {
308 if ( pttoMaterial ) {
309 fTargetMaterial = pttoMaterial;
310 if (fLogicTarget) fLogicTarget->SetMaterial(fTargetMaterial);
311 G4cout << "\n----> The target is made of " << materialName << G4endl;
312 } else {
313 G4cout << "\n--> WARNING from SetTargetMaterial : "
314 << materialName << " not found" << G4endl;
315 }
316 }
317}

◆ SetChamberMaterial()

void B2bDetectorConstruction::SetChamberMaterial ( G4String  materialName)

Definition at line 321 of file B2bDetectorConstruction.cc.

322{
323 G4NistManager* nistManager = G4NistManager::Instance();
324
325 G4Material* pttoMaterial =
326 nistManager->FindOrBuildMaterial(materialName);
327
328 if (fChamberMaterial != pttoMaterial) {
329 if ( pttoMaterial ) {
330 fChamberMaterial = pttoMaterial;
332 G4cout << "\n----> The chambers are made of " << materialName << G4endl;
333 } else {
334 G4cout << "\n--> WARNING from SetChamberMaterial : "
335 << materialName << " not found" << G4endl;
336 }
337 }
338}

◆ SetMaxStep()

void B2bDetectorConstruction::SetMaxStep ( G4double  maxStep)

Definition at line 342 of file B2bDetectorConstruction.cc.

343{
344 if ((fStepLimit)&&(maxStep>0.)) fStepLimit->SetMaxAllowedStep(maxStep);
345}

◆ SetCheckOverlaps()

void B2bDetectorConstruction::SetCheckOverlaps ( G4bool  )

◆ DefineMaterials()

void B2bDetectorConstruction::DefineMaterials ( )
private

Definition at line 96 of file B2bDetectorConstruction.cc.

97{
98 // Material definition
99
100 G4NistManager* nistManager = G4NistManager::Instance();
101
102 // Air defined using NIST Manager
103 nistManager->FindOrBuildMaterial("G4_AIR");
104
105 // Lead defined using NIST Manager
106 fTargetMaterial = nistManager->FindOrBuildMaterial("G4_Pb");
107
108 // Xenon gas defined using NIST Manager
109 fChamberMaterial = nistManager->FindOrBuildMaterial("G4_Xe");
110
111 // Print materials
112 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
113}

◆ DefineVolumes()

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 117 of file B2bDetectorConstruction.cc.

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

Member Data Documentation

◆ fLogicTarget

G4LogicalVolume* B2bDetectorConstruction::fLogicTarget
private

Definition at line 70 of file B2bDetectorConstruction.hh.

◆ fLogicChamber

G4LogicalVolume* B2bDetectorConstruction::fLogicChamber
private

Definition at line 71 of file B2bDetectorConstruction.hh.

◆ fTargetMaterial

G4Material* B2bDetectorConstruction::fTargetMaterial
private

Definition at line 73 of file B2bDetectorConstruction.hh.

◆ fChamberMaterial

G4Material* B2bDetectorConstruction::fChamberMaterial
private

Definition at line 74 of file B2bDetectorConstruction.hh.

◆ fStepLimit

G4UserLimits* B2bDetectorConstruction::fStepLimit
private

Definition at line 76 of file B2bDetectorConstruction.hh.

◆ fMessenger

B2bDetectorMessenger* B2bDetectorConstruction::fMessenger
private

Definition at line 78 of file B2bDetectorConstruction.hh.

◆ fMagFieldMessenger

G4ThreadLocal G4GlobalMagFieldMessenger * B2bDetectorConstruction::fMagFieldMessenger = 0
staticprivate

Definition at line 80 of file B2bDetectorConstruction.hh.

◆ fCheckOverlaps

G4bool B2bDetectorConstruction::fCheckOverlaps
private

Definition at line 83 of file B2bDetectorConstruction.hh.


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

Applications | User Support | Publications | Collaboration