Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4HepRepSceneHandler.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 // $Id: G4HepRepSceneHandler.hh 99152 2016-09-07 08:04:30Z gcosmo $
27 //
28 
33 #ifndef G4HEPREPSCENEHANDLER_HH
34 #define G4HEPREPSCENEHANDLER_HH 1
35 
36 #include "globals.hh"
37 #include <iostream>
38 #include <stack>
39 #include <map>
40 #include <vector>
41 
42 // HepRep
43 #include "HEPREP/HepRep.h"
44 
45 //G4
46 #include "G4Box.hh"
47 #include "G4Cons.hh"
48 #include "G4Tubs.hh"
49 #include "G4Trd.hh"
50 #include "G4Trap.hh"
51 #include "G4Sphere.hh"
52 #include "G4Para.hh"
53 #include "G4Torus.hh"
54 #include "G4Polycone.hh"
55 #include "G4Polyhedra.hh"
56 
57 #include "G4VGraphicsSystem.hh"
58 #include "G4VSceneHandler.hh"
59 #include "G4Visible.hh"
60 #include "G4Material.hh"
61 #include "G4LogicalVolume.hh"
62 #include "G4PhysicalVolumeModel.hh"
63 
65 
66  public:
68  virtual ~G4HepRepSceneHandler ();
69 
70  void AddSolid (const G4Box& box);
71  void AddSolid (const G4Cons& cons);
72  void AddSolid (const G4Tubs& tubs);
73  void AddSolid (const G4Trd& trd);
74  void AddSolid (const G4Trap& trap);
75  void AddSolid (const G4Sphere& sphere);
76  void AddSolid (const G4Para& para);
77  void AddSolid (const G4Torus& torus);
78  void AddSolid (const G4Polycone& polycone);
79  void AddSolid (const G4Polyhedra& polyhedra);
80  void AddSolid (const G4Orb& orb);
81  void AddSolid (const G4Ellipsoid& ellipsoid);
82  void AddSolid (const G4VSolid& solid);
83 
84  void AddCompound (const G4VTrajectory&);
85  void AddCompound (const G4VHit& hit);
86  void AddCompound (const G4VDigi& digi) {
88  }
91  }
94  }
95 
96  void PreAddSolid (const G4Transform3D& objectTransformation, const G4VisAttributes& visAttribs);
97  void PostAddSolid ();
98 
99  void AddPrimitive (const G4Polyline&);
100  void AddPrimitive (const G4Text&);
101  void AddPrimitive (const G4Circle&);
102  void AddPrimitive (const G4Square&);
103  void AddPrimitive (const G4Polyhedron&);
104 
105  void AddPrimitive (const G4Polymarker&);
106  void AddPrimitive (const G4Scale& scale);
107 
108  void BeginPrimitives (const G4Transform3D& objectTransformation);
109  void EndPrimitives ();
110  void BeginModeling ();
111  void EndModeling ();
112 
113  void openHepRep();
114  bool closeHepRep(bool final = false);
115  void openFile(G4String name);
116  void closeFile();
117 
118  private:
122 
124 
125  std::ostream* out;
128 
129  // Methods
130  G4bool dontWrite();
131 
132  void setColor (HEPREP::HepRepAttribute *attribute, const G4Color& color,
133  const G4String& key = G4String("Color"));
134  G4Color getColorFor (const G4Visible& visible);
135  G4Color getColorFor (const G4VSolid& solid);
136 
137  void setVisibility (HEPREP::HepRepAttribute *attribute, const G4VSolid& solid);
138  void setLine (HEPREP::HepRepAttribute *attribute, const G4VSolid& solid);
139 
140  void setVisibility (HEPREP::HepRepAttribute *attribute, const G4Visible& visible);
141  void setLine (HEPREP::HepRepAttribute *attribute, const G4Visible& visible);
142 
143  void setMarker (HEPREP::HepRepAttribute *attribute, const G4VMarker& marker);
144 
145  inline void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, char* value) {
146  setAttribute(attribute, name, G4String(value));
147  }
149  void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, bool value);
150  void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, double value);
151  void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, int value);
152  void setAttribute (HEPREP::HepRepAttribute* attribute, G4String name, double red, double green, double blue, double alpha);
153 
154  bool isEventData();
155 
156  void open(G4String name);
157  void close();
158 
159  void writeLayers(HEPREP::HepRep* heprep);
160 
162 
163  void addAttDefs(HEPREP::HepRepDefinition* definition, const std::map<G4String,G4AttDef>* attDefs);
164  void addAttVals(HEPREP::HepRepAttribute* attribute, const std::map<G4String,G4AttDef>* attDefs, std::vector<G4AttValue>* attValues);
165 
167 
169 
170  // Returns the particular instance/type or if not created, creates them and adds them to the HepRep
175  HEPREP::HepRepInstance* getGeometryInstance(G4String volumeName, int depth);
178  HEPREP::HepRepType* getGeometryType(G4String volumeName, int depth);
188 
189  G4String getFullTypeName(G4String volumeName, int depth);
190  G4String getParentTypeName(int currentDepth);
191 
192  // initialized Member Variables
196 
209 
210  // DO NOT USE member vars directly, use get methods.
214  std::vector<HEPREP::HepRepInstance*> _geometryInstance;
217  std::vector<G4String> _geometryTypeName;
218  std::map<G4String, HEPREP::HepRepType*> _geometryType;
228 
229  std::map<int, G4String> materialState;
230 };
231 
232 #endif
233 
void AddCompound(const G4VTrajectory &)
const XML_Char * name
Definition: expat.h:151
HEPREP::HepRepType * _eventType
HEPREP::HepRepInstance * getGeometryInstance(G4LogicalVolume *volume, G4Material *material, int depth)
void setMarker(HEPREP::HepRepAttribute *attribute, const G4VMarker &marker)
void AddCompound(const G4VDigi &digi)
HEPREP::HepRepType * getCalHitType()
system("rm -rf microbeam.root")
HEPREP::HepRep * getHepRep()
void addAttDefs(HEPREP::HepRepDefinition *definition, const std::map< G4String, G4AttDef > *attDefs)
Definition: test07.cc:36
Definition: G4Tubs.hh:85
Definition: G4VHit.hh:48
HEPREP::HepRepInstance * _geometryRootInstance
void setVisibility(HEPREP::HepRepAttribute *attribute, const G4VSolid &solid)
G4HepRepSceneHandler(G4VGraphicsSystem &system, const G4String &name="")
std::vector< G4String > _geometryTypeName
void AddCompound(const G4THitsMap< G4StatDouble > &hits)
G4Color getColorFor(const G4Visible &visible)
HEPREP::HepRepType * _calHitFaceType
Definition: test07.cc:36
void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &visAttribs)
G4HepRepSceneHandler & operator=(const G4HepRepSceneHandler &)
G4String getFullTypeName(G4String volumeName, int depth)
virtual void AddCompound(const G4VTrajectory &)
bool G4bool
Definition: G4Types.hh:79
Double_t scale
std::vector< HEPREP::HepRepInstance * > _geometryInstance
void openFile(G4String name)
const G4VTrajectory * currentTrack
void AddCompound(const G4THitsMap< G4double > &hits)
void hits()
Definition: readHits.C:15
HEPREP::HepRepInstanceTree * _eventInstanceTree
Definition: G4Text.hh:73
const XML_Char int const XML_Char * value
Definition: expat.h:331
Definition: G4Cons.hh:83
HEPREP::HepRepInstanceTree * getEventInstanceTree()
HEPREP::HepRep * _heprepGeometry
G4String getParentTypeName(int currentDepth)
void addAttVals(HEPREP::HepRepAttribute *attribute, const std::map< G4String, G4AttDef > *attDefs, std::vector< G4AttValue > *attValues)
HEPREP::HepRepTypeTree * _geometryTypeTree
static const G4double alpha
Definition: G4Box.hh:64
HEPREP::HepRepType * getCalHitFaceType()
bool closeHepRep(bool final=false)
HEPREP::HepRepType * _trajectoryType
HEPREP::HepRepType * getGeometryRootType()
HEPREP::HepRepTypeTree * _eventTypeTree
void addTopLevelAttributes(HEPREP::HepRepType *type)
Definition: G4Orb.hh:62
HEPREP::HepRep * getHepRepGeometry()
HEPREP::HepRepType * getGeometryType(G4String volumeName, int depth)
void setAttribute(HEPREP::HepRepAttribute *attribute, G4String name, char *value)
void open(G4String name)
void AddPrimitive(const G4Polyline &)
HEPREP::HepRepInstanceTree * getGeometryInstanceTree()
void setLine(HEPREP::HepRepAttribute *attribute, const G4VSolid &solid)
HEPREP::HepRepTypeTree * getGeometryTypeTree()
HEPREP::HepRepInstance * getEventInstance()
void addAttributes(HEPREP::HepRepInstance *instance, HEPREP::HepRepType *type)
int G4int
Definition: G4Types.hh:78
HEPREP::HepRepType * getTrajectoryType()
HEPREP::HepRepWriter * writer
HEPREP::HepRepInstance * _eventInstance
HEPREP::HepRepType * _calHitType
HEPREP::HepRepTypeTree * getEventTypeTree()
Definition: G4Trd.hh:72
static MCTruthManager * instance
HEPREP::HepRepType * getEventType()
void BeginPrimitives(const G4Transform3D &objectTransformation)
std::map< int, G4String > materialState
HEPREP::HepRepInstanceTree * _geometryInstanceTree
void setColor(HEPREP::HepRepAttribute *attribute, const G4Color &color, const G4String &key=G4String("Color"))
HEPREP::HepRepFactory * factory
HEPREP::HepRepInstance * getGeometryRootInstance()
std::map< G4String, HEPREP::HepRepType * > _geometryType
HEPREP::HepRepType * getHitType()
Definition: G4Para.hh:86
HEPREP::HepRepType * _geometryRootType
void AddSolid(const G4Box &box)
HEPREP::HepRepInstance * getGeometryOrEventInstance(HEPREP::HepRepType *type)
void writeLayers(HEPREP::HepRep *heprep)
HEPREP::HepRepType * _hitType