Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4GMocrenFileSceneHandler.hh
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4GMocrenFileSceneHandler.hh 99152 2016-09-07 08:04:30Z gcosmo $
28 //
29 //
30 // Created: Mar. 31, 2009 Akinori Kimura
31 //
32 // Scene handler to export geometry and trajectories to a gMocren file.
33 //
34 #ifndef G4GMocrenFile_SCENE_HANDLER_HH
35 #define G4GMocrenFile_SCENE_HANDLER_HH
36 
37 #include "globals.hh"
38 
39 #include "G4VSceneHandler.hh"
40 
41 #include <fstream>
42 
43 #include "G4THitsMap.hh"
44 
45 class G4VisAttributes ;
46 class G4GMocrenFile;
47 class G4GMocrenMessenger;
48 class G4GMocrenIO;
49 class G4VSolid;
50 class G4Polyhedron;
51 class G4Colour;
52 
53 //-----
55 
56  friend class G4GMocrenFileViewer;
57 
58 public:
59 
60  //----- constructor and destructor
62  G4GMocrenMessenger & messenger,
63  const G4String& name = "");
64  virtual ~G4GMocrenFileSceneHandler ();
65 
66  //----- overriding base class methods
67  void AddPrimitive (const G4Polyline& line);
68  void AddPrimitive (const G4Polyhedron& p);
69  void AddPrimitive (const G4Text&);
70  void AddPrimitive (const G4Circle&);
71  void AddPrimitive (const G4Square&);
72 
73  //----- explicitly invoke base class methods to avoid warnings about
74  //----- hiding of base class methods.
75  void AddPrimitive (const G4Polymarker& polymarker)
76  { G4VSceneHandler::AddPrimitive (polymarker); }
77  void AddPrimitive (const G4Scale& scale)
79 
82 
83  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
84  virtual void EndPrimitives ();
85 
86  void AddSolid ( const G4Box& box );
87  void AddSolid ( const G4Cons& cons );
88  void AddSolid ( const G4Tubs& tubs );
89  void AddSolid ( const G4Trd& trd );
90  void AddSolid ( const G4Trap& trap );
91  void AddSolid ( const G4Sphere& sphere );
92  void AddSolid ( const G4Para& para );
93  void AddSolid ( const G4Torus& torus );
94  void AddSolid ( const G4Polycone& polycone ) {
95  G4VSceneHandler::AddSolid (polycone);
96  }
97  void AddSolid ( const G4Polyhedra& polyhedra) {
98  G4VSceneHandler::AddSolid (polyhedra);
99  }
100  void AddSolid ( const G4Orb& orb ) {
102  }
103  void AddSolid ( const G4Ellipsoid& ellipsoid) {
104  G4VSceneHandler::AddSolid (ellipsoid);
105  }
106  void AddSolid ( const G4VSolid& solid );
107  void AddCompound ( const G4VTrajectory& traj);
108  void AddCompound ( const G4VHit& hit);
109  void AddCompound ( const G4VDigi& hit);
110  void AddCompound ( const G4THitsMap<G4double> & hits);
111  void AddCompound ( const G4THitsMap<G4StatDouble> & hits);
112 
113 
114  void ClearTransientStore(); // Used for triggering detector re-drawing.
115 
116  //----- public methods inherent to this class
117  void GFBeginModeling () ;
118  void GFEndModeling () ;
120 
121  G4bool IsSavingGdd ( void ) { return kFlagSaving_g4_gdd ; }
122  void BeginSavingGdd( void );
123  void EndSavingGdd ( void ) ;
124  void SetGddFileName() ;
125 
126  G4GMocrenFile& GetSystem () { return kSystem ; }
127  const char* GetGddFileName () { return kGddFileName ; }
128 
129 
130 private:
131 
132  //----- initialize all parameters
133  void InitializeParameters();
134 
135  //----- Utilities etc.
136  G4bool IsVisible();
137 
138  //
139  void AddDetector(const G4VSolid & solid);
140  void ExtractDetector();
141 
142  void GetNestedVolumeIndex(G4int, G4int[3]);
143 
144 private:
145  G4GMocrenFile& kSystem; // Graphics system for this scene.
148 
149  std::map<G4int, float> kModality;
151  //std::map<G4ThreeVector, float> kModalityDensities; // key: position, val: density
154 
156  //std::vector<float *> fTrajectories;
157  //std::vector<unsigned char *> fTrajectoryColors;
159 
160  class Detector {
161  public:
165  unsigned char color[3];
166  Detector();
167  ~Detector();
168  void clear();
169  };
170  std::vector<Detector> kDetectors;
173  std::vector<G4String> kNestedVolumeNames;
176 
177  class Index3D {
178  public:
179  G4int x, y, z;
180 
181  Index3D();
182  Index3D(const Index3D & _index3D);
183  Index3D(G4int _x, G4int _y, G4int _z);
184  ~Index3D(){;}
185  G4bool operator < (const Index3D & _right) const;
186  G4bool operator == (const Index3D & _right) const;
187  private:
188  // Private assigment operator -
189  // assignment not allowed. Keeps Coverity happy.
190  // Index3D& operator = (const Index3D&);
191  };
192 
193  std::map<Index3D, float> kNestedModality;
194  //std::map<Index3D, G4double> * fTempNestedHits;
195  std::map<G4String, std::map<Index3D, G4double> > kNestedHitsList;
196  //std::map<G4String, G4String> kNestedHitsUnit;
197 
198  std::ofstream kGddDest; // defined here
200  // true: GF_BEGIN_MODELING has sent to gMocrenFile, and
201  // GF_END_MODELING has not sent yet.
202  // false: otherwise
203  //
204  // kFlagInModeling is set to "true"
205  // in GFBeginModeling(), and to "false"
206  // in GFEndModeling().
207 
209 
210  G4int kFlagParameterization; // 0: G4VNestedParameterisation based geometry
211  // 1: G4PhantomParameterisation
212  // 2: interactive scorer
214 
215  char kGddDestDir[256];
216  char kGddFileName[256];
218 
219 };
220 
221 #endif
const XML_Char * name
Definition: expat.h:151
system("rm -rf microbeam.root")
Definition: G4Tubs.hh:85
const char * p
Definition: xmltok.h:285
Definition: G4VHit.hh:48
void AddSolid(const G4Polyhedra &polyhedra)
void AddSolid(const G4Ellipsoid &ellipsoid)
void AddDetector(const G4VSolid &solid)
bool G4bool
Definition: G4Types.hh:79
Double_t scale
void hits()
Definition: readHits.C:15
Definition: G4Text.hh:73
Definition: G4Cons.hh:83
virtual void BeginModeling()
Definition: G4Box.hh:64
void AddPrimitive(const G4Polymarker &polymarker)
G4bool operator==(const Index3D &_right) const
std::vector< Detector > kDetectors
Definition: G4Orb.hh:62
void AddCompound(const G4VTrajectory &traj)
virtual void EndModeling()
std::vector< G4String > kNestedVolumeNames
G4GMocrenFileSceneHandler(G4GMocrenFile &system, G4GMocrenMessenger &messenger, const G4String &name="")
virtual void AddSolid(const G4Box &)
G4bool operator<(const Index3D &_right) const
int G4int
Definition: G4Types.hh:78
virtual void AddPrimitive(const G4Polyline &)=0
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
Definition: G4Trd.hh:72
std::map< G4int, float > kModality
std::map< G4String, std::map< Index3D, G4double > > kNestedHitsList
void AddSolid(const G4Polycone &polycone)
void AddPrimitive(const G4Polyline &line)
Definition: G4Para.hh:86
void AddPrimitive(const G4Scale &scale)
void GetNestedVolumeIndex(G4int, G4int[3])
std::map< Index3D, float > kNestedModality