| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GiGaSetVisAttributes Class Reference

The simplest tool which set the visualisation attributes for G4 visualization. More...

#include <GiGaSetVisAttributes.h>

Inheritance diagram for GiGaSetVisAttributes:

[legend]
Collaboration diagram for GiGaSetVisAttributes:
[legend]
List of all members.

Public Types

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  Status
enum  Status
enum  Status

Public Member Functions

virtual StatusCode process (const std::string &volume) const
 the only one method
virtual StatusCode initialize ()
 initialize the object
virtual StatusCode finalize ()
 finalize the object
 GiGaSetVisAttributes (const std::string &type, const std::string &name, const IInterface *parent)
 standard constructor
virtual ~GiGaSetVisAttributes ()
 destructor
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)=0
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)=0
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)=0
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
virtual unsigned long addRef ()=0
virtual unsigned long addRef ()=0
virtual unsigned long addRef ()=0
virtual unsigned long addRef ()
virtual unsigned long release ()=0
virtual unsigned long release ()=0
virtual unsigned long release ()=0
StatusCode release (const IInterface *interface) const
virtual unsigned long release ()
virtual const std::string & type () const =0
virtual const std::string & type () const
virtual const IInterfaceparent () const =0
virtual const IInterfaceparent () const
virtual StatusCode configure ()=0
virtual StatusCode configure ()
virtual StatusCode start ()=0
virtual StatusCode start ()
virtual StatusCode stop ()=0
virtual StatusCode stop ()
virtual StatusCode terminate ()=0
virtual StatusCode terminate ()
virtual StatusCode reinitialize ()=0
virtual StatusCode reinitialize ()
virtual StatusCode restart ()=0
virtual StatusCode restart ()
virtual Gaudi::StateMachine::State FSMState () const =0
virtual Gaudi::StateMachine::State FSMState () const
virtual StatusCode sysInitialize ()=0
virtual StatusCode sysInitialize ()
virtual StatusCode sysStart ()=0
virtual StatusCode sysStart ()
virtual StatusCode sysStop ()=0
virtual StatusCode sysStop ()
virtual StatusCode sysFinalize ()=0
virtual StatusCode sysFinalize ()
virtual StatusCode sysReinitialize ()=0
virtual StatusCode sysReinitialize ()
virtual StatusCode sysRestart ()=0
virtual StatusCode sysRestart ()
virtual unsigned long refCount () const =0
virtual const std::string & name () const =0
virtual const std::string & name () const
virtual void handle (const Incident &i)
IGiGaSvcgigaSvc () const
IGiGaSetUpSvcsetupSvc () const
INTupleSvcntupleSvc () const
INTupleSvcevtColSvc () const
IDataProviderSvcdetSvc () const
IDataProviderSvcevtSvc () const
IIncidentSvcincSvc () const
IChronoStatSvcchronoSvc () const
IHistogramSvchistoSvc () const
IAlgContextSvccontextSvc () const
DataObjectput (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const
DataObjectput (DataObject *object, const std::string &address, const bool useRootInTES=true) const
Gaudi::Utils::GetData< TYPE
>::return_type 
get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Gaudi::Utils::GetData< TYPE
>::return_type 
get (const std::string &location, const bool useRootInTES=true) const
TYPE * getDet (IDataProviderSvc *svc, const std::string &location) const
TYPE * getDet (const std::string &location) const
bool exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
bool exist (const std::string &location, const bool useRootInTES=true) const
bool existDet (IDataProviderSvc *svc, const std::string &location) const
bool existDet (const std::string &location) const
TYPE * getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
TYPE * getOrCreate (const std::string &location, const bool useRootInTES=true) const
TOOL * tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const
TOOL * tool (const std::string &type, const IInterface *parent=0, bool create=true) const
SERVICE * svc (const std::string &name, const bool create=true) const
IUpdateManagerSvcupdMgrSvc () const
IDataProviderSvcfastContainersSvc () const
StatusCode Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
StatusCode Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
StatusCode Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const
StatusCode Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
StatusCode Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
StatusCode Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
StatusCode Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
StatusCode Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
MsgStreammsgStream (const MSG::Level level) const
MsgStreamalways () const
MsgStreamfatal () const
MsgStreamerr () const
MsgStreamerror () const
MsgStreamwarning () const
MsgStreaminfo () const
MsgStreamdebug () const
MsgStreamverbose () const
MsgStreammsg () const
const Statisticscounters () const
StatEntitycounter (const std::string &tag) const
MSG::Level msgLevel () const
bool msgLevel (const MSG::Level level) const
void resetMsgStream () const
bool typePrint () const
bool propsPrint () const
bool statPrint () const
bool errorsPrint () const
long printStat (const MSG::Level level=MSG::ALWAYS) const
long printErrors (const MSG::Level level=MSG::ALWAYS) const
long printProps (const MSG::Level level=MSG::ALWAYS) const
void registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL)
void registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL)
void registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL)
void registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL)
StatusCode runUpdate ()
TransientFastContainer< T > * getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0)
const std::string & context () const
const std::string & rootInTES () const
double globalTimeOffset () const
virtual Gaudi::StateMachine::State targetFSMState () const
virtual StatusCode setProperty (const Property &p)
virtual StatusCode setProperty (const std::string &s)
virtual StatusCode setProperty (const std::string &n, const std::string &v)
StatusCode setProperty (const std::string &name, const TYPE &value)
virtual StatusCode getProperty (Property *p) const
virtual const PropertygetProperty (const std::string &name) const
virtual StatusCode getProperty (const std::string &n, std::string &v) const
virtual const std::vector<
Property * > & 
getProperties () const
PropertyMgrgetPropertyMgr ()
ISvcLocatorserviceLocator () const
ISvcLocatorsvcLoc () const
IMessageSvcmsgSvc () const
IToolSvctoolSvc () const
StatusCode setProperties ()
StatusCode service (const std::string &name, T *&svc, bool createIf=true) const
StatusCode service (const std::string &type, const std::string &name, T *&svc) const
void declInterface (const InterfaceID &, void *)
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
IAuditorSvcauditorSvc () const
IMonitorSvcmonitorSvc () const
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const

