Import Geant4 8.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:36:02 +02:00
parent d93e1e39a9
commit 8a51e0bc40
5471 changed files with 99628 additions and 55248 deletions
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSCellFlux.cc,v 1.3 2005/11/19 03:16:07 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSCellFlux
#include "G4PSCellFlux.hh"
#include "G4Track.hh"
#include "G4VSolid.hh"
#include "G4UnitsTable.hh"
///////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring cell flux.
// The Cell Flux is defined by a sum of track length divided
// by the geometry volume, where all of the tracks in the geometry
// are taken into account.
//
// If you want to score only tracks passing through the geometry volume,
// please use G4PSPassageCellFlux.
//
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
///////////////////////////////////////////////////////////////////////////////
G4PSCellFlux::G4PSCellFlux(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1)
{;}
G4PSCellFlux::~G4PSCellFlux()
{;}
G4bool G4PSCellFlux::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4double stepLength = aStep->GetStepLength();
if ( stepLength == 0. ) return FALSE;
G4double volume = aStep->GetPreStepPoint()->GetPhysicalVolume()
->GetLogicalVolume()->GetSolid()->GetCubicVolume();
G4double CellFlux = stepLength / volume ;
CellFlux *= aStep->GetPreStepPoint()->GetWeight();
G4int index = GetIndex(aStep);
EvtMap->add(index,CellFlux);
return TRUE;
}
void G4PSCellFlux::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(detector->GetName(),
GetName());
if ( HCID < 0 ) HCID = GetCollectionID(0);
HCE->AddHitsCollection(HCID,EvtMap);
}
void G4PSCellFlux::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSCellFlux::clear(){
EvtMap->clear();
}
void G4PSCellFlux::DrawAll()
{;}
void G4PSCellFlux::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() <<G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " cell flux : " << *(itr->second)*cm*cm << " [cm^-2]"
<< G4endl;
}
}
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSDoseDeposit.cc,v 1.3 2005/12/13 08:43:39 gunter Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSDoseDeposit
#include "G4PSDoseDeposit.hh"
#include "G4VSolid.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring only energy deposit.
//
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
///////////////////////////////////////////////////////////////////////////////
G4PSDoseDeposit::G4PSDoseDeposit(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1)
{;}
G4PSDoseDeposit::~G4PSDoseDeposit()
{;}
G4bool G4PSDoseDeposit::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if ( edep == 0. ) return FALSE;
G4double volume = aStep->GetPreStepPoint()->GetPhysicalVolume()
->GetLogicalVolume()->GetSolid()->GetCubicVolume();
G4double density = aStep->GetTrack()->GetMaterial()->GetDensity();
G4double dose = edep / ( density * volume );
dose *= aStep->GetPreStepPoint()->GetWeight();
G4int index = GetIndex(aStep);
EvtMap->add(index,dose);
return TRUE;
}
void G4PSDoseDeposit::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(),
GetName());
if(HCID < 0) {HCID = GetCollectionID(0);}
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSDoseDeposit::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSDoseDeposit::clear()
{
EvtMap->clear();
}
void G4PSDoseDeposit::DrawAll()
{;}
void G4PSDoseDeposit::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " dose deposit: " << G4BestUnit(*(itr->second),"Dose")
<< G4endl;
}
}
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSEnergyDeposit.cc,v 1.3 2005/12/13 08:43:41 gunter Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSEnergyDeposit
#include "G4PSEnergyDeposit.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// Description:
// This is a primitive scorer class for scoring energy deposit.
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
///////////////////////////////////////////////////////////////////////////////
G4PSEnergyDeposit::G4PSEnergyDeposit(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1)
{;}
G4PSEnergyDeposit::~G4PSEnergyDeposit()
{;}
G4bool G4PSEnergyDeposit::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if ( edep == 0. ) return FALSE;
edep *= aStep->GetPreStepPoint()->GetWeight(); // (Particle Weight)
G4int index = GetIndex(aStep);
EvtMap->add(index,edep);
return TRUE;
}
void G4PSEnergyDeposit::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(),
GetName());
if(HCID < 0) {HCID = GetCollectionID(0);}
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSEnergyDeposit::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSEnergyDeposit::clear()
{
EvtMap->clear();
}
void G4PSEnergyDeposit::DrawAll()
{;}
void G4PSEnergyDeposit::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " energy deposit: " << G4BestUnit(*(itr->second),"Energy")
<< G4endl;
}
}
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSFlatSurfaceCurrent.cc,v 1.3 2005/11/19 03:16:07 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSFlatSurfaceCurrent
#include "G4PSFlatSurfaceCurrent.hh"
#include "G4StepStatus.hh"
#include "G4Track.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring only Surface Flux.
// Current version assumes only for G4Box shape.
//
// Surface is defined at the -Z surface.
// Direction -Z +Z
// 0 IN || OUT ->|<- |
// 1 IN ->| |
// 2 OUT |<- |
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
///////////////////////////////////////////////////////////////////////////////
G4PSFlatSurfaceCurrent::G4PSFlatSurfaceCurrent(G4String name,
G4int direction, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction)
{;}
G4PSFlatSurfaceCurrent::~G4PSFlatSurfaceCurrent()
{;}
G4bool G4PSFlatSurfaceCurrent::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4StepPoint* preStep = aStep->GetPreStepPoint();
G4VSolid * solid =
preStep->GetPhysicalVolume()->GetLogicalVolume()->GetSolid();
if( solid->GetEntityType() != "G4Box" ){
G4Exception("G4PSFlatSurfaceCurrentScorer. - Solid type is not supported.");
return FALSE;
}
G4Box* boxSolid = (G4Box*)(solid);
G4int dirFlag =IsSelectedSurface(aStep,boxSolid);
if ( dirFlag > 0 ) {
G4int index = GetIndex(aStep);
G4double square = 4.*boxSolid->GetXHalfLength()*boxSolid->GetYHalfLength();
G4TouchableHandle theTouchable = preStep->GetTouchableHandle();
G4ThreeVector pdirection = preStep->GetMomentumDirection();
G4ThreeVector localdir =
theTouchable->GetHistory()->GetTopTransform().TransformAxis(pdirection);
G4double current = preStep->GetWeight(); // Current (Particle Weight)
current = current/square; // Current with angle.
if ( fDirection == fCurrent_InOut || fDirection == dirFlag ){
EvtMap->add(index,current);
}
}
return TRUE;
}
G4int G4PSFlatSurfaceCurrent::IsSelectedSurface(G4Step* aStep, G4Box* boxSolid){
G4TouchableHandle theTouchable =
aStep->GetPreStepPoint()->GetTouchableHandle();
if (aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary ){
// Entering Geometry
G4ThreeVector stppos1= aStep->GetPreStepPoint()->GetPosition();
G4ThreeVector localpos1 =
theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1);
if(fabs( localpos1.z() + boxSolid->GetZHalfLength())<kCarTolerance ){
return fCurrent_In;
}
}
if (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary ){
// Exiting Geometry
G4ThreeVector stppos2= aStep->GetPostStepPoint()->GetPosition();
G4ThreeVector localpos2 =
theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos2);
if(fabs( localpos2.z() + boxSolid->GetZHalfLength())<kCarTolerance ){
return fCurrent_Out;
}
}
return -1;
}
void G4PSFlatSurfaceCurrent::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(detector->GetName(), GetName());
if ( HCID < 0 ) HCID = GetCollectionID(0);
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSFlatSurfaceCurrent::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSFlatSurfaceCurrent::clear(){
EvtMap->clear();
}
void G4PSFlatSurfaceCurrent::DrawAll()
{;}
void G4PSFlatSurfaceCurrent::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() <<G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " current : " << *(itr->second)*cm*cm << " [cm^-2]"
<< G4endl;
}
}
@@ -0,0 +1,152 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSFlatSurfaceFlux.cc,v 1.3 2005/11/19 03:16:07 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSFlatSurfaceFlux
#include "G4PSFlatSurfaceFlux.hh"
#include "G4StepStatus.hh"
#include "G4Track.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring Surface Flux.
// Current version assumes only for G4Box shape, and the surface
// is fixed on -Z plane.
//
// Surface is defined at the -Z surface.
// Direction -Z +Z
// 0 IN || OUT ->|<- |
// 1 IN ->| |
// 2 OUT |<- |
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
// 18-Nov-2005 T.Aso, To use always positive value for anglefactor.
///////////////////////////////////////////////////////////////////////////////
G4PSFlatSurfaceFlux::G4PSFlatSurfaceFlux(G4String name,
G4int direction, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction)
{;}
G4PSFlatSurfaceFlux::~G4PSFlatSurfaceFlux()
{;}
G4bool G4PSFlatSurfaceFlux::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4StepPoint* preStep = aStep->GetPreStepPoint();
G4VSolid * solid =
preStep->GetPhysicalVolume()->GetLogicalVolume()->GetSolid();
if( solid->GetEntityType() != "G4Box" ){
G4Exception("G4PSFlatSurfaceFluxScorer. - Solid type is not supported.");
return FALSE;
}
G4Box* boxSolid = (G4Box*)(solid);
G4int dirFlag =IsSelectedSurface(aStep,boxSolid);
if ( dirFlag > 0 ) {
G4int index = GetIndex(aStep);
G4double square = 4.*boxSolid->GetXHalfLength()*boxSolid->GetYHalfLength();
G4TouchableHandle theTouchable = preStep->GetTouchableHandle();
G4ThreeVector pdirection = preStep->GetMomentumDirection();
G4ThreeVector localdir =
theTouchable->GetHistory()->GetTopTransform().TransformAxis(pdirection);
G4double angleFactor = localdir.z();
if ( angleFactor < 0 ) angleFactor *= -1.;
G4double flux = preStep->GetWeight(); // Current (Particle Weight)
flux = flux/angleFactor/square; // Flux with angle.
if ( fDirection == fFlux_InOut || fDirection == dirFlag ){
EvtMap->add(index,flux);
}
#ifdef debug
G4cout << " PASSED vol "
<< index << " trk "<<trkid<<" len " << fFlatSurfaceFlux<<G4endl;
#endif
}
return TRUE;
}
G4int G4PSFlatSurfaceFlux::IsSelectedSurface(G4Step* aStep, G4Box* boxSolid){
G4TouchableHandle theTouchable =
aStep->GetPreStepPoint()->GetTouchableHandle();
if (aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary ){
// Entering Geometry
G4ThreeVector stppos1= aStep->GetPreStepPoint()->GetPosition();
G4ThreeVector localpos1 =
theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1);
if(fabs( localpos1.z() + boxSolid->GetZHalfLength())<kCarTolerance ){
return fFlux_In;
}
}
if (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary ){
// Exiting Geometry
G4ThreeVector stppos2= aStep->GetPostStepPoint()->GetPosition();
G4ThreeVector localpos2 =
theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos2);
if(fabs( localpos2.z() + boxSolid->GetZHalfLength())<kCarTolerance ){
return fFlux_Out;
}
}
return -1;
}
void G4PSFlatSurfaceFlux::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(),
GetName());
if ( HCID < 0 ) HCID = GetCollectionID(0);
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSFlatSurfaceFlux::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSFlatSurfaceFlux::clear(){
EvtMap->clear();
}
void G4PSFlatSurfaceFlux::DrawAll()
{;}
void G4PSFlatSurfaceFlux::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer" << GetName() <<G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " flux : " << *(itr->second)*cm*cm << " [cm^-2]"
<< G4endl;
}
}
+113
View File
@@ -0,0 +1,113 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSMinKinEAtGeneration.cc,v 1.4 2005/12/13 08:43:45 gunter Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSMinKinEAtGeneration
#include "G4PSMinKinEAtGeneration.hh"
#include "G4UnitsTable.hh"
// (Description)
// This is a primitive scorer class for scoring minimum energy of
// newly produced particles in the geometry.
//
// Created: 2005-11-17 Tsukasa ASO, Akinori Kimura.
//
G4PSMinKinEAtGeneration::G4PSMinKinEAtGeneration(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1)
{;}
G4PSMinKinEAtGeneration::~G4PSMinKinEAtGeneration()
{;}
G4bool G4PSMinKinEAtGeneration::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
// ===============
// First Step,
// Confirm this is a newly produced secondary.
//
//- check for newly produced particle. e.g. Step number is 1.
if ( aStep->GetTrack()->GetCurrentStepNumber() != 1) return FALSE;
//- check for this is not a primary particle. e.g. ParentID != 0 .
if ( aStep->GetTrack()->GetParentID() == 0 ) return FALSE;
//===============================================
//- This is a newly produced secondary particle.
//===============================================
// ===============
// Second Step,
// Confirm this track has lower energy than previous one.
//
// -Kinetic energy of this particle at the starting point.
G4double kinetic = aStep->GetPreStepPoint()->GetKineticEnergy();
// -Stored value in the current HitsMap.
G4int index = GetIndex(aStep);
G4double* mapValue= ((*EvtMap)[index]);
// -
// If mapValue exits (e.g not NULL ), compare it with
// current track's kinetic energy.
if ( mapValue && ( kinetic > *mapValue ) ) return FALSE;
// -
// Current Track is a newly produced secondary and has lower
// kinetic energy than previous one in this geometry.
//
EvtMap->set(index, kinetic);
return TRUE;
}
void G4PSMinKinEAtGeneration::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(detector->GetName(),GetName());
if(HCID < 0) {HCID = GetCollectionID(0);}
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSMinKinEAtGeneration::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSMinKinEAtGeneration::clear(){
EvtMap->clear();
}
void G4PSMinKinEAtGeneration::DrawAll()
{;}
void G4PSMinKinEAtGeneration::PrintAll()
{
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " num of step: " << G4BestUnit(*(itr->second),"Energy")
<< G4endl;
}
}
+86
View File
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSNofSecondary.cc,v 1.2 2005/12/13 08:43:49 gunter Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSNofSecondary
#include "G4PSNofSecondary.hh"
// (Description)
// This is a primitive scorer class for scoring number of steps in the
// Cell.
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
G4PSNofSecondary::G4PSNofSecondary(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1)
{;}
G4PSNofSecondary::~G4PSNofSecondary()
{;}
G4bool G4PSNofSecondary::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
//- check for newly produced particle. e.g. first step.
if ( aStep->GetTrack()->GetCurrentStepNumber() != 1) return FALSE;
//- check for this is not a primary particle. e.g. ParentID > 0 .
if ( aStep->GetTrack()->GetParentID() == 0 ) return FALSE;
//
//- This is a newly produced secondary particle.
G4int index = GetIndex(aStep);
G4double weight = aStep->GetPreStepPoint()->GetWeight();
EvtMap->add(index,weight);
return TRUE;
}
void G4PSNofSecondary::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(detector->GetName(),GetName());
if(HCID < 0) {HCID = GetCollectionID(0);}
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSNofSecondary::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSNofSecondary::clear(){
EvtMap->clear();
}
void G4PSNofSecondary::DrawAll()
{;}
void G4PSNofSecondary::PrintAll()
{
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " num of step: " << *(itr->second)
<< G4endl;
}
}
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSNofStep.cc,v 1.4 2005/12/13 08:43:51 gunter Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSNofStep
#include "G4PSNofStep.hh"
// (Description)
// This is a primitive scorer class for scoring number of steps in the
// Cell.
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
G4PSNofStep::G4PSNofStep(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1)
{;}
G4PSNofStep::~G4PSNofStep()
{;}
G4bool G4PSNofStep::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4int index = GetIndex(aStep);
G4double val = 1.0;
EvtMap->add(index,val);
return TRUE;
}
void G4PSNofStep::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(detector->GetName(),GetName());
if(HCID < 0) {HCID = GetCollectionID(0);}
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSNofStep::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSNofStep::clear(){
EvtMap->clear();
}
void G4PSNofStep::DrawAll()
{;}
void G4PSNofStep::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " num of step: " << *(itr->second)
<< G4endl;
}
}
@@ -0,0 +1,131 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSPassageCellFlux.cc,v 1.4 2005/11/19 03:16:07 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSPassageCellFlux
#include "G4PSPassageCellFlux.hh"
#include "G4StepStatus.hh"
#include "G4Track.hh"
#include "G4VSolid.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring cell flux.
// The Cell Flux is defined by a track length divided by a geometry
// volume, where only tracks passing through the geometry are taken
// into account. e.g. the unit of Cell Flux is mm/mm3.
//
// If you want to score all tracks in the geometry volume,
// please use G4PSCellFlux.
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
///////////////////////////////////////////////////////////////////////////////
G4PSPassageCellFlux::G4PSPassageCellFlux(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fCurrentTrkID(-1),fCellFlux(0)
{;}
G4PSPassageCellFlux::~G4PSPassageCellFlux()
{;}
G4bool G4PSPassageCellFlux::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
if ( IsPassed(aStep) ) {
fCellFlux /=
aStep->GetPreStepPoint()->GetPhysicalVolume()
->GetLogicalVolume()->GetSolid()->GetCubicVolume();
G4int index = GetIndex(aStep);
EvtMap->add(index,fCellFlux);
}
return TRUE;
}
G4bool G4PSPassageCellFlux::IsPassed(G4Step* aStep){
G4bool Passed = FALSE;
G4bool IsEnter = aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary;
G4bool IsExit = aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary;
G4int trkid = aStep->GetTrack()->GetTrackID();
G4double trklength = aStep->GetStepLength();
trklength *= aStep->GetPreStepPoint()->GetWeight();
if ( IsEnter &&IsExit ){ // Passed at one step
fCellFlux = trklength; // Track length is absolutely given.
Passed = TRUE;
}else if ( IsEnter ){ // Enter a new geometry
fCurrentTrkID = trkid; // Resetting the current track.
fCellFlux = trklength;
}else if ( IsExit ){ // Exit a current geometry
if ( fCurrentTrkID == trkid ) {// if the track is same as entered,
fCellFlux += trklength; // add the track length to current one.
Passed = TRUE;
}
}else{ // Inside geometry
if ( fCurrentTrkID == trkid ){ // if the track is same as entered,
fCellFlux += trklength; // adding the track length to current one.
}
}
return Passed;
}
void G4PSPassageCellFlux::Initialize(G4HCofThisEvent* HCE)
{
fCurrentTrkID = -1;
EvtMap = new G4THitsMap<G4double>(detector->GetName(),
GetName());
if ( HCID < 0 ) HCID = GetCollectionID(0);
HCE->AddHitsCollection(HCID,EvtMap);
}
void G4PSPassageCellFlux::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSPassageCellFlux::clear(){
EvtMap->clear();
}
void G4PSPassageCellFlux::DrawAll()
{;}
void G4PSPassageCellFlux::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() <<G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " cell flux : " << *(itr->second)*cm*cm << " [cm^-2]"
<< G4endl;
}
}
@@ -0,0 +1,119 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSPassageCurrent.cc,v 1.3 2005/11/19 03:16:07 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSPassageCurrent
#include "G4PSPassageCurrent.hh"
#include "G4StepStatus.hh"
#include "G4Track.hh"
#include "G4VSolid.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring number of tracks,
// where only tracks passing through the geometry are taken
// into account.
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
///////////////////////////////////////////////////////////////////////////////
G4PSPassageCurrent::G4PSPassageCurrent(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fCurrentTrkID(-1),fCurrent(0)
{;}
G4PSPassageCurrent::~G4PSPassageCurrent()
{;}
G4bool G4PSPassageCurrent::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
if ( IsPassed(aStep) ) {
fCurrent = aStep->GetPreStepPoint()->GetWeight();
G4int index = GetIndex(aStep);
EvtMap->add(index,fCurrent);
}
return TRUE;
}
G4bool G4PSPassageCurrent::IsPassed(G4Step* aStep){
G4bool Passed = FALSE;
G4bool IsEnter = aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary;
G4bool IsExit = aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary;
G4int trkid = aStep->GetTrack()->GetTrackID();
if ( IsEnter &&IsExit ){ // Passed at one step
Passed = TRUE;
}else if ( IsEnter ){ // Enter a new geometry
fCurrentTrkID = trkid; // Resetting the current track.
}else if ( IsExit ){ // Exit a current geometry
if ( fCurrentTrkID == trkid ) {
Passed = TRUE; // if the track is same as entered.
}
}else{ // Inside geometry
if ( fCurrentTrkID == trkid ){ // Adding the track length to current one ,
}
}
return Passed;
}
void G4PSPassageCurrent::Initialize(G4HCofThisEvent* HCE)
{
fCurrentTrkID = -1;
EvtMap = new G4THitsMap<G4double>(detector->GetName(),
GetName());
if ( HCID < 0 ) HCID = GetCollectionID(0);
HCE->AddHitsCollection(HCID,EvtMap);
}
void G4PSPassageCurrent::EndOfEvent(G4HCofThisEvent*)
{
}
void G4PSPassageCurrent::clear(){
EvtMap->clear();
}
void G4PSPassageCurrent::DrawAll()
{;}
void G4PSPassageCurrent::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() <<G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " cell current : " << *(itr->second)
<< G4endl;
}
}
@@ -0,0 +1,123 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSPassageTrackLength.cc,v 1.2 2005/11/19 00:44:00 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSPassageTrackLength
#include "G4PSPassageTrackLength.hh"
#include "G4StepStatus.hh"
#include "G4Track.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring only track length.
// The tracks which passed a geometry is taken into account.
//
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
///////////////////////////////////////////////////////////////////////////////
G4PSPassageTrackLength::G4PSPassageTrackLength(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fCurrentTrkID(-1),fTrackLength(0.),
weighted(false)
{;}
G4PSPassageTrackLength::~G4PSPassageTrackLength()
{;}
G4bool G4PSPassageTrackLength::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
if ( IsPassed(aStep) ) {
G4int index = GetIndex(aStep);
EvtMap->add(index,fTrackLength);
}
return TRUE;
}
G4bool G4PSPassageTrackLength::IsPassed(G4Step* aStep){
G4bool Passed = FALSE;
G4bool IsEnter = aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary;
G4bool IsExit = aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary;
G4int trkid = aStep->GetTrack()->GetTrackID();
G4double trklength = aStep->GetStepLength();
if(weighted) trklength *= aStep->GetPreStepPoint()->GetWeight();
if ( IsEnter &&IsExit ){ // Passed at one step
fTrackLength = trklength; // Track length is absolutely given.
Passed = TRUE;
}else if ( IsEnter ){ // Enter a new geometry
fCurrentTrkID = trkid; // Resetting the current track.
fTrackLength = trklength;
}else if ( IsExit ){ // Exit a current geometry
if ( fCurrentTrkID == trkid ) {
fTrackLength += trklength; // Adding the track length to current one,
Passed = TRUE; // if the track is same as entered.
}
}else{ // Inside geometry
if ( fCurrentTrkID == trkid ){ // Adding the track length to current one ,
fTrackLength += trklength; // if the track is same as entered.
}
}
return Passed;
}
void G4PSPassageTrackLength::Initialize(G4HCofThisEvent* HCE)
{
fCurrentTrkID = -1;
EvtMap = new G4THitsMap<G4double>(detector->GetName(),GetName());
if ( HCID < 0 ) HCID = GetCollectionID(0);
HCE->AddHitsCollection(HCID,EvtMap);
}
void G4PSPassageTrackLength::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSPassageTrackLength::clear(){
EvtMap->clear();
}
void G4PSPassageTrackLength::DrawAll()
{;}
void G4PSPassageTrackLength::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveSenstivity " << GetName() << G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " track length : " << G4BestUnit(*(itr->second),"Length")
<< G4endl;
}
}
@@ -0,0 +1,153 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSSphereSurfaceCurrent.cc,v 1.3 2005/11/17 22:53:38 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSSphereSurfaceCurrent
#include "G4PSSphereSurfaceCurrent.hh"
#include "G4StepStatus.hh"
#include "G4Track.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring only Surface Current.
// Current version assumes only for G4Sphere shape.
//
// Surface is defined at the inside of sphere.
// Direction -Rmin +Rmax
// 0 IN || OUT ->|<- |
// 1 IN ->| |
// 2 OUT |<- |
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
///////////////////////////////////////////////////////////////////////////////
G4PSSphereSurfaceCurrent::G4PSSphereSurfaceCurrent(G4String name,
G4int direction, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction)
{;}
G4PSSphereSurfaceCurrent::~G4PSSphereSurfaceCurrent()
{;}
G4bool G4PSSphereSurfaceCurrent::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4StepPoint* preStep = aStep->GetPreStepPoint();
G4VSolid * solid =
preStep->GetPhysicalVolume()->GetLogicalVolume()->GetSolid();
if( solid->GetEntityType() != "G4Sphere" ){
G4Exception("G4PSSphereSurfaceCurrentScorer. - Solid type is not supported.");
return FALSE;
}
G4Sphere* sphereSolid = (G4Sphere*)(solid);
G4int dirFlag =IsSelectedSurface(aStep,sphereSolid);
if ( dirFlag > 0 ) {
G4double radi = sphereSolid->GetInsideRadius();
G4double dph = sphereSolid->GetDeltaPhiAngle()/radian;
G4double stth = sphereSolid->GetStartThetaAngle()/radian;
G4double enth = stth+sphereSolid->GetDeltaThetaAngle()/radian;
G4double square = radi*radi*dph*( -std::cos(enth) + std::cos(stth) );
G4double current = preStep->GetWeight(); // Current (Particle Weight)
current = current/square; // Current with angle.
if ( fDirection == fCurrent_InOut || fDirection == dirFlag ){
G4int index = GetIndex(aStep);
EvtMap->add(index,current);
}
}
return TRUE;
}
G4int G4PSSphereSurfaceCurrent::IsSelectedSurface(G4Step* aStep, G4Sphere* sphereSolid){
G4TouchableHandle theTouchable =
aStep->GetPreStepPoint()->GetTouchableHandle();
if (aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary ){
// Entering Geometry
G4ThreeVector stppos1= aStep->GetPreStepPoint()->GetPosition();
G4ThreeVector localpos1 =
theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1);
G4double localR2 = localpos1.x()*localpos1.x()
+localpos1.y()*localpos1.y()
+localpos1.z()*localpos1.z();
G4double InsideRadius2 =
sphereSolid->GetInsideRadius()*sphereSolid->GetInsideRadius();
if(fabs( localR2 - InsideRadius2 ) < kCarTolerance ){
return fCurrent_In;
}
}
if (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary ){
// Exiting Geometry
G4ThreeVector stppos2= aStep->GetPostStepPoint()->GetPosition();
G4ThreeVector localpos2 =
theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos2);
G4double localR2 = localpos2.x()*localpos2.x()
+localpos2.y()*localpos2.y()
+localpos2.z()*localpos2.z();
G4double InsideRadius2 =
sphereSolid->GetInsideRadius()*sphereSolid->GetInsideRadius();
if(fabs( localR2 - InsideRadius2 ) < kCarTolerance ){
return fCurrent_Out;
}
}
return -1;
}
void G4PSSphereSurfaceCurrent::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(detector->GetName(), GetName());
if ( HCID < 0 ) HCID = GetCollectionID(0);
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSSphereSurfaceCurrent::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSSphereSurfaceCurrent::clear(){
EvtMap->clear();
}
void G4PSSphereSurfaceCurrent::DrawAll()
{;}
void G4PSSphereSurfaceCurrent::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() <<G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " current : " << *(itr->second)
<< G4endl;
}
}
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PSTrackLength.cc,v 1.4 2005/12/13 08:43:54 gunter Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4PSTrackLength
#include "G4PSTrackLength.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring sum of track length.
//
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
///////////////////////////////////////////////////////////////////////////////
G4PSTrackLength::G4PSTrackLength(G4String name, G4int depth)
:G4VPrimitiveScorer(name,depth),HCID(-1),weighted(false)
{;}
G4PSTrackLength::~G4PSTrackLength()
{;}
G4bool G4PSTrackLength::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4double trklength = aStep->GetStepLength();
if ( trklength == 0. ) return FALSE;
if(weighted) trklength *= aStep->GetPreStepPoint()->GetWeight();
G4int index = GetIndex(aStep);
EvtMap->add(index,trklength);
return TRUE;
}
void G4PSTrackLength::Initialize(G4HCofThisEvent* HCE)
{
EvtMap = new G4THitsMap<G4double>(detector->GetName(),GetName());
if(HCID < 0) {HCID = GetCollectionID(0);}
HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
}
void G4PSTrackLength::EndOfEvent(G4HCofThisEvent*)
{;}
void G4PSTrackLength::clear(){
EvtMap->clear();
}
void G4PSTrackLength::DrawAll()
{;}
void G4PSTrackLength::PrintAll()
{
G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << EvtMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
for(; itr != EvtMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " track length: " << G4BestUnit(*(itr->second),"Length")
<< G4endl;
}
}
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4SDChargedFilter.cc,v 1.1 2005/11/16 23:04:04 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4VSensitiveDetector
#include "G4SDChargedFilter.hh"
#include "G4Step.hh"
#include "G4TouchableHistory.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
////////////////////////////////////////////////////////////////////////////////
// class description:
//
// This is the class of a filter to be associated with a
// sensitive detector.
//
// Created: 2005-11-14 Tsukasa ASO.
//
///////////////////////////////////////////////////////////////////////////////
G4SDChargedFilter::G4SDChargedFilter(G4String name)
:G4VSDFilter(name)
{;}
G4SDChargedFilter::~G4SDChargedFilter()
{;}
G4bool G4SDChargedFilter::Accept(const G4Step* aStep) const
{
if (aStep->GetPreStepPoint()->GetCharge() != 0. ) return TRUE;
return FALSE;
}
@@ -0,0 +1,71 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4SDKineticEnergyFilter.cc,v 1.4 2005/11/22 21:41:55 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4VSensitiveDetector
#include "G4SDKineticEnergyFilter.hh"
#include "G4Step.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////////////////////////////////////
// class description:
//
// This is the class of a filter to be associated with a
// sensitive detector.
//
//
// Created: 2005-11-14 Tsukasa ASO.
//
///////////////////////////////////////////////////////////////////////////////
G4SDKineticEnergyFilter::G4SDKineticEnergyFilter(G4String name,
G4double elow,
G4double ehigh)
:G4VSDFilter(name),fLowEnergy(elow),fHighEnergy(ehigh)
{;}
G4SDKineticEnergyFilter::~G4SDKineticEnergyFilter()
{;}
G4bool G4SDKineticEnergyFilter::Accept(const G4Step* aStep) const
{
G4double kinetic = aStep->GetPreStepPoint()->GetKineticEnergy();
if ( kinetic < fLowEnergy ) return FALSE;
if ( kinetic >= fHighEnergy ) return FALSE;
return TRUE;
}
void G4SDKineticEnergyFilter::SetKineticEnergy(G4double elow, G4double ehigh){
fLowEnergy = elow;
fHighEnergy = ehigh;
}
void G4SDKineticEnergyFilter::show() {
G4cout << " G4SDKineticEnergyFilter:: " << GetName()
<< " LowE " << G4BestUnit(fLowEnergy,"Energy")
<< " HighE " << G4BestUnit(fHighEnergy,"Energy")
<<G4endl;
}
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4SDNeutralFilter.cc,v 1.1 2005/11/16 23:04:04 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4VSensitiveDetector
#include "G4SDNeutralFilter.hh"
#include "G4Step.hh"
#include "G4TouchableHistory.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
////////////////////////////////////////////////////////////////////////////////
// class description:
//
// This is the class of a filter to be associated with a
// sensitive detector.
//
// Created: 2005-11-14 Tsukasa ASO.
//
///////////////////////////////////////////////////////////////////////////////
G4SDNeutralFilter::G4SDNeutralFilter(G4String name)
:G4VSDFilter(name)
{;}
G4SDNeutralFilter::~G4SDNeutralFilter()
{;}
G4bool G4SDNeutralFilter::Accept(const G4Step* aStep) const
{
if (aStep->GetPreStepPoint()->GetCharge()== 0. ) return TRUE;
return FALSE;
}
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4SDParticleFilter.cc,v 1.2 2005/11/22 21:41:55 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4VSensitiveDetector
#include "G4SDParticleFilter.hh"
#include "G4Step.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
////////////////////////////////////////////////////////////////////////////////
// class description:
//
// This is the class of a filter to be associated with a
// sensitive detector.
// This class filters steps by partilce definition.
//
// Created: 2005-11-14 Tsukasa ASO.
//
///////////////////////////////////////////////////////////////////////////////
G4SDParticleFilter::G4SDParticleFilter(G4String name)
:G4VSDFilter(name)
{
thePdef.clear();
}
G4SDParticleFilter::G4SDParticleFilter(G4String name,
const G4String& particleName)
:G4VSDFilter(name)
{
thePdef.clear();
G4ParticleDefinition* pd = G4ParticleTable::GetParticleTable()->FindParticle(particleName);
if(!pd)
{
G4String msg = "Particle <";
msg += particleName;
msg += "> not found.";
G4Exception("G4SDParticleFilter::G4SDParticleFilter()",
"DetUtil0000",FatalException,msg);
}
thePdef.push_back(pd);
}
G4SDParticleFilter::G4SDParticleFilter(G4String name,
const std::vector<G4String>& particleNames)
:G4VSDFilter(name)
{
thePdef.clear();
for ( size_t i = 0; i < particleNames.size(); i++){
G4ParticleDefinition* pd = G4ParticleTable::GetParticleTable()->FindParticle(particleNames[i]);
if(!pd)
{
G4String msg = "Particle <";
msg += particleNames[i];
msg += "> not found.";
G4Exception("G4SDParticleFilter::G4SDParticleFilter()",
"DetUtil0000",FatalException,msg);
}
thePdef.push_back(pd);
}
}
G4SDParticleFilter::G4SDParticleFilter(G4String name,
const std::vector<G4ParticleDefinition*>& particleDef)
:G4VSDFilter(name), thePdef(particleDef)
{
for ( size_t i = 0; i < particleDef.size(); i++){
if(!particleDef[i]) G4Exception("G4SDParticleFilter::G4SDParticleFilter()","DetUtil0001",FatalException,
"NULL pointer is found in the given particleDef vector.");
}
}
G4SDParticleFilter::~G4SDParticleFilter()
{
thePdef.clear();
}
G4bool G4SDParticleFilter::Accept(const G4Step* aStep) const
{
for ( size_t i = 0; i < thePdef.size(); i++){
if ( thePdef[i] == aStep->GetTrack()->GetDefinition() ) return TRUE;
}
return FALSE;
}
void G4SDParticleFilter::add(const G4String& particleName)
{
G4ParticleDefinition* pd =
G4ParticleTable::GetParticleTable()->FindParticle(particleName);
if(!pd)
{
G4String msg = "Particle <";
msg += particleName;
msg += "> not found.";
G4Exception("G4SDParticleFilter::add()",
"DetUtil0002",FatalException,msg);
}
for ( size_t i = 0; i < thePdef.size(); i++){
if ( thePdef[i] == pd ) return;
}
thePdef.push_back(pd);
}
void G4SDParticleFilter::show(){
G4cout << "----G4SDParticleFileter particle list------"<<G4endl;
for ( size_t i = 0; i < thePdef.size(); i++){
G4cout << thePdef[i]->GetParticleName() << G4endl;
}
G4cout << "-------------------------------------------"<<G4endl;
}
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4SDParticleWithEnergyFilter.cc,v 1.1 2005/11/16 23:04:04 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4VSensitiveDetector
#include "G4SDParticleWithEnergyFilter.hh"
#include "G4Step.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
////////////////////////////////////////////////////////////////////////////////
// class description:
//
// This is the class of a filter to be associated with a
// sensitive detector.
// This class filters steps by partilce definition and kinetic energy.
//
// Created: 2005-11-14 Tsukasa ASO.
//
///////////////////////////////////////////////////////////////////////////////
G4SDParticleWithEnergyFilter::G4SDParticleWithEnergyFilter(G4String name,
G4double elow,
G4double ehigh)
:G4VSDFilter(name)
{
fParticleFilter = new G4SDParticleFilter(name);
fKineticFilter = new G4SDKineticEnergyFilter(name,elow,ehigh);
}
G4SDParticleWithEnergyFilter::~G4SDParticleWithEnergyFilter()
{
delete fParticleFilter;
delete fKineticFilter;
}
G4bool G4SDParticleWithEnergyFilter::Accept(const G4Step* aStep) const
{
if ( ! fParticleFilter->Accept(aStep) ) return FALSE;
if ( ! fKineticFilter->Accept(aStep) ) return FALSE;
return TRUE;
}
void G4SDParticleWithEnergyFilter::add(const G4String& particleName)
{
fParticleFilter->add(particleName);
}
void G4SDParticleWithEnergyFilter::SetKineticEnergy(G4double elow,
G4double ehigh)
{
fKineticFilter->SetKineticEnergy(elow,ehigh);
}
void G4SDParticleWithEnergyFilter::show(){
fParticleFilter->show();
fKineticFilter->show();
}