Import Geant4 9.2.0 source tree
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGDetectorConstruction.cc,v 1.1 2008/11/03 10:06:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "G4tgbVolumeMgr.hh"
|
||||
#include "ExTGDetectorConstruction.hh"
|
||||
#include "G4tgrMessenger.hh"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
ExTGDetectorConstruction::ExTGDetectorConstruction()
|
||||
{
|
||||
messenger = new G4tgrMessenger;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
ExTGDetectorConstruction::~ExTGDetectorConstruction()
|
||||
{
|
||||
delete messenger;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
G4VPhysicalVolume* ExTGDetectorConstruction::Construct()
|
||||
{
|
||||
//------------------------------------------------
|
||||
// Define one or several text files containing the geometry description
|
||||
//------------------------------------------------
|
||||
G4String filename = "g4geom.txt";
|
||||
G4tgbVolumeMgr* volmgr = G4tgbVolumeMgr::GetInstance();
|
||||
volmgr->AddTextFile(filename);
|
||||
|
||||
//------------------------------------------------
|
||||
// Read the text files and construct the GEANT4 geometry
|
||||
//------------------------------------------------
|
||||
G4VPhysicalVolume* physiWorld = volmgr->ReadAndConstructDetector();
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGDetectorConstructionWithCpp.cc,v 1.1 2008/11/03 10:06:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "G4tgbVolumeMgr.hh"
|
||||
#include "ExTGDetectorConstructionWithCpp.hh"
|
||||
#include "G4tgrMessenger.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
ExTGDetectorConstructionWithCpp::ExTGDetectorConstructionWithCpp()
|
||||
{
|
||||
messenger = new G4tgrMessenger;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
ExTGDetectorConstructionWithCpp::~ExTGDetectorConstructionWithCpp()
|
||||
{
|
||||
delete messenger;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
G4VPhysicalVolume* ExTGDetectorConstructionWithCpp::Construct()
|
||||
{
|
||||
//------------------------------------------------
|
||||
// Define one or several text files containing the geometry description
|
||||
//------------------------------------------------
|
||||
G4String filename = "g4geom_simple.txt";
|
||||
G4tgbVolumeMgr* volmgr = G4tgbVolumeMgr::GetInstance();
|
||||
volmgr->AddTextFile(filename);
|
||||
|
||||
//------------------------------------------------
|
||||
// Read the text files and construct the GEANT4 geometry
|
||||
//------------------------------------------------
|
||||
G4VPhysicalVolume* physiWorld = volmgr->ReadAndConstructDetector();
|
||||
|
||||
//------------------------------------------------
|
||||
// Build another volume and place it in the text geometry
|
||||
//------------------------------------------------
|
||||
G4Box* solid = new G4Box("mybox",2.,2.,3.);
|
||||
|
||||
G4Material* water = G4NistManager::Instance()->FindOrBuildMaterial("G4_Fe");
|
||||
|
||||
G4LogicalVolume* logicVol = new G4LogicalVolume(solid,water,"mybox",0,0,0);
|
||||
|
||||
//----- Place the volume in the world of the text geometry
|
||||
G4LogicalVolume* textWorldVol = physiWorld->GetLogicalVolume();
|
||||
|
||||
// NOTE: if you want to place your full text geometry in the C++ geometry,
|
||||
// you should use this G4LogicalVolume and place it in a C++ logical
|
||||
// volume
|
||||
new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(0.,-20.,0), // at (x,y,z)
|
||||
logicVol, // its logical volume
|
||||
"myBox1", // its name
|
||||
textWorldVol, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
//----- Place the volume inside a volume of the text geometry
|
||||
G4LogicalVolume* textSphereVol =
|
||||
G4tgbVolumeMgr::GetInstance()->FindG4LogVol("sphere",1);
|
||||
new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(0.,0.,0), // at (x,y,z)
|
||||
logicVol, // its logical volume
|
||||
"myBox2", // its name
|
||||
textSphereVol, // its mother volume
|
||||
false, // no boolean operations
|
||||
1); // copy number
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGDetectorConstructionWithCuts.cc,v 1.2 2008/11/03 16:26:56 arce Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGDetectorConstructionWithCuts.hh"
|
||||
#include "ExTGRCDetectorBuilder.hh"
|
||||
#include "G4tgbVolumeMgr.hh"
|
||||
#include "G4tgrMessenger.hh"
|
||||
|
||||
ExTGDetectorConstructionWithCuts::ExTGDetectorConstructionWithCuts()
|
||||
{
|
||||
messenger = new G4tgrMessenger;
|
||||
}
|
||||
|
||||
ExTGDetectorConstructionWithCuts::~ExTGDetectorConstructionWithCuts()
|
||||
{
|
||||
delete messenger;
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* ExTGDetectorConstructionWithCuts::Construct()
|
||||
{
|
||||
//------------------------------------------------
|
||||
// Define one or several text files containing the geometry description
|
||||
//------------------------------------------------
|
||||
G4String filename = "g4geom_cutsPerRegion.txt";
|
||||
G4tgbVolumeMgr* volmgr = G4tgbVolumeMgr::GetInstance();
|
||||
volmgr->AddTextFile(filename);
|
||||
|
||||
//------------------------------------------------
|
||||
// Use your own detector builder, that will invoke your own line processor
|
||||
//------------------------------------------------
|
||||
ExTGRCDetectorBuilder* gtb = new ExTGRCDetectorBuilder;
|
||||
volmgr->SetDetectorBuilder( gtb );
|
||||
|
||||
const G4tgrVolume* tgrVoltop = gtb->ReadDetector();
|
||||
G4VPhysicalVolume* physiWorld = gtb->ConstructDetector(tgrVoltop);
|
||||
|
||||
// G4VPhysicalVolume* physiWorld = volmgr->ReadAndConstructDetector();
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGDetectorConstructionWithSD.cc,v 1.2 2008/12/18 12:56:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGDetectorConstructionWithSD.hh"
|
||||
#include "ExTGTrackerSD.hh"
|
||||
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4tgbVolumeMgr.hh"
|
||||
#include "G4tgrMessenger.hh"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
ExTGDetectorConstructionWithSD::ExTGDetectorConstructionWithSD()
|
||||
{
|
||||
messenger = new G4tgrMessenger;
|
||||
}
|
||||
|
||||
ExTGDetectorConstructionWithSD::~ExTGDetectorConstructionWithSD()
|
||||
{
|
||||
delete messenger;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
G4VPhysicalVolume* ExTGDetectorConstructionWithSD::Construct()
|
||||
{
|
||||
//------------------------------------------------
|
||||
// Define one or several text files containing the geometry description
|
||||
//------------------------------------------------
|
||||
G4String filename = "g4geom_SD.txt";
|
||||
G4tgbVolumeMgr* volmgr = G4tgbVolumeMgr::GetInstance();
|
||||
volmgr->AddTextFile(filename);
|
||||
|
||||
//------------------------------------------------
|
||||
// Read the text files and construct the GEANT4 geometry
|
||||
//------------------------------------------------
|
||||
G4VPhysicalVolume* physiWorld = volmgr->ReadAndConstructDetector();
|
||||
|
||||
//------------------------------------------------
|
||||
// Sensitive detectors
|
||||
//------------------------------------------------
|
||||
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
G4String trackerChamberSDname = "ExTextGeom/TrackerChamberSD";
|
||||
ExTGTrackerSD* aTrackerSD = new ExTGTrackerSD( trackerChamberSDname );
|
||||
SDman->AddNewDetector( aTrackerSD );
|
||||
G4LogicalVolume * logicChamber =
|
||||
G4tgbVolumeMgr::GetInstance()->FindG4LogVol("Chamber",0);
|
||||
if(logicChamber)
|
||||
{
|
||||
logicChamber->SetSensitiveDetector( aTrackerSD );
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("ExTGDetectorConstructionWithSD::Construct()",
|
||||
"InvalidGeometry", JustWarning,
|
||||
"Volume does not exists in geometry: Chamber.");
|
||||
}
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGPhysicsList.cc,v 1.1 2008/11/03 10:06:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "globals.hh"
|
||||
#include "ExTGPhysicsList.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGPhysicsList::ExTGPhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
defaultCutValue = 1.0*cm;
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGPhysicsList::~ExTGPhysicsList()
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGPhysicsList::ConstructParticle()
|
||||
{
|
||||
// In this method, static member functions should be called
|
||||
// for all particles which you want to use.
|
||||
// This ensures that objects of these particle types will be
|
||||
// created in the program.
|
||||
|
||||
ConstructBosons();
|
||||
ConstructLeptons();
|
||||
ConstructMesons();
|
||||
ConstructBaryons();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGPhysicsList::ConstructBosons()
|
||||
{
|
||||
// pseudo-particles
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGPhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
// e+/-
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
// mu+/-
|
||||
G4MuonPlus::MuonPlusDefinition();
|
||||
G4MuonMinus::MuonMinusDefinition();
|
||||
// nu_e
|
||||
G4NeutrinoE::NeutrinoEDefinition();
|
||||
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
||||
// nu_mu
|
||||
G4NeutrinoMu::NeutrinoMuDefinition();
|
||||
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGPhysicsList::ConstructMesons()
|
||||
{
|
||||
// mesons
|
||||
// light mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4PionZero::PionZeroDefinition();
|
||||
G4Eta::EtaDefinition();
|
||||
G4EtaPrime::EtaPrimeDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
G4KaonZero::KaonZeroDefinition();
|
||||
G4AntiKaonZero::AntiKaonZeroDefinition();
|
||||
G4KaonZeroLong::KaonZeroLongDefinition();
|
||||
G4KaonZeroShort::KaonZeroShortDefinition();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGPhysicsList::ConstructBaryons()
|
||||
{
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
|
||||
G4Neutron::NeutronDefinition();
|
||||
G4AntiNeutron::AntiNeutronDefinition();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGPhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructGeneral();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4GammaConversion.hh"
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
|
||||
#include "G4MultipleScattering.hh"
|
||||
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
#include "G4MuIonisation.hh"
|
||||
#include "G4MuBremsstrahlung.hh"
|
||||
#include "G4MuPairProduction.hh"
|
||||
|
||||
#include "G4hIonisation.hh"
|
||||
|
||||
#include "G4StepLimiter.hh"
|
||||
#include "G4UserSpecialCuts.hh"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGPhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
// gamma
|
||||
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
|
||||
pmanager->AddDiscreteProcess(new G4ComptonScattering);
|
||||
pmanager->AddDiscreteProcess(new G4GammaConversion);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
|
||||
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
|
||||
|
||||
} else if( particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
//muon
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
||||
pmanager->AddProcess(new G4MuIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3,3);
|
||||
pmanager->AddProcess(new G4MuPairProduction, -1, 4,4);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
//all others charged particles except geantino
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1, 2,2);
|
||||
//step limit
|
||||
pmanager->AddProcess(new G4StepLimiter, -1,-1,3);
|
||||
///pmanager->AddProcess(new G4UserSpecialCuts, -1,-1,4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "G4Decay.hh"
|
||||
void ExTGPhysicsList::ConstructGeneral()
|
||||
{
|
||||
// Add Decay Process
|
||||
G4Decay* theDecayProcess = new G4Decay();
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
if (theDecayProcess->IsApplicable(*particle)) {
|
||||
pmanager ->AddProcess(theDecayProcess);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGPhysicsList::SetCuts()
|
||||
{
|
||||
//G4VUserPhysicsList::SetCutsWithDefault method sets
|
||||
//the default cut value for all particle types
|
||||
//
|
||||
SetCutsWithDefault();
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGPrimaryGeneratorAction.cc,v 1.1 2008/11/03 10:06:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGPrimaryGeneratorAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGPrimaryGeneratorAction::ExTGPrimaryGeneratorAction()
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("e-");
|
||||
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
particleGun->SetParticleEnergy(10*MeV);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGPrimaryGeneratorAction::~ExTGPrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGRCDetectorBuilder.cc,v 1.3 2008/12/18 12:56:54 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// Author: P. Arce
|
||||
// Changes: creation May 2007
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGRCDetectorBuilder.hh"
|
||||
#include "ExTGRCLineProcessor.hh"
|
||||
#include "ExTGRCRegionCutsMgr.hh"
|
||||
|
||||
#include "G4tgrFileReader.hh"
|
||||
#include "G4tgrVolumeMgr.hh"
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
ExTGRCDetectorBuilder::ExTGRCDetectorBuilder()
|
||||
: G4tgbDetectorBuilder(), tlproc(0)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
ExTGRCDetectorBuilder::~ExTGRCDetectorBuilder()
|
||||
{
|
||||
if (tlproc) { delete tlproc; }
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
const G4tgrVolume* ExTGRCDetectorBuilder::ReadDetector()
|
||||
{
|
||||
//------------------- construct geometry
|
||||
tlproc = new ExTGRCLineProcessor;
|
||||
G4tgrFileReader* tfr = G4tgrFileReader::GetInstance();
|
||||
tfr->SetLineProcessor( tlproc );
|
||||
tfr->ReadFiles();
|
||||
|
||||
//---------- find top G4tgrVolume
|
||||
G4tgrVolumeMgr* tgrVolmgr = G4tgrVolumeMgr::GetInstance();
|
||||
const G4tgrVolume* tgrVoltop = tgrVolmgr->GetTopVolume();
|
||||
|
||||
return tgrVoltop;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
G4VPhysicalVolume* ExTGRCDetectorBuilder::
|
||||
ConstructDetector( const G4tgrVolume* tgrVoltop)
|
||||
{
|
||||
G4VPhysicalVolume* topPV =
|
||||
G4tgbDetectorBuilder::ConstructDetector( tgrVoltop );
|
||||
|
||||
//--- Create regions
|
||||
ExTGRCRegionCutsMgr::GetInstance()->BuildRegions();
|
||||
|
||||
//--- Set cuts to regions
|
||||
ExTGRCRegionCutsMgr::GetInstance()->BuildProductionCuts();
|
||||
|
||||
return topPV;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGRCLineProcessor.cc,v 1.1 2008/11/03 10:06:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// Author: P. Arce
|
||||
// Changes: creation May 2007
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGRCLineProcessor.hh"
|
||||
#include "ExTGRCRegionCutsMgr.hh"
|
||||
|
||||
//---------------------------------------------------------------
|
||||
ExTGRCLineProcessor::ExTGRCLineProcessor() : G4tgrLineProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
ExTGRCLineProcessor::~ExTGRCLineProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
G4bool ExTGRCLineProcessor::ProcessLine( const std::vector<G4String>& wl )
|
||||
{
|
||||
|
||||
G4bool iret = G4tgrLineProcessor::ProcessLine( wl );
|
||||
|
||||
G4String wl0 = wl[0];
|
||||
for( size_t ii = 0; ii < wl0.length(); ii++ )
|
||||
{
|
||||
wl0[ii] = toupper( wl0[ii] );
|
||||
}
|
||||
|
||||
if( !iret )
|
||||
{
|
||||
//------------------------------- parameter number
|
||||
if( wl0 == ":REGION" )
|
||||
{
|
||||
std::vector<G4String>::const_iterator ite = wl.begin()+1;
|
||||
std::vector<G4String> wlc;
|
||||
for( ; ite != wl.end(); ite++ ) //loop skipping the first one
|
||||
{
|
||||
wlc.push_back( *ite );
|
||||
}
|
||||
// wlc = wlc.erase( wlc.begin() );
|
||||
ExTGRCRegionCutsMgr::GetInstance()->AddRegionData( wlc );
|
||||
iret = 1;
|
||||
|
||||
}
|
||||
else if( wl0 == ":CUTS" )
|
||||
{
|
||||
std::vector<G4String>::const_iterator ite = wl.begin()+1;
|
||||
std::vector<G4String> wlc;
|
||||
for( ; ite != wl.end(); ite++ ) //loop skipping the first one
|
||||
{
|
||||
wlc.push_back( *ite );
|
||||
}
|
||||
ExTGRCRegionCutsMgr::GetInstance()->AddRegionCuts( wlc );
|
||||
iret = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
iret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return iret;
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGRCRegionCutsMgr.cc,v 1.3 2008/12/18 12:56:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// Author: P. Arce
|
||||
// Changes: creation May 2007
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGRCRegionCutsMgr.hh"
|
||||
#include "ExTGRCRegionData.hh"
|
||||
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4tgbVolumeMgr.hh"
|
||||
#include "G4tgrUtils.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
ExTGRCRegionCutsMgr* ExTGRCRegionCutsMgr::theInstance = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
ExTGRCRegionCutsMgr* ExTGRCRegionCutsMgr::GetInstance()
|
||||
{
|
||||
if( !theInstance )
|
||||
{
|
||||
theInstance = new ExTGRCRegionCutsMgr;
|
||||
}
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
ExTGRCRegionCutsMgr::ExTGRCRegionCutsMgr()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
ExTGRCRegionCutsMgr::~ExTGRCRegionCutsMgr()
|
||||
{
|
||||
delete theInstance;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void ExTGRCRegionCutsMgr::AddRegionData( const std::vector<G4String>& rd )
|
||||
{
|
||||
|
||||
if( (rd.size() > 1) && (FindRegionData( rd[0] ).size() != 0) )
|
||||
{
|
||||
G4Exception("ExTGRCRegionCutsMgr::AddRegionData", "InvalidArgument",
|
||||
JustWarning,
|
||||
G4String("Region already exists: " + rd[0]).c_str() );
|
||||
return;
|
||||
}
|
||||
theRegionDatae.push_back( new ExTGRCRegionData( rd ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void ExTGRCRegionCutsMgr::AddRegionCuts( const std::vector<G4String>& rc )
|
||||
{
|
||||
if( rc.size() == 0 )
|
||||
{
|
||||
G4cerr << "ERROR - ExTGRCRegionCutsMgr::AddRegionCuts()" << G4endl
|
||||
<< " Must have 3 or 4 arguments : REGION_NAME, gamma_CUT,"
|
||||
<< " e-_CUT (e+_CUT)." << G4endl
|
||||
<< " It has only " << rc.size() << " !" << G4endl;
|
||||
G4Exception("ExTGRCRegionCutsMgr::AddRegionCuts()", "InvalidArgument",
|
||||
FatalErrorInArgument, G4UIcommand::ConvertToString(G4int(rc.size())) );
|
||||
}
|
||||
|
||||
// Find region
|
||||
std::vector<ExTGRCRegionData*>::const_iterator iter;
|
||||
std::vector<ExTGRCRegionData*> regs = FindRegionData(rc[0]);
|
||||
|
||||
if( regs.size() == 0 )
|
||||
{
|
||||
G4Exception("ExTGRCRegionCutsMgr::AddRegionCuts()",
|
||||
"InvalidArgument", FatalErrorInArgument,
|
||||
G4String(" region does not exist: " + rc[0]).c_str());
|
||||
}
|
||||
|
||||
for( size_t ii = 0; ii < regs.size(); ii++)
|
||||
{
|
||||
regs[ii]->SetCutsData( rc );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
std::vector<ExTGRCRegionData*>
|
||||
ExTGRCRegionCutsMgr::FindRegionData( const G4String& name)
|
||||
{
|
||||
std::vector<ExTGRCRegionData*> regs;
|
||||
std::vector<ExTGRCRegionData*>::const_iterator iter;
|
||||
for( iter = theRegionDatae.begin(); iter != theRegionDatae.end(); iter++ )
|
||||
{
|
||||
if( G4tgrUtils::AreWordsEquivalent( name , (*iter)->GetRegionName()) )
|
||||
{
|
||||
regs.push_back(*iter);
|
||||
}
|
||||
}
|
||||
return regs;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void ExTGRCRegionCutsMgr::BuildRegions()
|
||||
{
|
||||
std::vector<ExTGRCRegionData*>::const_iterator iter;
|
||||
std::vector<G4String>::const_iterator ites;
|
||||
std::vector<G4LogicalVolume*>::const_iterator itelv;
|
||||
for( iter = theRegionDatae.begin(); iter != theRegionDatae.end(); iter++ )
|
||||
{
|
||||
G4Region* reg = new G4Region( (*iter)->GetRegionName() );
|
||||
std::vector<G4String> lvs = (*iter)->GetLVNames();
|
||||
for( ites = lvs.begin(); ites != lvs.end(); ites++ )
|
||||
{
|
||||
G4LogicalVolume* logVol =
|
||||
G4tgbVolumeMgr::GetInstance()->FindG4LogVol(*ites, true );
|
||||
reg->AddRootLogicalVolume( logVol );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void ExTGRCRegionCutsMgr::BuildProductionCuts()
|
||||
{
|
||||
std::vector<ExTGRCRegionData*>::const_iterator iter;
|
||||
G4RegionStore* regions = G4RegionStore::GetInstance();
|
||||
//----- loop to region datae
|
||||
for( iter = theRegionDatae.begin(); iter != theRegionDatae.end(); iter++ )
|
||||
{
|
||||
if( (*iter)->CutsAreSet() )
|
||||
{
|
||||
G4Region* reg = regions->GetRegion( (*iter)->GetRegionName() );
|
||||
if( !reg )
|
||||
{
|
||||
G4Exception("ExTGRCRegionCutsMgr::BuildProductionCuts()",
|
||||
"InvalidArgument", FatalErrorInArgument,
|
||||
G4String("Region not found: " + (*iter)->GetRegionName()).c_str() );
|
||||
}
|
||||
G4ProductionCuts* cuts = new G4ProductionCuts ;
|
||||
|
||||
cuts->SetProductionCut((*iter)->GetGammaCut(),"gamma");
|
||||
cuts->SetProductionCut((*iter)->GetElectronCut(),"e-");
|
||||
cuts->SetProductionCut((*iter)->GetPositronCut(),"e+");
|
||||
reg->SetProductionCuts(cuts);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGRCRegionData.cc,v 1.3 2008/12/18 12:56:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// Author: P. Arce
|
||||
// Changes: creation May 2007
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGRCRegionData.hh"
|
||||
#include "G4tgrUtils.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
ExTGRCRegionData::ExTGRCRegionData(const std::vector<G4String>& wl )
|
||||
{
|
||||
if( wl.size() < 2 )
|
||||
{
|
||||
G4Exception("ExTGRCRegionData::ExTGRCRegionData()",
|
||||
"InvalidArgument", FatalErrorInArgument,
|
||||
G4UIcommand::ConvertToString( G4int(wl.size()) ) );
|
||||
}
|
||||
theRegionName = wl[0];
|
||||
for( size_t ii = 1; ii < wl.size(); ii++ )
|
||||
{
|
||||
theLVNames.push_back( wl[ii] );
|
||||
}
|
||||
bCutsSet = false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
ExTGRCRegionData::~ExTGRCRegionData()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void ExTGRCRegionData::SetCutsData( const std::vector<G4String>& rc )
|
||||
{
|
||||
if( (rc.size() != 3) && (rc.size() != 4) )
|
||||
{
|
||||
G4cerr << "ERROR - ExTGRCRegionData::SetCutsData()" << G4endl
|
||||
<< " Must have 3 or 4 arguments : "
|
||||
<< "REGION_NAME, gamma_CUT, e-_CUT (e+_CUT)." << G4endl
|
||||
<< " It has only " << rc.size() << " !" << G4endl;
|
||||
G4Exception("ExTGRCRegionCutsMgr::AddRegionCuts()",
|
||||
"InvalidArgument", FatalErrorInArgument,
|
||||
G4UIcommand::ConvertToString( G4int(rc.size()) ) );
|
||||
}
|
||||
|
||||
if( bCutsSet )
|
||||
{
|
||||
G4Exception("ExTGRCRegionData::SetCutsData()",
|
||||
"InvalidArgument", JustWarning,
|
||||
G4String("Cuts are already set for region " + theRegionName).c_str() );
|
||||
}
|
||||
|
||||
theGammaCut = G4tgrUtils::GetDouble( rc[1] );
|
||||
theElectronCut = G4tgrUtils::GetDouble( rc[2] );
|
||||
if( rc.size() == 3 )
|
||||
{
|
||||
thePositronCut = theElectronCut;
|
||||
}
|
||||
else
|
||||
{
|
||||
thePositronCut = G4tgrUtils::GetDouble( rc[3] );
|
||||
}
|
||||
|
||||
bCutsSet = true;
|
||||
}
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ExTGRunAction.cc,v 1.1 2008/11/03 10:06:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGRunAction.hh"
|
||||
|
||||
#include "G4tgbGeometryDumper.hh"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGRunAction::ExTGRunAction()
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGRunAction::~ExTGRunAction()
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGRunAction::BeginOfRunAction(const G4Run* )
|
||||
{
|
||||
G4tgbGeometryDumper::GetInstance()->DumpGeometry("geom.txt");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGRunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGTrackerHit.cc,v 1.1 2008/11/03 10:06:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGTrackerHit.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
G4Allocator<ExTGTrackerHit> ExTGTrackerHitAllocator;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGTrackerHit::ExTGTrackerHit()
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGTrackerHit::~ExTGTrackerHit()
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGTrackerHit::ExTGTrackerHit(const ExTGTrackerHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
trackID = right.trackID;
|
||||
chamberNb = right.chamberNb;
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const ExTGTrackerHit& ExTGTrackerHit::operator=(const ExTGTrackerHit& right)
|
||||
{
|
||||
trackID = right.trackID;
|
||||
chamberNb = right.chamberNb;
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
G4int ExTGTrackerHit::operator==(const ExTGTrackerHit& right) const
|
||||
{
|
||||
return (this==&right) ? 1 : 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGTrackerHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Circle circle(pos);
|
||||
circle.SetScreenSize(2.);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1.,0.,0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGTrackerHit::Print()
|
||||
{
|
||||
G4cout << " trackID: " << trackID << " chamberNb: " << chamberNb
|
||||
<< " energy deposit: " << G4BestUnit(edep,"Energy")
|
||||
<< " position: " << G4BestUnit(pos,"Length") << G4endl;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExTGTrackerSD.cc,v 1.1 2008/11/03 10:06:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "ExTGTrackerSD.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGTrackerSD::ExTGTrackerSD(G4String name)
|
||||
:G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname;
|
||||
collectionName.insert(HCname="trackerCollection");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
ExTGTrackerSD::~ExTGTrackerSD()
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGTrackerSD::Initialize(G4HCofThisEvent* HCE)
|
||||
{
|
||||
trackerCollection = new ExTGTrackerHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
static G4int HCID = -1;
|
||||
if ( HCID<0 )
|
||||
{
|
||||
HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
HCE->AddHitsCollection( HCID, trackerCollection );
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
G4bool ExTGTrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
if(edep==0.) { return false; }
|
||||
|
||||
ExTGTrackerHit* newHit = new ExTGTrackerHit();
|
||||
newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
|
||||
newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchableHandle()
|
||||
->GetCopyNumber());
|
||||
newHit->SetEdep (edep);
|
||||
newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
|
||||
trackerCollection->insert( newHit );
|
||||
|
||||
//newHit->Print();
|
||||
//newHit->Draw();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void ExTGTrackerSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
G4int NbHits = trackerCollection->entries();
|
||||
G4cout << "\n-------->Hits Collection: in this event there are " << NbHits
|
||||
<< " hits in the tracker chambers: " << G4endl;
|
||||
for (G4int i=0;i<NbHits;i++)
|
||||
{
|
||||
(*trackerCollection)[i]->Print();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user