Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
+2
View File
@@ -1,3 +1,5 @@
# $Id: CMakeLists.txt 68058 2013-03-13 14:47:43Z gcosmo $
#----------------------------------------------------------------------------
# Setup the project
#
+3 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 2000-10-19 12:22:10 stanaka Exp $
# $Id: GNUmakefile 68058 2013-03-13 14:47:43Z gcosmo $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
@@ -14,6 +14,8 @@ endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/binmake.gmk
visclean:
+14 -10
View File
@@ -29,15 +29,17 @@
/// \brief Main program of the B2b example
#include "B2bDetectorConstruction.hh"
#include "B2PrimaryGeneratorAction.hh"
#include "B2RunAction.hh"
#include "B2EventAction.hh"
#include "G4StepLimiterBuilder.hh"
#include "B2ActionInitialization.hh"
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "G4StepLimiterPhysics.hh"
#include "Randomize.hh"
@@ -55,25 +57,27 @@ int main(int argc,char** argv)
{
// Choose the Random engine
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
G4Random::setTheEngine(new CLHEP::RanecuEngine);
// Construct the default run manager
#ifdef G4MULTITHREADED
G4MTRunManager * runManager = new G4MTRunManager;
#else
G4RunManager * runManager = new G4RunManager;
#endif
// Set mandatory initialization classes
runManager->SetUserInitialization(new B2bDetectorConstruction());
G4VModularPhysicsList* physicsList = new FTFP_BERT;
physicsList->RegisterPhysics(new G4StepLimiterBuilder());
physicsList->RegisterPhysics(new G4StepLimiterPhysics());
runManager->SetUserInitialization(physicsList);
// Set user action classes
runManager->SetUserAction(new B2PrimaryGeneratorAction());
runManager->SetUserAction(new B2RunAction());
runManager->SetUserAction(new B2EventAction());
runManager->SetUserInitialization(new B2ActionInitialization());
// Initialize G4 kernel
File diff suppressed because it is too large Load Diff
+4 -5
View File
@@ -16,7 +16,6 @@
/gui/addMenu run Run
/gui/addButton run "beamOn 1" "/run/beamOn 1"
/gui/addButton run run1 "/control/execute run1.mac"
/gui/addButton run run2 "/control/execute run2.mac"
#
# Gun menu :
/gui/addMenu gun Gun
@@ -31,14 +30,14 @@
#
# Field menu :
/gui/addMenu field Field
/gui/addButton field "off" "/B2/det/setField 0.2 tesla"
/gui/addButton field "0.2 tesla" "/B2/det/setField 0.2 tesla"
/gui/addButton field "2.0 tesla" "/B2/det/setField 2.0 tesla"
/gui/addButton field "off" "/globalField/setValue 0 0 0 tesla"
/gui/addButton field "0.2 tesla" "/globalField/setValue 0.2 0 0 tesla"
/gui/addButton field "2.0 tesla" "/globalField/setValue 2.0 0 0 tesla"
#
# Viewer menu :
/gui/addMenu viewer Viewer
/gui/addButton viewer "Set style surface" "/vis/viewer/set/style surface"
/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wire"
/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wireframe"
/gui/addButton viewer "Refresh viewer" "/vis/viewer/refresh"
/gui/addButton viewer "Update viewer (interaction or end-of-file)" "/vis/viewer/update"
/gui/addButton viewer "Flush viewer (= refresh + update)" "/vis/viewer/flush"
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B2ActionInitialization.hh 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B2ActionInitialization.hh
/// \brief Definition of the B2ActionInitialization class
#ifndef B2ActionInitialization_h
#define B2ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
class B4DetectorConstruction;
/// Action initialization class.
///
class B2ActionInitialization : public G4VUserActionInitialization
{
public:
B2ActionInitialization();
virtual ~B2ActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
};
#endif
+1 -12
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2EventAction.hh 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2EventAction.hh
/// \brief Definition of the B2EventAction class
@@ -45,19 +45,8 @@ class B2EventAction : public G4UserEventAction
virtual void BeginOfEventAction(const G4Event* );
virtual void EndOfEventAction(const G4Event* );
// Set methods
void SetPrintModulo(G4int value);
private:
G4int fPrintModulo;
};
// inline functions
inline void B2EventAction::SetPrintModulo(G4int value) {
fPrintModulo = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2PrimaryGeneratorAction.hh 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2PrimaryGeneratorAction.hh
/// \brief Definition of the B2PrimaryGeneratorAction class
+1 -1
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2RunAction.hh 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2RunAction.hh
/// \brief Definition of the B2RunAction class
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2TrackerHit.hh 69505 2013-05-07 01:57:27Z asaim $
//
/// \file B2TrackerHit.hh
/// \brief Definition of the B2TrackerHit class
@@ -35,6 +35,7 @@
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "tls.hh"
/// Tracker hit class
///
@@ -84,22 +85,22 @@ class B2TrackerHit : public G4VHit
typedef G4THitsCollection<B2TrackerHit> B2TrackerHitsCollection;
extern G4Allocator<B2TrackerHit> B2TrackerHitAllocator;
extern G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void* B2TrackerHit::operator new(size_t)
{
void *hit;
hit = (void *) B2TrackerHitAllocator.MallocSingle();
return hit;
if(!B2TrackerHitAllocator)
B2TrackerHitAllocator = new G4Allocator<B2TrackerHit>;
return (void *) B2TrackerHitAllocator->MallocSingle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void B2TrackerHit::operator delete(void *hit)
{
B2TrackerHitAllocator.FreeSingle((B2TrackerHit*) hit);
B2TrackerHitAllocator->FreeSingle((B2TrackerHit*) hit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+4 -5
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2TrackerSD.hh 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2TrackerSD.hh
/// \brief Definition of the B2TrackerSD class
@@ -44,10 +44,9 @@ class G4HCofThisEvent;
/// B2Tracker sensitive detector class
///
/// In Initialize(), it creates one hit for each tracker volume
///
/// The values are accounted in hits in ProcessHits() function which is called
/// by Geant4 kernel at each step.
/// The hits are accounted in hits in ProcessHits() function which is called
/// by Geant4 kernel at each step. A hit is created with each step with non zero
/// energy deposit.
class B2TrackerSD : public G4VSensitiveDetector
{
@@ -43,6 +43,7 @@ class G4Trap;
class G4Cons;
class G4Orb;
class G4Sphere;
class G4Ellipsoid;
class G4Torus;
class G4Para;
class G4Hype;
@@ -76,17 +77,30 @@ class B2bChamberParameterisation : public G4VPVParameterisation
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions (G4Box&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Trd&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Trap&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Cons&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Sphere&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Orb&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Torus&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Para&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Hype&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polycone&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Box&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Trd&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Trap&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Cons&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Sphere&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Orb&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Ellipsoid&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Torus&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Para&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Hype&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polycone&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polyhedra&,const G4int,
const G4VPhysicalVolume*) const {}
private:
@@ -33,20 +33,18 @@
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "tls.hh"
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4Material;
class G4UserLimits;
class G4GlobalMagFieldMessenger;
class B2bDetectorMessenger;
class B2MagneticField;
/// Detector construction class to define materials and geometry.
///
/// In addition a transverse uniform magnetic field is defined in
/// SetMagField() method which can be activated via a command
/// defined in the B2bDetectorMessenger class.
/// Detector construction class to define materials, geometry
/// and global uniform magnetic field.
class B2bDetectorConstruction : public G4VUserDetectorConstruction
{
@@ -56,9 +54,9 @@ class B2bDetectorConstruction : public G4VUserDetectorConstruction
public:
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
// Set methods
void SetMagField(G4double );
void SetTargetMaterial (G4String );
void SetChamberMaterial(G4String );
void SetMaxStep (G4double );
@@ -76,10 +74,12 @@ class B2bDetectorConstruction : public G4VUserDetectorConstruction
G4Material* fTargetMaterial; // pointer to the target material
G4Material* fChamberMaterial; // pointer to the chamber material
G4UserLimits* fStepLimit; // pointer to user step limits
G4UserLimits* fStepLimit; // pointer to user step limits
B2bDetectorMessenger* fMessenger; // messenger
B2MagneticField* fMagField; // magnetic field
B2bDetectorMessenger* fMessenger; // detector messenger
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
G4bool fCheckOverlaps; // option to activate checking of volumes overlaps
};
@@ -46,7 +46,6 @@ class G4UIcmdWithADoubleAndUnit;
/// It implements commands:
/// - /B2/det/setTargetMaterial name
/// - /B2/det/setChamberMaterial name
/// - /B2/det/setField value unit
/// - /B2/det/stepMax value unit
class B2bDetectorMessenger: public G4UImessenger
@@ -66,7 +65,6 @@ class B2bDetectorMessenger: public G4UImessenger
G4UIcmdWithAString* fTargMatCmd;
G4UIcmdWithAString* fChamMatCmd;
G4UIcmdWithADoubleAndUnit* fSetFieldCmd;
G4UIcmdWithADoubleAndUnit* fStepMaxCmd;
};
+1 -1
View File
@@ -1,4 +1,4 @@
# Macro file for the initialization phase of "exampleN03.cc"
# Macro file for the initialization phase of example B2
# when running in interactive mode without visualization
#
# Set some default verbose
+1 -1
View File
@@ -1,4 +1,4 @@
# Macro file for the initialization phase of "exampleB2.cc"
# Macro file for the initialization phase of example B2
# when running in interactive mode with visualization
#
# Set some default verbose
+2 -1
View File
@@ -25,7 +25,8 @@
# set a magnetic field and max allowed step length
# 3 event with printing hits
#
/B2/det/setField 0.2 tesla
/globalField/verbose 1
/globalField/setValue 0.2 0 0 tesla
/B2/det/stepMax 1.0 mm
/gun/energy 0.3 GeV
/run/beamOn 3
@@ -23,39 +23,41 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2ActionInitialization.cc 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B2MagneticField.hh
/// \brief Definition of the B2MagneticField class
/// \file B2ActionInitialization.cc
/// \brief Implementation of the B2ActionInitialization class
#ifndef B2MagneticField_h
#define B2MagneticField_h 1
#include "G4UniformMagField.hh"
class G4FieldManager;
#include "B2ActionInitialization.hh"
#include "B2PrimaryGeneratorAction.hh"
#include "B2RunAction.hh"
#include "B2EventAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// A class for control of the Magnetic Field of the detector.
/// The field is assumed to be uniform.
class B2MagneticField : public G4UniformMagField
B2ActionInitialization::B2ActionInitialization()
: G4VUserActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2ActionInitialization::~B2ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2ActionInitialization::BuildForMaster() const
{
public:
B2MagneticField(); // A zero field
B2MagneticField(G4ThreeVector); // The value of the field
virtual ~B2MagneticField();
//Set the field (fieldValue,0,0)
void SetMagFieldValue(G4double fieldValue);
void SetMagFieldValue(G4ThreeVector fieldVector);
protected:
// Find the global Field Manager
G4FieldManager* GetGlobalFieldManager(); // static
};
SetUserAction(new B2RunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
void B2ActionInitialization::Build() const
{
SetUserAction(new B2PrimaryGeneratorAction);
SetUserAction(new B2RunAction);
SetUserAction(new B2EventAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+7 -18
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2EventAction.cc 69652 2013-05-10 09:05:11Z ihrivnac $
//
/// \file B2EventAction.cc
/// \brief Implementation of the B2EventAction class
@@ -39,8 +39,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2EventAction::B2EventAction()
: G4UserEventAction(),
fPrintModulo(1000)
: G4UserEventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -50,25 +49,13 @@ B2EventAction::~B2EventAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2EventAction::BeginOfEventAction(const G4Event* event)
{
G4int eventID = event->GetEventID();
if ( eventID % fPrintModulo == 0) {
G4cout << "\n---> Begin of event: " << eventID << G4endl;
//CLHEP::HepRandom::showEngineStatus();
}
}
void B2EventAction::BeginOfEventAction(const G4Event*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2EventAction::EndOfEventAction(const G4Event* event)
{
// print per event (modulo n)
G4int eventID = event->GetEventID();
if ( eventID % fPrintModulo == 0)
G4cout << "---> End of event: " << eventID << G4endl;
// get number of stored trajectories
G4TrajectoryContainer* trajectoryContainer = event->GetTrajectoryContainer();
@@ -77,6 +64,7 @@ void B2EventAction::EndOfEventAction(const G4Event* event)
// periodic printing
G4int eventID = event->GetEventID();
if ( eventID < 100 || eventID % 100 == 0) {
G4cout << ">>> Event: " << eventID << G4endl;
if ( trajectoryContainer ) {
@@ -84,7 +72,8 @@ void B2EventAction::EndOfEventAction(const G4Event* event)
<< " trajectories stored in this event." << G4endl;
}
G4VHitsCollection* hc = event->GetHCofThisEvent()->GetHC(0);
G4cout << " " << hc->GetSize() << " hits stored in this event" << G4endl;
G4cout << " "
<< hc->GetSize() << " hits stored in this event" << G4endl;
}
}
@@ -1,89 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file B2MagneticField.cc
/// \brief Implementation of the B2MagneticField class
#include "B2MagneticField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2MagneticField::B2MagneticField()
: G4UniformMagField(G4ThreeVector())
{
GetGlobalFieldManager()->SetDetectorField(NULL);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2MagneticField::B2MagneticField(G4ThreeVector fieldVector)
: G4UniformMagField(fieldVector)
{
GetGlobalFieldManager()->SetDetectorField(this);
GetGlobalFieldManager()->CreateChordFinder(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2MagneticField::~B2MagneticField()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Set the value of the Global Field to fieldValue along X
void B2MagneticField::SetMagFieldValue(G4double fieldValue)
{
SetMagFieldValue(G4ThreeVector(fieldValue,0,0));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Set the value of the Global Field
void B2MagneticField::SetMagFieldValue(G4ThreeVector fieldVector)
{
if( fieldVector != G4ThreeVector(0.,0.,0.) )
{
SetFieldValue(fieldVector);
GetGlobalFieldManager()->SetDetectorField(this);
GetGlobalFieldManager()->CreateChordFinder(this);
} else
GetGlobalFieldManager()->SetDetectorField(NULL);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4FieldManager* B2MagneticField::GetGlobalFieldManager()
{
return G4TransportationManager::GetTransportationManager()->GetFieldManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2PrimaryGeneratorAction.cc 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2PrimaryGeneratorAction.cc
/// \brief Implementation of the B2PrimaryGeneratorAction class
+6 -6
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2RunAction.cc 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2RunAction.cc
/// \brief Implementation of the B2RunAction class
@@ -37,7 +37,10 @@
B2RunAction::B2RunAction()
: G4UserRunAction()
{}
{
// set printing event number per each 100 events
G4RunManager::GetRunManager()->SetPrintProgress(1000);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -46,12 +49,9 @@ B2RunAction::~B2RunAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2RunAction::BeginOfRunAction(const G4Run* aRun)
void B2RunAction::BeginOfRunAction(const G4Run*)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
//inform the runManager to save random number seed
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
}
+2 -2
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2TrackerHit.cc 69505 2013-05-07 01:57:27Z asaim $
//
/// \file B2TrackerHit.cc
/// \brief Implementation of the B2TrackerHit class
@@ -37,7 +37,7 @@
#include <iomanip>
G4Allocator<B2TrackerHit> B2TrackerHitAllocator;
G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator=0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+1 -1
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B2TrackerSD.cc 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2TrackerSD.cc
/// \brief Implementation of the B2TrackerSD class
@@ -44,6 +44,7 @@ B2bChamberParameterisation::B2bChamberParameterisation(
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal )
: G4VPVParameterisation()
{
fNoChambers = noChambers;
fStartZ = startZ;
@@ -31,7 +31,6 @@
#include "B2bDetectorConstruction.hh"
#include "B2bDetectorMessenger.hh"
#include "B2bChamberParameterisation.hh"
#include "B2MagneticField.hh"
#include "B2TrackerSD.hh"
#include "G4Material.hh"
@@ -42,8 +41,8 @@
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "G4SDManager.hh"
#include "G4GlobalMagFieldMessenger.hh"
#include "G4AutoDelete.hh"
#include "G4GeometryTolerance.hh"
#include "G4GeometryManager.hh"
@@ -55,28 +54,27 @@
#include "G4SystemOfUnits.hh"
//#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* B2bDetectorConstruction::fMagFieldMessenger = 0;
B2bDetectorConstruction::B2bDetectorConstruction()
:
:G4VUserDetectorConstruction(),
fLogicTarget(NULL), fLogicChamber(NULL),
fTargetMaterial(NULL), fChamberMaterial(NULL),
fStepLimit(NULL),
fStepLimit(NULL),
fCheckOverlaps(true)
{
fMessenger = new B2bDetectorMessenger(this);
fMagField = new B2MagneticField();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2bDetectorConstruction::~B2bDetectorConstruction()
{
delete fMagField;
delete fStepLimit;
delete fMessenger;
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -98,16 +96,14 @@ void B2bDetectorConstruction::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;
@@ -242,14 +238,6 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
<< fChamberMaterial->GetName() << "\nThe distance between chamber is "
<< chamberSpacing/cm << " cm" << G4endl;
// Sensitive detectors
G4String trackerChamberSDname = "B2/TrackerChamberSD";
B2TrackerSD* aTrackerSD = new B2TrackerSD(trackerChamberSDname,
"TrackerHitsCollection");
G4SDManager::GetSDMpointer()->AddNewDetector( aTrackerSD );
fLogicChamber->SetSensitiveDetector( aTrackerSD );
// Visualization attributes
G4VisAttributes* boxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
@@ -286,13 +274,34 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::ConstructSDandField()
{
// Sensitive detectors
G4String trackerChamberSDname = "B2/TrackerChamberSD";
B2TrackerSD* aTrackerSD = new B2TrackerSD(trackerChamberSDname,
"TrackerHitsCollection");
SetSensitiveDetector( fLogicChamber, aTrackerSD );
// 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 B2bDetectorConstruction::SetTargetMaterial(G4String materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
G4bool fromIsotopes = false;
G4Material* pttoMaterial =
nistManager->FindOrBuildMaterial(materialName, fromIsotopes);
nistManager->FindOrBuildMaterial(materialName);
if (fTargetMaterial != pttoMaterial) {
if ( pttoMaterial ) {
@@ -311,10 +320,9 @@ void B2bDetectorConstruction::SetTargetMaterial(G4String materialName)
void B2bDetectorConstruction::SetChamberMaterial(G4String materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
G4bool fromIsotopes = false;
G4Material* pttoMaterial =
nistManager->FindOrBuildMaterial(materialName, fromIsotopes);
nistManager->FindOrBuildMaterial(materialName);
if (fChamberMaterial != pttoMaterial) {
if ( pttoMaterial ) {
@@ -330,13 +338,6 @@ void B2bDetectorConstruction::SetChamberMaterial(G4String materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::SetMagField(G4double fieldValue)
{
fMagField->SetMagFieldValue(fieldValue);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::SetMaxStep(G4double maxStep)
{
if ((fStepLimit)&&(maxStep>0.)) fStepLimit->SetMaxAllowedStep(maxStep);
@@ -57,13 +57,6 @@ B2bDetectorMessenger::B2bDetectorMessenger(B2bDetectorConstruction* Det)
fChamMatCmd->SetParameterName("choice",false);
fChamMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetFieldCmd = new G4UIcmdWithADoubleAndUnit("/B2/det/setField",this);
fSetFieldCmd->SetGuidance("Define magnetic field.");
fSetFieldCmd->SetGuidance("Magnetic field will be in X direction.");
fSetFieldCmd->SetParameterName("Bx",false);
fSetFieldCmd->SetUnitCategory("Magnetic flux density");
fSetFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/B2/det/stepMax",this);
fStepMaxCmd->SetGuidance("Define a step max");
fStepMaxCmd->SetParameterName("stepMax",false);
@@ -77,7 +70,6 @@ B2bDetectorMessenger::~B2bDetectorMessenger()
{
delete fTargMatCmd;
delete fChamMatCmd;
delete fSetFieldCmd;
delete fStepMaxCmd;
delete fB2Directory;
delete fDetDirectory;
@@ -93,11 +85,6 @@ void B2bDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
if( command == fChamMatCmd )
{ fDetectorConstruction->SetChamberMaterial(newValue);}
if( command == fSetFieldCmd ) {
fDetectorConstruction
->SetMagField(fSetFieldCmd->GetNewDoubleValue(newValue));
}
if( command == fStepMaxCmd ) {
fDetectorConstruction
->SetMaxStep(fStepMaxCmd->GetNewDoubleValue(newValue));