Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -23,14 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: B2aDetectorConstruction.cc 77603 2013-11-26 17:11:49Z gcosmo $
|
||||
//
|
||||
/// \file B2aDetectorConstruction.cc
|
||||
/// \brief Implementation of the B2aDetectorConstruction class
|
||||
|
||||
#include "B2aDetectorConstruction.hh"
|
||||
#include "B2aDetectorMessenger.hh"
|
||||
#include "B2MagneticField.hh"
|
||||
#include "B2TrackerSD.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
@@ -40,8 +39,8 @@
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4GlobalMagFieldMessenger.hh"
|
||||
#include "G4AutoDelete.hh"
|
||||
|
||||
#include "G4GeometryTolerance.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
@@ -53,12 +52,13 @@
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* B2aDetectorConstruction::fMagFieldMessenger = 0;
|
||||
|
||||
B2aDetectorConstruction::B2aDetectorConstruction()
|
||||
:
|
||||
:G4VUserDetectorConstruction(),
|
||||
fNbOfChambers(0),
|
||||
fLogicTarget(NULL), fLogicChamber(NULL),
|
||||
fTargetMaterial(NULL), fChamberMaterial(NULL),
|
||||
@@ -66,7 +66,6 @@ B2aDetectorConstruction::B2aDetectorConstruction()
|
||||
fCheckOverlaps(true)
|
||||
{
|
||||
fMessenger = new B2aDetectorMessenger(this);
|
||||
fMagField = new B2MagneticField();
|
||||
|
||||
fNbOfChambers = 5;
|
||||
fLogicChamber = new G4LogicalVolume*[fNbOfChambers];
|
||||
@@ -77,7 +76,6 @@ B2aDetectorConstruction::B2aDetectorConstruction()
|
||||
B2aDetectorConstruction::~B2aDetectorConstruction()
|
||||
{
|
||||
delete [] fLogicChamber;
|
||||
delete fMagField;
|
||||
delete fStepLimit;
|
||||
delete fMessenger;
|
||||
}
|
||||
@@ -101,16 +99,14 @@ void B2aDetectorConstruction::DefineMaterials()
|
||||
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
|
||||
G4bool fromIsotopes = false;
|
||||
|
||||
// Air defined using NIST Manager
|
||||
nistManager->FindOrBuildMaterial("G4_AIR", fromIsotopes);
|
||||
nistManager->FindOrBuildMaterial("G4_AIR");
|
||||
|
||||
// Lead defined using NIST Manager
|
||||
fTargetMaterial = nistManager->FindOrBuildMaterial("G4_Pb", fromIsotopes);
|
||||
fTargetMaterial = nistManager->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
// Xenon gas defined using NIST Manager
|
||||
fChamberMaterial = nistManager->FindOrBuildMaterial("G4_Xe", fromIsotopes);
|
||||
fChamberMaterial = nistManager->FindOrBuildMaterial("G4_Xe");
|
||||
|
||||
// Print materials
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
@@ -215,13 +211,6 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
|
||||
fLogicTarget ->SetVisAttributes(boxVisAtt);
|
||||
trackerLV ->SetVisAttributes(boxVisAtt);
|
||||
|
||||
// Sensitive detectors
|
||||
|
||||
G4String trackerChamberSDname = "B2/TrackerChamberSD";
|
||||
B2TrackerSD* aTrackerSD = new B2TrackerSD(trackerChamberSDname,
|
||||
"TrackerHitsCollection");
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector( aTrackerSD );
|
||||
|
||||
// Tracker segments
|
||||
|
||||
G4cout << "There are " << fNbOfChambers << " chambers in the tracker region. "
|
||||
@@ -252,18 +241,17 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
|
||||
G4double rmax = rmaxFirst + copyNo * rmaxIncr;
|
||||
|
||||
G4Tubs* chamberS
|
||||
= new G4Tubs("chamber", 0, rmax, halfWidth, 0.*deg, 360.*deg);
|
||||
= new G4Tubs("Chamber_solid", 0, rmax, halfWidth, 0.*deg, 360.*deg);
|
||||
|
||||
fLogicChamber[copyNo] =
|
||||
new G4LogicalVolume(chamberS,fChamberMaterial,"Chamber",0,0,0);
|
||||
new G4LogicalVolume(chamberS,fChamberMaterial,"Chamber_LV",0,0,0);
|
||||
|
||||
fLogicChamber[copyNo]->SetSensitiveDetector( aTrackerSD );
|
||||
fLogicChamber[copyNo]->SetVisAttributes(chamberVisAtt);
|
||||
|
||||
new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(0,0,Zposition), // at (x,y,z)
|
||||
fLogicChamber[copyNo], // its logical volume
|
||||
"Chamber", // its name
|
||||
"Chamber_PV", // its name
|
||||
trackerLV, // its mother volume
|
||||
false, // no boolean operations
|
||||
copyNo, // copy number
|
||||
@@ -297,13 +285,36 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B2aDetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
// Sensitive detectors
|
||||
|
||||
G4String trackerChamberSDname = "B2/TrackerChamberSD";
|
||||
B2TrackerSD* aTrackerSD = new B2TrackerSD(trackerChamberSDname,
|
||||
"TrackerHitsCollection");
|
||||
// Setting aTrackerSD to all logical volumes with the same name
|
||||
// of "Chamber_LV".
|
||||
SetSensitiveDetector("Chamber_LV", aTrackerSD, true);
|
||||
|
||||
// Create global magnetic field messenger.
|
||||
// Uniform magnetic field is then created automatically if
|
||||
// the field value is not zero.
|
||||
G4ThreeVector fieldValue = G4ThreeVector();
|
||||
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
|
||||
fMagFieldMessenger->SetVerboseLevel(1);
|
||||
|
||||
// Register the field messenger for deleting
|
||||
G4AutoDelete::Register(fMagFieldMessenger);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B2aDetectorConstruction::SetTargetMaterial(G4String materialName)
|
||||
{
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
G4bool fromIsotopes = false;
|
||||
|
||||
G4Material* pttoMaterial =
|
||||
nistManager->FindOrBuildMaterial(materialName, fromIsotopes);
|
||||
nistManager->FindOrBuildMaterial(materialName);
|
||||
|
||||
if (fTargetMaterial != pttoMaterial) {
|
||||
if ( pttoMaterial ) {
|
||||
@@ -322,10 +333,9 @@ void B2aDetectorConstruction::SetTargetMaterial(G4String materialName)
|
||||
void B2aDetectorConstruction::SetChamberMaterial(G4String materialName)
|
||||
{
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
G4bool fromIsotopes = false;
|
||||
|
||||
G4Material* pttoMaterial =
|
||||
nistManager->FindOrBuildMaterial(materialName, fromIsotopes);
|
||||
nistManager->FindOrBuildMaterial(materialName);
|
||||
|
||||
if (fChamberMaterial != pttoMaterial) {
|
||||
if ( pttoMaterial ) {
|
||||
@@ -342,13 +352,6 @@ void B2aDetectorConstruction::SetChamberMaterial(G4String materialName)
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B2aDetectorConstruction::SetMagField(G4double fieldValue)
|
||||
{
|
||||
fMagField->SetMagFieldValue(fieldValue);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B2aDetectorConstruction::SetMaxStep(G4double maxStep)
|
||||
|
||||
Reference in New Issue
Block a user