Static Public Member Functions

static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()

Public Attributes

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR

Protected Types

typedef std::map< std::string,
StatEntity
Statistics
typedef std::map< std::string,
unsigned int > 
Counter
typedef std::vector< IAlgTool * > AlgTools
typedef std::pair< IInterface *,
std::string > 
ServiceEntry
typedef std::vector< ServiceEntryServices

Protected Member Functions

const ILVolumevolume (const std::string &address) const
 get ILVolume by its address
StatusCode setVisAttributes (const ILVolume *vol) const
 set visualization attribute for the volume
G4LogicalVolume * g4volume (const std::string &adddress) const
 find g4 volume by name
IVisualizationSvcvisSvc () const
 accessor to visualization service
virtual unsigned long refCount () const
StatusCode releaseTool (const IAlgTool *tool) const
StatusCode releaseSvc (const IInterface *svc) const
int outputLevel () const
IntegerPropertyoutputLevelProperty ()
void initOutputLevel (Property &prop)

Static Protected Attributes

static const bool IgnoreRootInTES
static const bool UseRootInTES

Private Attributes

std::string m_visSvcName
IVisualizationSvcm_visSvc

Detailed Description

The simplest tool which set the visualisation attributes for G4 visualization.

Author:
Vanya BELYAEV Ivan.Belyaev@itep.ru
Date:
2003-04-06

Definition at line 22 of file GiGaSetVisAttributes.h.


Constructor & Destructor Documentation

GiGaSetVisAttributes::GiGaSetVisAttributes ( const std::string &  type,
const std::string &  name,
const IInterface parent 
)

standard constructor

See also:
GiGaToolBase

GiGaBase

AlgTool

Parameters:
type type of the object (?)
name name of the object
parent pointer to parent object

Definition at line 43 of file GiGaSetVisAttributes.cpp.

00046   : GiGaToolBase   ( type , name , parent ) 
00047   , m_visSvcName   ( "VisualizationSvc"   ) 
00048   , m_visSvc       ( 0                    ) 
00049 {
00050   declareProperty ( "VisualizationService" , m_visSvcName ) ;
00051 };

