Geant4  10.02.p03
G4GMocrenFileSceneHandler Class Reference

#include <G4GMocrenFileSceneHandler.hh>

Inheritance diagram for G4GMocrenFileSceneHandler:
Collaboration diagram for G4GMocrenFileSceneHandler:

Classes

class  Detector
 
class  Index3D
 

Public Member Functions

 G4GMocrenFileSceneHandler (G4GMocrenFile &system, G4GMocrenMessenger &messenger, const G4String &name="")
 
virtual ~G4GMocrenFileSceneHandler ()
 
void AddPrimitive (const G4Polyline &line)
 
void AddPrimitive (const G4Polyhedron &p)
 
void AddPrimitive (const G4Text &)
 
void AddPrimitive (const G4Circle &)
 
void AddPrimitive (const G4Square &)
 
void AddPrimitive (const G4Polymarker &polymarker)
 
void AddPrimitive (const G4Scale &scale)
 
virtual void BeginModeling ()
 
virtual void EndModeling ()
 
virtual void BeginPrimitives (const G4Transform3D &objectTransformation)
 
virtual void EndPrimitives ()
 
void AddSolid (const G4Box &box)
 
void AddSolid (const G4Cons &cons)
 
void AddSolid (const G4Tubs &tubs)
 
void AddSolid (const G4Trd &trd)
 
void AddSolid (const G4Trap &trap)
 
void AddSolid (const G4Sphere &sphere)
 
void AddSolid (const G4Para &para)
 
void AddSolid (const G4Torus &torus)
 
void AddSolid (const G4Polycone &polycone)
 
void AddSolid (const G4Polyhedra &polyhedra)
 
void AddSolid (const G4VSolid &solid)
 
void AddCompound (const G4VTrajectory &traj)
 
void AddCompound (const G4VHit &hit)
 
void AddCompound (const G4VDigi &hit)
 
void AddCompound (const G4THitsMap< G4double > &hits)
 
void ClearTransientStore ()
 
void GFBeginModeling ()
 
void GFEndModeling ()
 
G4bool GFIsInModeling ()
 
G4bool IsSavingGdd (void)
 
void BeginSavingGdd (void)
 
void EndSavingGdd (void)
 
void SetGddFileName ()
 
G4GMocrenFileGetSystem ()
 
const char * GetGddFileName ()
 
- Public Member Functions inherited from G4VSceneHandler
 G4VSceneHandler (G4VGraphicsSystem &system, G4int id, const G4String &name="")
 
virtual ~G4VSceneHandler ()
 
virtual void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &)
 
virtual void PostAddSolid ()
 
virtual void BeginPrimitives2D (const G4Transform3D &objectTransformation)
 
virtual void EndPrimitives2D ()
 
virtual const G4VisExtentGetExtent () const
 
const G4StringGetName () const
 
G4int GetSceneHandlerId () const
 
G4int GetViewCount () const
 
G4VGraphicsSystemGetGraphicsSystem () const
 
G4SceneGetScene () const
 
const G4ViewerListGetViewerList () const
 
G4VModelGetModel () const
 
G4VViewerGetCurrentViewer () const
 
G4bool GetMarkForClearingTransientStore () const
 
G4bool IsReadyForTransients () const
 
G4bool GetTransientsDrawnThisEvent () const
 
G4bool GetTransientsDrawnThisRun () const
 
const G4Transform3DGetObjectTransformation () const
 
void SetName (const G4String &)
 
void SetCurrentViewer (G4VViewer *)
 
virtual void SetScene (G4Scene *)
 
G4ViewerListSetViewerList ()
 
void SetModel (G4VModel *)
 
void SetMarkForClearingTransientStore (G4bool)
 
void SetTransientsDrawnThisEvent (G4bool)
 
void SetTransientsDrawnThisRun (G4bool)
 
void SetObjectTransformation (const G4Transform3D &)
 
const G4ColourGetColour (const G4Visible &)
 
const G4ColourGetColor (const G4Visible &)
 
const G4ColourGetTextColour (const G4Text &)
 
const G4ColourGetTextColor (const G4Text &)
 
G4double GetLineWidth (const G4VisAttributes *)
 
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes *)
 
G4bool GetAuxEdgeVisible (const G4VisAttributes *)
 
G4int GetNoOfSides (const G4VisAttributes *)
 
