Import Geant4 10.3.0 source tree
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorConstruction.cc 73446 2013-08-27 11:32:59Z gcosmo $
|
||||
// $Id: DetectorConstruction.cc 99841 2016-10-07 10:09:34Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -37,6 +37,8 @@
|
||||
// Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4Material.hh"
|
||||
@@ -48,15 +50,19 @@
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
DetectorConstruction::DetectorConstruction() :
|
||||
Iron(0), Copper(0), Tungsten(0), Lead(0), Uranium(0), PbWO4(0),
|
||||
Polystyrene(0), LiquidArgon(0),
|
||||
theAbsorberMaterial(0),
|
||||
logicAbsorber(0), physiAbsorber(0) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
DetectorConstruction::~DetectorConstruction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
@@ -226,6 +232,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
return experimentalHall_phys;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void DetectorConstruction::PrintParameters()
|
||||
{
|
||||
@@ -240,3 +247,5 @@ void DetectorConstruction::PrintParameters()
|
||||
G4cout << G4endl << " -------------------------------------------------------- "
|
||||
<< G4endl << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the MCTruthConfig class
|
||||
//
|
||||
//
|
||||
// $Id: MCTruthConfig.cc 73446 2013-08-27 11:32:59Z gcosmo $
|
||||
// $Id: MCTruthConfig.cc 99841 2016-10-07 10:09:34Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -37,11 +37,19 @@
|
||||
// Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
#include "MCTruthConfig.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthConfig::MCTruthConfig()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthConfig::~MCTruthConfig()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the MCTruthEventAction class
|
||||
//
|
||||
//
|
||||
// $Id: MCTruthEventAction.cc 73446 2013-08-27 11:32:59Z gcosmo $
|
||||
// $Id: MCTruthEventAction.cc 99841 2016-10-07 10:09:34Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -37,23 +37,35 @@
|
||||
// Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
#include "MCTruthEventAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthEventAction::MCTruthEventAction() : G4UserEventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthEventAction::~MCTruthEventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void MCTruthEventAction::BeginOfEventAction(const G4Event*)
|
||||
{
|
||||
// instanciating new event
|
||||
MCTruthManager::GetInstance()->NewEvent();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void MCTruthEventAction::EndOfEventAction(const G4Event*)
|
||||
{
|
||||
// printing event
|
||||
MCTruthManager::GetInstance()->PrintEvent();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the MCTruthManager class
|
||||
//
|
||||
//
|
||||
// $Id: MCTruthManager.cc 73446 2013-08-27 11:32:59Z gcosmo $
|
||||
// $Id: MCTruthManager.cc 99841 2016-10-07 10:09:34Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -37,17 +37,27 @@
|
||||
// Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
#include "MCTruthManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
static MCTruthManager* instance = 0;
|
||||
|
||||
MCTruthManager::MCTruthManager() : event(0), config(0)
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthManager::MCTruthManager() : event(0), fConfig(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthManager::~MCTruthManager()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthManager* MCTruthManager::GetInstance()
|
||||
{
|
||||
if( instance == 0 )
|
||||
@@ -57,14 +67,18 @@ MCTruthManager* MCTruthManager::GetInstance()
|
||||
return instance;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void MCTruthManager::NewEvent()
|
||||
{
|
||||
// first delete the old event
|
||||
delete event;
|
||||
delete fEvent;
|
||||
// and now instaciate a new one
|
||||
event = new HepMC::GenEvent();
|
||||
fEvent = new HepMC::GenEvent();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
G4LorentzVector& prodpos,
|
||||
G4LorentzVector& endpos,
|
||||
@@ -76,7 +90,7 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
particle->suggest_barcode(partID);
|
||||
// we initialize the 'segmentations' map
|
||||
// for the moment particle is not 'segmented'
|
||||
segmentations[partID] = 1;
|
||||
fSegmentations[partID] = 1;
|
||||
|
||||
// we create the GenVertex corresponding to the end point of the track
|
||||
HepMC::GenVertex* endvertex = new HepMC::GenVertex(endpos);
|
||||
@@ -84,13 +98,13 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
// barcode of the endvertex = - barcode of the track
|
||||
endvertex->suggest_barcode(-partID);
|
||||
endvertex->add_particle_in(particle);
|
||||
event->add_vertex(endvertex);
|
||||
fEvent->add_vertex(endvertex);
|
||||
|
||||
if(motherID) // not a primary
|
||||
{
|
||||
// here we could try to improve speed by searching only through particles which
|
||||
// belong to the given primary tree
|
||||
HepMC::GenParticle* mother = event->barcode_to_particle(motherID);
|
||||
HepMC::GenParticle* mother = fEvent->barcode_to_particle(motherID);
|
||||
//
|
||||
if(mother)
|
||||
{
|
||||
@@ -147,7 +161,7 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
// minus the daughter particle barcode
|
||||
//
|
||||
childvtx->suggest_barcode(-500000-partID);
|
||||
event->add_vertex(childvtx);
|
||||
fEvent->add_vertex(childvtx);
|
||||
|
||||
HepMC::GenParticle* dummypart =
|
||||
new HepMC::GenParticle(G4LorentzVector(),-999999);
|
||||
@@ -166,7 +180,7 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
// the right 'segment' to add the new daugther.
|
||||
// We use Time coordinate to locate the place for the new vertex
|
||||
|
||||
G4int number_of_segments = segmentations[motherID];
|
||||
G4int number_of_segments = fSegmentations[motherID];
|
||||
G4int segment = 0;
|
||||
|
||||
// we loop through the segments
|
||||
@@ -178,7 +192,7 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
if (segment == number_of_segments)
|
||||
G4cerr << "Problem!!!! Time coordinates incompatible!" << G4endl;
|
||||
|
||||
mother = event->barcode_to_particle(segment*10000000 + motherID);
|
||||
mother = fEvent->barcode_to_particle(segment*10000000 + motherID);
|
||||
}
|
||||
|
||||
// now, we 'split' the appropriate 'segment' of the mother particle
|
||||
@@ -186,7 +200,7 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
//
|
||||
HepMC::GenVertex* childvtx = new HepMC::GenVertex(prodpos);
|
||||
childvtx->add_particle_out(particle);
|
||||
event->add_vertex(childvtx);
|
||||
fEvent->add_vertex(childvtx);
|
||||
|
||||
// we first detach the mother from its original vertex
|
||||
//
|
||||
@@ -202,12 +216,12 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
// original barcode
|
||||
//
|
||||
HepMC::GenParticle* mothertwo = new HepMC::GenParticle(*mother);
|
||||
mothertwo->suggest_barcode(segmentations[motherID]*10000000
|
||||
mothertwo->suggest_barcode(fSegmentations[motherID]*10000000
|
||||
+ mother->barcode());
|
||||
|
||||
// we also reset the barcodes of the vertices
|
||||
//
|
||||
orig_mother_end_vtx->suggest_barcode(-segmentations[motherID]
|
||||
orig_mother_end_vtx->suggest_barcode(-fSegmentations[motherID]
|
||||
*10000000 - mother->barcode());
|
||||
childvtx->suggest_barcode(-mother->barcode());
|
||||
|
||||
@@ -221,7 +235,7 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
|
||||
// and finally ... the increase the 'segmentation counter'
|
||||
//
|
||||
segmentations[motherID] = segmentations[motherID]+1;
|
||||
fSegmentations[motherID] = fSegmentations[motherID]+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,28 +252,32 @@ void MCTruthManager::AddParticle(G4LorentzVector& momentum,
|
||||
{
|
||||
HepMC::GenVertex* primaryvtx = new HepMC::GenVertex(prodpos);
|
||||
primaryvtx->add_particle_out(particle);
|
||||
event->add_vertex(primaryvtx);
|
||||
fEvent->add_vertex(primaryvtx);
|
||||
|
||||
// add id to the list of primaries
|
||||
//
|
||||
primarybarcodes.push_back(partID);
|
||||
fPrimarybarcodes.push_back(partID);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void MCTruthManager::PrintEvent()
|
||||
{
|
||||
event->print();
|
||||
fEvent->print();
|
||||
|
||||
// looping over primaries and print the decay tree for each of them
|
||||
//
|
||||
for(std::vector<int>::const_iterator primarybar=primarybarcodes.begin();
|
||||
primarybar!=primarybarcodes.end();primarybar++)
|
||||
for(std::vector<int>::const_iterator primarybar=fPrimarybarcodes.begin();
|
||||
primarybar!=fPrimarybarcodes.end();primarybar++)
|
||||
{
|
||||
printTree(event->barcode_to_particle(*primarybar), " | ");
|
||||
PrintTree(fEvent->barcode_to_particle(*primarybar), " | ");
|
||||
}
|
||||
}
|
||||
|
||||
void MCTruthManager::printTree(HepMC::GenParticle* particle, G4String offset)
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void MCTruthManager::PrintTree(HepMC::GenParticle* particle, G4String offset)
|
||||
{
|
||||
G4cout << offset << "--- barcode: " << particle->barcode() << " pdg: "
|
||||
<< particle->pdg_id() << " energy: " << particle->momentum().e()
|
||||
@@ -284,6 +302,8 @@ void MCTruthManager::printTree(HepMC::GenParticle* particle, G4String offset)
|
||||
deltaoffset = " | ";
|
||||
}
|
||||
|
||||
printTree((*it), offset + deltaoffset);
|
||||
PrintTree((*it), offset + deltaoffset);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the MCTruthTrackInformation class
|
||||
//
|
||||
//
|
||||
// $Id: MCTruthTrackInformation.cc 73446 2013-08-27 11:32:59Z gcosmo $
|
||||
// $Id: MCTruthTrackInformation.cc 99841 2016-10-07 10:09:34Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -37,14 +37,22 @@
|
||||
// Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
#include "MCTruthTrackInformation.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthTrackInformation::MCTruthTrackInformation()
|
||||
{
|
||||
directParent = true;
|
||||
fDirectParent = true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthTrackInformation::~MCTruthTrackInformation()
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the MCTruthTrackingAction class
|
||||
//
|
||||
//
|
||||
// $Id: MCTruthTrackingAction.cc 73446 2013-08-27 11:32:59Z gcosmo $
|
||||
// $Id: MCTruthTrackingAction.cc 99841 2016-10-07 10:09:34Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -37,6 +37,8 @@
|
||||
// Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -46,12 +48,18 @@
|
||||
#include "MCTruthTrackingAction.hh"
|
||||
#include "MCTruthTrackInformation.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthTrackingAction::MCTruthTrackingAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
MCTruthTrackingAction::~MCTruthTrackingAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void MCTruthTrackingAction::PreUserTrackingAction(const G4Track* track)
|
||||
{
|
||||
fmom = G4LorentzVector(track->GetMomentum(), track->GetTotalEnergy());
|
||||
@@ -63,6 +71,8 @@ void MCTruthTrackingAction::PreUserTrackingAction(const G4Track* track)
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void MCTruthTrackingAction::PostUserTrackingAction(const G4Track* track)
|
||||
{
|
||||
|
||||
@@ -72,7 +82,7 @@ void MCTruthTrackingAction::PostUserTrackingAction(const G4Track* track)
|
||||
|
||||
// here (?) make all different checks to decide whether to store the particle
|
||||
//
|
||||
if (trackToBeStored(track))
|
||||
if (TrackToBeStored(track))
|
||||
{
|
||||
MCTruthTrackInformation* mcinf =
|
||||
(MCTruthTrackInformation*) track->GetUserInformation();
|
||||
@@ -107,7 +117,9 @@ void MCTruthTrackingAction::PostUserTrackingAction(const G4Track* track)
|
||||
}
|
||||
}
|
||||
|
||||
G4bool MCTruthTrackingAction::trackToBeStored(const G4Track* track)
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4bool MCTruthTrackingAction::TrackToBeStored(const G4Track* track)
|
||||
{
|
||||
MCTruthConfig* config = MCTruthManager::GetInstance()->GetConfig();
|
||||
|
||||
@@ -127,3 +139,5 @@ G4bool MCTruthTrackingAction::trackToBeStored(const G4Track* track)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc 73446 2013-08-27 11:32:59Z gcosmo $
|
||||
// $Id: PrimaryGeneratorAction.cc 99841 2016-10-07 10:09:34Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -37,6 +37,9 @@
|
||||
// Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
@@ -46,6 +49,8 @@
|
||||
#include "globals.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
@@ -61,11 +66,15 @@ PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
particleGun->SetParticleEnergy(3.0*GeV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4double position = 0.0;
|
||||
@@ -73,3 +82,5 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
Reference in New Issue
Block a user