GiGaSetVisAttributes::~GiGaSetVisAttributes (  )  [virtual]

destructor

Definition at line 58 of file GiGaSetVisAttributes.cpp.

00058 {};


Member Function Documentation

StatusCode GiGaSetVisAttributes::process ( const std::string &  volume  )  const [virtual]

the only one method

See also:
IGiGaTool
Parameters:
volume volume name
Returns:
status code

Implements GiGaToolBase.

Definition at line 155 of file GiGaSetVisAttributes.cpp.

00156 {
00157   if( 0 == detSvc () ) 
00158     { return Error( " process('" + vol + "'): detSvc () is NULL! " ) ; }
00159   if( 0 == visSvc () )
00160     { return Error( " process('" + vol + "'): visSvc () is NULL! " ) ; }
00161   
00162   // for all volumes 
00163   if( vol.empty() || "All" == vol || "ALL" == vol || "all" == vol ) 
00164     {
00165       const G4LogicalVolumeStore* store = G4LogicalVolumeStore::GetInstance();
00166       if( 0 == store ) 
00167         { return Error( " process('" + vol + 
00168                         "'): G4LogicalVolumeStore* is invalid" ) ; }
00169       for( G4LogicalVolumeStore::const_iterator ivolume = 
00170              store -> begin() ; store -> end() != ivolume ; ++ivolume ) 
00171         {
00172           G4LogicalVolume* vol = *ivolume ;
00173           if( 0 != vol ) { process( vol->GetName() ) ;  }
00174         }
00175       return StatusCode::SUCCESS ;
00176     };
00177   
00178   G4LogicalVolume* g4lv = g4volume ( vol ) ;
00179   if ( 0 == g4lv ) 
00180     { return Error( " process('" + vol + "'): invald G4LogicalVolume " ) ; }
00181   const ILVolume*    lv = volume   ( vol ) ;
00182   if( 0 == lv ) 
00183     { return Error( " process('" + vol + "'): invalid ILVolume "       ) ; }
00184   
00185   const VisAttribute va =  visSvc()-> visAttribute( lv ) ;
00186   
00187   static const VisAttribute s_def = VisAttribute () ;
00188   if( s_def.visible       () != va.visible       () || 
00189       s_def.openStatus    () != va.openStatus    () || 
00190       s_def.displayMode   () != va.displayMode   () || 
00191       s_def.color().red   () != va.color().red   () ||
00192       s_def.color().green () != va.color().green () ||
00193       s_def.color().blue  () != va.color().red   () ||
00194       s_def.color().alpha () != va.color().alpha ()  )
00195     {
00196       // create new attribute 
00197       G4VisAttributes* g4va = new G4VisAttributes () ;
00198       
00199       if      ( VisAttribute::VISIBLE     == va.visible     () ) 
00200         { g4va -> SetVisibility         ( true  ) ; }
00201       else if ( VisAttribute::NOT_VISIBLE == va.visible     () ) 
00202         { g4va -> SetVisibility         ( false ) ; }
00203       
00204       if      ( VisAttribute::OPENED      == va.openStatus  () )
00205         { g4va -> SetDaughtersInvisible ( false ) ; }
00206       else if ( VisAttribute::CLOSED      == va.openStatus  () )
00207         { g4va -> SetDaughtersInvisible ( true  ) ; }
00208       
00209       if      ( VisAttribute::PLAIN       == va.displayMode () )
00210         { g4va -> SetDaughtersInvisible ( true  ) ; }
00211       else if ( VisAttribute::WIRE_FRAME  == va.displayMode () )
00212         { g4va -> SetForceWireframe     ( true  ) ; }
00213       
00214       g4va -> SetColor( va.color () .red   () , 
00215                         va.color () .green () , 
00216                         va.color () .blue  () , 
00217                         va.color () .alpha () ) ;
00218       
00219       // set visualization attributes 
00220       g4lv -> SetVisAttributes( g4va ) ;
00221     }
00222   
00223   return StatusCode::SUCCESS ;
00224 };

StatusCode GiGaSetVisAttributes::initialize (  )  [virtual]

initialize the object

See also:
GiGaToolBase

GiGaBase

AlgTool

IAlgTool

Returns:
status code

Reimplemented from GiGaToolBase.

Definition at line 70 of file GiGaSetVisAttributes.cpp.

00071 {
00072   StatusCode sc = GiGaToolBase::initialize () ;
00073   if( sc.isFailure() ) { return Error("GiGaToolBase is not initilized!",sc);}
00074   
00075   if( 0 == detSvc() ) 
00076     { return Error("IDataProviderSvc*(detSvc()) points ti NULL!"); }
00077   
00078   // get the service 
00079   if( 0 != m_visSvc ) { m_visSvc -> release () ; m_visSvc = 0 ; }
00080   sc = service( m_visSvcName , m_visSvc , true );
00081   if( sc.isFailure() ) 
00082     { return Error("IVisualizationSvc('"+m_visSvcName+"') is not located",sc); }
00083   if( 0 == m_visSvc || 0 == visSvc() ) 
00084     { return Error("IVisualizationSvc('"+m_visSvcName+"') is NULL " ) ; }
00085   
00086   return StatusCode::SUCCESS ;
00087 };

StatusCode GiGaSetVisAttributes::finalize (  )  [virtual]

finalize the object

See also:
GiGaToolBase

GiGaBase

AlgTool

IAlgTool

Returns:
status code

Reimplemented from GiGaToolBase.

Definition at line 99 of file GiGaSetVisAttributes.cpp.

00100 {
00101   if( 0 != m_visSvc ) { m_visSvc -> release () ; m_visSvc = 0 ; }
00102   return GiGaToolBase::finalize ();
00103 };

const ILVolume * GiGaSetVisAttributes::volume ( const std::string &  address  )  const [protected]

get ILVolume by its address

Returns:
ILVolume object

Definition at line 112 of file GiGaSetVisAttributes.cpp.

00113 {
00114   if( 0 == detSvc() ) 
00115     { Error("volume('"+address+"'): detSvc() is NULL"); return 0 ; } 
00116   SmartDataPtr<ILVolume> logvol( detSvc() , address ) ;
00117   return logvol ;
00118 };

StatusCode GiGaSetVisAttributes::setVisAttributes ( const ILVolume vol  )  const [protected]

set visualization attribute for the volume

Parameters:
vol pointer to volume
Returns:
statsu code

G4LogicalVolume * GiGaSetVisAttributes::g4volume ( const std::string &  adddress  )  const [protected]

find g4 volume by name

Parameters:
name name of the volume

Definition at line 126 of file GiGaSetVisAttributes.cpp.

00127 {
00128   const G4LogicalVolumeStore* store = G4LogicalVolumeStore::GetInstance();
00129   if( 0 == store ) 
00130   {
00131     Error ( "g4volume('" + address + "'): G4LogicalVolumeStore* is NULL!" ) ;
00132     return 0 ;
00133   }
00134   for( G4LogicalVolumeStore::const_iterator ivolume = 
00135          store -> begin() ; store->end() != ivolume ; ++ivolume ) 
00136   {
00137     G4LogicalVolume* vol = *ivolume ;
00138     if( 0 != vol ) {
00139       std::string G4VolName = vol->GetName();
00140       if (G4VolName == address ) { return vol ; }
00141     }
00142   }
00143   Error ( "g4volume('" + address + "'): volume is not found!" ) ;
00144   return 0 ;
00145 };

IVisualizationSvc* GiGaSetVisAttributes::visSvc (  )  const [inline, protected]

accessor to visualization service

Definition at line 96 of file GiGaSetVisAttributes.h.

00096 { return m_visSvc ; }


Member Data Documentation

std::string GiGaSetVisAttributes::m_visSvcName [private]

Definition at line 100 of file GiGaSetVisAttributes.h.

IVisualizationSvc* GiGaSetVisAttributes::m_visSvc [private]

Definition at line 101 of file GiGaSetVisAttributes.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:01:38 2011 for GiGaVisUI by doxygen 1.4.7