Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.11 2006/05/22 08:49:27 allison Exp $
# $Id: GNUmakefile,v 1.12 2009/11/04 12:44:39 allison Exp $
# --------------------------------------------------------------
# GNUmakefile for modeling library. John Allison, 31/12/1997.
# --------------------------------------------------------------
@@ -31,6 +31,7 @@ CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
CPPFLAGS += -I$(G4BASE)/processes/management/include
CPPFLAGS += -I$(G4BASE)/particles/management/include
CPPFLAGS += -I$(G4BASE)/event/include
CPPFLAGS += -I$(G4BASE)/digits_hits/utils/include
CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
CPPFLAGS += -I$(G4BASE)/digits_hits/digits/include
CPPFLAGS += -I$(G4BASE)/digits_hits/detector/include
+32 -2
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.106 2008/11/21 21:50:02 perl Exp $
$Id: History,v 1.115 2009/11/04 12:44:39 allison Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,7 +20,37 @@ committal in the CVS repository !
History file for visualization/modeling
---------------------------------------
27th July 2008 John Allison (modeling-V09-01-01)
4th November 2009 John Allison
- G4PSHitsModel:
o Now intended as end-of-run model.
o Picks up hits from G4ScoringManager instead of event.
22nd October 2009 John Allison (modeling-V09-02-05 coworks greps-V09-02-02)
- Added G4PSHitsModel for gMocren driver.
- G4PhysicalVolumeModel.cc: Makes use of HepPolyhedronProcessor.
21st October 2009 John Allison (modeling-V09-02-04 coworks greps-V09-02-02)
- G4BoundingSphereScene, G4PhysicalVolumeMassScene,
G4PhysicalVolumeSearchScene:
o Added empty AddCompound (const G4THitsMap<G4double>&) methods.
10th October 2009 John Allison (modeling-V09-02-03)
- G4PhysicalVolumeModel: Added G4PhysicalVolumeModelTouchable. Used in
ComputeMaterial. Effective for nested parameterisations.
29th September 2009 John Allison (modeling-V09-02-02)
- G4PhysicalVolumeModel.cc: Added warning if logical volume not defined.
25th February 2009 John Allison (modeling-V09-02-01 - needs greps-V09-02-01)
- G4ModelApplyCommandsT: Added visManager->NotifyHandlers() after
application (Apply) of all commands. Forces update of all viewers
after a change of model, e.g., trajectory colour, point size, etc.
24th February 2009 John Allison (modeling-V09-02-00 - needs greps-V09-02-00)
- Added setAux/StepPtsSizeType commands (candidates: "none world screen").
- Added unit to setAux/StepPtsSize for SizeType == world.
27th July 2008 John Allison (modeling-V09-01-01)
- G4PhysicalVolumeSearchScene.cc: Cosmetic improvement to a message.
4th January 2008 John Allison (modeling-V09-01-00)
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4BoundingSphereScene.hh,v 1.18 2008/01/04 21:59:15 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4BoundingSphereScene.hh,v 1.19 2009/10/21 14:17:33 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// John Allison 7th June 1997
@@ -70,6 +70,7 @@ public:
void AddSolid (const G4VSolid& s) {Accrue (s);}
void AddCompound (const G4VTrajectory&) {}
void AddCompound (const G4VHit&) {}
void AddCompound (const G4THitsMap<G4double>&) {}
G4VisExtent GetBoundingSphereExtent ();
const G4Point3D& GetCentre() const {return fCentre;}
G4double GetRadius() const {return fRadius;}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ModelApplyCommandsT.hh,v 1.5 2006/09/11 21:22:02 tinslay Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ModelApplyCommandsT.hh,v 1.6 2009/02/25 14:17:11 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// Abstract model messenges. Derived classes should implement
// the "Apply" method
@@ -43,7 +43,7 @@
#include "G4UIcmdWithAString.hh"
#include "G4UIcommand.hh"
#include "G4VModelCommand.hh"
#include "globals.hh"
#include "G4VVisManager.hh"
#include <sstream>
///////////////////////////////////////////////////////////////////////////
@@ -151,6 +151,8 @@ void G4ModelCmdApplyStringColour<M>::SetNewValue(G4UIcommand* cmd, G4String newV
}
Apply(parameter, myColour);
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if (visManager) visManager->NotifyHandlers();
}
///////////////////////////////////////////////////////////////////////////
@@ -253,6 +255,8 @@ void G4ModelCmdApplyColour<M>::SetNewValue(G4UIcommand* cmd, G4String newValue)
}
Apply(myColour);
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if (visManager) visManager->NotifyHandlers();
}
///////////////////////////////////////////////////////////////////////////
@@ -300,6 +304,8 @@ template <typename M>
void G4ModelCmdApplyBool<M>::SetNewValue(G4UIcommand*, G4String newValue)
{
Apply(fpCmd->GetNewBoolValue(newValue));
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if (visManager) visManager->NotifyHandlers();
}
///////////////////////////////////////////////////////////////////////////
@@ -346,6 +352,8 @@ template <typename M>
void G4ModelCmdApplyNull<M>::SetNewValue(G4UIcommand*, G4String)
{
Apply();
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if (visManager) visManager->NotifyHandlers();
}
///////////////////////////////////////////////////////////////////////////
@@ -394,6 +402,8 @@ template <typename M>
void G4ModelCmdApplyDouble<M>::SetNewValue(G4UIcommand*, G4String newValue)
{
Apply(fpCmd->GetNewDoubleValue(newValue));
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if (visManager) visManager->NotifyHandlers();
}
///////////////////////////////////////////////////////////////////////////
@@ -442,6 +452,8 @@ template <typename M>
void G4ModelCmdApplyDoubleAndUnit<M>::SetNewValue(G4UIcommand*, G4String newValue)
{
Apply(fpCmd->GetNewDoubleValue(newValue));
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if (visManager) visManager->NotifyHandlers();
}
///////////////////////////////////////////////////////////////////////////
@@ -489,6 +501,8 @@ template <typename M>
void G4ModelCmdApplyInteger<M>::SetNewValue(G4UIcommand* cmd, G4String newValue)
{
Apply(fpCmd->GetNewIntValue(newValue));
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if (visManager) visManager->NotifyHandlers();
}
///////////////////////////////////////////////////////////////////////////
@@ -536,6 +550,8 @@ template <typename M>
void G4ModelCmdApplyString<M>::SetNewValue(G4UIcommand*, G4String newValue)
{
Apply(newValue);
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if (visManager) visManager->NotifyHandlers();
}
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ModelCommandUtils.hh,v 1.2 2006/09/13 12:54:31 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ModelCommandUtils.hh,v 1.3 2009/02/24 12:00:56 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// Jane Tinslay September 2006
//
@@ -52,6 +52,7 @@ namespace G4ModelCommandUtils {
messengers.push_back(new G4ModelCmdSetStepPtsVisible<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsColour<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsSize<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsSizeType<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsType<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsFillStyle<G4VisTrajContext>(context, placement));
@@ -59,6 +60,7 @@ namespace G4ModelCommandUtils {
messengers.push_back(new G4ModelCmdSetAuxPtsVisible<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsColour<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsSize<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsSizeType<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsType<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsFillStyle<G4VisTrajContext>(context, placement));
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ModelCommandsT.hh,v 1.12 2006/11/01 10:34:03 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ModelCommandsT.hh,v 1.13 2009/02/24 12:00:56 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// Generic model messenges.
//
@@ -397,44 +397,68 @@ protected:
////////////////////////////////////////////////////////////////////////
// Set auxiliary points size command
template <typename M>
class G4ModelCmdSetAuxPtsSize : public G4ModelCmdApplyDouble<M> {
class G4ModelCmdSetAuxPtsSize : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetAuxPtsSize(M* model, const G4String& placement,
const G4String& cmdName="setAuxPtsSize")
:G4ModelCmdApplyDouble<M>(model, placement, cmdName)
const G4String& cmdName="setAuxPtsSize")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4ModelCmdApplyDouble<M>::Command()->SetGuidance("Set auxiliary points size command");
G4ModelCmdApplyString<M>::Command()->SetGuidance("Set auxiliary points size command");
}
protected:
void Apply(const G4double& myDouble) {
G4VModelCommand<M>::Model()->SetAuxPtsSize(myDouble);
}
void Apply(const G4String& sizeString) {
std::istringstream iss(sizeString);
G4double size;
G4String unit;
iss >> size >> unit;
if (G4VModelCommand<M>::Model()->GetAuxPtsSizeType() == G4VMarker::world)
{
G4double myDouble = G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(sizeString);
G4VModelCommand<M>::Model()->SetAuxPtsSize(myDouble);
}
else // none or screen
{
G4VModelCommand<M>::Model()->SetAuxPtsSize(size);
}
}
};
////////////////////////////////////////////////////////////////////////
// Set step points size command
template <typename M>
class G4ModelCmdSetStepPtsSize : public G4ModelCmdApplyDouble<M> {
class G4ModelCmdSetStepPtsSize : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetStepPtsSize(M* model, const G4String& placement,
const G4String& cmdName="setStepPtsSize")
:G4ModelCmdApplyDouble<M>(model, placement, cmdName)
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4ModelCmdApplyDouble<M>::Command()->SetGuidance("Set step points size command");
G4ModelCmdApplyString<M>::Command()->SetGuidance("Set step points size command");
}
protected:
void Apply(const G4double& myDouble) {
G4VModelCommand<M>::Model()->SetStepPtsSize(myDouble);
}
void Apply(const G4String& sizeString) {
std::istringstream iss(sizeString);
G4double size;
G4String unit;
iss >> size >> unit;
if (G4VModelCommand<M>::Model()->GetStepPtsSizeType() == G4VMarker::world)
{
G4double myDouble = G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(sizeString);
G4VModelCommand<M>::Model()->SetStepPtsSize(myDouble);
}
else // none or screen
{
G4VModelCommand<M>::Model()->SetStepPtsSize(size);
}
}
};
@@ -514,6 +538,80 @@ protected:
};
////////////////////////////////////////////////////////////////////////
// Set step points size type command
template <typename M>
class G4ModelCmdSetStepPtsSizeType : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetStepPtsSizeType(M* model, const G4String& placement,
const G4String& cmdName="setStepPtsSizeType")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set step size type.");
cmd->SetCandidates("none world screen");
}
protected:
void Apply(const G4String& type) {
G4VMarker::SizeType mySizeType;
if (type == "none") {mySizeType = G4VMarker::none;}
else if (type == "world") {mySizeType = G4VMarker::world;}
else if (type == "screen") {mySizeType = G4VMarker::screen;}
else {
std::ostringstream o;
o << "Invalid argument. See command guidance for options.";
G4Exception
("G4ModelCmdSetStepPtsSizeType::Apply",
"InvalidArgument", JustWarning, o.str().c_str());
return;
}
G4VModelCommand<M>::Model()->SetStepPtsSizeType(mySizeType);
}
};
////////////////////////////////////////////////////////////////////////
// Set auxiliary points size type command
template <typename M>
class G4ModelCmdSetAuxPtsSizeType : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetAuxPtsSizeType(M* model, const G4String& placement,
const G4String& cmdName="setAuxPtsSizeType")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set auxiliary size type.");
cmd->SetCandidates("none world screen");
}
protected:
void Apply(const G4String& type) {
G4VMarker::SizeType mySizeType;
if (type == "none") {mySizeType = G4VMarker::none;}
else if (type == "world") {mySizeType = G4VMarker::world;}
else if (type == "screen") {mySizeType = G4VMarker::screen;}
else {
std::ostringstream o;
o << "Invalid argument. See command guidance for options.";
G4Exception
("G4ModelCmdSetAuxPtsSizeType::Apply",
"InvalidArgument", JustWarning, o.str().c_str());
return;
}
G4VModelCommand<M>::Model()->SetAuxPtsSizeType(mySizeType);
}
};
////////////////////////////////////////////////////////////////////////
// Set step points fill style command
template <typename M>
@@ -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: G4PSHitsModel.hh,v 1.4 2009/11/04 12:44:39 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// Created: Mar. 31, 2009 Akinori Kimura
//
// Model which knows how to draw GEANT4 scorers.
//
#ifndef G4SCORINGHITSMODEL_HH
#define G4SCORINGHITSMODEL_HH
#include "G4VModel.hh"
template <typename T> class G4THitsMap;
class G4PSHitsModel: public G4VModel {
public: // With description
G4PSHitsModel (const G4String& requestedMapName = "all");
virtual ~G4PSHitsModel ();
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the graphics scene.
const G4THitsMap<G4double>* GetCurrentHits() const
{return fpCurrentHits;}
private:
G4String fRequestedMapName;
const G4THitsMap<G4double>* fpCurrentHits;
};
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeMassScene.hh,v 1.9 2008/01/04 21:59:15 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4PhysicalVolumeMassScene.hh,v 1.10 2009/10/21 14:17:33 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// John Allison 12th September 2004
@@ -108,6 +108,7 @@ public:
void AddSolid (const G4VSolid& s) {AccrueMass (s);}
void AddCompound (const G4VTrajectory&) {}
void AddCompound (const G4VHit&) {}
void AddCompound (const G4THitsMap<G4double>&) {}
////////////////////////////////////////////////////////////////
// Functions not used but required by the abstract interface.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.hh,v 1.34 2007/04/03 13:46:49 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4PhysicalVolumeModel.hh,v 1.35 2009/10/10 14:29:59 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// John Allison 31st December 1997.
@@ -48,6 +48,7 @@
#define G4PHYSICALVOLUMEMODEL_HH
#include "G4VModel.hh"
#include "G4VTouchable.hh"
#include "G4Transform3D.hh"
#include "G4Plane3D.hh"
@@ -75,19 +76,42 @@ public: // With description
class G4PhysicalVolumeNodeID {
public:
G4PhysicalVolumeNodeID
(G4VPhysicalVolume* pPV = 0, G4int iCopyNo = 0, G4int depth = 0):
fpPV(pPV), fCopyNo(iCopyNo), fNonCulledDepth(depth) {}
(G4VPhysicalVolume* pPV = 0,
G4int iCopyNo = 0,
G4int depth = 0,
const G4Transform3D& transform = G4Transform3D()):
fpPV(pPV),
fCopyNo(iCopyNo),
fNonCulledDepth(depth),
fTransform(transform) {}
G4VPhysicalVolume* GetPhysicalVolume() const {return fpPV;}
G4int GetCopyNo() const {return fCopyNo;}
G4int GetNonCulledDepth() const {return fNonCulledDepth;}
const G4Transform3D& GetTransform() const {return fTransform;}
G4bool operator< (const G4PhysicalVolumeNodeID& right) const;
private:
G4VPhysicalVolume* fpPV;
G4int fCopyNo;
G4int fNonCulledDepth;
G4Transform3D fTransform;
};
// Nested class for identifying physical volume nodes.
class G4PhysicalVolumeModelTouchable: public G4VTouchable {
public:
G4PhysicalVolumeModelTouchable
(const std::vector<G4PhysicalVolumeNodeID>& fullPVPath);
const G4ThreeVector& GetTranslation(G4int depth) const;
const G4RotationMatrix* GetRotation(G4int depth) const;
G4VPhysicalVolume* GetVolume(G4int depth) const;
G4VSolid* GetSolid(G4int depth) const;
G4int GetReplicaNumber(G4int depth) const;
G4int GetHistoryDepth() const {return fFullPVPath.size();}
private:
const std::vector<G4PhysicalVolumeNodeID>& fFullPVPath;
};
// Nested class for handling nested parameterisations.
G4PhysicalVolumeModel
(G4VPhysicalVolume*,
G4int requestedDepth = UNLIMITED,
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeSearchScene.hh,v 1.18 2008/01/04 21:59:15 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4PhysicalVolumeSearchScene.hh,v 1.19 2009/10/21 14:17:33 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// John Allison 10th August 1998.
@@ -73,6 +73,7 @@ public:
void AddSolid (const G4VSolid& s) {FindVolume (s);}
void AddCompound (const G4VTrajectory&) {}
void AddCompound (const G4VHit&) {}
void AddCompound (const G4THitsMap<G4double>&) {}
G4int GetFoundDepth () const;
G4VPhysicalVolume* GetFoundVolume () const;
const G4Transform3D& GetFoundTransformation () const;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisTrajContext.hh,v 1.3 2006/08/14 11:47:53 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisTrajContext.hh,v 1.4 2009/02/24 12:00:56 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// Jane Tinslay May 2006
//
@@ -71,6 +71,9 @@ public:
void SetAuxPtsSize(const G4double& size);
G4double GetAuxPtsSize() const;
void SetAuxPtsSizeType(const G4VMarker::SizeType& sizeType);
G4VMarker::SizeType GetAuxPtsSizeType() const;
void SetAuxPtsFillStyle(const G4VMarker::FillStyle& style);
G4VMarker::FillStyle GetAuxPtsFillStyle() const;
@@ -90,6 +93,9 @@ public:
void SetStepPtsSize(const G4double& size);
G4double GetStepPtsSize() const;
void SetStepPtsSizeType(const G4VMarker::SizeType& sizeType);
G4VMarker::SizeType GetStepPtsSizeType() const;
void SetStepPtsFillStyle(const G4VMarker::FillStyle& style);
G4VMarker::FillStyle GetStepPtsFillStyle() const;
@@ -116,6 +122,7 @@ private:
G4bool fDrawAuxPts;
G4Polymarker::MarkerType fAuxPtsType;
G4double fAuxPtsSize;
G4VMarker::SizeType fAuxPtsSizeType;
G4VMarker::FillStyle fAuxPtsFillStyle;
G4Colour fAuxPtsColour;
G4bool fAuxPtsVisible;
@@ -124,6 +131,7 @@ private:
G4bool fDrawStepPts;
G4Polymarker::MarkerType fStepPtsType;
G4double fStepPtsSize;
G4VMarker::SizeType fStepPtsSizeType;
G4VMarker::FillStyle fStepPtsFillStyle;
G4Colour fStepPtsColour;
G4bool fStepPtsVisible;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisTrajContext.icc,v 1.3 2006/08/14 11:47:53 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisTrajContext.icc,v 1.4 2009/02/24 12:00:56 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// Jane Tinslay May 2006
//
@@ -60,6 +60,9 @@ inline G4Polymarker::MarkerType G4VisTrajContext::GetAuxPtsType() const {return
inline void G4VisTrajContext::SetAuxPtsSize(const G4double& size) {fAuxPtsSize = size;}
inline G4double G4VisTrajContext::GetAuxPtsSize() const {return fAuxPtsSize;}
inline void G4VisTrajContext::SetAuxPtsSizeType(const G4VMarker::SizeType& sizeType) {fAuxPtsSizeType = sizeType;}
inline G4VMarker::SizeType G4VisTrajContext::GetAuxPtsSizeType() const {return fAuxPtsSizeType;}
inline void G4VisTrajContext::SetAuxPtsFillStyle(const G4VMarker::FillStyle& style) {fAuxPtsFillStyle = style;}
inline G4VMarker::FillStyle G4VisTrajContext::GetAuxPtsFillStyle() const {return fAuxPtsFillStyle;}
@@ -79,6 +82,9 @@ inline G4Polymarker::MarkerType G4VisTrajContext::GetStepPtsType() const {return
inline void G4VisTrajContext::SetStepPtsSize(const G4double& size) {fStepPtsSize = size;}
inline G4double G4VisTrajContext::GetStepPtsSize() const {return fStepPtsSize;}
inline void G4VisTrajContext::SetStepPtsSizeType(const G4VMarker::SizeType& sizeType) {fStepPtsSizeType = sizeType;}
inline G4VMarker::SizeType G4VisTrajContext::GetStepPtsSizeType() const {return fStepPtsSizeType;}
inline void G4VisTrajContext::SetStepPtsFillStyle(const G4VMarker::FillStyle& style) {fStepPtsFillStyle = style;}
inline G4VMarker::FillStyle G4VisTrajContext::GetStepPtsFillStyle() const {return fStepPtsFillStyle;}
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * 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: G4PSHitsModel.cc,v 1.4 2009/11/04 12:44:39 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// Created: Mar. 31, 2009 Akinori Kimura
// Model which draws the primtive scorer hits.
//
#include "G4PSHitsModel.hh"
#include "G4ModelingParameters.hh"
#include "G4VGraphicsScene.hh"
#include "G4Event.hh"
#include "G4ScoringManager.hh"
G4PSHitsModel::~G4PSHitsModel () {}
G4PSHitsModel::G4PSHitsModel (const G4String& requestedMapName):
fRequestedMapName(requestedMapName), fpCurrentHits(0)
{
fGlobalTag = "G4PSHitsModel for G4THitsMap<G4double> hits.";
fGlobalDescription = fGlobalTag;
}
void G4PSHitsModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler)
{
G4ScoringManager* scoringManager =
G4ScoringManager::GetScoringManagerIfExist();
if (scoringManager) {
size_t nMeshes = scoringManager->GetNumberOfMesh();
for (size_t i = 0; i < nMeshes; ++i) {
G4VScoringMesh* mesh = scoringManager->GetMesh(i);
if (mesh && mesh->IsActive()) {
MeshScoreMap scoreMap = mesh->GetScoreMap();
for(MeshScoreMap::const_iterator i = scoreMap.begin();
i != scoreMap.end(); ++i) {
const G4String& name = i->first;
if (fRequestedMapName == "all" || name == fRequestedMapName) {
fpCurrentHits = i->second;
//G4cout << name << ": " << fpCurrentHits << G4endl;
if (fpCurrentHits) sceneHandler.AddCompound(*fpCurrentHits);
}
}
}
}
}
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc,v 1.63 2007/11/10 14:56:36 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4PhysicalVolumeModel.cc,v 1.66 2009/10/23 08:08:19 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// John Allison 31st December 1997.
@@ -45,6 +45,7 @@
#include "G4PhysicalVolumeSearchScene.hh"
#include "G4TransportationManager.hh"
#include "G4Polyhedron.hh"
#include "HepPolyhedronProcessor.h"
#include "G4AttDefStore.hh"
#include "G4AttDef.hh"
#include "G4AttValue.hh"
@@ -53,32 +54,6 @@
#include <sstream>
G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator<
(const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID& right) const
{
if (fpPV < right.fpPV) return true;
if (fpPV == right.fpPV) {
if (fCopyNo < right.fCopyNo) return true;
if (fCopyNo == right.fCopyNo)
return fNonCulledDepth < right.fNonCulledDepth;
}
return false;
}
std::ostream& operator<<
(std::ostream& os, const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID node)
{
G4VPhysicalVolume* pPV = node.GetPhysicalVolume();
if (pPV) {
os << pPV->GetName()
<< ':' << node.GetCopyNo()
<< '[' << node.GetNonCulledDepth() << ']';
} else {
os << "Null node";
}
return os;
}
G4PhysicalVolumeModel::G4PhysicalVolumeModel
(G4VPhysicalVolume* pVPV,
G4int requestedDepth,
@@ -231,12 +206,17 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
pVPV -> GetReplicationData (axis, nReplicas, width, offset, consuming);
G4VPVParameterisation* pP = pVPV -> GetParameterisation ();
if (pP) { // Parametrised volume.
if (fCurrentDepth == 0) nReplicas = 1; // Just draw first
for (int n = 0; n < nReplicas; n++) {
pSol = pP -> ComputeSolid (n, pVPV);
pMaterial = pP -> ComputeMaterial (n, pVPV);
pP -> ComputeTransformation (n, pVPV);
pSol -> ComputeDimensions (pP, n, pVPV);
pVPV -> SetCopyNo (n);
// Create a touchable of current parent for ComputeMaterial.
// fFullPVPath has not been updated yet so at this point it
// corresponds to the parent.
G4PhysicalVolumeModelTouchable parentTouchable(fFullPVPath);
pMaterial = pP -> ComputeMaterial (n, pVPV, &parentTouchable);
DescribeAndDescend (pVPV, requestedDepth, pLV, pSol, pMaterial,
theAT, sceneHandler);
}
@@ -362,32 +342,6 @@ void G4PhysicalVolumeModel::DescribeAndDescend
if (fCurrentDepth != 0) theNewAT = theAT * theLT;
fpCurrentTransform = &theNewAT;
/********************************************************
G4cout << "G4PhysicalVolumeModel::DescribeAndDescend: "
<< pVPV -> GetName () << "." << pVPV -> GetCopyNo ();
G4cout << "\n theAT: ";
G4cout << "\n Rotation: ";
G4RotationMatrix rotation = theAT.getRotation ();
G4cout << rotation.thetaX() << ", "
<< rotation.phiX() << ", "
<< rotation.thetaY() << ", "
<< rotation.phiY() << ", "
<< rotation.thetaZ() << ", "
<< rotation.phiZ();
G4cout << "\n Translation: " << theAT.getTranslation();
G4cout << "\n theNewAT: ";
G4cout << "\n Rotation: ";
rotation = theNewAT.getRotation ();
G4cout << rotation.thetaX() << ", "
<< rotation.phiX() << ", "
<< rotation.thetaY() << ", "
<< rotation.phiY() << ", "
<< rotation.thetaZ() << ", "
<< rotation.phiZ();
G4cout << "\n Translation: " << theNewAT.getTranslation();
G4cout << G4endl;
**********************************************************/
// Make decision to draw...
const G4VisAttributes* pVisAttribs = pLV->GetVisAttributes();
if (!pVisAttribs) pVisAttribs = fpMP->GetDefaultVisAttributes();
@@ -428,14 +382,16 @@ void G4PhysicalVolumeModel::DescribeAndDescend
// Update full path of physical volumes...
G4int copyNo = fpCurrentPV->GetCopyNo();
fFullPVPath.push_back
(G4PhysicalVolumeNodeID(fpCurrentPV,copyNo,fCurrentDepth));
(G4PhysicalVolumeNodeID
(fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform));
if (thisToBeDrawn) {
// Update path of drawn physical volumes...
G4int copyNo = fpCurrentPV->GetCopyNo();
fDrawnPVPath.push_back
(G4PhysicalVolumeNodeID(fpCurrentPV,copyNo,fCurrentDepth));
(G4PhysicalVolumeNodeID
(fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform));
if (fpMP->IsExplode() && fDrawnPVPath.size() == 1) {
// For top-level drawn volumes, explode along radius...
@@ -562,69 +518,82 @@ void G4PhysicalVolumeModel::DescribeSolid
G4Polyhedron::SetNumberOfRotationSteps(fpMP->GetNoOfSides());
G4Polyhedron* pOriginal = pSol->GetPolyhedron();
G4Polyhedron::ResetNumberOfRotationSteps();
if (!pOriginal) {
if (fpMP->IsWarning())
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: solid\n \""
<< pSol->GetName() <<
"\" has no polyhedron. Cannot by clipped."
<< G4endl;
pSol -> DescribeYourselfTo (sceneHandler); // Standard treatment.
if (fpMP->IsWarning())
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: solid\n \""
<< pSol->GetName() <<
"\" has no polyhedron. Cannot by clipped."
<< G4endl;
pSol -> DescribeYourselfTo (sceneHandler); // Standard treatment.
} else {
G4Polyhedron resultant = *pOriginal;
G4VisAttributes resultantVisAttribs(*pVisAttribs);
if (fpClippingPolyhedron) {
G4Polyhedron clipper = *fpClippingPolyhedron; // Local copy.
clipper.Transform(theAT.inverse());
HepPolyhedronProcessor processor;
switch (fClippingMode) {
default:
case subtraction: resultant = resultant.subtract(clipper); break;
case intersection: resultant = resultant.intersect(clipper); break;
case subtraction: processor.push_back(HepPolyhedronProcessor::SUBTRACTION, clipper); break;
case intersection: processor.push_back(HepPolyhedronProcessor::INTERSECTION, clipper); break;
}
if(resultant.IsErrorBooleanProcess()) {
if (!processor.execute(resultant)) {
if (fpMP->IsWarning())
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: clipped polyhedron for"
"\n solid \"" << pSol->GetName() <<
"\" not defined due to error during Boolean processing."
"\n It will be drawn in red."
<< G4endl;
// Nevertheless, keep resultant.
// Nevertheless, keep resultant, but draw it in red
resultantVisAttribs.SetColour(G4Colour::Red());
}
}
if (pSectionPolyhedron) {
G4Polyhedron sectioner = *pSectionPolyhedron; // Local copy.
sectioner.Transform(theAT.inverse());
resultant = resultant.intersect(sectioner);
if(resultant.IsErrorBooleanProcess()) {
HepPolyhedronProcessor processor;
processor.push_back(HepPolyhedronProcessor::INTERSECTION, sectioner);
if (!processor.execute(resultant)) {
if (fpMP->IsWarning())
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: sectioned polyhedron for"
"\n solid \"" << pSol->GetName() <<
"\" not defined due to error during Boolean processing."
"\n It will be drawn in red."
<< G4endl;
// Nevertheless, keep resultant.
// Nevertheless, keep resultant, but draw it in red
resultantVisAttribs.SetColour(G4Colour::Red());
}
}
if (pCutawayPolyhedron) {
G4Polyhedron cutter = *pCutawayPolyhedron; // Local copy.
cutter.Transform(theAT.inverse());
resultant = resultant.subtract(cutter);
if(resultant.IsErrorBooleanProcess()) {
HepPolyhedronProcessor processor;
processor.push_back(HepPolyhedronProcessor::SUBTRACTION, cutter);
if (!processor.execute(resultant)) {
if (fpMP->IsWarning())
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: cutaway polyhedron for"
"\n solid \"" << pSol->GetName() <<
"\" not defined due to error during Boolean processing."
"\n It will be drawn in red."
<< G4endl;
// Nevertheless, keep resultant.
// Nevertheless, keep resultant, but draw it in red
resultantVisAttribs.SetColour(G4Colour::Red());
}
}
// Finally, force polyhedron drawing...
resultant.SetVisAttributes(pVisAttribs);
resultant.SetVisAttributes(resultantVisAttribs);
sceneHandler.BeginPrimitives(theAT);
sceneHandler.AddPrimitive(resultant);
sceneHandler.EndPrimitives();
@@ -759,6 +728,16 @@ std::vector<G4AttValue>* G4PhysicalVolumeModel::CreateCurrentAttValues() const
<< ':' << fFullPVPath[i].GetCopyNo();
if (i != fFullPVPath.size() - 1) oss << '/';
}
if (!fpCurrentLV) {
G4Exception
("G4PhysicalVolumeModel::CreateCurrentAttValues",
"",
JustWarning,
"Current logical volume not defined.");
return values;
}
values->push_back(G4AttValue("PVPath", oss.str(),""));
values->push_back(G4AttValue("LVol", fpCurrentLV->GetName(),""));
G4VSolid* pSol = fpCurrentLV->GetSolid();
@@ -784,3 +763,98 @@ std::vector<G4AttValue>* G4PhysicalVolumeModel::CreateCurrentAttValues() const
values->push_back(G4AttValue("RootRegion", oss.str(),""));
return values;
}
G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator<
(const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID& right) const
{
if (fpPV < right.fpPV) return true;
if (fpPV == right.fpPV) {
if (fCopyNo < right.fCopyNo) return true;
if (fCopyNo == right.fCopyNo)
return fNonCulledDepth < right.fNonCulledDepth;
}
return false;
}
std::ostream& operator<<
(std::ostream& os, const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID node)
{
G4VPhysicalVolume* pPV = node.GetPhysicalVolume();
if (pPV) {
os << pPV->GetName()
<< ':' << node.GetCopyNo()
<< '[' << node.GetNonCulledDepth() << ']'
<< ':' << node.GetTransform();
} else {
os << "Null node";
}
return os;
}
G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::G4PhysicalVolumeModelTouchable
(const std::vector<G4PhysicalVolumeNodeID>& fullPVPath):
fFullPVPath(fullPVPath) {}
const G4ThreeVector& G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetTranslation(G4int depth) const
{
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetTranslation",
"Index out of range",
FatalErrorInArgument,
"Asking for non-existent depth");
}
static G4ThreeVector tempTranslation;
tempTranslation = fFullPVPath[i].GetTransform().getTranslation();
return tempTranslation;
}
const G4RotationMatrix* G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetRotation(G4int depth) const
{
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetRotation",
"Index out of range",
FatalErrorInArgument,
"Asking for non-existent depth");
}
static G4RotationMatrix tempRotation;
tempRotation = fFullPVPath[i].GetTransform().getRotation();
return &tempRotation;
}
G4VPhysicalVolume* G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetVolume(G4int depth) const
{
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetVolume",
"Index out of range",
FatalErrorInArgument,
"Asking for non-existent depth");
}
return fFullPVPath[i].GetPhysicalVolume();
}
G4VSolid* G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetSolid(G4int depth) const
{
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetSolid",
"Index out of range",
FatalErrorInArgument,
"Asking for non-existent depth");
}
return fFullPVPath[i].GetPhysicalVolume()->GetLogicalVolume()->GetSolid();
}
G4int G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetReplicaNumber(G4int depth) const
{
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetReplicaNumber",
"Index out of range",
FatalErrorInArgument,
"Asking for non-existent depth");
}
return fFullPVPath[i].GetCopyNo();
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawerUtils.cc,v 1.11 2007/05/30 08:56:55 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4TrajectoryDrawerUtils.cc,v 1.12 2009/02/24 12:00:56 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -253,7 +253,7 @@ namespace G4TrajectoryDrawerUtils {
if (myContext.GetDrawAuxPts() && (auxiliaryPoints.size() > 0)) {
auxiliaryPoints.SetMarkerType(myContext.GetAuxPtsType());
auxiliaryPoints.SetScreenSize(myContext.GetAuxPtsSize());
auxiliaryPoints.SetSize(myContext.GetAuxPtsSizeType(), myContext.GetAuxPtsSize());
auxiliaryPoints.SetFillStyle(myContext.GetAuxPtsFillStyle());
G4VisAttributes auxiliaryPointsAttribs(myContext.GetAuxPtsColour());
@@ -265,7 +265,7 @@ namespace G4TrajectoryDrawerUtils {
if (myContext.GetDrawStepPts() && (stepPoints.size() > 0)) {
stepPoints.SetMarkerType(myContext.GetStepPtsType());
stepPoints.SetScreenSize(myContext.GetStepPtsSize());
stepPoints.SetSize(myContext.GetStepPtsSizeType(), myContext.GetStepPtsSize());
stepPoints.SetFillStyle(myContext.GetStepPtsFillStyle());
G4VisAttributes stepPointsAttribs(myContext.GetStepPtsColour());
@@ -312,7 +312,7 @@ namespace G4TrajectoryDrawerUtils {
G4Polymarker point;
point.push_back(auxiliaryPoints[i]);
point.SetMarkerType(myContext.GetAuxPtsType());
point.SetScreenSize(myContext.GetAuxPtsSize());
point.SetSize(myContext.GetAuxPtsSizeType(), myContext.GetAuxPtsSize());
point.SetFillStyle(myContext.GetAuxPtsFillStyle());
auxiliaryPointsAttribs.SetStartTime(auxiliaryPointTimes[i]);
auxiliaryPointsAttribs.SetEndTime(auxiliaryPointTimes[i]);
@@ -329,7 +329,7 @@ namespace G4TrajectoryDrawerUtils {
G4Polymarker point;
point.push_back(stepPoints[i]);
point.SetMarkerType(myContext.GetStepPtsType());
point.SetScreenSize(myContext.GetStepPtsSize());
point.SetSize(myContext.GetStepPtsSizeType(), myContext.GetStepPtsSize());
point.SetFillStyle(myContext.GetStepPtsFillStyle());
stepPointsAttribs.SetStartTime(stepPointTimes[i]);
stepPointsAttribs.SetEndTime(stepPointTimes[i]);
@@ -34,12 +34,14 @@ G4VisTrajContext::G4VisTrajContext(const G4String& name)
,fDrawAuxPts(false)
,fAuxPtsType(G4Polymarker::squares)
,fAuxPtsSize(2)
,fAuxPtsSizeType(G4VMarker::screen)
,fAuxPtsFillStyle(G4VMarker::filled)
,fAuxPtsColour(G4Colour::Magenta())
,fAuxPtsVisible(true)
,fDrawStepPts(false)
,fStepPtsType(G4Polymarker::circles)
,fStepPtsSize(2)
,fStepPtsSizeType(G4VMarker::screen)
,fStepPtsFillStyle(G4VMarker::filled)
,fStepPtsColour(G4Colour::Yellow())
,fStepPtsVisible(true)