G4double GetMarkerSize (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerDiameter (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerRadius (const G4VMarker &, MarkerSizeType &)
 
G4ModelingParametersCreateModelingParameters ()
 
void DrawEvent (const G4Event *)
 
void DrawEndOfRunModels ()
 
G4int IncrementViewCount ()
 
virtual void ClearStore ()
 
void AddViewerToList (G4VViewer *pView)
 
void RemoveViewerFromList (G4VViewer *pView)
 
- Public Member Functions inherited from G4VGraphicsScene
 G4VGraphicsScene ()
 
virtual ~G4VGraphicsScene ()
 

Private Member Functions

void InitializeParameters ()
 
G4bool IsVisible ()
 
void AddDetector (const G4VSolid &solid)
 
void ExtractDetector ()
 
void GetNestedVolumeIndex (G4int, G4int[3])
 

Private Attributes

G4GMocrenFilekSystem
 
G4GMocrenMessengerkMessenger
 
G4GMocrenIOkgMocrenIO
 
std::map< G4int, float > kModality
 
G4int kModalitySize [3]
 
G4bool kbSetModalityVoxelSize
 
G4bool kbModelingTrajectory
 
G4Transform3D kVolumeTrans3D
 
std::vector< DetectorkDetectors
 
G4ThreeVector kVolumeSize
 
G4ThreeVector kVoxelDimension
 
std::vector< G4StringkNestedVolumeNames
 
G4int kNestedVolumeDimension [3]
 
G4int kNestedVolumeDirAxis [3]
 
std::map< Index3D, float > kNestedModality
 
std::map< G4String, std::map< Index3D, G4double > > kNestedHitsList
 
std::ofstream kGddDest
 
G4bool kFlagInModeling
 
G4bool kFlagSaving_g4_gdd
 
G4int kFlagParameterization
 
G4bool kFlagProcessedInteractiveScorer
 
char kGddDestDir [256]
 
char kGddFileName [256]
 
G4int kMaxFileNum
 

Static Private Attributes

static G4int kSceneIdCount = 0
 

Friends

class G4GMocrenFileViewer
 

Additional Inherited Members

- Public Types inherited from G4VSceneHandler
enum  MarkerSizeType { world, screen }
 
- Protected Member Functions inherited from G4VSceneHandler
virtual void ProcessScene ()
 
virtual void RequestPrimitives (const G4VSolid &solid)
 
virtual G4VSolidCreateSectionSolid ()
 
virtual G4VSolidCreateCutawaySolid ()
 
void LoadAtts (const G4Visible &, G4AttHolder *)
 
- Protected Attributes inherited from G4VSceneHandler
G4VGraphicsSystemfSystem
 
const G4int fSceneHandlerId
 
G4String fName
 
G4int fViewCount
 
G4ViewerList fViewerList
 
G4VViewerfpViewer
 
G4ScenefpScene
 
G4bool fMarkForClearingTransientStore
 
G4bool fReadyForTransients
 
G4bool fTransientsDrawnThisEvent
 
G4bool fTransientsDrawnThisRun
 
G4bool fProcessingSolid
 
G4bool fProcessing2D
 
G4VModelfpModel
 
G4Transform3D fObjectTransformation
 
G4int fNestingDepth
 
const G4VisAttributesfpVisAttribs
 
const G4Transform3D fIdentityTransformation
 

Detailed Description

Definition at line 54 of file G4GMocrenFileSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4GMocrenFileSceneHandler()

G4GMocrenFileSceneHandler::G4GMocrenFileSceneHandler ( G4GMocrenFile system,
G4GMocrenMessenger messenger,
const G4String name = "" 
)

Definition at line 118 of file G4GMocrenFileSceneHandler.cc.

121  : G4VSceneHandler(system, kSceneIdCount++, name),
122  kSystem(system),
123  kMessenger(messenger),
124  kgMocrenIO(new G4GMocrenIO()),
125  kbSetModalityVoxelSize(false),
126  kbModelingTrajectory(false),
127 // kGddDest(0),
128  kFlagInModeling(false),
129  kFlagSaving_g4_gdd(false),
132 
133  // g4.gdd filename and its directory
134  if(std::getenv("G4GMocrenFile_DEST_DIR") == NULL) {
135  kGddDestDir[0] = '\0';
136  //std::strcpy(kGddDestDir , ""); // output dir
137  //std::strcpy(kGddFileName, DEFAULT_GDD_FILE_NAME); // filename
138  std::strncpy(kGddFileName, DEFAULT_GDD_FILE_NAME,
139  std::strlen(DEFAULT_GDD_FILE_NAME)+1); // filename
140  } else {
141  const char * env = std::getenv("G4GMocrenFile_DEST_DIR");
142  int len = std::strlen(env);
143  if(len > 256) {
144  G4Exception("G4GMocrenFileSceneHandler::G4GMocrenFileSceneHandler(*)",
145  "gMocren1000", FatalException,
146  "Invalid length of string set in G4GMocrenFile_DEST_DIR");
147  }
148  std::strncpy(kGddDestDir, env, len+1); // output dir
149  std::strncpy(kGddFileName, DEFAULT_GDD_FILE_NAME,
150  std::strlen(DEFAULT_GDD_FILE_NAME)+1); // filename
151  }
152 
153  // maximum number of g4.gdd files in the dest directory
154  kMaxFileNum = FR_MAX_FILE_NUM ; // initialization
155  if ( std::getenv( "G4GMocrenFile_MAX_FILE_NUM" ) != NULL ) {
156  char * pcFileNum = getenv("G4GMocrenFile_MAX_FILE_NUM");
157  char c10FileNum[10];
158  std::strncpy(c10FileNum, pcFileNum, 10);
159  kMaxFileNum = std::atoi(c10FileNum);
160 
161  } else {
163  }
164  if( kMaxFileNum < 1 ) { kMaxFileNum = 1 ; }
165 
167 
168 }
const G4int FR_MAX_FILE_NUM
const char DEFAULT_GDD_FILE_NAME[]
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:

◆ ~G4GMocrenFileSceneHandler()

G4GMocrenFileSceneHandler::~G4GMocrenFileSceneHandler ( )
virtual

Definition at line 172 of file G4GMocrenFileSceneHandler.cc.

173 {
175  G4cout << "***** ~G4GMocrenFileSceneHandler" << G4endl;
176 
177  if(kGddDest) {
178  //----- End of modeling
179  // close g4.gdd
180  GFEndModeling();
181  }
182  if(kgMocrenIO != NULL) delete kgMocrenIO;
183 
184 }
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

Member Function Documentation

◆ AddCompound() [1/4]

void G4GMocrenFileSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1555 of file G4GMocrenFileSceneHandler.cc.

1555  {
1556 
1557  kbModelingTrajectory = true;
1558 
1560 
1561  if(GFDEBUG_TRK) {
1562  G4cout << " ::AddCompound(const G4VTrajectory&) >>>>>>>>> " << G4endl;
1563  G4TrajectoriesModel * pTrModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
1564  if (!pTrModel) {
1565  G4Exception
1566  ("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
1567  "gMocren0013", FatalException, "Not a G4TrajectoriesModel.");
1568  } else {
1569  traj.DrawTrajectory();
1570 
1571  const G4VTrajectory * trj = pTrModel->GetCurrentTrajectory();
1572  G4cout << "------ track" << G4endl;
1573  G4cout << " name: " << trj->GetParticleName() << G4endl;
1574  G4cout << " id: " << trj->GetTrackID() << G4endl;
1575  G4cout << " charge: " << trj->GetCharge() << G4endl;
1576  G4cout << " momentum: " << trj->GetInitialMomentum() << G4endl;
1577 
1578  G4int nPnt = trj->GetPointEntries();
1579  G4cout << " point: ";
1580  for(G4int i = 0; i < nPnt; i++) {
1581  G4cout << trj->GetPoint(i)->GetPosition() << ", ";
1582  }
1583  G4cout << G4endl;
1584  }
1585  G4cout << G4endl;
1586  }
1587 
1588  kbModelingTrajectory = false;
1589 }
virtual void DrawTrajectory() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
const G4bool GFDEBUG_TRK
int G4int
Definition: G4Types.hh:78
virtual int GetPointEntries() const =0
G4GLOB_DLL std::ostream G4cout
virtual G4String GetParticleName() const =0
virtual G4double GetCharge() const =0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual const G4ThreeVector GetPosition() const =0
virtual void AddCompound(const G4VTrajectory &)
const G4VTrajectory * GetCurrentTrajectory() const
virtual G4int GetTrackID() const =0
#define G4endl
Definition: G4ios.hh:61
virtual G4ThreeVector GetInitialMomentum() const =0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddCompound() [2/4]

void G4GMocrenFileSceneHandler::AddCompound ( const G4VHit hit)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1595 of file G4GMocrenFileSceneHandler.cc.

1595  {
1596  if(GFDEBUG_HIT) G4cout << " ::AddCompound(const G4VHit&) >>>>>>>>> " << G4endl;
1597 
1599 
1600  /*
1601  const std::map<G4String, G4AttDef> * map = hit.GetAttDefs();
1602  if(!map) return;
1603  std::map<G4String, G4AttDef>::const_iterator itr = map->begin();
1604  for(; itr != map->end(); itr++) {
1605  G4cout << itr->first << " : " << itr->second.GetName()
1606  << " , " << itr->second.GetDesc() << G4endl;
1607  }
1608  */
1609 
1610  std::vector<G4String> hitNames = kMessenger.getHitNames();
1611  if(GFDEBUG_HIT) {
1612  std::vector<G4String>::iterator itr = hitNames.begin();
1613  for(; itr != hitNames.end(); itr++)
1614  G4cout << " hit name : " << *itr << G4endl;
1615  }
1616 
1617  std::vector<G4AttValue> * attval = hit.CreateAttValues();
1618  if(!attval) {G4cout << "0 empty " << G4endl;}
1619  else {
1620 
1621  G4bool bid[3] = {false, false, false};
1622  Index3D id;
1623 
1624  std::vector<G4AttValue>::iterator itr;
1625  // First, get IDs
1626  for(itr = attval->begin(); itr != attval->end(); itr++) {
1627  std::string stmp = itr->GetValue();
1628  std::istringstream sval(stmp.c_str());
1629 
1630  if(itr->GetName() == G4String("XID")) {
1631  sval >> id.x;
1632  bid[0] = true;
1633  continue;
1634  }
1635  if(itr->GetName() == G4String("YID")) {
1636  sval >> id.y;
1637  bid[1] = true;
1638  continue;
1639  }
1640  if(itr->GetName() == G4String("ZID")) {
1641  sval >> id.z;
1642  bid[2] = true;
1643  continue;
1644  }
1645  }
1646 
1647  G4int nhitname = (G4int)hitNames.size();
1648 
1649  if(bid[0] && bid[1] && bid[2]) {
1650 
1651  if(GFDEBUG_HIT)
1652  G4cout << " Hit : index(" << id.x << ", " << id.y << ", "
1653  << id.z << ")" << G4endl;
1654 
1655  // Get attributes
1656  for(itr = attval->begin(); itr != attval->end(); itr++) {
1657  for(G4int i = 0; i < nhitname; i++) {
1658  if(itr->GetName() == hitNames[i]) {
1659 
1660  std::string stmp = itr->GetValue();
1661  std::istringstream sval(stmp.c_str());
1662  G4double value;
1663  G4String unit;
1664  sval >> value >> unit;
1665 
1666  std::map<G4String, std::map<Index3D, G4double> >::iterator kNestedHitsListItr;
1667  kNestedHitsListItr = kNestedHitsList.find(hitNames[i]);
1668  if(kNestedHitsListItr != kNestedHitsList.end()) {
1669  //fTempNestedHits = &kNestedHitsListItr->second;
1670  //(*fTempNestedHits)[id] = value;
1671  kNestedHitsListItr->second[id] = value;
1672  } else {
1673  std::map<Index3D, G4double> hits;
1674  hits.insert(std::map<Index3D, G4double>::value_type(id, value));
1675  kNestedHitsList[hitNames[i]] = hits;
1676  }
1677 
1678 
1679  if(GFDEBUG_HIT)
1680  G4cout << " : " << hitNames[i] << " -> " << value
1681  << " [" << unit << "]" << G4endl;
1682  }
1683  }
1684  }
1685  } else {
1686  G4Exception("G4GMocrenFileSceneHandler::AddCompound(const G4VHit &)",
1687  "gMocren0014", FatalException, "Error");
1688  }
1689 
1690  delete attval;
1691  }
1692 
1693 }
std::map< G4String, std::map< Index3D, G4double > > kNestedHitsList
void hits()
Definition: readHits.C:15
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
virtual std::vector< G4String > getHitNames()
bool G4bool
Definition: G4Types.hh:79
virtual std::vector< G4AttValue > * CreateAttValues() const
Definition: G4VHit.hh:67
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual void AddCompound(const G4VTrajectory &)
const G4bool GFDEBUG_HIT
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ AddCompound() [3/4]

void G4GMocrenFileSceneHandler::AddCompound ( const G4VDigi hit)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1695 of file G4GMocrenFileSceneHandler.cc.

1695  {
1696  if(GFDEBUG_DIGI) G4cout << " ::AddCompound(const G4VDigi&) >>>>>>>>> " << G4endl;
1698 }
G4GLOB_DLL std::ostream G4cout
virtual void AddCompound(const G4VTrajectory &)
#define G4endl
Definition: G4ios.hh:61
const G4bool GFDEBUG_DIGI
Here is the call graph for this function:

◆ AddCompound() [4/4]

void G4GMocrenFileSceneHandler::AddCompound ( const G4THitsMap< G4double > &  hits)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1700 of file G4GMocrenFileSceneHandler.cc.

1700  {
1701  if(GFDEBUG_HIT)
1702  G4cout << " ::AddCompound(const std::map<G4int, G4double*> &) >>>>>>>>> " << G4endl;
1703 
1704 
1705  std::vector<G4String> hitScorerNames = kMessenger.getHitScorerNames();
1706  G4int nhitname = (G4int)hitScorerNames.size();
1707  G4String scorername = static_cast<G4VHitsCollection>(hits).GetName();
1708 
1709  //-- --//
1710  /*
1711  std::vector<G4String> hitScorerNames = kMessenger.getHitScorerNames();
1712  if(GFDEBUG_HIT) {
1713  std::vector<G4String>::iterator itr = hitScorerNames.begin();
1714  for(; itr != hitScorerNames.end(); itr++)
1715  G4cout << " PS name : " << *itr << G4endl;
1716  }
1717  */
1718 
1719  { // Scope bracket to avoid compiler messages about shadowing (JA).
1720  //for(G4int i = 0; i < nhitname; i++) { // this selection trusts
1721  //if(scorername == hitScorerNames[i]) { // thea command /vis/scene/add/psHits hit_name.
1722 
1723  G4int idx[3];
1724  std::map<G4int, G4double*> * map = hits.GetMap();
1725  std::map<G4int, G4double*>::const_iterator itr = map->begin();
1726  for(; itr != map->end(); itr++) {
1727  GetNestedVolumeIndex(itr->first, idx);
1728  Index3D id(idx[0], idx[1], idx[2]);
1729 
1730  std::map<G4String, std::map<Index3D, G4double> >::iterator nestedHitsListItr;
1731  nestedHitsListItr = kNestedHitsList.find(scorername);
1732  if(nestedHitsListItr != kNestedHitsList.end()) {
1733  nestedHitsListItr->second[id] = *itr->second;
1734  } else {
1735  std::map<Index3D, G4double> hit;
1736  hit.insert(std::map<Index3D, G4double>::value_type(id, *itr->second));
1737  kNestedHitsList[scorername] = hit;
1738  }
1739  }
1740 
1741  //break;
1742  //}
1743  //}
1744  }
1745 
1746  if(GFDEBUG_HIT) {
1747  G4String meshname = static_cast<G4VHitsCollection>(hits).GetSDname();
1748  G4cout << " >>>>> " << meshname << " : " << scorername << G4endl;
1749 
1750  for(G4int i = 0; i < nhitname; i++)
1751  if(scorername == hitScorerNames[i])
1752  G4cout << " !!!! Hit scorer !!!! " << scorername << G4endl;
1753 
1754  G4cout << " dimension: "
1755  << kNestedVolumeDimension[0] << " x "
1756  << kNestedVolumeDimension[1] << " x "
1757  << kNestedVolumeDimension[2] << G4endl;
1758 
1759  G4int id[3];
1760  std::map<G4int, G4double*> * map = hits.GetMap();
1761  std::map<G4int, G4double*>::const_iterator itr = map->begin();
1762  for(; itr != map->end(); itr++) {
1763  GetNestedVolumeIndex(itr->first, id);
1764  G4cout << "[" << itr->first << "] "
1765  << "("<< id[0] << "," << id[1] << "," << id[2] << ")"
1766  << *itr->second << ", ";
1767  }
1768  G4cout << G4endl;
1769  }
1770 
1771 }
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:68
const G4String & GetName() const
std::map< G4String, std::map< Index3D, G4double > > kNestedHitsList
void hits()
Definition: readHits.C:15
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void GetNestedVolumeIndex(G4int, G4int[3])
virtual std::vector< G4String > getHitScorerNames()
const G4bool GFDEBUG_HIT
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddDetector()

void G4GMocrenFileSceneHandler::AddDetector ( const G4VSolid solid)
private

Definition at line 1805 of file G4GMocrenFileSceneHandler.cc.

1805  {
1806 
1807  Detector detector;
1808 
1809  // detector name
1810  detector.name = solid.GetName();
1811  if(GFDEBUG_DET > 1)
1812  G4cout << "0 Detector name : " << detector.name << G4endl;
1813 
1814  const G4VModel* pv_model = GetModel();
1815  if (!pv_model) { return ; }
1816  G4PhysicalVolumeModel* pPVModel =
1817  dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
1818  if (!pPVModel) { return ; }
1819 
1820  // edge points of the detector
1821  std::vector<G4float *> dedges;
1822  G4Polyhedron * poly = solid.CreatePolyhedron();
1823  detector.polyhedron = poly;
1824  detector.transform3D = fObjectTransformation;
1825 
1826  // retrieve color
1827  unsigned char uccolor[3] = {30, 30, 30};
1828  if(pPVModel->GetCurrentLV()->GetVisAttributes()) {
1829  G4Color color = pPVModel->GetCurrentLV()->GetVisAttributes()->GetColor();
1830  uccolor[0] = (unsigned char)(color.GetRed()*255);
1831  uccolor[1] = (unsigned char)(color.GetGreen()*255);
1832  uccolor[2] = (unsigned char)(color.GetBlue()*255);
1833  //if(uccolor[0] < 2 && uccolor[1] < 2 && uccolor[2] < 2)
1834  //uccolor[0] = uccolor[1] = uccolor[2] = 30; // dark grey
1835  }
1836  for(G4int i = 0; i < 3; i++) detector.color[i] = uccolor[i];
1837  //
1838  kDetectors.push_back(detector);
1839 
1840  if(GFDEBUG_DET > 1) {
1841  G4cout << "0 color: (" << (G4int)uccolor[0] << ", "
1842  << (G4int)uccolor[1] << ", " << (G4int)uccolor[2] << ")"
1843  << G4endl;
1844  }
1845 
1846 }
G4Transform3D fObjectTransformation
G4double GetGreen() const
Definition: G4Colour.hh:140
int G4int
Definition: G4Types.hh:78
const G4int GFDEBUG_DET
G4String GetName() const
G4double GetRed() const
Definition: G4Colour.hh:139
G4VModel * GetModel() const
G4GLOB_DLL std::ostream G4cout
G4double GetBlue() const
Definition: G4Colour.hh:141
const G4VisAttributes * GetVisAttributes() const
G4LogicalVolume * GetCurrentLV() const
const G4Color & GetColor() const
std::vector< Detector > kDetectors
#define G4endl
Definition: G4ios.hh:61
virtual G4Polyhedron * CreatePolyhedron() const
Definition: G4VSolid.cc:639
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddPrimitive() [1/7]

void G4GMocrenFileSceneHandler::AddPrimitive ( const G4Polyline line)
virtual

Implements G4VSceneHandler.

Definition at line 536 of file G4GMocrenFileSceneHandler.cc.

537 {
539  G4cout << "***** AddPrimitive" << G4endl;
540 
541  if (fProcessing2D) {
542  static G4bool warned = false;
543  if (!warned) {
544  warned = true;
546  ("G4GMocrenFileSceneHandler::AddPrimitive (const G4Polyline&)",
547  "gMocren1001", JustWarning,
548  "2D polylines not implemented. Ignored.");
549  }
550  return;
551  }
552 
553  //----- Initialize if necessary
554  GFBeginModeling();
555 
556  static G4int numTrajectories = 0;
557  if(numTrajectories >= MAX_NUM_TRAJECTORIES) return;
558 
559  // draw trajectories
561 
562  G4TrajectoriesModel * pTrModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
563  if (!pTrModel) {
564  G4Exception
565  ("G4VSceneHandler::AddCompound(const G4Polyline&)",
566  "gMocren0002", FatalException, "Not a G4TrajectoriesModel.");
567  }
568 
569  G4ThreeVector trans;
570  G4RotationMatrix rot;
571  trans = kVolumeTrans3D.getTranslation();
573 
574  if(GFDEBUG_TRK) G4cout << " trajectory points : " << G4endl;
575  std::vector<G4float *> trajectory;
576  if(polyline.size() < 2) return;
577  G4Polyline::const_iterator preitr = polyline.begin();
578  G4Polyline::const_iterator postitr = preitr; postitr++;
579  for(; postitr != polyline.end(); preitr++, postitr++) {
580  G4ThreeVector prePts(preitr->x(), preitr->y(), preitr->z());
581  prePts -= trans;
582  prePts.transform(rot);
583  G4ThreeVector postPts(postitr->x(), postitr->y(), postitr->z());
584  postPts -= trans;
585  postPts.transform(rot);
586  G4float * stepPts = new G4float[6];
587  stepPts[0] = prePts.x();
588  stepPts[1] = prePts.y();
589  stepPts[2] = prePts.z();
590  stepPts[3] = postPts.x();
591  stepPts[4] = postPts.y();
592  stepPts[5] = postPts.z();
593  trajectory.push_back(stepPts);
594 
595  if(GFDEBUG_TRK) {
596  G4cout << " ("
597  << stepPts[0] << ", "
598  << stepPts[1] << ", "
599  << stepPts[2] << ") - ("
600  << stepPts[3] << ", "
601  << stepPts[4] << ", "
602  << stepPts[5] << ")" << G4endl;
603  }
604  }
605 
606  const G4VisAttributes * att = polyline.GetVisAttributes();
607  G4Color color = att->GetColor();
608  unsigned char trkcolor[3];
609  trkcolor[0] = (unsigned char)(color.GetRed()*255);
610  trkcolor[1] = (unsigned char)(color.GetGreen()*255);
611  trkcolor[2] = (unsigned char)(color.GetBlue()*255);
612  if(GFDEBUG_TRK) {
613  G4cout << " color : ["
614  << color.GetRed() << ", "
615  << color.GetGreen() << ", "
616  << color.GetBlue() << "]" << G4endl;
617  }
618 
619  kgMocrenIO->addTrack(trajectory, trkcolor);
620 
621  numTrajectories++;
622  }
623 
624 } // G4GMocrenFileSceneHandler::AddPrimitive (polyline)
CLHEP::Hep3Vector getTranslation() const
void addTrack(float *_tracks)
float G4float
Definition: G4Types.hh:77
const G4bool GFDEBUG_TRK
G4double GetGreen() const
Definition: G4Colour.hh:140
int G4int
Definition: G4Types.hh:78
G4double GetRed() const
Definition: G4Colour.hh:139
G4GLOB_DLL std::ostream G4cout
G4double GetBlue() const
Definition: G4Colour.hh:141
bool G4bool
Definition: G4Types.hh:79
Hep3Vector & transform(const HepRotation &)
Definition: ThreeVectorR.cc:24
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double x() const
const G4int MAX_NUM_TRAJECTORIES
const G4Color & GetColor() const
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
HepRotation inverse() const
CLHEP::HepRotation getRotation() const
Here is the call graph for this function:

◆ AddPrimitive() [2/7]

void G4GMocrenFileSceneHandler::AddPrimitive ( const G4Polyhedron p)
virtual

Implements G4VSceneHandler.

Definition at line 713 of file G4GMocrenFileSceneHandler.cc.

714 {
715  //-----
717  G4cout << "***** AddPrimitive( G4Polyhedron )" << G4endl;
718 
719 
720  if (polyhedron.GetNoFacets() == 0) return;
721 
722  if (fProcessing2D) {
723  static G4bool warned = false;
724  if (!warned) {
725  warned = true;
727  ("G4GMocrenFileSceneHandler::AddPrimitive (const G4Polyhedron&)",
728  "gMocren1005", JustWarning,
729  "2D polyhedra not implemented. Ignored.");
730  }
731  return;
732  }
733 
734  //----- Initialize if necessary
735  GFBeginModeling();
736 
737  //---------- (3) Facet block
738  for (G4int f = polyhedron.GetNoFacets(); f; f--){
739  G4bool notLastEdge = true;
740  G4int index = -1; // initialization
741  G4int edgeFlag = 1;
742  //G4int preedgeFlag = 1;
743  //G4int work[4], i = 0;
744  G4int i = 0;
745  do {
746  //preedgeFlag = edgeFlag;
747  notLastEdge = polyhedron.GetNextVertexIndex(index, edgeFlag);
748  //work[i++] = index;
749  i++;
750  }while (notLastEdge);
751  switch (i){
752  case 3:
753  //SendStrInt3(FR_FACET, work[0], work[1], work[2] );
754  break;
755  case 4:
756  //SendStrInt4(FR_FACET, work[0], work[1], work[2], work[3] );
757  break;
758  default:
760  G4cout <<
761  "ERROR G4GMocrenFileSceneHandler::AddPrimitive(G4Polyhedron)" << G4endl;
762  G4PhysicalVolumeModel* pPVModel =
763  dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
764  if (pPVModel)
766  G4cout << "Volume " << pPVModel->GetCurrentPV()->GetName() <<
767  ", Solid " << pPVModel->GetCurrentLV()->GetSolid()->GetName() <<
768  " (" << pPVModel->GetCurrentLV()->GetSolid()->GetEntityType();
769 
771  G4cout <<
772  "\nG4Polyhedron facet with " << i << " edges" << G4endl;
773  }
774  }
775 
776 } // G4GMocrenFileSceneHandler::AddPrimitive (polyhedron)
Int_t index
virtual G4GeometryType GetEntityType() const =0
int G4int
Definition: G4Types.hh:78
G4String GetName() const
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
G4LogicalVolume * GetCurrentLV() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetName() const
static Verbosity GetVerbosity()
G4VPhysicalVolume * GetCurrentPV() const
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
G4VSolid * GetSolid() const
Here is the call graph for this function:

◆ AddPrimitive() [3/7]

void G4GMocrenFileSceneHandler::AddPrimitive ( const G4Text text)
virtual

Implements G4VSceneHandler.

Definition at line 628 of file G4GMocrenFileSceneHandler.cc.

629 {
630  if (fProcessing2D) {
631  static G4bool warned = false;
632  if (!warned) {
633  warned = true;
635  ("G4GMocrenFileSceneHandler::AddPrimitive (const G4Text&)",
636  "gMocren1002", JustWarning,
637  "2D text not implemented. Ignored.");
638  }
639  return;
640  }
641 
642  // to avoid a warning in the compile process
643  G4Text dummytext = text;
644 
645  //-----
647  G4cout << "***** AddPrimitive( G4Text )" << G4endl;
648 
649  //----- Initialize IF NECESSARY
650  GFBeginModeling();
651 
652 } // G4GMocrenFileSceneHandler::AddPrimitive ( text )
Definition: G4Text.hh:73
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddPrimitive() [4/7]

void G4GMocrenFileSceneHandler::AddPrimitive ( const G4Circle mark_circle)
virtual

Implements G4VSceneHandler.

Definition at line 656 of file G4GMocrenFileSceneHandler.cc.

657 {
658  // to avoid a warning in the compile process
659  G4Circle dummycircle = mark_circle;
660 
661  if (fProcessing2D) {
662  static G4bool warned = false;
663  if (!warned) {
664  warned = true;
666  ("G4GMocrenFileSceneHandler::AddPrimitive (const G4Circle&)",
667  "gMocren1003", JustWarning,
668  "2D circles not implemented. Ignored.");
669  }
670  return;
671  }
672 
673  //-----
675  G4cout << "***** AddPrimitive( G4Circle )" << G4endl;
676 
677  //----- Initialize IF NECESSARY
678  GFBeginModeling();
679 
680 
681 } // G4GMocrenFileSceneHandler::AddPrimitive ( mark_circle )
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddPrimitive() [5/7]

void G4GMocrenFileSceneHandler::AddPrimitive ( const G4Square mark_square)
virtual

Implements G4VSceneHandler.

Definition at line 685 of file G4GMocrenFileSceneHandler.cc.

686 {
687  // to avoid a warning in the compile process
688  G4Square dummysquare = mark_square;
689 
690  if (fProcessing2D) {
691  static G4bool warned = false;
692  if (!warned) {
693  warned = true;
695  ("G4GMocrenFileSceneHandler::AddPrimitive (const G4Square&)",
696  "gMocren1004", JustWarning,
697  "2D squares not implemented. Ignored.");
698  }
699  return;
700  }
701 
702  //-----
704  G4cout << "***** AddPrimitive( G4Square )" << G4endl;
705 
706  //----- Initialize if necessary
707  GFBeginModeling();
708 
709 } // G4GMocrenFileSceneHandler::AddPrimitive ( mark_square )
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddPrimitive() [6/7]

void G4GMocrenFileSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 75 of file G4GMocrenFileSceneHandler.hh.

76  { G4VSceneHandler::AddPrimitive (polymarker); }
virtual void AddPrimitive(const G4Polyline &)=0
Here is the call graph for this function:

◆ AddPrimitive() [7/7]

void G4GMocrenFileSceneHandler::AddPrimitive ( const G4Scale scale)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 77 of file G4GMocrenFileSceneHandler.hh.

virtual void AddPrimitive(const G4Polyline &)=0
Here is the call graph for this function:

◆ AddSolid() [1/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Box box)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 832 of file G4GMocrenFileSceneHandler.cc.

833 {
835  G4cout << "***** AddSolid ( box )" << G4endl;
836 
837  if(GFDEBUG_DET > 0)
838  G4cout << "G4GMocrenFileSceneHandler::AddSolid(const G4Box&) : "
839  << box.GetName() << G4endl;
840 
841  //----- skip drawing invisible primitive
842  if( !IsVisible() ) { return ; }
843 
844  //----- Initialize if necessary
845  GFBeginModeling();
846 
847 
848  //--
849  if(GFDEBUG_DET > 1) {
850  G4cout << "-------" << G4endl;
851  G4cout << " " << box.GetName() << G4endl;
852  G4Polyhedron * poly = box.CreatePolyhedron();
854  //G4int nv = poly->GetNoVertices();
855  G4Point3D v1, v2;
856  G4int next;
857  //while(1) { // next flag isn't functional.
858  for(G4int i = 0; i < 12; i++) { // # of edges is 12.
859  poly->GetNextEdge(v1, v2, next);
860  if(next == 0) break;
861  G4cout << " (" << v1.x() << ", "
862  << v1.y() << ", "
863  << v1.z() << ") - ("
864  << v2.x() << ", "
865  << v2.y() << ", "
866  << v2.z() << ") [" << next << "]"
867  << G4endl;
868  }
869  delete poly;
870  }
871 
872 
873  // the volume name set by /vis/gMocren/setVolumeName
874  G4String volName = kMessenger.getVolumeName();
875 
876  if(kFlagParameterization != 2) {
878  if(pScrMan) {
879  G4ScoringBox * pScBox = dynamic_cast<G4ScoringBox*>(pScrMan->FindMesh(volName));
880  G4bool bMesh = false;
881  if(pScBox != NULL) bMesh = true;
882  if(bMesh) kFlagParameterization = 2;
883  if(GFDEBUG_DET > 0) G4cout << " G4ScoringManager::FindMesh() : "
884  << volName << " - " << bMesh << G4endl;
885  }
886  }
887 
888  const G4VModel* pv_model = GetModel();
889  if (!pv_model) { return ; }
890  G4PhysicalVolumeModel* pPVModel =
891  dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
892  if (!pPVModel) { return ; }
893 
894 
895  //-- debug information
896  if(GFDEBUG_DET > 0) {
897  G4Material * mat = pPVModel->GetCurrentMaterial();
898  G4String name = mat->GetName();
899  G4double dens = mat->GetDensity()/(g/cm3);
900  G4int copyNo = pPVModel->GetCurrentPV()->GetCopyNo();
901  G4int depth = pPVModel->GetCurrentDepth();
902  G4cout << " copy no.: " << copyNo << G4endl;
903  G4cout << " depth : " << depth << G4endl;
904  G4cout << " density : " << dens << " [g/cm3]" << G4endl;
905  G4cout << " location: " << pPVModel->GetCurrentPV()->GetObjectTranslation() << G4endl;
906  G4cout << " Multiplicity : " << pPVModel->GetCurrentPV()->GetMultiplicity() << G4endl;
907  G4cout << " Is replicated? : " << pPVModel->GetCurrentPV()->IsReplicated() << G4endl;
908  G4cout << " Is parameterised? : " << pPVModel->GetCurrentPV()->IsParameterised() << G4endl;
909  G4cout << " top phys. vol. name : " << pPVModel->GetTopPhysicalVolume()->GetName() << G4endl;
910  }
911 
912  //-- check the parameterised volume
913  if(box.GetName() == volName) {
914 
916  // coordination system correction for gMocren
917  G4ThreeVector raxis(1., 0., 0.), dummy(0.,0.,0.);
918  G4RotationMatrix rot(raxis, pi*rad);
919  G4Transform3D trot(rot, dummy);
920  if(GFDEBUG_DET) {
923  G4cout << "kVolumeTrans3D: " << trans1 << G4endl << rot1 << G4endl;
924  }
926  if(GFDEBUG_DET) G4cout << " Parameterised volume : " << box.GetName() << G4endl;
927 
928 
929 
930  //
931  G4VPhysicalVolume * pv[3] = {0,0,0};
932  pv[0] = pPVModel->GetCurrentPV()->GetLogicalVolume()->GetDaughter(0);
933  if(!pv[0]) {
934  G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
935  "gMocren0003", FatalException, "Unexpected volume.");
936  }
937  G4int dirAxis[3] = {-1,-1,-1};
938  G4int nDaughters[3] = {0,0,0};
939 
940  EAxis axis; G4int nReplicas; G4double width; G4double offset; G4bool consuming;
941  pv[0]->GetReplicationData(axis, nReplicas, width, offset, consuming);
942  nDaughters[0] = nReplicas;
943  switch(axis) {
944  case kXAxis: dirAxis[0] = 0; break;
945  case kYAxis: dirAxis[0] = 1; break;
946  case kZAxis: dirAxis[0] = 2; break;
947  default:
948  G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
949  "gMocren0004", FatalException, "Error.");
950  }
951  kNestedVolumeNames.push_back(pv[0]->GetName());
952  if(GFDEBUG_DET)
953  G4cout << " daughter name : " << pv[0]->GetName()
954  << " # : " << nDaughters[0] << G4endl;
955 
956  //
957  if(GFDEBUG_DET) {
958  if(pv[0]->GetLogicalVolume()->GetNoDaughters()) {
959  G4cout << "# of daughters : "
960  << pv[0]->GetLogicalVolume()->GetNoDaughters() << G4endl;
961  } else {
962  //G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
963  // "gMocren0005", FatalException, "Error.");
964  }
965  }
966 
967  // check whether nested or regular parameterization
968  if(GFDEBUG_DET) G4cout << "# of daughters : "
969  << pv[0]->GetLogicalVolume()->GetNoDaughters() << G4endl;
970  if(pv[0]->GetLogicalVolume()->GetNoDaughters() == 0) {
972  //G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
973  // "gMocren0006", FatalException, "Error.");
974  }
975 
976  if(kFlagParameterization == 0) {
977 
978  pv[1] = pv[0]->GetLogicalVolume()->GetDaughter(0);
979  if(pv[1]) {
980  pv[1]->GetReplicationData(axis, nReplicas, width, offset, consuming);
981  nDaughters[1] = nReplicas;
982  switch(axis) {
983  case kXAxis: dirAxis[1] = 0; break;
984  case kYAxis: dirAxis[1] = 1; break;
985  case kZAxis: dirAxis[1] = 2; break;
986  default:
987  G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
988  "gMocren0007", FatalException, "Error.");
989  }
990  kNestedVolumeNames.push_back(pv[1]->GetName());
991  if(GFDEBUG_DET)
992  G4cout << " sub-daughter name : " << pv[1]->GetName()
993  << " # : " << nDaughters[1]<< G4endl;
994 
995  //
996  pv[2] = pv[1]->GetLogicalVolume()->GetDaughter(0);
997  if(pv[2]) {
998  nDaughters[2] = pv[2]->GetMultiplicity();
999  kNestedVolumeNames.push_back(pv[2]->GetName());
1000  if(GFDEBUG_DET)
1001  G4cout << " sub-sub-daughter name : " << pv[2]->GetName()
1002  << " # : " << nDaughters[2] << G4endl;
1003 
1004  if(nDaughters[2] > 1) {
1005  G4VNestedParameterisation * nestPara
1006  = dynamic_cast<G4VNestedParameterisation*>(pv[2]->GetParameterisation());
1007  if(nestPara == NULL)
1008  G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1009  "gMocren0008", FatalException, "Non-nested parameterisation");
1010 
1011  nestPara->ComputeTransformation(0, pv[2]);
1012  G4ThreeVector trans0 = pv[2]->GetObjectTranslation();
1013  nestPara->ComputeTransformation(1, pv[2]);
1014  G4ThreeVector trans1 = pv[2]->GetObjectTranslation();
1015  G4ThreeVector diff(trans0 - trans1);
1016  if(GFDEBUG_DET)
1017  G4cout << trans0 << " - " << trans1 << " - " << diff << G4endl;
1018 
1019  if(diff.x() != 0.) dirAxis[2] = 0;
1020  else if(diff.y() != 0.) dirAxis[2] = 1;
1021  else if(diff.z() != 0.) dirAxis[2] = 2;
1022  else
1023  G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1024  "gMocren0009", FatalException, "Unexpected nested parameterisation");
1025  }
1026  }
1027  }
1028 
1029  for(G4int i = 0; i < 3; i++) {
1030  kNestedVolumeDimension[i] = nDaughters[i];
1031  //kNestedVolumeDimension[i] = nDaughters[dirAxis[i]];
1032  kNestedVolumeDirAxis[i] = dirAxis[i];
1033  }
1034  //G4cout << "@@@@@@@@@ "
1035  // << dirAxis[0] << ", " << dirAxis[1] << ", " << dirAxis[2] << G4endl;
1036 
1037  // get densities
1038  G4VNestedParameterisation * nestPara
1039  = dynamic_cast<G4VNestedParameterisation*>(pv[2]->GetParameterisation());
1040  if(nestPara != NULL) {
1041  G4double prexyz[3] = {0.,0.,0.}, xyz[3] = {0.,0.,0.};
1042  for(G4int n0 = 0; n0 < nDaughters[0]; n0++) {
1043  for(G4int n1 = 0; n1 < nDaughters[1]; n1++) {
1044  for(G4int n2 = 0; n2 < nDaughters[2]; n2++) {
1045 
1046  G4GMocrenTouchable * touch = new G4GMocrenTouchable(n1, n0);
1047  if(GFDEBUG_DET)
1048  G4cout << " retrieve volume : copy # : " << n0
1049  << ", " << n1 << ", " << n2 << G4endl;
1050  G4Material * mat = nestPara->ComputeMaterial(pv[2], n2, touch);
1051  delete touch;
1052  G4double dens = mat->GetDensity()/(g/cm3);
1053 
1054  if(GFDEBUG_DET)
1055  G4cout << " density :" << dens << " [g/cm3]" << G4endl;
1056 
1057  G4Box tbox(box);
1058  nestPara->ComputeDimensions(tbox, n2, pv[2]);
1059  xyz[0] = tbox.GetXHalfLength()/mm;
1060  xyz[1] = tbox.GetYHalfLength()/mm;
1061  xyz[2] = tbox.GetZHalfLength()/mm;
1062  if(n0 != 0 || n1 != 0 || n2 != 0) {
1063  for(G4int i = 0; i < 3; i++) {
1064  if(xyz[i] != prexyz[i])
1065  G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1066  "gMocren0010", FatalException, "Unsupported parameterisation");
1067  }
1068  }
1069  if(GFDEBUG_DET)
1070  G4cout << " size : " << tbox.GetXHalfLength()/mm << " x "
1071  << tbox.GetYHalfLength()/mm << " x "
1072  << tbox.GetZHalfLength()/mm << " [mm3]" << G4endl;
1073 
1074  G4int idx[3];
1075  idx[dirAxis[0]] = n0;
1076  idx[dirAxis[1]] = n1;
1077  idx[dirAxis[2]] = n2;
1078  Index3D i3d(idx[0],idx[1],idx[2]);
1079  kNestedModality[i3d] = dens;
1080  if(GFDEBUG_DET)
1081  G4cout << " index: " << idx[0] << ", " << idx[1] << ", " << idx[2]
1082  << " density: " << dens << G4endl;
1083 
1084  for(G4int i = 0; i < 3; i++) prexyz[i] = xyz[i];
1085  }
1086  }
1087  }
1088 
1089  kVolumeSize.set(box.GetXHalfLength()*2/mm,
1090  box.GetYHalfLength()*2/mm,
1091  box.GetZHalfLength()*2/mm);
1092  // mesh size
1093  if(!kbSetModalityVoxelSize) {
1094  G4float spacing[3] = {static_cast<G4float>(2*xyz[0]),
1095  static_cast<G4float>(2*xyz[1]),
1096  static_cast<G4float>(2*xyz[2])};
1097  kgMocrenIO->setVoxelSpacing(spacing);
1098  kVoxelDimension.set(spacing[0], spacing[1], spacing[2]);
1099  kbSetModalityVoxelSize = true;
1100  }
1101 
1102  } else {
1103  if(GFDEBUG_DET)
1104  G4cout << pv[2]->GetName() << G4endl;
1105  G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1106  "gMocren0011", FatalException, "Non-nested parameterisation");
1107  }
1108 
1109 
1110 
1111  //-- debug
1112  if(GFDEBUG_DET > 1) {
1113  if(pPVModel->GetCurrentPV()->IsParameterised()) {
1114  G4VPVParameterisation * para = pPVModel->GetCurrentPV()->GetParameterisation();
1115  G4cout << " Is nested parameterisation? : " << para->IsNested() << G4endl;
1116 
1117 
1118  G4int npvp = pPVModel->GetDrawnPVPath().size();
1119  G4cout << " physical volume node id : "
1120  << "size: " << npvp << ", PV name: ";
1121  for(G4int i = 0; i < npvp; i++) {
1122  G4cout << pPVModel->GetDrawnPVPath()[i].GetPhysicalVolume()->GetName()
1123  << " [param:"
1124  << pPVModel->GetDrawnPVPath()[i].GetPhysicalVolume()->IsParameterised()
1125  << ",rep:"
1126  << pPVModel->GetDrawnPVPath()[i].GetPhysicalVolume()->IsReplicated();
1127  if(pPVModel->GetDrawnPVPath()[i].GetPhysicalVolume()->GetParameterisation()) {
1128  G4cout << ",nest:"
1129  << pPVModel->GetDrawnPVPath()[i].GetPhysicalVolume()->GetParameterisation()->IsNested();
1130  }
1131  G4cout << ",copyno:"
1132  << pPVModel->GetDrawnPVPath()[i].GetPhysicalVolume()->GetCopyNo();
1133  G4cout << "] - ";
1134  }
1135  G4cout << G4endl;
1136 
1137 
1138  pPVModel->GetCurrentPV()->GetReplicationData(axis, nReplicas, width, offset, consuming);
1139  G4cout << " # replicas : " << nReplicas << G4endl;
1140  G4double pareDims[3] = {0.,0.,0.};
1141  G4Box * pbox = dynamic_cast<G4Box *>(pPVModel->GetDrawnPVPath()[npvp-2].GetPhysicalVolume()->GetLogicalVolume()->GetSolid());
1142  if(pbox) {
1143  pareDims[0] = 2.*pbox->GetXHalfLength()*mm;
1144  pareDims[1] = 2.*pbox->GetYHalfLength()*mm;
1145  pareDims[2] = 2.*pbox->GetZHalfLength()*mm;
1146  G4cout << " mother size ["
1147  << pPVModel->GetDrawnPVPath()[npvp-2].GetPhysicalVolume()->GetName()
1148  << "] : "
1149  << pareDims[0] << " x "
1150  << pareDims[1] << " x "
1151  << pareDims[2] << " [mm3]"
1152  << G4endl;
1153  }
1154  G4double paraDims[3];
1155  G4Box * boxP = dynamic_cast<G4Box *>(pPVModel->GetDrawnPVPath()[npvp-1].GetPhysicalVolume()->GetLogicalVolume()->GetSolid());
1156  if(boxP) {
1157  paraDims[0] = 2.*boxP->GetXHalfLength()*mm;
1158  paraDims[1] = 2.*boxP->GetYHalfLength()*mm;
1159  paraDims[2] = 2.*boxP->GetZHalfLength()*mm;
1160  G4cout << " parameterised volume? ["
1161  << pPVModel->GetDrawnPVPath()[npvp-1].GetPhysicalVolume()->GetName()
1162  << "] : "
1163  << paraDims[0] << " x "
1164  << paraDims[1] << " x "
1165  << paraDims[2] << " [mm3] : "
1166  << G4int(pareDims[0]/paraDims[0]) << " x "
1167  << G4int(pareDims[1]/paraDims[1]) << " x "
1168  << G4int(pareDims[2]/paraDims[2]) << G4endl;
1169  } else {
1170  G4cout << pPVModel->GetDrawnPVPath()[npvp-2].GetPhysicalVolume()->GetName()
1171  << " isn't a G4Box." << G4endl;
1172  }
1173  }
1174  }
1175 
1176 
1177  } else if(kFlagParameterization == 1) { // G4PhantomParameterisation based geom. construnction
1178 
1179  // get the dimension of the parameterized patient geometry
1180  G4PhantomParameterisation * phantomPara
1181  = dynamic_cast<G4PhantomParameterisation*>(pv[0]->GetParameterisation());
1182  if(phantomPara == NULL) {
1183  G4Exception("G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )",
1184  "gMocren0012", FatalException, "no G4PhantomParameterisation");
1185  } else {
1186  ;
1187  }
1188 
1189  kNestedVolumeDimension[0] = phantomPara->GetNoVoxelX();
1190  kNestedVolumeDimension[1] = phantomPara->GetNoVoxelY();
1191  kNestedVolumeDimension[2] = phantomPara->GetNoVoxelZ();
1192  kNestedVolumeDirAxis[0] = 0;
1193  kNestedVolumeDirAxis[1] = 1;
1194  kNestedVolumeDirAxis[2] = 2;
1195 
1196  // get densities of the parameterized patient geometry
1197  G4int nX = kNestedVolumeDimension[0];
1199 
1200  for(G4int n0 = 0; n0 < kNestedVolumeDimension[0]; n0++) {
1201  for(G4int n1 = 0; n1 < kNestedVolumeDimension[1]; n1++) {
1202  for(G4int n2 = 0; n2 < kNestedVolumeDimension[2]; n2++) {
1203 
1204  G4int repNo = n0 + n1*nX + n2*nXY;
1205  G4Material * mat = phantomPara->ComputeMaterial(repNo, pv[0]);
1206  G4double dens = mat->GetDensity()/(g/cm3);
1207 
1208 
1209  G4int idx[3];
1210  idx[kNestedVolumeDirAxis[0]] = n0;
1211  idx[kNestedVolumeDirAxis[1]] = n1;
1212  idx[kNestedVolumeDirAxis[2]] = n2;
1213  Index3D i3d(idx[0],idx[1],idx[2]);
1214  kNestedModality[i3d] = dens;
1215 
1216  if(GFDEBUG_DET)
1217  G4cout << " index: " << idx[0] << ", " << idx[1] << ", " << idx[2]
1218  << " density: " << dens << G4endl;
1219 
1220  }
1221  }
1222  }
1223 
1224  kVolumeSize.set(box.GetXHalfLength()*2/mm,
1225  box.GetYHalfLength()*2/mm,
1226  box.GetZHalfLength()*2/mm);
1227 
1228  // mesh size
1229  if(!kbSetModalityVoxelSize) {
1230  G4float spacing[3] = {static_cast<G4float>(2*phantomPara->GetVoxelHalfX()),
1231  static_cast<G4float>(2*phantomPara->GetVoxelHalfY()),
1232  static_cast<G4float>(2*phantomPara->GetVoxelHalfZ())};
1233  kgMocrenIO->setVoxelSpacing(spacing);
1234  kVoxelDimension.set(spacing[0], spacing[1], spacing[2]);
1235  kbSetModalityVoxelSize = true;
1236  }
1237  }
1238 
1239  } // if(box.GetName() == volName)
1240 
1241 
1242  // processing geometry construction based on the interactive PS
1244 
1245 
1246  // get the dimension of the geometry defined in G4VScoringMesh
1248  if(!pScrMan) return;
1249  G4ScoringBox * scoringBox
1250  = dynamic_cast<G4ScoringBox*>(pScrMan->FindMesh(volName));
1251  if(scoringBox == NULL) return;
1252 
1253 
1254  G4int nVoxels[3];
1255  scoringBox->GetNumberOfSegments(nVoxels);
1256  // this order depends on the G4ScoringBox
1257  kNestedVolumeDimension[0] = nVoxels[2];
1258  kNestedVolumeDimension[1] = nVoxels[1];
1259  kNestedVolumeDimension[2] = nVoxels[0];
1260  kNestedVolumeDirAxis[0] = 2;
1261  kNestedVolumeDirAxis[1] = 1;
1262  kNestedVolumeDirAxis[2] = 0;
1263 
1264  // get densities of the parameterized patient geometry
1265  for(G4int n0 = 0; n0 < kNestedVolumeDimension[0]; n0++) {
1266  for(G4int n1 = 0; n1 < kNestedVolumeDimension[1]; n1++) {
1267  for(G4int n2 = 0; n2 < kNestedVolumeDimension[2]; n2++) {
1268 
1269  G4double dens = 0.*(g/cm3);
1270 
1271  G4int idx[3];
1272  idx[kNestedVolumeDirAxis[0]] = n0;
1273  idx[kNestedVolumeDirAxis[1]] = n1;
1274  idx[kNestedVolumeDirAxis[2]] = n2;
1275  Index3D i3d(idx[0],idx[1],idx[2]);
1276  kNestedModality[i3d] = dens;
1277 
1278  }
1279  }
1280  }
1281 
1282  G4ThreeVector boxSize = scoringBox->GetSize();
1283  if(GFDEBUG_DET > 1) {
1284  G4cout << "Interactive Scorer : size - "
1285  << boxSize.x()/cm << " x "
1286  << boxSize.y()/cm << " x "
1287  << boxSize.z()/cm << " [cm3]" << G4endl;
1288  G4cout << "Interactive Scorer : # voxels - "
1289  << nVoxels[0] << " x "
1290  << nVoxels[1] << " x "
1291  << nVoxels[2] << G4endl;
1292  }
1293  kVolumeSize.set(boxSize.x()*2,
1294  boxSize.y()*2,
1295  boxSize.z()*2);
1296 
1297  // mesh size
1298  if(!kbSetModalityVoxelSize) {
1299  G4float spacing[3] = {static_cast<G4float>(boxSize.x()*2/nVoxels[0]),
1300  static_cast<G4float>(boxSize.y()*2/nVoxels[1]),
1301  static_cast<G4float>(boxSize.z()*2/nVoxels[2])};
1302 
1303  kgMocrenIO->setVoxelSpacing(spacing);
1304  kVoxelDimension.set(spacing[0], spacing[1], spacing[2]);
1305  kbSetModalityVoxelSize = true;
1306 
1307  }
1308 
1309 
1311 
1312  // translation for the scoring mesh
1313  G4ThreeVector sbth = scoringBox->GetTranslation();
1314  G4Translate3D sbtranslate(sbth);
1315  kVolumeTrans3D = kVolumeTrans3D*sbtranslate;
1316 
1317  // rotation matrix for the scoring mesh
1318  G4RotationMatrix sbrm;
1319  sbrm = scoringBox->GetRotationMatrix();
1320  if(!sbrm.isIdentity()) {
1321  G4ThreeVector sbdummy(0.,0.,0.);
1322  G4Transform3D sbrotate(sbrm.inverse(), sbdummy);
1323  kVolumeTrans3D = kVolumeTrans3D*sbrotate;
1324  }
1325 
1326 
1327  // coordination system correction for gMocren
1328  G4ThreeVector raxisY(0., 1., 0.), dummyY(0.,0.,0.);
1329  G4RotationMatrix rotY(raxisY, pi*rad);
1330  G4Transform3D trotY(rotY, dummyY);
1331  G4ThreeVector raxisZ(0., 0., 1.), dummyZ(0.,0.,0.);
1332  G4RotationMatrix rotZ(raxisZ, pi*rad);
1333  G4Transform3D trotZ(rotZ, dummyZ);
1334 
1335  kVolumeTrans3D = kVolumeTrans3D*trotY*trotZ;
1336 
1337 
1338  //
1340  }
1341 
1342 
1343 
1344  //-- add detectors
1345  G4bool bAddDet = true;
1346  if(!kMessenger.getDrawVolumeGrid()) {
1347 
1348  if(kFlagParameterization == 0) { // nested parameterisation
1349 
1350  if(volName == box.GetName()) {
1351  bAddDet = false;
1352  }
1353 
1354  std::vector<G4String>::iterator itr = kNestedVolumeNames.begin();
1355  for(; itr != kNestedVolumeNames.end(); itr++) {
1356  if(*itr == box.GetName()) {
1357  bAddDet = false;
1358  break;
1359  }
1360  }
1361  } else if(kFlagParameterization == 1) { // phantom paramemterisation
1362 
1363  if(volName != box.GetName()) {
1364  bAddDet = false;
1365  }
1366 
1367  } else if(kFlagParameterization == 2) { // interactive primitive scorer
1368  ;
1369  }
1370 
1371  }
1372  if(bAddDet) AddDetector(box);
1373 
1374 
1375 } // void G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )
void set(double x, double y, double z)
const std::vector< G4PhysicalVolumeNodeID > & GetDrawnPVPath() const
static const double cm
Definition: G4SIunits.hh:118
virtual G4Material * ComputeMaterial(G4VPhysicalVolume *currentVol, const G4int repNo, const G4VTouchable *parentTouch=0)=0
bool isIdentity() const
Definition: Rotation.cc:172
G4ThreeVector GetSize() const
void GetNumberOfSegments(G4int nSegment[3])
CLHEP::Hep3Vector getTranslation() const
G4VPhysicalVolume * GetTopPhysicalVolume() const
G4int GetNoDaughters() const
virtual G4int GetMultiplicity() const
void AddDetector(const G4VSolid &solid)
virtual G4bool IsReplicated() const =0
G4double GetVoxelHalfY() const
Definition: G4Box.hh:64
G4String name
Definition: TRTMaterials.hh:40
float G4float
Definition: G4Types.hh:77
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
const G4String & GetName() const
G4Polyhedron * CreatePolyhedron() const
Definition: G4Box.cc:1047
virtual G4String getVolumeName()
size_t GetNoVoxelX() const
G4ThreeVector GetTranslation() const
G4double GetDensity() const
Definition: G4Material.hh:180
#define width
G4Transform3D fObjectTransformation
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
G4RotationMatrix GetRotationMatrix() const
G4double GetVoxelHalfZ() const
HepPolyhedron & Transform(const G4Transform3D &t)
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
int G4int
Definition: G4Types.hh:78
const G4int GFDEBUG_DET
size_t GetNoVoxelZ() const
G4String GetName() const
Float_t mat
G4double GetXHalfLength() const
virtual G4bool getDrawVolumeGrid()
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5206
G4VModel * GetModel() const
G4GLOB_DLL std::ostream G4cout
G4bool GetNextEdge(G4Point3D &p1, G4Point3D &p2, G4int &edgeFlag) const
G4double GetZHalfLength() const
bool G4bool
Definition: G4Types.hh:79
virtual G4VPVParameterisation * GetParameterisation() const =0
virtual void ComputeTransformation(const G4int no, G4VPhysicalVolume *currentPV) const =0
static const double cm3
Definition: G4SIunits.hh:120
virtual G4bool IsNested() const
size_t GetNoVoxelY() const
void setVoxelSpacing(float _spacing[3])
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4ThreeVector GetObjectTranslation() const
double x() const
static const double rad
Definition: G4SIunits.hh:148
virtual G4bool IsParameterised() const =0
G4double GetVoxelHalfX() const
G4double GetYHalfLength() const
const G4String & GetName() const
static const double pi
Definition: G4SIunits.hh:74
double y() const
EAxis
Definition: geomdefs.hh:54
virtual G4int GetCopyNo() const =0
double z() const
static Verbosity GetVerbosity()
G4VPhysicalVolume * GetCurrentPV() const
G4Material * GetCurrentMaterial() const
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
G4VPhysicalVolume * GetDaughter(const G4int i) const
static G4ScoringManager * GetScoringManager()
HepRotation inverse() const
double G4double
Definition: G4Types.hh:76
CLHEP::HepRotation getRotation() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
Definition: G4Material.hh:178
std::vector< G4String > kNestedVolumeNames
static const double mm
Definition: G4SIunits.hh:114
std::map< Index3D, float > kNestedModality
Here is the caller graph for this function:

◆ AddSolid() [2/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Cons cons)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1423 of file G4GMocrenFileSceneHandler.cc.

1424 {
1426  G4cout << "***** AddSolid ( cons )" << G4endl;
1427 
1428  //----- skip drawing invisible primitive
1429  if( !IsVisible() ) { return ; }
1430 
1431  //----- Initialize if necessary
1432  GFBeginModeling();
1433 
1434  //
1435  AddDetector(cons);
1436 
1437 }// G4GMocrenFileSceneHandler::AddSolid( cons )
void AddDetector(const G4VSolid &solid)
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddSolid() [3/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Tubs tubs)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1380 of file G4GMocrenFileSceneHandler.cc.

1381 {
1383  G4cout << "***** AddSolid ( tubes )" << G4endl;
1384 
1385  //----- skip drawing invisible primitive
1386  if( !IsVisible() ) { return ; }
1387 
1388  //----- Initialize if necessary
1389  GFBeginModeling();
1390 
1391  //
1392  AddDetector(tubes);
1393 
1394 
1395  // for a debug
1396  if(GFDEBUG_DET > 0) {
1397  G4cout << "-------" << G4endl;
1398  G4cout << " " << tubes.GetName() << G4endl;
1399  G4Polyhedron * poly = tubes.CreatePolyhedron();
1400  G4int nv = poly->GetNoVertices();
1401  for(G4int i = 0; i < nv; i++) {
1402  G4cout << " (" << poly->GetVertex(i).x() << ", "
1403  << poly->GetVertex(i).y() << ", "
1404  << poly->GetVertex(i).z() << ")" << G4endl;
1405  }
1406  delete poly;
1407  }
1408 
1409  const G4VModel* pv_model = GetModel();
1410  if (!pv_model) { return ; }
1411  G4PhysicalVolumeModel* pPVModel =
1412  dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
1413  if (!pPVModel) { return ; }
1414  G4Material * mat = pPVModel->GetCurrentMaterial();
1415  G4String name = mat->GetName();
1416 
1417 } // void G4GMocrenFileSceneHandler::AddSolid( const G4Tubs& )
G4Point3D GetVertex(G4int index) const
void AddDetector(const G4VSolid &solid)
G4String name
Definition: TRTMaterials.hh:40
int G4int
Definition: G4Types.hh:78
const G4int GFDEBUG_DET
Float_t mat
G4VModel * GetModel() const
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
G4Material * GetCurrentMaterial() const
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
Definition: G4Material.hh:178
G4int GetNoVertices() const
Here is the call graph for this function:

◆ AddSolid() [4/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Trd trd)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1441 of file G4GMocrenFileSceneHandler.cc.

1442 {
1444  G4cout << "***** AddSolid ( trd )" << G4endl;
1445 
1446 
1447  //----- skip drawing invisible primitive
1448  if( !IsVisible() ) { return ; }
1449 
1450  //----- Initialize if necessary
1451  GFBeginModeling();
1452 
1453  //
1454  AddDetector(trd);
1455 
1456 } // G4GMocrenFileSceneHandler::AddSolid ( trd )
void AddDetector(const G4VSolid &solid)
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddSolid() [5/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Trap trap)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1496 of file G4GMocrenFileSceneHandler.cc.

1497 {
1499  G4cout << "***** AddSolid ( trap )" << G4endl;
1500 
1501  //----- skip drawing invisible primitive
1502  if( !IsVisible() ) { return ; }
1503 
1504  //----- Initialize if necessary
1505  GFBeginModeling();
1506 
1507  //
1508  AddDetector(trap);
1509 
1510 } // G4GMocrenFileSceneHandler::AddSolid (const G4Trap& trap)
void AddDetector(const G4VSolid &solid)
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddSolid() [6/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Sphere sphere)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1460 of file G4GMocrenFileSceneHandler.cc.

1461 {
1463  G4cout << "***** AddSolid ( sphere )" << G4endl;
1464 
1465  //----- skip drawing invisible primitive
1466  if( !IsVisible() ) { return ; }
1467 
1468  //----- Initialize if necessary
1469  GFBeginModeling();
1470 
1471  //
1472  AddDetector(sphere);
1473 
1474 } // G4GMocrenFileSceneHandler::AddSolid ( sphere )
void AddDetector(const G4VSolid &solid)
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddSolid() [7/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Para para)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1478 of file G4GMocrenFileSceneHandler.cc.

1479 {
1481  G4cout << "***** AddSolid ( para )" << G4endl;
1482 
1483  //----- skip drawing invisible primitive
1484  if( !IsVisible() ) { return ; }
1485 
1486  //----- Initialize if necessary
1487  GFBeginModeling();
1488 
1489  //
1490  AddDetector(para);
1491 
1492 } // G4GMocrenFileSceneHandler::AddSolid ( para )
void AddDetector(const G4VSolid &solid)
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddSolid() [8/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Torus torus)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1515 of file G4GMocrenFileSceneHandler.cc.

1516 {
1518  G4cout << "***** AddSolid ( torus )" << G4endl;
1519 
1520  //----- skip drawing invisible primitive
1521  if( !IsVisible() ) { return ; }
1522 
1523  //----- Initialize if necessary
1524  GFBeginModeling();
1525 
1526  //
1527  AddDetector(torus);
1528 
1529 } // void G4GMocrenFileSceneHandler::AddSolid( const G4Torus& )
void AddDetector(const G4VSolid &solid)
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddSolid() [9/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Polycone polycone)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 94 of file G4GMocrenFileSceneHandler.hh.

94  {
95  G4VSceneHandler::AddSolid (polycone);
96  }
virtual void AddSolid(const G4Box &)
Here is the call graph for this function:

◆ AddSolid() [10/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4Polyhedra polyhedra)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 97 of file G4GMocrenFileSceneHandler.hh.

97  {
98  G4VSceneHandler::AddSolid (polyhedra);
99  }
virtual void AddSolid(const G4Box &)
Here is the call graph for this function:

◆ AddSolid() [11/11]

void G4GMocrenFileSceneHandler::AddSolid ( const G4VSolid solid)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1534 of file G4GMocrenFileSceneHandler.cc.

1535 {
1536  //----- skip drawing invisible primitive
1537  if( !IsVisible() ) { return ; }
1538 
1539  //----- Initialize if necessary
1540  GFBeginModeling();
1541 
1542  //
1543  AddDetector(solid);
1544 
1545  //----- Send a primitive
1546  G4VSceneHandler::AddSolid( solid ) ;
1547 
1548 } //G4GMocrenFileSceneHandler::AddSolid ( const G4VSolid& )
virtual void AddSolid(const G4Box &)
void AddDetector(const G4VSolid &solid)
Here is the call graph for this function:

◆ BeginModeling()

virtual void G4GMocrenFileSceneHandler::BeginModeling ( )
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 80 of file G4GMocrenFileSceneHandler.hh.

Here is the call graph for this function:

◆ BeginPrimitives()

void G4GMocrenFileSceneHandler::BeginPrimitives ( const G4Transform3D objectTransformation)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 807 of file G4GMocrenFileSceneHandler.cc.

808 {
810  G4cout << "***** BeginPrimitives " << G4endl;
811 
812  GFBeginModeling();
813 
814  G4VSceneHandler::BeginPrimitives (objectTransformation);
815 
816 }
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BeginSavingGdd()

void G4GMocrenFileSceneHandler::BeginSavingGdd ( void  )

Definition at line 274 of file G4GMocrenFileSceneHandler.cc.

275 {
277  G4cout << "***** BeginSavingGdd (called)" << G4endl;
278 
279  if( !IsSavingGdd() ) {
280 
282  G4cout << "***** (started) " ;
283  G4cout << "(open g4.gdd, ##)" << G4endl;
284  }
285 
286  SetGddFileName() ; // result set to kGddFileName
287  kFlagSaving_g4_gdd = true;
288 
289 
291  short minmax[2];
292  minmax[0] = ctdens.GetMinCT();
293  minmax[1] = ctdens.GetMaxCT();
295  std::vector<G4float> map;
296  G4float dens;
297  for(G4int i = minmax[0]; i <= minmax[1]; i++) {
298  dens = ctdens.GetDensity(i);
299  map.push_back(dens);
300  }
302 
303  /*
304  G4String fname = "modality-map.dat";
305  std::ifstream ifile(fname);
306  if(ifile) {
307  short minmax[2];
308  ifile >> minmax[0] >> minmax[1];
309  kgMocrenIO->setModalityImageMinMax(minmax);
310  std::vector<G4float> map;
311  G4float dens;
312  for(G4int i = minmax[0]; i <= minmax[1]; i++) {
313  ifile >> dens;
314  map.push_back(dens);
315  }
316  kgMocrenIO->setModalityImageDensityMap(map);
317 
318  } else {
319  G4cout << "cann't open the file : " << fname << G4endl;
320  }
321  */
322 
323  // mesh size
324  //kMessenger.getNoVoxels(kModalitySize[0], kModalitySize[1], kModalitySize[2]);
325  //kgMocrenIO->setModalityImageSize(kModalitySize);
326 
327  // initializations
328  //kgMocrenIO->clearModalityImage();
333  std::vector<Detector>::iterator itr = kDetectors.begin();
334  for(; itr != kDetectors.end(); itr++) {
335  itr->clear();
336  }
337  kDetectors.clear();
338 
339  kNestedHitsList.clear();
340  kNestedVolumeNames.clear();
341 
342  }
343 }
float G4float
Definition: G4Types.hh:77
std::map< G4String, std::map< Index3D, G4double > > kNestedHitsList
G4double GetDensity(G4int &_ct) const
int G4int
Definition: G4Types.hh:78
void clearDetector()
Definition: G4GMocrenIO.hh:451
void clearROIAll()
G4GLOB_DLL std::ostream G4cout
void clearDoseDistAll()
void setModalityImageMinMax(short _minmax[2])
void clearTracks()
Definition: G4GMocrenIO.hh:439
std::vector< Detector > kDetectors
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
std::vector< G4String > kNestedVolumeNames
void setModalityImageDensityMap(std::vector< float > &_map)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClearTransientStore()

void G4GMocrenFileSceneHandler::ClearTransientStore ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1792 of file G4GMocrenFileSceneHandler.cc.

1793 {
1794  // This is typically called after an update and before drawing hits
1795  // of the next event. To simulate the clearing of "transients"
1796  // (hits, etc.) the detector is redrawn...
1797  if (fpViewer) {
1798  fpViewer -> SetView ();
1799  fpViewer -> ClearView ();
1800  fpViewer -> DrawView ();
1801  }
1802 }
G4VViewer * fpViewer
Here is the caller graph for this function:

◆ EndModeling()

virtual void G4GMocrenFileSceneHandler::EndModeling ( )
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 81 of file G4GMocrenFileSceneHandler.hh.

Here is the call graph for this function:

◆ EndPrimitives()

void G4GMocrenFileSceneHandler::EndPrimitives ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 820 of file G4GMocrenFileSceneHandler.cc.

821 {
823  G4cout << "***** EndPrimitives " << G4endl;
824 
826 }
G4GLOB_DLL std::ostream G4cout
virtual void EndPrimitives()
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EndSavingGdd()

void G4GMocrenFileSceneHandler::EndSavingGdd ( void  )

Definition at line 345 of file G4GMocrenFileSceneHandler.cc.

