Import Geant4 6.0.0 source tree
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTJpegCoder.cc,v 1.4 2001/07/11 10:09:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTJpegMaker.cc,v 1.9 2003/06/18 08:23:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RTMessenger.cc,v 1.6 2002/12/05 01:37:36 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4RTMessenger.cc,v 1.7 2003/09/18 11:13:25 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -117,6 +117,11 @@ G4RTMessenger::G4RTMessenger(G4RayTracer* p1,G4RTSteppingAction* p2)
|
||||
transCmd->SetGuidance("Ignore transparency even if the alpha of G4Colour < 1.");
|
||||
transCmd->SetParameterName("flag",true);
|
||||
transCmd->SetDefaultValue(false);
|
||||
|
||||
bkgColCmd = new G4UIcmdWith3Vector("/vis/rayTracer/backgroundColour",this);
|
||||
bkgColCmd->SetGuidance("Set background colour: red green blue: range 0.->1."); bkgColCmd->SetGuidance("E.g: /vis/rayTracer/backgroundColour 0 0 0");
|
||||
bkgColCmd->SetParameterName("red","green","blue",true);
|
||||
bkgColCmd->SetDefaultValue(G4ThreeVector(1.,1.,1.));
|
||||
}
|
||||
|
||||
G4RTMessenger::~G4RTMessenger()
|
||||
@@ -132,6 +137,7 @@ G4RTMessenger::~G4RTMessenger()
|
||||
delete distCmd;
|
||||
delete transCmd;
|
||||
delete fileCmd;
|
||||
delete bkgColCmd;
|
||||
delete rayDirectory;
|
||||
}
|
||||
|
||||
@@ -158,6 +164,8 @@ G4String G4RTMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
{ currentValue = distCmd->ConvertToString(theTracer->GetDistortion()); }
|
||||
else if(command==transCmd)
|
||||
{ currentValue = transCmd->ConvertToString(theSteppingAction->GetIgnoreTransparency()); }
|
||||
else if(command==bkgColCmd)
|
||||
{ currentValue = bkgColCmd->ConvertToString(theTracer->GetBackgroundColour()); }
|
||||
return currentValue;
|
||||
}
|
||||
|
||||
@@ -181,6 +189,8 @@ void G4RTMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{ theTracer->SetAttenuationLength(attCmd->GetNewDoubleValue(newValue)); }
|
||||
else if(command==distCmd)
|
||||
{ theTracer->SetDistortion(distCmd->GetNewBoolValue(newValue)); }
|
||||
else if(command==bkgColCmd)
|
||||
{ theTracer->SetBackgroundColour(bkgColCmd->GetNew3VectorValue(newValue)); }
|
||||
else if(command==transCmd)
|
||||
{ theSteppingAction->SetIgnoreTransparency(transCmd->GetNewBoolValue(newValue)); }
|
||||
else if(command==fileCmd)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTOutBitStream.cc,v 1.4 2001/07/11 10:09:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4RTSimpleScanner.cc,v 1.1 2003/09/18 11:14:04 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4RTSimpleScanner.hh"
|
||||
|
||||
G4RTSimpleScanner::G4RTSimpleScanner():
|
||||
theNRow(0), theNColumn(0), theIRow(0), theIColumn(0) {}
|
||||
|
||||
void G4RTSimpleScanner::Initialize(G4int nRow, G4int nColumn) {
|
||||
theNRow = nRow;
|
||||
theNColumn = nColumn;
|
||||
theIRow = 0;
|
||||
theIColumn = 0;
|
||||
}
|
||||
|
||||
G4bool G4RTSimpleScanner::Coords(G4int& iRow, G4int& iColumn) {
|
||||
if (theIRow >= theNRow) return false;
|
||||
iRow = theIRow;
|
||||
iColumn = theIColumn;
|
||||
if (++theIColumn >= theNColumn) {
|
||||
theIColumn = 0;
|
||||
++theIRow;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTSteppingAction.cc,v 1.6 2001/07/11 10:09:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTTrackingAction.cc,v 1.4 2003/05/30 13:01:21 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayShooter.cc,v 1.2 2001/07/11 10:09:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#include "G4RayShooter.hh"
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracer.cc,v 1.11 2002/12/11 16:00:00 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4RayTracer.cc,v 1.13 2003/09/18 11:14:04 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "G4RayTrajectory.hh"
|
||||
#include "G4RayTrajectoryPoint.hh"
|
||||
#include "G4RTJpegMaker.hh"
|
||||
#include "G4RTSimpleScanner.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4StateManager.hh"
|
||||
@@ -50,13 +51,18 @@
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
|
||||
G4RayTracer::G4RayTracer(G4VFigureFileMaker* figMaker)
|
||||
G4RayTracer::G4RayTracer(G4VFigureFileMaker* figMaker,
|
||||
G4VRTScanner* scanner)
|
||||
:G4VGraphicsSystem("RayTracer","RayTracer",RAYTRACER_FEATURES,
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
theFigMaker = figMaker;
|
||||
if(!theFigMaker) theFigMaker = new G4RTJpegMaker();
|
||||
theScanner = scanner;
|
||||
if(!theScanner) theScanner = new G4RTSimpleScanner;
|
||||
theRayShooter = new G4RayShooter();
|
||||
theRayTracerEventAction = 0;
|
||||
theRayTracerStackingAction = 0;
|
||||
@@ -76,6 +82,8 @@ G4RayTracer::G4RayTracer(G4VFigureFileMaker* figMaker)
|
||||
attenuationLength = 1.0*m;
|
||||
|
||||
distortionOn = false;
|
||||
|
||||
backgroundColour = G4Colour(1.,1.,1.);
|
||||
}
|
||||
|
||||
G4RayTracer::~G4RayTracer()
|
||||
@@ -84,6 +92,7 @@ G4RayTracer::~G4RayTracer()
|
||||
delete theRayTracerTrackingAction;
|
||||
delete theRayTracerSteppingAction;
|
||||
delete theMessenger;
|
||||
delete theScanner;
|
||||
delete theFigMaker;
|
||||
}
|
||||
|
||||
@@ -176,6 +185,10 @@ void G4RayTracer::RestoreUserActions()
|
||||
{ theSDMan->Activate("/",true); }
|
||||
}
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
#include "G4Geantino.hh"
|
||||
|
||||
G4bool G4RayTracer::CreateBitMap()
|
||||
{
|
||||
G4int iEvent = 0;
|
||||
@@ -183,10 +196,34 @@ G4bool G4RayTracer::CreateBitMap()
|
||||
G4double viewSpanX = stepAngle*nColumn;
|
||||
G4double viewSpanY = stepAngle*nRow;
|
||||
G4bool succeeded;
|
||||
for(int iRow=0;iRow<nRow;iRow++)
|
||||
{
|
||||
for(int iColumn=0;iColumn<nColumn;iColumn++)
|
||||
{
|
||||
|
||||
// Confirm process(es) of Geantino is initialized
|
||||
G4RegionStore::GetInstance()->UpdateMaterialList();
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->UpdateCoupleTable();
|
||||
G4ProcessVector* pVector
|
||||
= G4Geantino::GeantinoDefinition()->GetProcessManager()->GetProcessList();
|
||||
for (G4int j=0; j < pVector->size(); ++j) {
|
||||
(*pVector)[j]->BuildPhysicsTable(*(G4Geantino::GeantinoDefinition()));
|
||||
}
|
||||
|
||||
// Close geometry and set the application state
|
||||
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
|
||||
geomManager->OpenGeometry();
|
||||
geomManager->CloseGeometry(1,0);
|
||||
|
||||
G4ThreeVector center(0,0,0);
|
||||
G4Navigator* navigator =
|
||||
G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
|
||||
navigator->LocateGlobalPointAndSetup(center,0,false);
|
||||
|
||||
G4StateManager* theStateMan = G4StateManager::GetStateManager();
|
||||
theStateMan->SetNewState(G4State_GeomClosed);
|
||||
|
||||
// Event loop
|
||||
theScanner->Initialize(nRow,nColumn);
|
||||
G4int iRow, iColumn;
|
||||
while (theScanner->Coords(iRow,iColumn)) {
|
||||
G4int iCoord = iRow * nColumn + iColumn;
|
||||
G4Event* anEvent = new G4Event(iEvent++);
|
||||
|
||||
G4double angleX = -(viewSpanX/2. - iColumn*stepAngle);
|
||||
@@ -225,21 +262,21 @@ G4bool G4RayTracer::CreateBitMap()
|
||||
if (interceptable) {
|
||||
theRayShooter->Shoot(anEvent,rayPosition,rayDirection);
|
||||
theEventManager->ProcessOneEvent(anEvent);
|
||||
succeeded = GenerateColour(anEvent);
|
||||
succeeded = GenerateColour(anEvent,iCoord);
|
||||
//G4cout << iColumn << " " << iRow << " " << anEvent->GetEventID() << G4endl;
|
||||
}
|
||||
else { // Ray does not intercept world at all.
|
||||
// Generate background colour...
|
||||
G4int iEvent = anEvent->GetEventID();
|
||||
colorR[iEvent] = 0;
|
||||
colorG[iEvent] = 0;
|
||||
colorB[iEvent] = 0;
|
||||
// Store background colour...
|
||||
colorR[iCoord] = (unsigned char)(int(255*backgroundColour.GetRed()));
|
||||
colorG[iCoord] = (unsigned char)(int(255*backgroundColour.GetGreen()));
|
||||
colorB[iCoord] = (unsigned char)(int(255*backgroundColour.GetBlue()));
|
||||
succeeded = true;
|
||||
}
|
||||
delete anEvent;
|
||||
if(!succeeded) return false;
|
||||
}
|
||||
}
|
||||
|
||||
theStateMan->SetNewState(G4State_Idle);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -249,7 +286,7 @@ void G4RayTracer::CreateFigureFile(G4String fileName)
|
||||
theFigMaker->CreateFigureFile(fileName,nColumn,nRow,colorR,colorG,colorB);
|
||||
}
|
||||
|
||||
G4bool G4RayTracer::GenerateColour(G4Event* anEvent)
|
||||
G4bool G4RayTracer::GenerateColour(G4Event* anEvent, G4int iCoord)
|
||||
{
|
||||
G4TrajectoryContainer * trajectoryContainer = anEvent->GetTrajectoryContainer();
|
||||
|
||||
@@ -260,7 +297,7 @@ G4bool G4RayTracer::GenerateColour(G4Event* anEvent)
|
||||
if(nPoint==0) return false;
|
||||
|
||||
G4Colour rayColour;
|
||||
G4Colour initialColour(1.,1.,1.);
|
||||
G4Colour initialColour(backgroundColour);
|
||||
if( trajectory->GetPointC(nPoint-1)->GetPostStepAtt() )
|
||||
{ initialColour = GetSurfaceColour(trajectory->GetPointC(nPoint-1)); }
|
||||
rayColour = Attenuate(trajectory->GetPointC(nPoint-1),initialColour);
|
||||
@@ -273,10 +310,9 @@ G4bool G4RayTracer::GenerateColour(G4Event* anEvent)
|
||||
rayColour = Attenuate(trajectory->GetPointC(i),mixedColour);
|
||||
}
|
||||
|
||||
G4int iEvent = anEvent->GetEventID();
|
||||
colorR[iEvent] = (unsigned char)(int(255*rayColour.GetRed()));
|
||||
colorG[iEvent] = (unsigned char)(int(255*rayColour.GetGreen()));
|
||||
colorB[iEvent] = (unsigned char)(int(255*rayColour.GetBlue()));
|
||||
colorR[iCoord] = (unsigned char)(int(255*rayColour.GetRed()));
|
||||
colorG[iCoord] = (unsigned char)(int(255*rayColour.GetGreen()));
|
||||
colorB[iCoord] = (unsigned char)(int(255*rayColour.GetBlue()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerSceneHandler.cc,v 1.2 2001/07/11 10:09:05 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerViewer.cc,v 1.11 2003/06/16 17:13:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
|
||||
#include "G4RayTracerViewer.hh"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTrajectory.cc,v 1.12 2003/06/16 17:13:45 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTrajectoryPoint.cc,v 1.3 2001/07/11 10:09:05 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user