00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef G4GMocrenFile_SCENE_HANDLER_HH
00035 #define G4GMocrenFile_SCENE_HANDLER_HH
00036
00037 #include "globals.hh"
00038
00039 #include "G4VSceneHandler.hh"
00040
00041 #include <fstream>
00042
00043 #include "G4THitsMap.hh"
00044
00045 class G4VisAttributes ;
00046 class G4GMocrenFile;
00047 class G4GMocrenMessenger;
00048 class G4GMocrenIO;
00049 class G4VSolid;
00050 class G4Polyhedron;
00051 class G4Colour;
00052
00053
00054 class G4GMocrenFileSceneHandler: public G4VSceneHandler {
00055
00056 friend class G4GMocrenFileViewer;
00057
00058 public:
00059
00060
00061 G4GMocrenFileSceneHandler (G4GMocrenFile& system,
00062 G4GMocrenMessenger & messenger,
00063 const G4String& name = "");
00064 virtual ~G4GMocrenFileSceneHandler ();
00065
00066
00067 void AddPrimitive (const G4Polyline& line);
00068 void AddPrimitive (const G4Polyhedron& p);
00069 void AddPrimitive (const G4NURBS& nurb);
00070 void AddPrimitive (const G4Text&);
00071 void AddPrimitive (const G4Circle&);
00072 void AddPrimitive (const G4Square&);
00073
00074
00075
00076 void AddPrimitive (const G4Polymarker& polymarker)
00077 { G4VSceneHandler::AddPrimitive (polymarker); }
00078 void AddPrimitive (const G4Scale& scale)
00079 { G4VSceneHandler::AddPrimitive (scale); }
00080
00081 virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();}
00082 virtual void EndModeling () { G4VSceneHandler::EndModeling ();}
00083
00084 virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
00085 virtual void EndPrimitives ();
00086
00087 void AddSolid ( const G4Box& box );
00088 void AddSolid ( const G4Cons& cons );
00089 void AddSolid ( const G4Tubs& tubs );
00090 void AddSolid ( const G4Trd& trd );
00091 void AddSolid ( const G4Trap& trap );
00092 void AddSolid ( const G4Sphere& sphere );
00093 void AddSolid ( const G4Para& para );
00094 void AddSolid ( const G4Torus& torus );
00095 void AddSolid ( const G4Polycone& polycone ) {
00096 G4VSceneHandler::AddSolid (polycone);
00097 }
00098 void AddSolid ( const G4Polyhedra& polyhedra) {
00099 G4VSceneHandler::AddSolid (polyhedra);
00100 }
00101 void AddSolid ( const G4VSolid& solid );
00102 void AddCompound ( const G4VTrajectory& traj);
00103 void AddCompound ( const G4VHit& hit);
00104 void AddCompound ( const G4VDigi& hit);
00105 void AddCompound ( const G4THitsMap<G4double> & hits);
00106
00107
00108 void ClearTransientStore();
00109
00110
00111 void GFBeginModeling () ;
00112 void GFEndModeling () ;
00113 G4bool GFIsInModeling () { return kFlagInModeling ; }
00114
00115 G4bool IsSavingGdd ( void ) { return kFlagSaving_g4_gdd ; }
00116 void BeginSavingGdd( void );
00117 void EndSavingGdd ( void ) ;
00118 void SetGddFileName() ;
00119
00120 G4GMocrenFile& GetSystem () { return kSystem ; }
00121 const char* GetGddFileName () { return kGddFileName ; }
00122
00123
00124 private:
00125
00126
00127 void InitializeParameters();
00128
00129
00130 G4bool IsVisible();
00131
00132
00133 void AddDetector(const G4VSolid & solid);
00134 void ExtractDetector();
00135
00136 void GetNestedVolumeIndex(G4int, G4int[3]);
00137
00138 private:
00139 G4GMocrenFile& kSystem;
00140 G4GMocrenMessenger & kMessenger;
00141 G4GMocrenIO * kgMocrenIO;
00142
00143 std::map<G4int, float> kModality;
00144 G4int kModalitySize[3];
00145
00146 G4bool kbSetModalityVoxelSize;
00147 G4bool kbModelingTrajectory;
00148
00149 static G4int kSceneIdCount;
00150
00151
00152 G4Transform3D kVolumeTrans3D;
00153
00154 class Detector {
00155 public:
00156 G4String name;
00157 G4Polyhedron * polyhedron;
00158 G4Transform3D transform3D;
00159 unsigned char color[3];
00160 Detector();
00161 ~Detector();
00162 void clear();
00163 };
00164 std::vector<Detector> kDetectors;
00165 G4ThreeVector kVolumeSize;
00166 G4ThreeVector kVoxelDimension;
00167 std::vector<G4String> kNestedVolumeNames;
00168 G4int kNestedVolumeDimension[3];
00169 G4int kNestedVolumeDirAxis[3];
00170
00171 class Index3D {
00172 public:
00173 G4int x, y, z;
00174
00175 Index3D();
00176 Index3D(const Index3D & _index3D);
00177 Index3D(G4int _x, G4int _y, G4int _z);
00178 ~Index3D(){;}
00179 G4bool operator < (const Index3D & _right) const;
00180 G4bool operator == (const Index3D & _right) const;
00181 };
00182
00183 std::map<Index3D, float> kNestedModality;
00184 std::map<Index3D, G4double> * fTempNestedHits;
00185 std::map<G4String, std::map<Index3D, G4double> > kNestedHitsList;
00186
00187
00188 std::ofstream kGddDest;
00189 G4bool kFlagInModeling;
00190
00191
00192
00193
00194
00195
00196
00197
00198 G4bool kFlagSaving_g4_gdd ;
00199
00200 G4int kFlagParameterization;
00201
00202
00203 G4bool kFLagProcessedInteractiveScorer;
00204
00205 char kGddDestDir[256];
00206 char kGddFileName[256];
00207 G4int kMaxFileNum;
00208
00209 };
00210
00211 #endif