346 {
348  G4cout << "***** EndSavingGdd (called)" << G4endl;
349 
350  if(IsSavingGdd()) {
352  G4cout << "***** (started) (close "
353  << kGddFileName << ")" << G4endl;
354 
355  if(kGddDest) kGddDest.close();
356  kFlagSaving_g4_gdd = false;
357 
358  std::map<Index3D, G4float>::iterator itr = kNestedModality.begin();
359  G4int xmax=0, ymax=0, zmax=0;
360  for(; itr != kNestedModality.end(); itr++) {
361  if(itr->first.x > xmax) xmax = itr->first.x;
362  if(itr->first.y > ymax) ymax = itr->first.y;
363  if(itr->first.z > zmax) zmax = itr->first.z;
364  }
365  // mesh size
366  kModalitySize[0] = xmax+1;
367  kModalitySize[1] = ymax+1;
368  kModalitySize[2] = zmax+1;
370  if(GFDEBUG) G4cout << "gMocren-file driver : modality size : "
371  << kModalitySize[0] << " x "
372  << kModalitySize[1] << " x "
373  << kModalitySize[2] << G4endl;
374 
375  G4int nxy = kModalitySize[0]*kModalitySize[1];
376  //std::map<G4int, G4float>::iterator itr;
377  for(G4int z = 0; z < kModalitySize[2]; z++) {
378  short * modality = new short[nxy];
379  for(G4int y = 0; y < kModalitySize[1]; y++) {
380  for(G4int x = 0; x < kModalitySize[0]; x++) {
381  //for(G4int x = kModalitySize[0]-1; x >= 0 ; x--) {
382  //G4int ixy = x + (kModalitySize[1]-y-1)*kModalitySize[0];
383 
384  G4int ixy = x + y*kModalitySize[0];
385  Index3D idx(x,y,z);
386  itr = kNestedModality.find(idx);
387  if(itr != kNestedModality.end()) {
388 
389  modality[ixy] = kgMocrenIO->convertDensityToHU(itr->second);
390  } else {
391  modality[ixy] = -1024;
392  }
393 
394  }
395  }
396  kgMocrenIO->setModalityImage(modality);
397  }
398 
399  //-- dose
400  size_t nhits = kNestedHitsList.size();
401  if(GFDEBUG) G4cout << "gMocren-file driver : # hits = " << nhits << G4endl;
402 
403  std::map<Index3D, G4double>::iterator hitsItr;
404  std::map<G4String, std::map<Index3D, G4double> >::iterator hitsListItr = kNestedHitsList.begin();
405 
406  for(G4int n = 0; hitsListItr != kNestedHitsList.end(); hitsListItr++, n++) {
407 
409  kgMocrenIO->setDoseDistName(hitsListItr->first, n);
410  kgMocrenIO->setDoseDistSize(kModalitySize, n);
411 
412  G4double minmax[2] = {DBL_MAX, -DBL_MAX};
413  for(G4int z = 0 ; z < kModalitySize[2]; z++) {
414  G4double * values = new G4double[nxy];
415  for(G4int y = 0; y < kModalitySize[1]; y++) {
416  for(G4int x = 0; x < kModalitySize[0]; x++) {
417 
418  G4int ixy = x + y*kModalitySize[0];
419  Index3D idx(x,y,z);
420  hitsItr = hitsListItr->second.find(idx);
421  if(hitsItr != hitsListItr->second.end()) {
422 
423  values[ixy] = hitsItr->second;
424  } else {
425  values[ixy] = 0.;
426  }
427  if(values[ixy] < minmax[0]) minmax[0] = values[ixy];
428  if(values[ixy] > minmax[1]) minmax[1] = values[ixy];
429  }
430  }
431  kgMocrenIO->setDoseDist(values, n);
432  }
433  kgMocrenIO->setDoseDistMinMax(minmax, n);
434  G4double lower = 0.;
435  if(minmax[0] < 0) lower = minmax[0];
436  G4double scale = (minmax[1]-lower)/25000.;
437  kgMocrenIO->setDoseDistScale(scale, n);
438  G4String sunit("unit?"); //temporarily
439  kgMocrenIO->setDoseDistUnit(sunit, n);
440  }
441 
442 
443  //-- draw axes
444  if(false) {//true,false
445  G4ThreeVector trans;
446  G4RotationMatrix rot;
447  trans = kVolumeTrans3D.getTranslation();
449  // x
450  std::vector<G4float *> tracks;
451  unsigned char colors[3];
452  G4float * trk = new G4float[6];
453  tracks.push_back(trk);
454 
455  G4ThreeVector orig(0.,0.,0), xa(2000.,0.,0.), ya(0.,2000.,0.), za(0.,0.,2000.);
456  orig -= trans;
457  orig.transform(rot);
458  xa -= trans;
459  xa.transform(rot);
460  ya -= trans;
461  ya.transform(rot);
462  za -= trans;
463  za.transform(rot);
464  for(G4int i = 0; i < 3; i++) trk[i] = orig[i];
465  for(G4int i = 0; i < 3; i++) trk[i+3] = xa[i];
466  colors[0] = 255; colors[1] = 0; colors[2] = 0;
467  kgMocrenIO->addTrack(tracks, colors);
468  // y
469  for(G4int i = 0; i < 3; i++) trk[i+3] = ya[i];
470  colors[0] = 0; colors[1] = 255; colors[2] = 0;
471  kgMocrenIO->addTrack(tracks, colors);
472  // z
473  for(G4int i = 0; i < 3; i++) trk[i+3] = za[i];
474  colors[0] = 0; colors[1] = 0; colors[2] = 255;
475  kgMocrenIO->addTrack(tracks, colors);
476  }
477 
478  //-- detector
479  ExtractDetector();
480 
481 
482  if(GFDEBUG_DET) G4cout << ">>>>>>>>>>>>>>>>>>>>>> (";
483  std::vector<G4float> transformObjects;
484  for(G4int i = 0; i < 3; i++) {
485  // need to check!!
486  transformObjects.push_back((kVolumeSize[i]/2. - kVoxelDimension[i]/2.));
487  if(GFDEBUG_DET) G4cout << transformObjects[i] << ", ";
488  }
489  if(GFDEBUG_DET) G4cout << ")" << G4endl;
490 
491 
492  kgMocrenIO->translateTracks(transformObjects);
493  kgMocrenIO->translateDetector(transformObjects);
494 
495  // store
497  }
498 
499 }
void newDoseDist()
short convertDensityToHU(float &_dens)
void setDoseDistUnit(std::string &_unit, int _num=0)
CLHEP::Hep3Vector getTranslation() const
void addTrack(float *_tracks)
float G4float
Definition: G4Types.hh:77
void setDoseDistMinMax(short _minmax[2], int _num=0)
std::map< G4String, std::map< Index3D, G4double > > kNestedHitsList
void setModalityImageSize(int _size[3])
int G4int
Definition: G4Types.hh:78
const G4int GFDEBUG_DET
void translateDetector(std::vector< float > &_translate)
void setDoseDist(double *_image, int _num=0)
Double_t y
Char_t n[5]
bool storeData(char *_filename)
Definition: G4GMocrenIO.cc:458
G4GLOB_DLL std::ostream G4cout
Double_t scale
Hep3Vector & transform(const HepRotation &)
Definition: ThreeVectorR.cc:24
void setModalityImage(short *_image)
void translateTracks(std::vector< float > &_translateo)
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
HepRotation inverse() const
void setDoseDistScale(double &_scale, int _num=0)
double G4double
Definition: G4Types.hh:76
void setDoseDistSize(int _size[3], int _num=0)
CLHEP::HepRotation getRotation() const
#define DBL_MAX
Definition: templates.hh:83
std::map< Index3D, float > kNestedModality
void setDoseDistName(std::string _name, int _num=0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExtractDetector()

void G4GMocrenFileSceneHandler::ExtractDetector ( )
private

Definition at line 1849 of file G4GMocrenFileSceneHandler.cc.

1849  {
1850 
1851  std::vector<Detector>::iterator itr = kDetectors.begin();
1852 
1853  for(; itr != kDetectors.end(); itr++) {
1854 
1855  // detector name
1856  G4String detname = itr->name;
1857  if(GFDEBUG_DET > 1)
1858  G4cout << "Detector name : " << detname << G4endl;
1859 
1860  // edge points of the detector
1861  std::vector<G4float *> dedges;
1862  G4Polyhedron * poly = itr->polyhedron;
1863  poly->Transform(itr->transform3D);
1864  G4Transform3D invVolTrans = kVolumeTrans3D.inverse();
1865  poly->Transform(invVolTrans);
1866 
1867  G4Point3D v1, v2;
1868  G4bool bnext = true;
1869  G4int next;
1870  G4int nedges = 0;
1871  //
1872  while(bnext) {
1873  if(!(poly->GetNextEdge(v1, v2, next))) bnext =false;
1874  G4float * edge = new G4float[6];
1875  edge[0] = v1.x()/mm;
1876  edge[1] = v1.y()/mm;
1877  edge[2] = v1.z()/mm;
1878  edge[3] = v2.x()/mm;
1879  edge[4] = v2.y()/mm;
1880  edge[5] = v2.z()/mm;
1881  dedges.push_back(edge);
1882  nedges++;
1883  }
1884  //delete poly;
1885  // detector color
1886  unsigned char uccolor[3] = {itr->color[0],
1887  itr->color[1],
1888  itr->color[2]};
1889  //
1890  kgMocrenIO->addDetector(detname, dedges, uccolor);
1891  for(G4int i = 0; i < nedges; i++) { // # of edges is 12.
1892  delete [] dedges[i];
1893  }
1894  dedges.clear();
1895 
1896  if(GFDEBUG_DET > 1) {
1897  G4cout << " color: (" << (G4int)uccolor[0] << ", "
1898  << (G4int)uccolor[1] << ", " << (G4int)uccolor[2] << ")"
1899  << G4endl;
1900  }
1901  }
1902 }
void addDetector(std::string &_name, std::vector< float *> &_det, unsigned char _color[3])
float G4float
Definition: G4Types.hh:77
HepPolyhedron & Transform(const G4Transform3D &t)
int G4int
Definition: G4Types.hh:78
const G4int GFDEBUG_DET
G4GLOB_DLL std::ostream G4cout
G4bool GetNextEdge(G4Point3D &p1, G4Point3D &p2, G4int &edgeFlag) const
bool G4bool
Definition: G4Types.hh:79
std::vector< Detector > kDetectors
#define G4endl
Definition: G4ios.hh:61
static const double mm
Definition: G4SIunits.hh:114
Transform3D inverse() const
Definition: Transform3D.cc:142
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetGddFileName()

const char* G4GMocrenFileSceneHandler::GetGddFileName ( )
inline

Definition at line 120 of file G4GMocrenFileSceneHandler.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNestedVolumeIndex()

void G4GMocrenFileSceneHandler::GetNestedVolumeIndex ( G4int  _idx,
G4int  _idx3d[3] 
)
private

Definition at line 1904 of file G4GMocrenFileSceneHandler.cc.

1904  {
1905  if(kNestedVolumeDimension[0] == 0 ||
1906  kNestedVolumeDimension[1] == 0 ||
1907  kNestedVolumeDimension[2] == 0) {
1908  for(G4int i = 0; i < 3; i++) _idx3d[i] = 0;
1909  return;
1910  }
1911 
1912 
1913  if(kFlagParameterization == 0) {
1914 
1916  G4int line = kNestedVolumeDimension[2];
1917 
1918  /*
1919  G4int idx3d[3];
1920  idx3d[0] = _idx/plane;
1921  idx3d[1] = (_idx%plane)/line;
1922  idx3d[2] = (_idx%plane)%line;
1923  _idx3d[0] = idx3d[kNestedVolumeDirAxis[0]];
1924  _idx3d[1] = idx3d[kNestedVolumeDirAxis[1]];
1925  _idx3d[2] = idx3d[kNestedVolumeDirAxis[2]];
1926  */
1927 
1928  _idx3d[kNestedVolumeDirAxis[0]] = _idx/plane;
1929  _idx3d[kNestedVolumeDirAxis[1]] = (_idx%plane)/line;
1930  _idx3d[kNestedVolumeDirAxis[2]] = (_idx%plane)%line;
1931 
1932 
1933 
1934  /*
1935 
1936  G4cout << "G4GMocrenFileSceneHandler::GetNestedVolumeIndex : " << G4endl;
1937  G4cout << "(depi, depj, depk) : "
1938  << kNestedVolumeDirAxis[0] << ", "
1939  << kNestedVolumeDirAxis[1] << ", "
1940  << kNestedVolumeDirAxis[2] << G4endl;
1941  G4cout << "(ni, nj, nk) :"
1942  << kNestedVolumeDimension[0] << ", "
1943  << kNestedVolumeDimension[1] << ", "
1944  << kNestedVolumeDimension[2] << " - " << G4endl;
1945 
1946  G4cout << " _idx = " << _idx << " : plane = "
1947  << plane << " , line = " << line << G4endl;
1948  G4cout << "(idx,idy,idz) + " << _idx3d[0] << ", "
1949  << _idx3d[1] << ", " << _idx3d[2] << " + " << G4endl;
1950 
1951  */
1952 
1953 
1954 
1955  } else {
1956 
1958  G4int line = kNestedVolumeDimension[0];
1959  _idx3d[kNestedVolumeDirAxis[2]] = _idx/plane;
1960  _idx3d[kNestedVolumeDirAxis[1]] = (_idx%plane)/line;
1961  _idx3d[kNestedVolumeDirAxis[0]] = (_idx%plane)%line;
1962 
1963  }
1964 
1965 }
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

◆ GetSystem()

G4GMocrenFile& G4GMocrenFileSceneHandler::GetSystem ( )
inline

Definition at line 119 of file G4GMocrenFileSceneHandler.hh.

119 { return kSystem ; }

◆ GFBeginModeling()

void G4GMocrenFileSceneHandler::GFBeginModeling ( void  )

Definition at line 503 of file G4GMocrenFileSceneHandler.cc.

504 {
506 
507  if( !GFIsInModeling() ) {
508 
510  G4cout << "***** G4GMocrenFileSceneHandler::GFBeginModeling (called & started)" << G4endl;
511 
512  //----- Send saving command and heading comment
513  BeginSavingGdd();
514 
515  kFlagInModeling = true ;
516 
517  // These models are entrusted to user commands /vis/scene/add/psHits or hits
518  //GetScene()->AddEndOfEventModel(new G4PSHitsModel());
519  //GetScene()->AddEndOfRunModel(new G4PSHitsModel());
520  //scene->AddEndOfEventModel(new G4HitsModel());
521  if(GFDEBUG_HIT) {
522  G4Scene * scene = GetScene();
523  std::vector<G4Scene::Model> vmodel = scene->GetEndOfEventModelList();
524  std::vector<G4Scene::Model>::iterator itr = vmodel.begin();
525  for(; itr != vmodel.end(); itr++) {
526  G4cout << " IIIIII model name: " << itr->fpModel->GetGlobalTag() << G4endl;
527  }
528  }
529  }
530 }
const std::vector< Model > & GetEndOfEventModelList() const
virtual void BeginModeling()
G4Scene * GetScene() const
G4GLOB_DLL std::ostream G4cout
const G4bool GFDEBUG_HIT
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GFEndModeling()

void G4GMocrenFileSceneHandler::GFEndModeling ( )

Definition at line 780 of file G4GMocrenFileSceneHandler.cc.

781 {
783 
784  //-----
786  G4cout << "***** GFEndModeling (called)" << G4endl;
787 
788  if( GFIsInModeling() ) {
789 
791  G4cout << "***** GFEndModeling (started) " ;
792  G4cout << "(/EndModeling, /DrawAll, /CloseDevice)" << G4endl;
793  }
794 
795  //----- End saving data to g4.gdd
796  EndSavingGdd() ;
797 
798  //------ Reset flag
799  kFlagInModeling = false ;
800 
801  }
802 
803 }
G4GLOB_DLL std::ostream G4cout
virtual void EndModeling()
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GFIsInModeling()

