Classes | Public Types | Public Member Functions | Public Attributes | Friends | List of all members
EDepSim::VolumeId Class Reference

#include <EDepSimVolumeId.hh>

Classes

class  Volume
 

Public Types

typedef std::vector< VolumeVolumes
 

Public Member Functions

 VolumeId (const G4TouchableHandle &handle)
 Construct a new volume Id. More...
 
 VolumeId ()
 Construct an empty volume Id. More...
 
 ~VolumeId ()
 
void AddVolume (G4VPhysicalVolume *fHandle, int fReplica)
 Explicitly add a new volume to the volume Id. More...
 
bool operator! ()
 
EDepSim::VolumeIdoperator= (const G4TouchableHandle &handle)
 
EDepSim::VolumeIdoperator= (const EDepSim::VolumeId &id)
 
friend bool::operator== (const EDepSim::VolumeId &x, const G4TouchableHandle &y)
 
friend bool::operator== (const G4TouchableHandle &x, const EDepSim::VolumeId &y)
 
friend bool::operator== (const EDepSim::VolumeId &x, const EDepSim::VolumeId &y)
 
friend bool::operator!= (const EDepSim::VolumeId &x, const G4TouchableHandle &y)
 
friend bool::operator!= (const G4TouchableHandle &x, const EDepSim::VolumeId &y)
 
friend bool::operator!= (const EDepSim::VolumeId &x, const EDepSim::VolumeId &y)
 
friend bool::operator< (const EDepSim::VolumeId &x, const EDepSim::VolumeId &y)
 

Public Attributes

Volumes fVolumes
 

Friends

std::ostream & operator<< (std::ostream &s, const EDepSim::VolumeId &)
 

Detailed Description

A class to provide a unique identifier for all physical volumes. One of the features of G4 is that physical volumes are identified by their position in the volume tree. This has many advantages, but it means that it can be quite trick to figure out if two physical volume pointers refer to the same physical volume, or different replicas of the same physical volume. (Consider the case where a you have an unreplicated sub-volume of a replicated parent). This class provides a unique comparable object that allows an equality test between volumes taking into account the full position in the hierarchy. It is similar in function to G4TouchableHandle, but provides better comparison operators.

Definition at line 35 of file EDepSimVolumeId.hh.

Member Typedef Documentation

Definition at line 77 of file EDepSimVolumeId.hh.

Constructor & Destructor Documentation

EDepSim::VolumeId::VolumeId ( const G4TouchableHandle &  handle)

Construct a new volume Id.

Definition at line 15 of file EDepSimVolumeId.cc.

15  {
16  if(fVolumes.size()>0)fVolumes.clear();
17  int historyDepth = handle->GetHistoryDepth();
18 
19  for (int i=0; i< historyDepth; ++i) {
20  AddVolume(handle->GetVolume(i),handle->GetReplicaNumber(i));
21  }
22 
23 }
void AddVolume(G4VPhysicalVolume *fHandle, int fReplica)
Explicitly add a new volume to the volume Id.
EDepSim::VolumeId::VolumeId ( )

Construct an empty volume Id.

Definition at line 13 of file EDepSimVolumeId.cc.

13 {}
EDepSim::VolumeId::~VolumeId ( )

Definition at line 11 of file EDepSimVolumeId.cc.

11 {}

Member Function Documentation

void EDepSim::VolumeId::AddVolume ( G4VPhysicalVolume *  fHandle,
int  fReplica 
)

Explicitly add a new volume to the volume Id.

Definition at line 47 of file EDepSimVolumeId.cc.

47  {
48  Volume vol;
49  vol.fHandle = handle;
50  vol.fReplica = replica;
51  fVolumes.push_back(vol);
52 }
EDepSim::VolumeId::bool::operator!= ( const EDepSim::VolumeId x,
const G4TouchableHandle &  y 
)
EDepSim::VolumeId::bool::operator!= ( const G4TouchableHandle &  x,
const EDepSim::VolumeId y 
)
EDepSim::VolumeId::bool::operator!= ( const EDepSim::VolumeId x,
const EDepSim::VolumeId y 
)
EDepSim::VolumeId::bool::operator< ( const EDepSim::VolumeId x,
const EDepSim::VolumeId y 
)
EDepSim::VolumeId::bool::operator== ( const EDepSim::VolumeId x,
const G4TouchableHandle &  y 
)
EDepSim::VolumeId::bool::operator== ( const G4TouchableHandle &  x,
const EDepSim::VolumeId y 
)
EDepSim::VolumeId::bool::operator== ( const EDepSim::VolumeId x,
const EDepSim::VolumeId y 
)
bool EDepSim::VolumeId::operator! ( )
inline

Definition at line 46 of file EDepSimVolumeId.hh.

46  {
47  return (fVolumes.size()==0);
48  };
EDepSim::VolumeId & EDepSim::VolumeId::operator= ( const G4TouchableHandle &  handle)

Definition at line 25 of file EDepSimVolumeId.cc.

25  {
26  if(fVolumes.size()>0)fVolumes.clear();
27  int historyDepth = handle->GetHistoryDepth();
28 
29  for (int i=0; i< historyDepth; ++i) {
30  AddVolume(handle->GetVolume(i),handle->GetReplicaNumber(i));
31  }
32 
33  return *this;
34 }
void AddVolume(G4VPhysicalVolume *fHandle, int fReplica)
Explicitly add a new volume to the volume Id.
EDepSim::VolumeId & EDepSim::VolumeId::operator= ( const EDepSim::VolumeId id)

Definition at line 36 of file EDepSimVolumeId.cc.

36  {
37  if(fVolumes.size()>0)fVolumes.clear();
39  i != id.fVolumes.end();
40  ++i) {
41  AddVolume(i->fHandle, i->fReplica);
42  }
43 
44  return *this;
45 }
intermediate_table::const_iterator const_iterator
void AddVolume(G4VPhysicalVolume *fHandle, int fReplica)
Explicitly add a new volume to the volume Id.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const EDepSim::VolumeId  
)
friend

Definition at line 119 of file EDepSimVolumeId.cc.

119  {
121  stream<< "<VolumeId ";
122  if (v.fVolumes.size()<1) {
123  stream << "empty>";
124  return stream;
125  }
126  if (!v.fVolumes.front().fHandle) {
127  stream << "null>";
128  return stream;
129  }
130  stream << v.fVolumes.front().fHandle->GetName() << ">";
131  return stream;
132 }
intermediate_table::const_iterator const_iterator
static bool * b
Definition: config.cpp:1043

Member Data Documentation

Volumes EDepSim::VolumeId::fVolumes

This is a vector of information required to uniquely identify the volume. It is arranged so that the most local information is at the front of the vector and the world volume will be the last element in the vector.

Definition at line 83 of file EDepSimVolumeId.hh.


The documentation for this class was generated from the following files: