Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "eRositaActionInitialization.hh"
|
||||
#include "eRositaPrimaryGeneratorAction.hh"
|
||||
#include "eRositaEventAction.hh"
|
||||
#include "eRositaRunAction.hh"
|
||||
#include "eRositaSteppingAction.hh"
|
||||
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
|
||||
eRositaActionInitialization::eRositaActionInitialization() : G4VUserActionInitialization()
|
||||
{
|
||||
}
|
||||
|
||||
eRositaActionInitialization::~eRositaActionInitialization()
|
||||
{
|
||||
}
|
||||
|
||||
void eRositaActionInitialization::BuildForMaster() const
|
||||
{
|
||||
eRositaRunAction* runAction = new eRositaRunAction();
|
||||
SetUserAction(runAction);
|
||||
}
|
||||
|
||||
void eRositaActionInitialization::Build() const
|
||||
{
|
||||
eRositaPrimaryGeneratorAction* primaryGeneratorAction = new eRositaPrimaryGeneratorAction();
|
||||
SetUserAction(primaryGeneratorAction);
|
||||
|
||||
eRositaRunAction* runAction = new eRositaRunAction();
|
||||
SetUserAction(runAction);
|
||||
|
||||
//SetUserAction(new eRositaPrimaryGeneratorAction);
|
||||
//SetUserAction(new eRositaRunAction);
|
||||
SetUserAction(new eRositaEventAction);
|
||||
SetUserAction(new eRositaSteppingAction);
|
||||
}
|
||||
@@ -52,16 +52,13 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
eRositaDetectorConstruction::eRositaDetectorConstruction()
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
eRositaDetectorConstruction::~eRositaDetectorConstruction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -199,8 +196,6 @@ G4VPhysicalVolume* eRositaDetectorConstruction::Construct()
|
||||
0); // copy number
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
// Sensitive detectors
|
||||
//------------------------------------------------
|
||||
@@ -208,10 +203,9 @@ G4VPhysicalVolume* eRositaDetectorConstruction::Construct()
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
G4String trackerChamberSDname = "eRosita/TrackerChamberSD";
|
||||
eRositaTrackerSD* aTrackerSD = new eRositaTrackerSD( trackerChamberSDname );
|
||||
SDman->AddNewDetector( aTrackerSD );
|
||||
logicTracker->SetSensitiveDetector( aTrackerSD );
|
||||
|
||||
eRositaTrackerSD* aTrackerSD = new eRositaTrackerSD(trackerChamberSDname);
|
||||
SDman->AddNewDetector(aTrackerSD);
|
||||
logicTracker->SetSensitiveDetector(aTrackerSD);
|
||||
|
||||
//--------- Visualization attributes -------------------------------
|
||||
|
||||
@@ -237,6 +231,18 @@ G4VPhysicalVolume* eRositaDetectorConstruction::Construct()
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
void eRositaDetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
|
||||
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
G4String trackerChamberSDname = "eRosita/TrackerChamberSD";
|
||||
eRositaTrackerSD* aTrackerSD = new eRositaTrackerSD(trackerChamberSDname);
|
||||
SDman->AddNewDetector(aTrackerSD);
|
||||
logicTracker->SetSensitiveDetector(aTrackerSD);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
/*
|
||||
void eRositaDetectorConstruction::setTargetMaterial(G4String materialName)
|
||||
|
||||
@@ -36,13 +36,13 @@
|
||||
|
||||
|
||||
eRositaEventAction::eRositaEventAction()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eRositaEventAction::~eRositaEventAction()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void eRositaEventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int nEvent = evt->GetEventID() + 1;
|
||||
@@ -54,10 +54,9 @@ void eRositaEventAction::BeginOfEventAction(const G4Event* evt)
|
||||
|
||||
G4int remainder = nEvent % frequency;
|
||||
if (remainder == 0) G4cout << "---- eRosita event counter: " << nEvent
|
||||
<< std::endl;
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
void eRositaEventAction::EndOfEventAction(const G4Event*) // evt)
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -156,7 +156,7 @@ void eRositaPhysicsList::ConstructMesons()
|
||||
|
||||
void eRositaPhysicsList::ConstructBaryons()
|
||||
{
|
||||
// barions
|
||||
// baryons
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "eRositaPrimaryGeneratorAction.hh"
|
||||
#include "eRositaActionInitialization.hh"
|
||||
#include "eRositaDetectorConstruction.hh"
|
||||
#include "eRositaPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
@@ -40,8 +41,9 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
eRositaPrimaryGeneratorAction::eRositaPrimaryGeneratorAction()
|
||||
{
|
||||
eRositaPrimaryGeneratorAction::eRositaPrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction()
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
// G4int n_particle = 1000;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
@@ -49,16 +51,15 @@ eRositaPrimaryGeneratorAction::eRositaPrimaryGeneratorAction()
|
||||
// default particle
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("proton");
|
||||
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
xdirection = 0.0; // x component of initial momentum vector
|
||||
ydirection = -0.5; // y -"-
|
||||
zdirection = -1.0; // z -"-
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(xdirection,ydirection,zdirection));
|
||||
particleGun->SetParticleMomentumDirection(
|
||||
G4ThreeVector(xdirection,ydirection,zdirection));
|
||||
particleGun->SetParticleEnergy(100.0*MeV);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -77,7 +78,8 @@ void eRositaPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
yposition = 2.25*cm;
|
||||
zposition = 4.0*cm;
|
||||
|
||||
particleGun->SetParticlePosition(G4ThreeVector(xposition,yposition,zposition));
|
||||
particleGun->SetParticlePosition(
|
||||
G4ThreeVector(xposition,yposition,zposition));
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
@@ -33,41 +33,40 @@
|
||||
|
||||
|
||||
eRositaRunAction::eRositaRunAction()
|
||||
{}
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
eRositaRunAction::~eRositaRunAction()
|
||||
{}
|
||||
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
void eRositaRunAction::BeginOfRunAction(const G4Run* run)
|
||||
{
|
||||
timerRun.Start();
|
||||
|
||||
G4cout << "--- Run " << run->GetRunID() << " start." << G4endl;
|
||||
|
||||
AnalysisManager::Instance();
|
||||
timerRun.Start();
|
||||
|
||||
if (IsMaster()) {
|
||||
G4cout << "--- Run " << run->GetRunID() << " (master) start." << G4endl;
|
||||
AnalysisManager::Instance();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "--- Run " << run->GetRunID() << " (worker) start." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void eRositaRunAction::EndOfRunAction(const G4Run* run)
|
||||
{
|
||||
|
||||
AnalysisManager::Instance()->Destroy();
|
||||
|
||||
G4cout << "--- Run " << run->GetRunID()
|
||||
<< run -> GetRunID()
|
||||
<< " ends (Number of events = "
|
||||
<< run -> GetNumberOfEvent() << ")."
|
||||
<< G4endl;
|
||||
|
||||
timerRun.Stop();
|
||||
std::cout << " " << timerRun << std::endl;
|
||||
{
|
||||
if (IsMaster()) {
|
||||
G4cout << "--- Run " << run->GetRunID() << " (master) end."
|
||||
<< "Event total count = " << run->GetNumberOfEvent() << "."
|
||||
<< G4endl;
|
||||
AnalysisManager::Instance()->Destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "--- Run " << run->GetRunID() << " (worker) end." << G4endl;
|
||||
}
|
||||
|
||||
timerRun.Stop();
|
||||
std::cout << " " << timerRun << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
eRositaSteppingAction::eRositaSteppingAction()
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -36,12 +36,14 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
eRositaSteppingVerbose::eRositaSteppingVerbose()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
eRositaSteppingVerbose::~eRositaSteppingVerbose()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -27,25 +27,25 @@
|
||||
//
|
||||
|
||||
#include "eRositaTrackerHit.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "AnalysisManager.hh"
|
||||
|
||||
G4Allocator<eRositaTrackerHit> eRositaTrackerHitAllocator;
|
||||
G4ThreadLocal G4Allocator<eRositaTrackerHit>* eRositaTrackerHitAllocator=0;
|
||||
|
||||
eRositaTrackerHit::eRositaTrackerHit()
|
||||
{}
|
||||
|
||||
eRositaTrackerHit::eRositaTrackerHit() {}
|
||||
eRositaTrackerHit::~eRositaTrackerHit()
|
||||
{}
|
||||
|
||||
|
||||
eRositaTrackerHit::~eRositaTrackerHit() {}
|
||||
|
||||
|
||||
eRositaTrackerHit::eRositaTrackerHit(const eRositaTrackerHit& right)
|
||||
: G4VHit()
|
||||
eRositaTrackerHit::eRositaTrackerHit(const eRositaTrackerHit& right) : G4VHit()
|
||||
{
|
||||
trackID = right.trackID;
|
||||
chamberNb = right.chamberNb;
|
||||
@@ -53,7 +53,6 @@ eRositaTrackerHit::eRositaTrackerHit(const eRositaTrackerHit& right)
|
||||
pos = right.pos;
|
||||
}
|
||||
|
||||
|
||||
const eRositaTrackerHit& eRositaTrackerHit::operator=(const eRositaTrackerHit& right)
|
||||
{
|
||||
trackID = right.trackID;
|
||||
@@ -63,13 +62,11 @@ const eRositaTrackerHit& eRositaTrackerHit::operator=(const eRositaTrackerHit& r
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
G4bool eRositaTrackerHit::operator==(const eRositaTrackerHit& right) const
|
||||
{
|
||||
return (this==&right) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
void eRositaTrackerHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
@@ -78,22 +75,20 @@ void eRositaTrackerHit::Draw()
|
||||
G4Circle circle(pos);
|
||||
circle.SetScreenSize(2.);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1.,0.,0.);
|
||||
G4Colour colour(1., 0., 0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void eRositaTrackerHit::Print()
|
||||
{
|
||||
G4cout << " trackID: " << trackID
|
||||
<< " energy deposit: " << G4BestUnit(edep,"Energy")
|
||||
<< " position: " << G4BestUnit(pos,"Length") << G4endl;
|
||||
<< " energy deposit: " << G4BestUnit(edep, "Energy")
|
||||
<< " position: " << G4BestUnit(pos, "Length") << G4endl;
|
||||
}
|
||||
|
||||
|
||||
void eRositaTrackerHit::PrintToFile()
|
||||
{
|
||||
//out << trackID
|
||||
@@ -103,6 +98,4 @@ void eRositaTrackerHit::PrintToFile()
|
||||
// << " " << pos.z()
|
||||
// << std::endl;
|
||||
AnalysisManager::Instance()->Score(edep);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,10 @@
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#include "eRositaTrackerSD.hh"
|
||||
#include "eRositaTrackerHit.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
@@ -40,47 +43,43 @@
|
||||
#include "AnalysisManager.hh"
|
||||
|
||||
|
||||
|
||||
eRositaTrackerSD::eRositaTrackerSD(G4String name)
|
||||
:G4VSensitiveDetector(name)
|
||||
eRositaTrackerSD::eRositaTrackerSD(G4String name) : G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname;
|
||||
collectionName.insert(HCname="trackerCollection");
|
||||
}
|
||||
|
||||
|
||||
eRositaTrackerSD::~eRositaTrackerSD(){ }
|
||||
|
||||
eRositaTrackerSD::~eRositaTrackerSD()
|
||||
{
|
||||
}
|
||||
|
||||
void eRositaTrackerSD::Initialize(G4HCofThisEvent* HCE)
|
||||
{
|
||||
trackerCollection = new eRositaTrackerHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
trackerCollection =
|
||||
new eRositaTrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
static G4int HCID = -1;
|
||||
if (HCID < 0)
|
||||
{
|
||||
{
|
||||
HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
HCE->AddHitsCollection( HCID, trackerCollection );
|
||||
}
|
||||
HCE->AddHitsCollection( HCID, trackerCollection);
|
||||
}
|
||||
|
||||
|
||||
G4bool eRositaTrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
|
||||
G4bool eRositaTrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
if(aStep->GetTrack()->GetDefinition() != G4Gamma::GammaDefinition()) return false;
|
||||
|
||||
// G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
G4double edep = aStep->GetPreStepPoint()->GetKineticEnergy();
|
||||
|
||||
if (edep == 0.) return false;
|
||||
|
||||
eRositaTrackerHit* newHit = new eRositaTrackerHit();
|
||||
newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
|
||||
newHit->SetTrackID(aStep->GetTrack()->GetTrackID());
|
||||
//newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchableHandle()
|
||||
// ->GetCopyNumber());
|
||||
newHit->SetEdep(edep);
|
||||
newHit->SetPos(aStep->GetPostStepPoint()->GetPosition());
|
||||
trackerCollection->insert( newHit );
|
||||
trackerCollection->insert(newHit);
|
||||
|
||||
//newHit->Print();
|
||||
//newHit->Draw();
|
||||
@@ -92,7 +91,6 @@ G4bool eRositaTrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void eRositaTrackerSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
G4int NbHits = trackerCollection->entries();
|
||||
@@ -125,7 +123,3 @@ void eRositaTrackerSD::EndOfEvent(G4HCofThisEvent*)
|
||||
|
||||
//out.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user