G4bool G4GMocrenFileSceneHandler::GFIsInModeling ( )
inline

Definition at line 112 of file G4GMocrenFileSceneHandler.hh.

Here is the caller graph for this function:

◆ InitializeParameters()

void G4GMocrenFileSceneHandler::InitializeParameters ( )
private

Definition at line 187 of file G4GMocrenFileSceneHandler.cc.

187  {
188 
189  kbSetModalityVoxelSize = false;
190 
191  for(G4int i = 0; i < 3; i++) {
192  kModalitySize[i] = 0;
193  kNestedVolumeDimension[i] = 0;
194  kNestedVolumeDirAxis[i] = -1;
195  }
196 
197  // delete kgMocrenIO;
198 
199 }
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

◆ IsSavingGdd()

G4bool G4GMocrenFileSceneHandler::IsSavingGdd ( void  )
inline

Definition at line 114 of file G4GMocrenFileSceneHandler.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsVisible()

G4bool G4GMocrenFileSceneHandler::IsVisible ( void  )
private

Definition at line 1774 of file G4GMocrenFileSceneHandler.cc.

1775 {
1776  //-----
1777  G4bool visibility = true ;
1778 
1779  const G4VisAttributes* pVisAttribs =
1781 
1782  if(pVisAttribs) {
1783  visibility = pVisAttribs->IsVisible();
1784  }
1785 
1786  return visibility ;
1787 
1788 } // G4GMocrenFileSceneHandler::IsVisible()
G4VViewer * fpViewer
bool G4bool
Definition: G4Types.hh:79
const G4VisAttributes * fpVisAttribs
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const
Definition: G4VViewer.cc:78
G4bool IsVisible() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetGddFileName()

void G4GMocrenFileSceneHandler::SetGddFileName ( )

Definition at line 202 of file G4GMocrenFileSceneHandler.cc.

203 {
204  // g4_00.gdd, g4_01.gdd, ..., g4_MAX_FILE_INDEX.gdd
205  const G4int MAX_FILE_INDEX = kMaxFileNum - 1 ;
206 
207  // dest directory (null if no environmental variables is set)
208  std::strncpy(kGddFileName, kGddDestDir, std::strlen(kGddDestDir)+1);
209 
210  // create full path name (default)
211  std::strncat ( kGddFileName, DEFAULT_GDD_FILE_NAME, std::strlen(DEFAULT_GDD_FILE_NAME));
212 
213  // Automatic updation of file names
214  static G4int currentNumber = 0;
215  for( G4int i = currentNumber ; i < kMaxFileNum ; i++) {
216 
217  // Message in the final execution
218  if( i == MAX_FILE_INDEX )
219  {
221  G4cout << "===========================================" << G4endl;
222  G4cout << "WARNING MESSAGE from GMocrenFile driver: " << G4endl;
223  G4cout << " This file name is the final one in the " << G4endl;
224  G4cout << " automatic updation of the output file name." << G4endl;
225  G4cout << " You may overwrite existing files, i.e. " << G4endl;
226  G4cout << " g4_XX.gdd." << G4endl;
227  G4cout << "===========================================" << G4endl;
228  }
229  }
230 
231  // re-determine file name as G4GMocrenFile_DEST_DIR/g4_XX.gdd
232  if( i >= 0 && i <= 9 ) {
233  std::sprintf( kGddFileName, "%s%s%s%d.gdd" , kGddDestDir, GDD_FILE_HEADER, "0", i );
234  } else {
235  std::sprintf( kGddFileName, "%s%s%d.gdd" , kGddDestDir, GDD_FILE_HEADER, i );
236  }
237 
238  // check validity of the file name
239  std::ifstream fin(kGddFileName);
240  if(GFDEBUG)
241  G4cout << "FILEOPEN: " << i << " : " << kGddFileName << fin.fail()
242  << G4endl;
243  if(!fin) {
244  // new file
245  fin.close();
246  currentNumber = i+1;
247  break;
248  } else {
249  // already exists (try next)
250  fin.close();
251  }
252 
253  } // for
254 
255  G4cout << "======================================================================" << G4endl;
256  G4cout << "Output file: " << kGddFileName << G4endl;
257  G4cout << "Destination directory (current dir if NULL): " << kGddDestDir << G4endl;
258  G4cout << "Maximum number of files in the destination directory: " << kMaxFileNum << G4endl;
259  G4cout << "Note:" << G4endl;
260  G4cout << " * The maximum number is customizable as: " << G4endl;
261  G4cout << " % setenv G4GMocrenFile_MAX_FILE_NUM number " << G4endl;
262  G4cout << " * The destination directory is customizable as:" << G4endl;
263  G4cout << " % setenv G4GMocrenFile_DEST_DIR dir_name/ " << G4endl;
264  G4cout << " ** Do not forget \"/\" at the end of the dir_name, e.g. \"./tmp/\"." << G4endl;
265  //G4cout << " dir_name, e.g. \"./tmp/\"." << G4endl;
266  G4cout << G4endl;
267  G4cout << "Maximum number of trajectories is set to " << MAX_NUM_TRAJECTORIES << "."<< G4endl;
268  G4cout << "======================================================================" << G4endl;
269 
270 } // G4GMocrenFileSceneHandler::SetGddFileName()
TString fin
const char DEFAULT_GDD_FILE_NAME[]
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
const char GDD_FILE_HEADER[]
const G4int MAX_NUM_TRAJECTORIES
static Verbosity GetVerbosity()
const G4bool GFDEBUG
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ G4GMocrenFileViewer

friend class G4GMocrenFileViewer
friend

Definition at line 56 of file G4GMocrenFileSceneHandler.hh.

Member Data Documentation

◆ kbModelingTrajectory

G4bool G4GMocrenFileSceneHandler::kbModelingTrajectory
private

Definition at line 146 of file G4GMocrenFileSceneHandler.hh.

◆ kbSetModalityVoxelSize

G4bool G4GMocrenFileSceneHandler::kbSetModalityVoxelSize
private

Definition at line 145 of file G4GMocrenFileSceneHandler.hh.

◆ kDetectors

std::vector<Detector> G4GMocrenFileSceneHandler::kDetectors
private

Definition at line 163 of file G4GMocrenFileSceneHandler.hh.

◆ kFlagInModeling

G4bool G4GMocrenFileSceneHandler::kFlagInModeling
private

Definition at line 192 of file G4GMocrenFileSceneHandler.hh.

◆ kFlagParameterization

G4int G4GMocrenFileSceneHandler::kFlagParameterization
private

Definition at line 203 of file G4GMocrenFileSceneHandler.hh.

◆ kFlagProcessedInteractiveScorer

G4bool G4GMocrenFileSceneHandler::kFlagProcessedInteractiveScorer
private

Definition at line 206 of file G4GMocrenFileSceneHandler.hh.

◆ kFlagSaving_g4_gdd

G4bool G4GMocrenFileSceneHandler::kFlagSaving_g4_gdd
private

Definition at line 201 of file G4GMocrenFileSceneHandler.hh.

◆ kGddDest

std::ofstream G4GMocrenFileSceneHandler::kGddDest
private

Definition at line 191 of file G4GMocrenFileSceneHandler.hh.

◆ kGddDestDir

char G4GMocrenFileSceneHandler::kGddDestDir[256]
private

Definition at line 208 of file G4GMocrenFileSceneHandler.hh.

◆ kGddFileName

char G4GMocrenFileSceneHandler::kGddFileName[256]
private

Definition at line 209 of file G4GMocrenFileSceneHandler.hh.

◆ kgMocrenIO

G4GMocrenIO* G4GMocrenFileSceneHandler::kgMocrenIO
private

Definition at line 140 of file G4GMocrenFileSceneHandler.hh.

◆ kMaxFileNum

G4int G4GMocrenFileSceneHandler::kMaxFileNum
private

Definition at line 210 of file G4GMocrenFileSceneHandler.hh.

◆ kMessenger

G4GMocrenMessenger& G4GMocrenFileSceneHandler::kMessenger
private

Definition at line 139 of file G4GMocrenFileSceneHandler.hh.

◆ kModality

std::map<G4int, float> G4GMocrenFileSceneHandler::kModality
private

Definition at line 142 of file G4GMocrenFileSceneHandler.hh.

◆ kModalitySize

G4int G4GMocrenFileSceneHandler::kModalitySize[3]
private

Definition at line 143 of file G4GMocrenFileSceneHandler.hh.

◆ kNestedHitsList

std::map<G4String, std::map<Index3D, G4double> > G4GMocrenFileSceneHandler::kNestedHitsList
private

Definition at line 188 of file G4GMocrenFileSceneHandler.hh.

◆ kNestedModality

std::map<Index3D, float> G4GMocrenFileSceneHandler::kNestedModality
private

Definition at line 186 of file G4GMocrenFileSceneHandler.hh.

◆ kNestedVolumeDimension

G4int G4GMocrenFileSceneHandler::kNestedVolumeDimension[3]
private

Definition at line 167 of file G4GMocrenFileSceneHandler.hh.

◆ kNestedVolumeDirAxis

G4int G4GMocrenFileSceneHandler::kNestedVolumeDirAxis[3]
private

Definition at line 168 of file G4GMocrenFileSceneHandler.hh.

◆ kNestedVolumeNames

std::vector<G4String> G4GMocrenFileSceneHandler::kNestedVolumeNames
private

Definition at line 166 of file G4GMocrenFileSceneHandler.hh.

◆ kSceneIdCount

G4int G4GMocrenFileSceneHandler::kSceneIdCount = 0
staticprivate

Definition at line 148 of file G4GMocrenFileSceneHandler.hh.

◆ kSystem

G4GMocrenFile& G4GMocrenFileSceneHandler::kSystem
private

Definition at line 138 of file G4GMocrenFileSceneHandler.hh.

◆ kVolumeSize

G4ThreeVector G4GMocrenFileSceneHandler::kVolumeSize
private

Definition at line 164 of file G4GMocrenFileSceneHandler.hh.

◆ kVolumeTrans3D

G4Transform3D G4GMocrenFileSceneHandler::kVolumeTrans3D
private

Definition at line 151 of file G4GMocrenFileSceneHandler.hh.

◆ kVoxelDimension

G4ThreeVector G4GMocrenFileSceneHandler::kVoxelDimension
private

Definition at line 165 of file G4GMocrenFileSceneHandler.hh.


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