Import Geant4 8.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:55:03 +02:00
parent 216a75eeb1
commit fe73f43734
6714 changed files with 118229 additions and 68144 deletions
@@ -23,14 +23,30 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AttFilterUtils.hh,v 1.2 2006/12/13 15:49:58 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// $Id: G4AxesModel.icc,v 1.4 2006/06/29 21:30:06 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// Visualisation attribute filter utility functions.
//
// Jane Tinslay, September 2006
//
#ifndef G4ATTFILTERUTILS_HH
#define G4ATTFILTERUTILS_HH
inline G4String G4AxesModel::GetCurrentTag () const {
return fGlobalTag;
class G4AttDef;
class G4TypeKey;
class G4VAttValueFilter;
template <typename A, typename B, typename C> class G4CreatorFactoryT;
namespace G4AttFilterUtils {
typedef G4CreatorFactoryT<G4VAttValueFilter, G4TypeKey, G4VAttValueFilter*(*)()> G4AttValueFilterFactory;
// G4AttValue filter factory
G4AttValueFilterFactory* GetAttValueFilterFactory();
// Create new G4AttValue filter
G4VAttValueFilter* GetNewFilter(const G4AttDef& def);
}
inline G4String G4AxesModel::GetCurrentDescription () const {
return fGlobalDescription;
}
#endif
@@ -0,0 +1,220 @@
//
// ********************************************************************
// * 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: G4AttValueFilterT.hh,v 1.3 2006/12/13 15:50:00 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Templated class for G4AttValue filters.
//
// Jane Tinslay, September 2006
//
#ifndef G4ATTVALUEFILTERT_HH
#define G4ATTVALUEFILTERT_HH
#include "G4VAttValueFilter.hh"
#include "G4ConversionFatalError.hh"
#include "G4ConversionUtils.hh"
namespace {
// Helper classes
template <typename T>
class IsEqual{
public:
IsEqual(const T& value): fValue(value) {};
bool operator()(const std::pair<const G4String, T>& myPair) const
{
return myPair.second == fValue;
}
private:
T fValue;
};
template <typename T>
class InInterval{
public:
InInterval(const T& value): fValue(value) {};
bool operator()(const std::pair<const G4String, std::pair<T, T> >& myPair) const
{
T min = myPair.second.first;
T max = myPair.second.second;
return ((fValue > min || fValue == min) && (fValue < max));
}
private:
T fValue;
};
}
template <typename T, typename ConversionErrorPolicy = G4ConversionFatalError>
class G4AttValueFilterT : public ConversionErrorPolicy, public G4VAttValueFilter {
public:
// Constructor
G4AttValueFilterT();
// Destructor
virtual ~G4AttValueFilterT();
// Filter methods
G4bool Accept(const G4AttValue& attVal) const;
G4bool GetValidElement(const G4AttValue& input, G4String& interval) const;
// Print configuration
virtual void PrintAll(std::ostream& ostr) const;
// Reset
virtual void Reset();
void LoadIntervalElement(const G4String& input);
void LoadSingleValueElement(const G4String& input);
private:
typedef std::pair<T, T> Pair;
typedef typename std::map<G4String, Pair> IntervalMap;
typedef std::map<G4String, T> SingleValueMap;
// Data members
IntervalMap fIntervalMap;
SingleValueMap fSingleValueMap;
};
template <typename T, typename ConversionErrorPolicy>
G4AttValueFilterT<T, ConversionErrorPolicy>::G4AttValueFilterT() {}
template <typename T, typename ConversionErrorPolicy>
G4AttValueFilterT<T, ConversionErrorPolicy>::~G4AttValueFilterT() {}
template <typename T, typename ConversionErrorPolicy>
G4bool
G4AttValueFilterT<T, ConversionErrorPolicy>::GetValidElement(const G4AttValue& attValue, G4String& element) const
{
T value;
G4String input = attValue.GetValue();
if (!G4ConversionUtils::Convert(input, value)) ConversionErrorPolicy::ReportError(input, "Invalid format. Was the input data formatted correctly ?");
typename SingleValueMap::const_iterator iterValues =
std::find_if(fSingleValueMap.begin(), fSingleValueMap.end(), IsEqual<T>(value));
if (iterValues != fSingleValueMap.end()) {
element = iterValues->first;
return true;
}
typename IntervalMap::const_iterator iterIntervals =
std::find_if(fIntervalMap.begin(), fIntervalMap.end(), InInterval<T>(value));
if (iterIntervals != fIntervalMap.end()) {
element = iterIntervals->first;
return true;
}
return false;
}
template <typename T, typename ConversionErrorPolicy>
G4bool
G4AttValueFilterT<T, ConversionErrorPolicy>::Accept(const G4AttValue& attValue) const
{
T value;
G4String input = attValue.GetValue();
if (!G4ConversionUtils::Convert(input, value)) ConversionErrorPolicy::ReportError(input, "Invalid format. Was the input data formatted correctly ?");
typename SingleValueMap::const_iterator iterValues =
std::find_if(fSingleValueMap.begin(), fSingleValueMap.end(), IsEqual<T>(value));
if (iterValues != fSingleValueMap.end()) return true;
typename IntervalMap::const_iterator iterIntervals =
std::find_if(fIntervalMap.begin(), fIntervalMap.end(), InInterval<T>(value));
if (iterIntervals != fIntervalMap.end()) return true;
return false;
}
template <typename T, typename ConversionErrorPolicy>
void
G4AttValueFilterT<T, ConversionErrorPolicy>::LoadIntervalElement(const G4String& input)
{
T min;
T max;
if (!G4ConversionUtils::Convert(input, min, max)) ConversionErrorPolicy::ReportError(input, "Invalid format. Was the input data formatted correctly ?");
std::pair<T, T> myPair(min, max);
fIntervalMap[input] = myPair;
}
template <typename T, typename ConversionErrorPolicy>
void
G4AttValueFilterT<T, ConversionErrorPolicy>::LoadSingleValueElement(const G4String& input)
{
T output;
if (!G4ConversionUtils::Convert(input, output)) ConversionErrorPolicy::ReportError(input, "Invalid format. Was the input data formatted correctly ?");
fSingleValueMap[input] = output;
}
template <typename T, typename ConversionErrorPolicy>
void
G4AttValueFilterT<T, ConversionErrorPolicy>::PrintAll(std::ostream& ostr) const
{
ostr<<"Printing data for filter: "<<Name()<<std::endl;
ostr<<"Interval data:"<<std::endl;
typename IntervalMap::const_iterator iterIntervals = fIntervalMap.begin();
while (iterIntervals != fIntervalMap.end()) {
ostr<<iterIntervals->second.first<<" : "<<iterIntervals->second.second<<std::endl;
iterIntervals++;
}
ostr<<"Single value data:"<<std::endl;
typename SingleValueMap::const_iterator iterValues = fSingleValueMap.begin();
while (iterValues != fSingleValueMap.end()) {
ostr<<iterValues->second<<std::endl;
iterValues++;
}
}
template <typename T, typename ConversionErrorPolicy>
void
G4AttValueFilterT<T, ConversionErrorPolicy>::Reset()
{
fIntervalMap.clear();
fSingleValueMap.clear();
}
#endif
@@ -0,0 +1,229 @@
//
// ********************************************************************
// * 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: G4AttributeFilterT.hh,v 1.6 2006/12/13 15:50:02 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Generic attribute filter.
//
// Jane Tinslay, May 2006
//
#ifndef G4ATTRIBUTEFILTERT_HH
#define G4ATTRIBUTEFILTERT_HH
#include "G4AttDef.hh"
#include "G4AttFilterUtils.hh"
#include "G4AttUtils.hh"
#include "G4AttValue.hh"
#include "G4SmartFilter.hh"
#include "G4VAttValueFilter.hh"
#include <sstream>
#include <vector>
template <typename T>
class G4AttributeFilterT : public G4SmartFilter<T> {
public:
// Construct with filter name
G4AttributeFilterT(const G4String& name = "Unspecified");
// Destructor
virtual ~G4AttributeFilterT();
// Evaluate
virtual bool Evaluate(const T&) const;
// Print configuration
virtual void Print(std::ostream& ostr) const;
// Clear filter
virtual void Clear();
// Configuration functions
void Set(const G4String& name);
void AddInterval(const G4String&);
void AddValue(const G4String&);
private:
enum Config {Interval, SingleValue};
typedef std::pair<G4String, Config> Pair;
typedef std::vector<Pair> ConfigVect;
// Data members
G4String fAttName;
ConfigVect fConfigVect;
// Caching
mutable G4bool fFirst;
mutable G4bool fWarnedMissingAttribute;
mutable G4VAttValueFilter* filter;
};
template <typename T>
G4AttributeFilterT<T>::G4AttributeFilterT(const G4String& name)
:G4SmartFilter<T>(name)
,fAttName("")
,fFirst(true)
,fWarnedMissingAttribute(false)
,filter(0)
{}
template <typename T>
G4AttributeFilterT<T>::~G4AttributeFilterT()
{
delete filter;
}
template <typename T>
G4bool
G4AttributeFilterT<T>::Evaluate(const T& object) const
{
// Return false if attribute name has not been set. Just print one warning.
if (fAttName.isNull()) {
if (!fWarnedMissingAttribute) {
std::ostringstream o;
o<<"Null attribute name";
G4Exception("G4AttributeFilterT::Evaluate", "NullAttributeName", JustWarning, o.str().c_str());
fWarnedMissingAttribute = true;
}
return false;
}
if (fFirst) {
fFirst = false;
// Get attribute definition
G4AttDef attDef;
// Expect definition to exist
if (!G4AttUtils::ExtractAttDef(object, fAttName, attDef)) {
std::ostringstream o;
o <<"Unable to extract attribute definition named "<<fAttName;
G4Exception
("G4AttributeFilterT::Evaluate", "InvalidAttributeDefinition", FatalErrorInArgument, o.str().c_str());
}
// Get new G4AttValue filter
filter = G4AttFilterUtils::GetNewFilter(attDef);
// Load both interval and single valued data.
typename ConfigVect::const_iterator iter = fConfigVect.begin();
while (iter != fConfigVect.end()) {
if (iter->second == G4AttributeFilterT<T>::Interval) {filter->LoadIntervalElement(iter->first);}
else if (iter->second == G4AttributeFilterT<T>::SingleValue) {filter->LoadSingleValueElement(iter->first);}
iter++;
}
}
// Get attribute value
G4AttValue attVal;
// Expect value to exist
if (!G4AttUtils::ExtractAttValue(object, fAttName, attVal)) {
std::ostringstream o;
o <<"Unable to extract attribute value named "<<fAttName;
G4Exception
("G4AttributeFilterT::Evaluate", "InvalidAttributeValue", FatalErrorInArgument, o.str().c_str());
}
if (G4SmartFilter<T>::GetVerbose()) {
G4cout<<"G4AttributeFilterT processing attribute named "<<fAttName;
G4cout<<" with value "<<attVal.GetValue()<<G4endl;
}
// Pass subfilter
return (filter->Accept(attVal));
}
template <typename T>
void
G4AttributeFilterT<T>::Clear()
{
fConfigVect.clear();
if (0 != filter) filter->Reset();
}
template <typename T>
void
G4AttributeFilterT<T>::Print(std::ostream& ostr) const
{
ostr<<"Printing data for G4Attribute filter named: "<<G4VFilter<T>::Name()<<std::endl;
ostr<<"Filtered attribute name: "<<fAttName<<std::endl;
ostr<<"Printing sub filter data:"<<std::endl;
if (0 != filter) filter->PrintAll(ostr);
}
template <typename T>
void
G4AttributeFilterT<T>::Set(const G4String& name)
{
fAttName = name;
}
template <typename T>
void
G4AttributeFilterT<T>::AddInterval(const G4String& interval)
{
std::pair<G4String, Config> myPair(interval, G4AttributeFilterT<T>::Interval);
typename ConfigVect::iterator iter = std::find(fConfigVect.begin(), fConfigVect.end(), myPair);
if (iter != fConfigVect.end()) {
std::ostringstream o;
o <<"Interval "<< interval <<" already exists"<<std::endl;
G4Exception
("G4AttributeFilterT::AddInterval", "InvalidInterval", FatalErrorInArgument, o.str().c_str());
}
fConfigVect.push_back(myPair);
}
template <typename T>
void
G4AttributeFilterT<T>::AddValue(const G4String& value)
{
std::pair<G4String, Config> myPair(value, G4AttributeFilterT<T>::SingleValue);
typename ConfigVect::iterator iter = std::find(fConfigVect.begin(), fConfigVect.end(), myPair);
if (iter != fConfigVect.end()) {
std::ostringstream o;
o <<"Single value "<< value <<" already exists"<<std::endl;
G4Exception
("G4AttributeFilterT::AddValue", "InvalidValue", FatalErrorInArgument, o.str().c_str());
}
fConfigVect.push_back(myPair);
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4AxesModel.hh,v 1.5 2006/06/29 21:30:04 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4AxesModel.hh,v 1.6 2006/11/01 10:28:42 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 3rd April 2001
@@ -54,12 +54,6 @@ public: // With description
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the graphics scene.
virtual G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
virtual G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
private:
// Private copy contructor and assignment to forbid use...
@@ -70,6 +64,4 @@ private:
};
#include "G4AxesModel.icc"
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4BoundingSphereScene.hh,v 1.17 2006/06/29 21:30:08 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 7th June 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4CallbackModel.hh,v 1.5 2006/06/29 21:30:10 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 31st December 1997.
@@ -25,7 +25,7 @@
//
//
// $Id: G4FlavoredParallelWorldModel.hh,v 1.8 2006/06/29 21:30:12 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// P. Mora de Freitas et M.Verderi - 19 June 1998.
//
@@ -23,14 +23,37 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// $Id: G4HitFilterFactories.hh,v 1.1 2006/09/12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// $Id: G4HitsModel.icc,v 1.7 2006/06/29 21:30:16 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Hit filter model factories creating filters
// and associated messengers.
//
// Jane Tinslay March 2006
//
#ifndef G4HITFILTERFACTORIES_HH
#define G4HITFILTERFACTORIES_HH
inline G4String G4HitsModel::GetCurrentTag () const {
return fGlobalTag;
}
#include "G4VFilter.hh"
#include "G4VModelFactory.hh"
#include "G4VHit.hh"
// Attribute filter
class G4HitAttributeFilterFactory : public G4VModelFactory< G4VFilter<G4VHit> > {
public: // With description
typedef std::vector<G4UImessenger*> Messengers;
typedef std::pair< G4VFilter<G4VHit> *, Messengers > ModelAndMessengers;
G4HitAttributeFilterFactory();
virtual ~G4HitAttributeFilterFactory();
ModelAndMessengers Create(const G4String& placement, const G4String& name);
};
#endif
inline G4String G4HitsModel::GetCurrentDescription () const {
return fGlobalDescription;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HitsModel.hh,v 1.8 2006/06/29 21:30:14 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4HitsModel.hh,v 1.10 2006/11/02 11:57:31 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 26th August 1998.
@@ -43,6 +43,8 @@
#include "G4VModel.hh"
class G4VHit;
class G4HitsModel: public G4VModel {
public: // With description
@@ -54,14 +56,12 @@ public: // With description
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the graphics scene.
virtual G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
const G4VHit* GetCurrentHit() const
{return fpCurrentHit;}
virtual G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
private:
const G4VHit* fpCurrentHit;
};
#include "G4HitsModel.icc"
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.hh,v 1.8 2006/06/29 21:30:18 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4LogicalVolumeModel.hh,v 1.9 2006/11/01 10:28:42 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 26th July 1999.
@@ -66,9 +66,6 @@ public: // With description
void DescribeYourselfTo (G4VGraphicsScene&);
G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
protected:
// This called from G4PhysicalVolumeModel::DescribeAndDescend by the
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ModelApplyCommandsT.hh,v 1.3 2006/06/29 21:30:20 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4ModelApplyCommandsT.hh,v 1.5 2006/09/11 21:22:02 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Abstract model messenges. Derived classes should implement
// the "Apply" method
@@ -38,6 +38,7 @@
#include "G4String.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcommand.hh"
@@ -75,7 +76,7 @@ private:
template <typename M>
G4ModelCmdApplyStringColour<M>::G4ModelCmdApplyStringColour(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
:G4VModelCommand<M>(model, placement)
{
//Set variable colour through a string
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
@@ -182,7 +183,7 @@ private:
template <typename M>
G4ModelCmdApplyColour<M>::G4ModelCmdApplyColour(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
:G4VModelCommand<M>(model, placement)
{
//Set colour through a string
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
@@ -281,7 +282,7 @@ private:
template <typename M>
G4ModelCmdApplyBool<M>::G4ModelCmdApplyBool(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
:G4VModelCommand<M>(model, placement)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
fpCmd = new G4UIcmdWithABool(dir, this);
@@ -329,7 +330,7 @@ private:
template <typename M>
G4ModelCmdApplyNull<M>::G4ModelCmdApplyNull(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
:G4VModelCommand<M>(model, placement)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
fpCmd = new G4UIcommand(dir, this);
@@ -375,7 +376,7 @@ private:
template <typename M>
G4ModelCmdApplyDouble<M>::G4ModelCmdApplyDouble(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
:G4VModelCommand<M>(model, placement)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
@@ -395,6 +396,54 @@ void G4ModelCmdApplyDouble<M>::SetNewValue(G4UIcommand*, G4String newValue)
Apply(fpCmd->GetNewDoubleValue(newValue));
}
///////////////////////////////////////////////////////////////////////////
//ApplyDoubleAndUnit command
template <typename M>
class G4ModelCmdApplyDoubleAndUnit : public G4VModelCommand<M> {
public: // With description
G4ModelCmdApplyDoubleAndUnit(M* model, const G4String& placement, const G4String& cmdName);
virtual ~G4ModelCmdApplyDoubleAndUnit();
void SetNewValue(G4UIcommand* command, G4String newValue);
protected:
// Implement in derived class
virtual void Apply(const G4double&) = 0;
G4UIcmdWithADoubleAndUnit* Command() {return fpCmd;}
private:
G4UIcmdWithADoubleAndUnit* fpCmd;
};
template <typename M>
G4ModelCmdApplyDoubleAndUnit<M>::G4ModelCmdApplyDoubleAndUnit(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model, placement)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
fpCmd = new G4UIcmdWithADoubleAndUnit(dir, this);
fpCmd->SetParameterName("DoubleAndUnit", false);
}
template <typename M>
G4ModelCmdApplyDoubleAndUnit<M>::~G4ModelCmdApplyDoubleAndUnit()
{
delete fpCmd;
}
template <typename M>
void G4ModelCmdApplyDoubleAndUnit<M>::SetNewValue(G4UIcommand*, G4String newValue)
{
Apply(fpCmd->GetNewDoubleValue(newValue));
}
///////////////////////////////////////////////////////////////////////////
// ApplyInteger command
template <typename M>
@@ -422,7 +471,7 @@ private:
template <typename M>
G4ModelCmdApplyInteger<M>::G4ModelCmdApplyInteger(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
:G4VModelCommand<M>(model, placement)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
@@ -470,7 +519,7 @@ private:
template <typename M>
G4ModelCmdApplyString<M>::G4ModelCmdApplyString(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
:G4VModelCommand<M>(model, placement)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ModelColourMap.hh,v 1.2 2006/06/29 21:30:22 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Generic variable->G4Colour map, where "variable" is the template
// parameter.
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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: G4ModelCommandUtils.hh,v 1.2 2006/09/13 12:54:31 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay September 2006
//
// Command utilities
//
#ifndef G4MODELCOMMANDUTILS_HH
#define G4MODELCOMMANDUTILS_HH
#include "G4String.hh"
#include "G4ModelCommandsT.hh"
#include "G4UImessenger.hh"
#include "G4VisTrajContext.hh"
namespace G4ModelCommandUtils {
void AddContextMsgrs(G4VisTrajContext* context, std::vector<G4UImessenger*>& messengers,
const G4String& placement)
{
messengers.push_back(new G4ModelCmdCreateContextDir<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetDrawLine<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetLineVisible<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetLineColour<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetDrawStepPts<G4VisTrajContext>(context, placement));
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 G4ModelCmdSetStepPtsType<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsFillStyle<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetDrawAuxPts<G4VisTrajContext>(context, placement));
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 G4ModelCmdSetAuxPtsType<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsFillStyle<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetTimeSliceInterval<G4VisTrajContext>(context, placement));
}
}
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ModelCommandsT.hh,v 1.7 2006/06/29 21:30:24 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4ModelCommandsT.hh,v 1.12 2006/11/01 10:34:03 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Generic model messenges.
//
@@ -45,8 +45,9 @@ class G4ModelCmdSetStringColour : public G4ModelCmdApplyStringColour<M> {
public: // With description
G4ModelCmdSetStringColour(M* model, const G4String& placement)
:G4ModelCmdApplyStringColour<M>(model, placement, "set") {}
G4ModelCmdSetStringColour(M* model, const G4String& placement,
const G4String& cmdName="set")
:G4ModelCmdApplyStringColour<M>(model, placement, cmdName) {}
virtual ~G4ModelCmdSetStringColour() {}
@@ -65,8 +66,9 @@ class G4ModelCmdSetDefaultColour : public G4ModelCmdApplyColour<M> {
public: // With description
G4ModelCmdSetDefaultColour(M* model, const G4String& placement)
:G4ModelCmdApplyColour<M>(model, placement, "setDefault") {}
G4ModelCmdSetDefaultColour(M* model, const G4String& placement,
const G4String& cmdName="setDefault")
:G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
virtual ~G4ModelCmdSetDefaultColour() {}
@@ -85,8 +87,9 @@ class G4ModelCmdAddString : public G4ModelCmdApplyString<M> {
public: // With description
G4ModelCmdAddString(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "add")
G4ModelCmdAddString(M* model, const G4String& placement,
const G4String& cmdName="add")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4ModelCmdApplyString<M>::Command()->SetGuidance("Add command");
}
@@ -108,8 +111,9 @@ class G4ModelCmdAddInt : public G4ModelCmdApplyInteger<M> {
public: // With description
G4ModelCmdAddInt(M* model, const G4String& placement)
:G4ModelCmdApplyInteger<M>(model, placement, "add")
G4ModelCmdAddInt(M* model, const G4String& placement,
const G4String& cmdName="add")
:G4ModelCmdApplyInteger<M>(model, placement, cmdName)
{
G4ModelCmdApplyInteger<M>::Command()->SetGuidance("Add command");
}
@@ -131,8 +135,9 @@ class G4ModelCmdInvert : public G4ModelCmdApplyBool<M> {
public: // With description
G4ModelCmdInvert(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "invert")
G4ModelCmdInvert(M* model, const G4String& placement,
const G4String& cmdName="invert")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Invert command");
}
@@ -154,8 +159,9 @@ class G4ModelCmdActive : public G4ModelCmdApplyBool<M> {
public: // With description
G4ModelCmdActive(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "active")
G4ModelCmdActive(M* model, const G4String& placement,
const G4String& cmdName="active")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Active command");
}
@@ -177,8 +183,9 @@ class G4ModelCmdVerbose : public G4ModelCmdApplyBool<M> {
public: // With description
G4ModelCmdVerbose(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "verbose")
G4ModelCmdVerbose(M* model, const G4String& placement,
const G4String& cmdName="verbose")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Verbose command");
}
@@ -200,8 +207,9 @@ class G4ModelCmdReset : public G4ModelCmdApplyNull<M> {
public: // With description
G4ModelCmdReset(M* model, const G4String& placement)
:G4ModelCmdApplyNull<M>(model, placement, "reset")
G4ModelCmdReset(M* model, const G4String& placement,
const G4String& cmdName="reset")
:G4ModelCmdApplyNull<M>(model, placement, cmdName)
{
G4ModelCmdApplyNull<M>::Command()->SetGuidance("Reset command");
}
@@ -223,9 +231,10 @@ class G4ModelCmdSetAuxPtsColour : public G4ModelCmdApplyColour<M> {
public:
G4ModelCmdSetAuxPtsColour(M* model, const G4String& placement)
:G4ModelCmdApplyColour<M>(model, placement, "setAuxPtsColour") {}
G4ModelCmdSetAuxPtsColour(M* model, const G4String& placement,
const G4String& cmdName="setAuxPtsColour")
:G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
protected:
void Apply(const G4Colour& colour) {
@@ -241,9 +250,10 @@ class G4ModelCmdSetStepPtsColour : public G4ModelCmdApplyColour<M> {
public:
G4ModelCmdSetStepPtsColour(M* model, const G4String& placement)
:G4ModelCmdApplyColour<M>(model, placement, "setStepPtsColour") {}
G4ModelCmdSetStepPtsColour(M* model, const G4String& placement,
const G4String& cmdName="setStepPtsColour")
:G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
protected:
void Apply(const G4Colour& colour) {
@@ -259,8 +269,9 @@ class G4ModelCmdSetDrawLine : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetDrawLine(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setDrawLine")
G4ModelCmdSetDrawLine(M* model, const G4String& placement,
const G4String& cmdName="setDrawLine")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw line command");
}
@@ -280,8 +291,9 @@ class G4ModelCmdSetLineVisible : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetLineVisible(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setLineVisible")
G4ModelCmdSetLineVisible(M* model, const G4String& placement,
const G4String& cmdName="setLineVisible")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set line visibility command");
}
@@ -301,8 +313,9 @@ class G4ModelCmdSetDrawAuxPts : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetDrawAuxPts(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setDrawAuxPts")
G4ModelCmdSetDrawAuxPts(M* model, const G4String& placement,
const G4String& cmdName="setDrawAuxPts")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw auxiliary points command");
}
@@ -322,8 +335,9 @@ class G4ModelCmdSetAuxPtsVisible : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetAuxPtsVisible(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setAuxPtsVisible")
G4ModelCmdSetAuxPtsVisible(M* model, const G4String& placement,
const G4String& cmdName="setAuxPtsVisible")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set auxiliary points visibility command");
}
@@ -343,8 +357,9 @@ class G4ModelCmdSetDrawStepPts : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetDrawStepPts(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setDrawStepPts")
G4ModelCmdSetDrawStepPts(M* model, const G4String& placement,
const G4String& cmdName="setDrawStepPts")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw step points command");
}
@@ -364,10 +379,11 @@ class G4ModelCmdSetStepPtsVisible : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetStepPtsVisible(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setStepPtsVisible")
G4ModelCmdSetStepPtsVisible(M* model, const G4String& placement,
const G4String& cmdName="setStepPtsVisible")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set step points colour command");
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set step points visible command");
}
protected:
@@ -385,8 +401,9 @@ class G4ModelCmdSetAuxPtsSize : public G4ModelCmdApplyDouble<M> {
public:
G4ModelCmdSetAuxPtsSize(M* model, const G4String& placement)
:G4ModelCmdApplyDouble<M>(model, placement, "setAuxPtsSize")
G4ModelCmdSetAuxPtsSize(M* model, const G4String& placement,
const G4String& cmdName="setAuxPtsSize")
:G4ModelCmdApplyDouble<M>(model, placement, cmdName)
{
G4ModelCmdApplyDouble<M>::Command()->SetGuidance("Set auxiliary points size command");
}
@@ -406,10 +423,11 @@ class G4ModelCmdSetStepPtsSize : public G4ModelCmdApplyDouble<M> {
public:
G4ModelCmdSetStepPtsSize(M* model, const G4String& placement)
:G4ModelCmdApplyDouble<M>(model, placement, "setStepPtsSize")
G4ModelCmdSetStepPtsSize(M* model, const G4String& placement,
const G4String& cmdName="setStepPtsSize")
:G4ModelCmdApplyDouble<M>(model, placement, cmdName)
{
G4ModelCmdApplyDouble<M>::Command()->SetGuidance("Set step points colour command");
G4ModelCmdApplyDouble<M>::Command()->SetGuidance("Set step points size command");
}
protected:
@@ -427,8 +445,9 @@ class G4ModelCmdSetStepPtsType : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetStepPtsType(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "setStepPtsType")
G4ModelCmdSetStepPtsType(M* model, const G4String& placement,
const G4String& cmdName="setStepPtsType")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set step points type.");
@@ -463,8 +482,9 @@ class G4ModelCmdSetAuxPtsType : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetAuxPtsType(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "setAuxPtsType")
G4ModelCmdSetAuxPtsType(M* model, const G4String& placement,
const G4String& cmdName="setAuxPtsType")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
@@ -501,8 +521,9 @@ class G4ModelCmdSetStepPtsFillStyle : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetStepPtsFillStyle(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "setStepPtsFillStyle")
G4ModelCmdSetStepPtsFillStyle(M* model, const G4String& placement,
const G4String& cmdName="setStepPtsFillStyle")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set step fill style type.");
@@ -537,8 +558,9 @@ class G4ModelCmdSetAuxPtsFillStyle : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetAuxPtsFillStyle(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "setAuxPtsFillStyle")
G4ModelCmdSetAuxPtsFillStyle(M* model, const G4String& placement,
const G4String& cmdName="setAuxPtsFillStyle")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set auxiliary fill style.");
@@ -573,8 +595,9 @@ class G4ModelCmdSetLineColour : public G4ModelCmdApplyColour<M> {
public:
G4ModelCmdSetLineColour(M* model, const G4String& placement)
:G4ModelCmdApplyColour<M>(model, placement, "setLineColour") {}
G4ModelCmdSetLineColour(M* model, const G4String& placement,
const G4String& cmdName="""setLineColour")
:G4ModelCmdApplyColour<M>(model, placement, cmdName){}
protected:
@@ -584,6 +607,31 @@ protected:
};
////////////////////////////////////////////////////////////////////////
// Set time slice interval command
template <typename M>
class G4ModelCmdSetTimeSliceInterval : public G4ModelCmdApplyDoubleAndUnit<M> {
public:
G4ModelCmdSetTimeSliceInterval(M* model, const G4String& placement,
const G4String& cmdName = "setTimeSliceInterval")
:G4ModelCmdApplyDoubleAndUnit<M>(model, placement, cmdName)
{
G4UIcmdWithADoubleAndUnit* cmd = G4ModelCmdApplyDoubleAndUnit<M>::Command();
cmd->SetGuidance
("Set time slice interval. Give unit, e.g., \"0.1 ns\"");
cmd->SetUnitCategory("Time");
}
protected:
void Apply(const G4double& myDouble) {
G4VModelCommand<M>::Model()->SetTimeSliceInterval(myDouble);
}
};
////////////////////////////////////////////////////////////////////////
// Create context directory command
template <typename M>
@@ -591,7 +639,8 @@ class G4ModelCmdCreateContextDir : public G4UImessenger {
public:
G4ModelCmdCreateContextDir(M* model, const G4String& placement) {
G4ModelCmdCreateContextDir(M* model, const G4String& placement)
{
G4String title = placement+"/"+model->Name()+"/";
cmd = new G4UIdirectory(title);
@@ -607,5 +656,102 @@ protected:
G4UIdirectory* cmd;
};
#endif
////////////////////////////////////////////////////////////////////////
// Draw command
template <typename M>
class G4ModelCmdDraw : public G4ModelCmdApplyBool<M> {
public: // With description
G4ModelCmdDraw(M* model, const G4String& placement,
const G4String& cmdName="draw")
:G4ModelCmdApplyBool<M>(model, placement, cmdName)
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Draw command");
}
virtual ~G4ModelCmdDraw() {}
protected:
virtual void Apply(const G4bool& newValue) {
if (newValue) G4VModelCommand<M>::Model()->Draw();
}
};
////////////////////////////////////////////////////////////////////////
// Set interval
template <typename M>
class G4ModelCmdAddInterval : public G4ModelCmdApplyString<M> {
public: // With description
G4ModelCmdAddInterval(M* model, const G4String& placement,
const G4String& cmdName="addInterval")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set interval.");
}
virtual ~G4ModelCmdAddInterval() {}
protected:
virtual void Apply(const G4String& param) {
G4VModelCommand<M>::Model()->AddInterval(param);
}
};
////////////////////////////////////////////////////////////////////////
// Set value
template <typename M>
class G4ModelCmdAddValue : public G4ModelCmdApplyString<M> {
public: // With description
G4ModelCmdAddValue(M* model, const G4String& placement,
const G4String& cmdName="addValue")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set value.");
}
virtual ~G4ModelCmdAddValue() {}
protected:
virtual void Apply(const G4String& param) {
G4VModelCommand<M>::Model()->AddValue(param);
}
};
////////////////////////////////////////////////////////////////////////
// Set string command
template <typename M>
class G4ModelCmdSetString : public G4ModelCmdApplyString<M> {
public: // With description
G4ModelCmdSetString(M* model, const G4String& placement,
const G4String& cmdName="set")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4ModelCmdApplyString<M>::Command()->SetGuidance("Set command");
}
virtual ~G4ModelCmdSetString() {}
protected:
virtual void Apply(const G4String& newValue) {
G4VModelCommand<M>::Model()->Set(newValue);
}
};
#endif
@@ -0,0 +1,141 @@
//
// ********************************************************************
// * 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: G4ModelCompoundCommandsT.hh,v 1.1 2006/09/11 21:52:18 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay September 2006
//
// Compound model commands.
//
#ifndef G4MODELCOMPOUNDCOMMANDST_HH
#define G4MODELCOMPOUNDCOMMANDST_HH
#include "G4ModelApplyCommandsT.hh"
#include "G4ModelCommandUtils.hh"
#include "G4ModelCommandsT.hh"
#include "G4String.hh"
////////////////////////////////////////////////////////////////////////
// Set interval context
template <typename M>
class G4ModelCmdAddIntervalContext: public G4ModelCmdApplyString<M> {
public: // With description
G4ModelCmdAddIntervalContext(M* model, const G4String& placement,
const G4String& cmdName="addInterval")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Add interval.");
}
virtual ~G4ModelCmdAddIntervalContext() {
std::vector<G4UImessenger*>::iterator iter = fMessengers.begin();
while (iter != fMessengers.end()) {
delete *iter;
iter++;
}
}
protected:
virtual void Apply(const G4String& param) {
G4String myString(param);
G4String name;
std::istringstream is(param);
is >> name;
myString.erase(0, name.size());
G4String dir = G4VModelCommand<M>::Placement()+"/"+G4VModelCommand<M>::Model()->Name();
G4VisTrajContext* context = new G4VisTrajContext(name);
G4ModelCommandUtils::AddContextMsgrs(context, fMessengers, dir);
G4VModelCommand<M>::Model()->AddIntervalContext(myString, context);
}
private:
std::vector<G4UImessenger*> fMessengers;
};
////////////////////////////////////////////////////////////////////////
// Set value context
template <typename M>
class G4ModelCmdAddValueContext: public G4ModelCmdApplyString<M> {
public: // With description
G4ModelCmdAddValueContext(M* model, const G4String& placement,
const G4String& cmdName="addValue")
:G4ModelCmdApplyString<M>(model, placement, cmdName)
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Add value.");
}
virtual ~G4ModelCmdAddValueContext() {
std::vector<G4UImessenger*>::iterator iter = fMessengers.begin();
while (iter != fMessengers.end()) {
delete *iter;
iter++;
}
}
protected:
virtual void Apply(const G4String& param) {
G4String myString(param);
G4String name;
std::istringstream is(param);
is >> name;
myString.erase(0, name.size());
G4String dir = G4VModelCommand<M>::Placement()+"/"+G4VModelCommand<M>::Model()->Name();
G4VisTrajContext* context = new G4VisTrajContext(name);
G4ModelCommandUtils::AddContextMsgrs(context, fMessengers, dir);
G4VModelCommand<M>::Model()->AddValueContext(myString, context);
}
private:
std::vector<G4UImessenger*> fMessengers;
};
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.hh,v 1.12 2006/06/29 21:30:26 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4ModelingParameters.hh,v 1.17 2006/11/14 14:42:08 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 31st December 1997.
@@ -43,6 +43,8 @@
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4VisAttributes;
class G4Polyhedron;
class G4Event;
class G4ModelingParameters {
@@ -58,67 +60,17 @@ public: // With description
};
// Currently requested drawing style.
enum RepStyle {
wireframe, // Use G4Wireframe.
polyhedron, // Use G4Polyhedron.
nurbs // Use G4NURBS.
};
// RepStyle is used to determine which graphics_reps classes to use,
// if required.
G4ModelingParameters ();
G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
DrawingStyle drawingStyle,
RepStyle repStyle,
DrawingStyle drawingStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides);
// noOfSides is suggested no. of sides per circle in case a
// polygonal representation is produced.
G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
DrawingStyle drawingStyle,
RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides,
G4bool isViewGeom,
G4bool isViewHits,
G4bool isViewDigis);
// noOfSides is suggested no. of sides per circle in case a
// polygonal representation is produced.
G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides);
// noOfSides is suggested no. of sides per circle in case a
// polygonal representation is produced.
G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides,
G4bool isViewGeom,
G4bool isViewHits,
G4bool isViewDigis);
// noOfSides is suggested no. of sides per circle in case a
// polygonal representation is produced.
// Culling and clipping policy for G4PhysicalVolumeModel.
~G4ModelingParameters ();
@@ -127,55 +79,55 @@ public: // With description
G4bool operator != (const G4ModelingParameters&) const;
// Get and Is functions...
G4bool IsWarning () const;
const G4VisAttributes* GetDefaultVisAttributes () const;
DrawingStyle GetDrawingStyle () const;
RepStyle GetRepStyle () const;
G4bool IsCulling () const;
G4bool IsCullingInvisible () const;
G4bool IsDensityCulling () const;
G4double GetVisibleDensity () const;
G4bool IsCullingCovered () const;
G4bool IsExplode () const;
G4double GetExplodeFactor () const;
const G4Point3D& GetExplodeCentre () const;
G4int GetNoOfSides () const;
G4bool IsViewGeom () const;
G4bool IsViewHits () const;
G4bool IsViewDigis () const;
const G4Polyhedron* GetSectionPolyhedron () const;
const G4Polyhedron* GetCutawayPolyhedron () const;
const G4Event* GetEvent () const;
// Set functions...
void SetWarning (G4bool);
void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
void SetDrawingStyle (DrawingStyle);
void SetRepStyle (RepStyle);
void SetCulling (G4bool);
void SetCullingInvisible (G4bool);
void SetDensityCulling (G4bool);
void SetVisibleDensity (G4double);
void SetCullingCovered (G4bool);
void SetExplodeFactor (G4double explodeFactor);
void SetExplodeCentre (const G4Point3D& explodeCentre);
G4int SetNoOfSides (G4int); // Returns actual number set.
void SetViewGeom ();
void UnsetViewGeom ();
void SetViewHits ();
void UnsetViewHits ();
void SetViewDigis ();
void UnsetViewDigis ();
// Other functions...
void PrintDifferences (const G4ModelingParameters& that) const;
void SetSectionPolyhedron (const G4Polyhedron* pSectionPolyhedron);
void SetCutawayPolyhedron (const G4Polyhedron* pCutawayPolyhedron);
void SetEvent (const G4Event* pEvent);
private:
// Data members...
G4bool fWarning; // Print warnings if true.
const G4VisAttributes* fpDefaultVisAttributes;
DrawingStyle fDrawingStyle; // Drawing style.
RepStyle fRepStyle; // Representation style.
G4bool fCulling; // Culling requested.
G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
G4bool fDensityCulling; // Density culling requested. If so...
G4double fVisibleDensity; // ...density lower than this not drawn.
G4bool fCullCovered; // Cull daughters covered by opaque mothers.
G4double fExplodeFactor; // Explode along radius by this factor...
G4Point3D fExplodeCentre; // ...about this centre.
G4int fNoOfSides; // ...if polygon approximates circle.
G4bool fViewGeom; // View geometry objects.
G4bool fViewHits; // View hits, if any.
G4bool fViewDigis; // View digis, if any.
const G4Polyhedron* fpSectionPolyhedron; // For generic section (DCUT).
const G4Polyhedron* fpCutawayPolyhedron; // For generic cutaways.
const G4Event* fpEvent; // Event being processed.
};
#include "G4ModelingParameters.icc"
@@ -24,13 +24,17 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.icc,v 1.6 2006/06/29 21:30:28 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4ModelingParameters.icc,v 1.11 2006/11/14 14:42:08 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 31st December 1997.
// Parameters associated with the modeling of GEANT4 objects.
inline G4bool G4ModelingParameters::IsWarning () const {
return fWarning;
}
inline const G4VisAttributes*
G4ModelingParameters::GetDefaultVisAttributes () const {
return fpDefaultVisAttributes;
@@ -41,11 +45,6 @@ G4ModelingParameters::GetDrawingStyle () const {
return fDrawingStyle;
}
inline G4ModelingParameters::RepStyle
G4ModelingParameters::GetRepStyle () const {
return fRepStyle;
}
inline G4bool G4ModelingParameters::IsCulling () const {
return fCulling;
}
@@ -66,20 +65,33 @@ inline G4bool G4ModelingParameters::IsCullingCovered () const {
return fCullCovered;
}
inline G4bool G4ModelingParameters::IsExplode () const {
return fExplodeFactor > 1.;
}
inline G4double G4ModelingParameters::GetExplodeFactor () const {
return fExplodeFactor;
}
inline const G4Point3D& G4ModelingParameters::GetExplodeCentre () const {
return fExplodeCentre;
}
inline G4int G4ModelingParameters::GetNoOfSides () const {
return fNoOfSides;
}
inline G4bool G4ModelingParameters::IsViewGeom () const {
return fViewGeom;
}
inline const G4Polyhedron* G4ModelingParameters::GetSectionPolyhedron () const
{return fpSectionPolyhedron;}
inline G4bool G4ModelingParameters::IsViewHits () const {
return fViewHits;
}
inline const G4Polyhedron* G4ModelingParameters::GetCutawayPolyhedron () const
{return fpCutawayPolyhedron;}
inline G4bool G4ModelingParameters::IsViewDigis () const {
return fViewDigis;
inline const G4Event* G4ModelingParameters::GetEvent () const
{return fpEvent;}
inline void G4ModelingParameters::SetWarning (G4bool value) {
fWarning = value;
}
inline void G4ModelingParameters::SetDefaultVisAttributes
@@ -93,11 +105,6 @@ G4ModelingParameters::SetDrawingStyle
fDrawingStyle = style;
}
inline void
G4ModelingParameters::SetRepStyle (G4ModelingParameters::RepStyle style) {
fRepStyle = style;
}
inline void G4ModelingParameters::SetCulling (G4bool value) {
fCulling = value;
}
@@ -114,26 +121,25 @@ inline void G4ModelingParameters::SetCullingCovered (G4bool value) {
fCullCovered = value;
}
inline void G4ModelingParameters::SetViewGeom () {
fViewGeom = true;
inline void G4ModelingParameters::SetExplodeFactor (G4double explodeFactor) {
fExplodeFactor = explodeFactor;
}
inline void G4ModelingParameters::UnsetViewGeom () {
fViewGeom = false;
inline void G4ModelingParameters::SetExplodeCentre
(const G4Point3D& explodeCentre) {
fExplodeCentre = explodeCentre;
}
inline void G4ModelingParameters::SetViewHits () {
fViewHits = true;
inline void G4ModelingParameters::SetSectionPolyhedron
(const G4Polyhedron* pSectionPolyhedron) {
fpSectionPolyhedron = pSectionPolyhedron;
}
inline void G4ModelingParameters::UnsetViewHits () {
fViewHits = false;
inline void G4ModelingParameters::SetCutawayPolyhedron
(const G4Polyhedron* pCutawayPolyhedron) {
fpCutawayPolyhedron = pCutawayPolyhedron;
}
inline void G4ModelingParameters::SetViewDigis () {
fViewDigis = true;
}
inline void G4ModelingParameters::UnsetViewDigis () {
fViewDigis = false;
inline void G4ModelingParameters::SetEvent(const G4Event* pEvent) {
fpEvent = pEvent;
}
@@ -25,7 +25,7 @@
//
//
// $Id: G4NullModel.hh,v 1.7 2006/06/29 21:30:30 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 4th April 1998.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeMassScene.hh,v 1.7 2006/06/29 21:30:32 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4PhysicalVolumeMassScene.hh,v 1.8 2006/11/05 20:38:09 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 12th September 2004
@@ -36,6 +36,9 @@
// up to the depth specified in the G4PhysicalVolumeModel. Culling is
// ignored so that all volumes are seen.
//
// Do not use this for a "parallel world" for which materials are not
// defined. Use only for the material world.
//
// The calculation is quite tricky, since it involves subtracting the
// mass of that part of the mother that is occupied by each daughter and
// then adding the mass of the daughter, and so on down the heirarchy.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.hh,v 1.28 2006/06/29 21:30:34 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4PhysicalVolumeModel.hh,v 1.32 2006/10/26 11:05:42 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 31st December 1997.
@@ -50,8 +50,10 @@
#include "G4VModel.hh"
#include "G4Transform3D.hh"
#include "G4Plane3D.hh"
#include <iostream>
#include <vector>
#include <map>
class G4VPhysicalVolume;
class G4LogicalVolume;
@@ -59,6 +61,8 @@ class G4VSolid;
class G4Material;
class G4VisAttributes;
class G4Polyhedron;
class G4AttDef;
class G4AttValue;
class G4PhysicalVolumeModel: public G4VModel {
@@ -66,17 +70,21 @@ public: // With description
enum {UNLIMITED = -1};
enum ClippingMode {subtraction, intersection};
class G4PhysicalVolumeNodeID {
public:
G4PhysicalVolumeNodeID(G4VPhysicalVolume* pPV = 0, G4int iCopyNo = 0):
fpPV(pPV), fCopyNo(iCopyNo) {}
G4PhysicalVolumeNodeID
(G4VPhysicalVolume* pPV = 0, G4int iCopyNo = 0, G4int depth = 0):
fpPV(pPV), fCopyNo(iCopyNo), fNonCulledDepth(depth) {}
G4VPhysicalVolume* GetPhysicalVolume() const {return fpPV;}
G4int GetCopyNo() const {return fCopyNo;}
G4int GetNonCulledDepth() const {return fNonCulledDepth;}
G4bool operator< (const G4PhysicalVolumeNodeID& right) const;
G4bool operator== (const G4PhysicalVolumeNodeID& right) const;
private:
G4VPhysicalVolume* fpPV;
G4int fCopyNo;
G4int fNonCulledDepth;
};
// Nested class for identifying physical volume nodes.
@@ -92,16 +100,7 @@ public: // With description
void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the graphics scene
// handler (a object which inherits G4VSceneHandler, which inherits
// G4VGraphicsScene). It can also provide special information
// through pointers to working space in the scene handler. These
// pointers must be set up (if required by the scene handler) in the
// scene handler's implementaion of EstablishSpecials
// (G4PhysicalVolumeModel&) which is called from here. To do this,
// the scene handler should call DefinePointersToWorkingSpace - see
// below. DecommissionSpecials (G4PhysicalVolumeModel&) is also
// called from here. To see how this works, look at the
// implementation of this function and
// G4VSceneHandler::Establish/DecommissionSpecials.
// G4VGraphicsScene).
G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
@@ -109,17 +108,11 @@ public: // With description
G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
const G4PhysicalVolumeModel* GetG4PhysicalVolumeModel () const
{return this;}
G4PhysicalVolumeModel* GetG4PhysicalVolumeModel ()
{return this;}
G4VPhysicalVolume* GetTopPhysicalVolume () const {return fpTopPV;}
G4int GetRequestedDepth () const {return fRequestedDepth;}
const G4Polyhedron* GetClippingVolume () const
const G4Polyhedron* GetClippingPolyhedron () const
{return fpClippingPolyhedron;}
G4int GetCurrentDepth() const {return fCurrentDepth;}
@@ -147,6 +140,19 @@ public: // With description
// and there will already be a node in place on which to hang the
// current volume.
const std::map<G4String,G4AttDef>* GetAttDefs() const;
// Attribute definitions for current solid.
std::vector<G4AttValue>* CreateCurrentAttValues() const;
// Attribute values for current solid. Each must refer to an
// attribute definition in the above map; its name is the key. The
// user must test the validity of this pointer (it must be non-zero
// and conform to the G4AttDefs, which may be checked with
// G4AttCheck) and delete the list after use. See
// G4XXXStoredSceneHandler::PreAddSolid for how to access and
// G4VTrajectory::ShowTrajectory for an example of the use of
// G4Atts.
void SetRequestedDepth (G4int requestedDepth) {
fRequestedDepth = requestedDepth;
}
@@ -155,19 +161,13 @@ public: // With description
fpClippingPolyhedron = pClippingPolyhedron;
}
void SetClippingMode (ClippingMode mode) {
fClippingMode = mode;
}
G4bool Validate (G4bool warn);
// Validate, but allow internal changes (hence non-const function).
void DefinePointersToWorkingSpace
(G4int* pCurrentDepth = 0,
G4VPhysicalVolume** ppCurrentPV = 0,
G4LogicalVolume** ppCurrentLV = 0,
G4Material** ppCurrentMaterial = 0,
std::vector<G4PhysicalVolumeNodeID>* pDrawnPVPath = 0);
// For use (optional) by the scene handler if it needs to know about
// the current information maintained through these pointers. For
// description of pointers, see below.
void CurtailDescent() {fCurtailDescent = true;}
protected:
@@ -206,17 +206,9 @@ protected:
G4LogicalVolume* fpCurrentLV; // Current logical volume.
G4Material* fpCurrentMaterial; // Current material.
std::vector<G4PhysicalVolumeNodeID> fDrawnPVPath;
G4bool fCurtailDescent; // Can be set to curtail descent.
G4bool fCurtailDescent;// Can be set to curtail descent.
const G4Polyhedron*fpClippingPolyhedron;
////////////////////////////////////////////////////////////
// Pointers to working space in scene handler, if required.
G4int* fpCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume** fppCurrentPV; // Current physical volume.
G4LogicalVolume** fppCurrentLV; // Current logical volume.
G4Material** fppCurrentMaterial; // Current material.
std::vector<G4PhysicalVolumeNodeID>* fpDrawnPVPath;
ClippingMode fClippingMode;
private:
@@ -25,7 +25,7 @@
//
//
// $Id: G4PhysicalVolumeSearchScene.hh,v 1.17 2006/06/29 21:30:36 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 10th August 1998.
@@ -25,7 +25,7 @@
//
//
// $Id: G4PhysicalVolumeSearchScene.icc,v 1.6 2006/06/29 21:30:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 10th August 1998.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ScaleModel.hh,v 1.3 2006/06/29 21:31:10 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4ScaleModel.hh,v 1.4 2006/11/01 10:28:42 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 21st July 2001.
@@ -55,12 +55,6 @@ public: // With description
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the graphics scene.
virtual G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
virtual G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
private:
// Private copy contructor and assignment to forbid use...
@@ -70,6 +64,4 @@ private:
G4Scale fScale;
};
#include "G4ScaleModel.icc"
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4TextModel.hh,v 1.6 2006/06/29 21:31:39 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TextModel.hh,v 1.7 2006/11/01 10:28:42 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 3rd April 2001
@@ -55,12 +55,6 @@ public: // With description
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the graphics scene.
virtual G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
virtual G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
private:
// Private copy contructor and assignment to forbid use...
@@ -71,6 +65,4 @@ private:
};
#include "G4TextModel.icc"
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4TrajectoriesModel.hh,v 1.9 2006/06/29 21:31:43 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoriesModel.hh,v 1.10 2006/10/26 11:10:23 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 26th August 1998.
@@ -43,6 +43,8 @@
#include "G4VModel.hh"
class G4VTrajectory;
class G4TrajectoriesModel: public G4VModel {
public: // With description
@@ -54,21 +56,17 @@ public: // With description
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the graphics scene.
virtual G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
virtual G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
G4int GetDrawingMode() const { return fDrawingMode;}
void SetDrawingMode(G4int drawingMode) {fDrawingMode = drawingMode;}
const G4VTrajectory* GetCurrentTrajectory() const
{return fpCurrentTrajectory;}
private:
G4int fDrawingMode;
const G4VTrajectory* fpCurrentTrajectory;
};
#include "G4TrajectoriesModel.icc"
#endif
@@ -1,36 +0,0 @@
//
// ********************************************************************
// * 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: G4TrajectoriesModel.icc,v 1.7 2006/06/29 21:31:45 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
inline G4String G4TrajectoriesModel::GetCurrentTag () const {
return fGlobalTag;
}
inline G4String G4TrajectoriesModel::GetCurrentDescription () const {
return fGlobalDescription;
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryChargeFilter.hh,v 1.2 2006/06/29 21:31:47 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoryChargeFilter.hh,v 1.3 2006/08/25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Filter trajectories according to charge. Only registered
// charges will pass the filter.
@@ -48,7 +48,7 @@ public: // With description
virtual ~G4TrajectoryChargeFilter();
// Evaluate this trajectory
virtual bool Evaluate(const G4VTrajectory&);
virtual bool Evaluate(const G4VTrajectory&) const;
// Print configuration
virtual void Print(std::ostream& ostr) const;
@@ -23,14 +23,61 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawByAttribute.hh,v 1.1 2006/09/11 21:52:18 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// $Id: G4TextModel.icc,v 1.4 2006/06/29 21:31:41 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// Jane Tinslay September 2006
//
// Draw trajectories according to attribute.
//
#ifndef G4TRAJECTORYDRAWBYATTRIBUTE_HH
#define G4TRAJECTORYDRAWBYATTRIBUTE_HH
inline G4String G4TextModel::GetCurrentTag () const {
return fGlobalTag;
}
#include "globals.hh"
#include "G4VTrajectoryModel.hh"
#include <map>
inline G4String G4TextModel::GetCurrentDescription () const {
return fGlobalDescription;
}
class G4VAttValueFilter;
class G4VisTrajContext;
class G4TrajectoryDrawByAttribute : public G4VTrajectoryModel {
public:
// Constructor
G4TrajectoryDrawByAttribute(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
// Destructor
virtual ~G4TrajectoryDrawByAttribute();
// Draw the trajectory with optional i_mode parameter
virtual void Draw(const G4VTrajectory& trajectory, const G4int& i_mode = 0,
const G4bool& visible = true) const;
// Print configuration
virtual void Print(std::ostream& ostr) const;
// Configuration methods
void Set(const G4String& attribute);
void AddIntervalContext(const G4String& name, G4VisTrajContext* context);
void AddValueContext(const G4String& name, G4VisTrajContext* context);
private:
enum Config {Interval, SingleValue};
typedef std::pair<G4String, Config> Pair;
typedef std::map<Pair, G4VisTrajContext*> ContextMap;
// Data members
G4String fAttName;
ContextMap fContextMap;
// Caching
mutable G4bool fFirst;
mutable G4bool fWarnedMissingAttribute;
mutable G4VAttValueFilter* filter;
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4TrajectoryDrawByCharge.hh,v 1.7 2006/06/29 21:31:49 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4TrajectoryDrawByOriginVolume.hh,v 1.4 2006/06/29 21:31:51 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Class Description:
// Trajectory model which colours a trajectory according to
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4TrajectoryDrawByParticleID.hh,v 1.7 2006/06/29 21:31:53 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4TrajectoryDrawerUtils.hh,v 1.6 2006/06/29 21:31:55 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// $Id: G4TrajectoryFilterFactories.hh,v 1.3 2006/06/29 21:31:57 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
/// $Id: G4TrajectoryFilterFactories.hh,v 1.4 2006/09/12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// Trajectory filter model factories creating filters
@@ -39,6 +39,22 @@
#include "G4VModelFactory.hh"
#include "G4VTrajectory.hh"
// Attribute filter
class G4TrajectoryAttributeFilterFactory : public G4VModelFactory< G4VFilter<G4VTrajectory> > {
public: // With description
typedef std::vector<G4UImessenger*> Messengers;
typedef std::pair< G4VFilter<G4VTrajectory> *, Messengers > ModelAndMessengers;
G4TrajectoryAttributeFilterFactory();
virtual ~G4TrajectoryAttributeFilterFactory();
ModelAndMessengers Create(const G4String& placement, const G4String& name);
};
// Charge filter
class G4TrajectoryChargeFilterFactory : public G4VModelFactory< G4VFilter<G4VTrajectory> > {
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4TrajectoryGenericDrawer.hh,v 1.2 2006/06/29 21:31:59 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryModelFactories.hh,v 1.5 2006/06/29 21:32:01 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoryModelFactories.hh,v 1.6 2006/09/12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
//
@@ -44,6 +44,18 @@ namespace {
typedef std::pair<G4VTrajectoryModel*, Messengers > ModelAndMessengers;
}
class G4TrajectoryDrawByAttributeFactory : public G4VModelFactory<G4VTrajectoryModel> {
public: // With description
G4TrajectoryDrawByAttributeFactory();
virtual ~G4TrajectoryDrawByAttributeFactory();
ModelAndMessengers Create(const G4String& placement, const G4String& name);
};
class G4TrajectoryDrawByChargeFactory : public G4VModelFactory<G4VTrajectoryModel> {
public: // With description
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryOriginVolumeFilter.hh,v 1.2 2006/06/29 21:32:03 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoryOriginVolumeFilter.hh,v 1.3 2006/08/25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Filter trajectories according to volume name. Only registered
// volumes will pass the filter.
@@ -48,7 +48,7 @@ public: // With description
virtual ~G4TrajectoryOriginVolumeFilter();
// Evaluate this trajectory
virtual bool Evaluate(const G4VTrajectory&);
virtual bool Evaluate(const G4VTrajectory&) const;
// Print configuration
virtual void Print(std::ostream& ostr) const;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryParticleFilter.hh,v 1.2 2006/06/29 21:32:05 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoryParticleFilter.hh,v 1.3 2006/08/25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Filter trajectories according to particle type. Only registered
// particle types will pass the filter.
@@ -48,7 +48,7 @@ public: // With description
virtual ~G4TrajectoryParticleFilter();
// Evaluate this trajectory
virtual bool Evaluate(const G4VTrajectory&);
virtual bool Evaluate(const G4VTrajectory&) const;
// Print configuration
virtual void Print(std::ostream& ostr) const;
@@ -23,14 +23,47 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VAttValueFilter.hh,v 1.2 2006/12/13 15:50:04 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// $Id: G4ScaleModel.icc,v 1.3 2006/06/29 21:31:35 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// Abstract base class for G4AttValue filters
//
// Jane Tinslay, September 2006
//
#ifndef G4VATTVALUEFILTER_HH
#define G4VATTVALUEFILTER_HH
inline G4String G4ScaleModel::GetCurrentTag () const {
return fGlobalTag;
}
#include "globals.hh"
#include "G4String.hh"
#include "G4VFilter.hh"
inline G4String G4ScaleModel::GetCurrentDescription () const {
return fGlobalDescription;
}
class G4AttValue;
class G4VAttValueFilter : public G4VFilter<G4AttValue> {
public:
// Constructor
G4VAttValueFilter(const G4String& name = "G4AttValueFilter")
:G4VFilter<G4AttValue>(name){}
// Destructor
virtual ~G4VAttValueFilter() {}
// Filter methods
virtual G4bool Accept(const G4AttValue&) const = 0;
virtual G4bool GetValidElement(const G4AttValue&, G4String&) const = 0;
// Print configuration
virtual void PrintAll(std::ostream& ostr) const = 0;
// Reset
virtual void Reset() = 0;
// Load filter data
virtual void LoadIntervalElement(const G4String&) = 0;
virtual void LoadSingleValueElement(const G4String&) = 0;
};
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VModel.hh,v 1.18 2006/06/29 21:32:07 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4VModel.hh,v 1.19 2006/07/10 16:09:30 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 31st December 1997.
@@ -88,10 +88,6 @@ public: // With description
// world. It is the responsibility of the model to apply this
// transformation before passing items to the graphics scene.
virtual const G4PhysicalVolumeModel* GetG4PhysicalVolumeModel () const;
virtual G4PhysicalVolumeModel* GetG4PhysicalVolumeModel ();
// Returns 0 unless implemented by derived class.
// Set methods for above...
void SetModelingParameters (const G4ModelingParameters*);
void SetExtent (const G4VisExtent&);
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VModel.icc,v 1.11 2006/06/29 21:32:11 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4VModel.icc,v 1.12 2006/07/10 16:09:30 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 31st December 1997.
@@ -51,15 +51,6 @@ inline const G4Transform3D& G4VModel::GetTransformation () const {
return fTransform;
}
inline const G4PhysicalVolumeModel*
G4VModel::GetG4PhysicalVolumeModel () const {
return 0;
}
inline G4PhysicalVolumeModel* G4VModel::GetG4PhysicalVolumeModel () {
return 0;
}
inline void G4VModel::SetModelingParameters (const G4ModelingParameters* pMP) {
fpMP = pMP;
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VModelCommand.hh,v 1.3 2006/06/29 21:32:27 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4VModelCommand.hh,v 1.4 2006/09/11 21:22:02 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -45,29 +45,34 @@ class G4UIcommand;
template <typename T>
class G4VModelCommand : public G4UImessenger {
public: // With description
public:
G4VModelCommand(T* model);
// Input model
// Constructor
G4VModelCommand(T* model, const G4String& placement="");
// Destructor
virtual ~G4VModelCommand();
// Methods
G4String GetCurrentValue(G4UIcommand* command);
G4String Placement();
protected:
T* Model();
// Access to model
T* Model();
private:
// Data members
T* fpModel;
G4String fPlacement;
};
template <typename T>
G4VModelCommand<T>::G4VModelCommand(T* model)
G4VModelCommand<T>::G4VModelCommand(T* model, const G4String& placement)
:fpModel(model)
,fPlacement(placement)
{}
template <typename T>
@@ -87,6 +92,13 @@ G4VModelCommand<T>::Model()
return fpModel;
}
template <typename T>
G4String
G4VModelCommand<T>::Placement()
{
return fPlacement;
}
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4VModelFactory.hh,v 1.6 2006/06/29 21:32:30 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VTrajectoryModel.hh,v 1.6 2006/06/29 21:32:32 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4VTrajectoryModel.hh,v 1.7 2006/08/14 11:43:34 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
//
@@ -53,7 +53,7 @@ public:
virtual ~G4VTrajectoryModel();
// Draw method
virtual void Draw(const G4VTrajectory& model, const G4int& i_mode = 0,
virtual void Draw(const G4VTrajectory& trajectory, const G4int& i_mode = 0,
const G4bool& visible = true) const = 0;
// Print configuration
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisTrajContext.hh,v 1.2 2006/06/29 21:32:34 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4VisTrajContext.hh,v 1.3 2006/08/14 11:47:53 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay May 2006
//
@@ -99,6 +99,9 @@ public:
void SetStepPtsVisible(const G4bool& visible);
G4bool GetStepPtsVisible() const;
void SetTimeSliceInterval(const G4double& interval);
G4double GetTimeSliceInterval() const;
private:
// Data members
@@ -125,6 +128,9 @@ private:
G4Colour fStepPtsColour;
G4bool fStepPtsVisible;
// Time slicing
G4double fTimeSliceInterval;
};
#include "G4VisTrajContext.icc"
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisTrajContext.icc,v 1.2 2006/06/29 21:32:36 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4VisTrajContext.icc,v 1.3 2006/08/14 11:47:53 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay May 2006
//
@@ -88,6 +88,11 @@ inline G4Colour G4VisTrajContext::GetStepPtsColour() const {return fStepPtsColou
inline void G4VisTrajContext::SetStepPtsVisible(const G4bool& visible) {fStepPtsVisible = visible;}
inline G4bool G4VisTrajContext::GetStepPtsVisible() const {return fStepPtsVisible;}
inline void G4VisTrajContext::SetTimeSliceInterval(const G4double& interval) {fTimeSliceInterval = interval;}
inline G4double G4VisTrajContext::GetTimeSliceInterval() const {return fTimeSliceInterval;}
#include "G4UnitsTable.hh"
inline void G4VisTrajContext::Print(std::ostream& ostr) const
{
ostr<<"Name: "<<Name()<<G4endl;
@@ -106,6 +111,7 @@ inline void G4VisTrajContext::Print(std::ostream& ostr) const
ostr<<"Step points fill style "<<GetStepPtsFillStyle()<<G4endl;
ostr<<"Step points colour "<<GetStepPtsColour()<<G4endl;
ostr<<"Step points visible ? "<<GetStepPtsVisible()<<G4endl;
ostr<<"Time slice interval "<<G4BestUnit(GetTimeSliceInterval(),"Time")<<G4endl;
}
#endif