Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:28

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // John Allison 19/Oct/1996.
0028 // 
0029 // Class Description:
0030 //
0031 // G4VVisManager is an abstract interface for the GEANT4 Visualization Manager.
0032 // The inheritance hierarchy is:
0033 //   G4VVisManager <- G4VisManager <- G4VisExecutive
0034 //
0035 // You may also write your own vis manager in place of G4VisExecutive.
0036 //
0037 // See example/novice/N02 to see how and when to instantiate
0038 // G4VisExecutive (or your own vis manager).  You should *not* access
0039 // it directly; instead you should obtain a pointer as follows:
0040 // 
0041 //   G4VVisManager* pVVMan =  G4VVisManager::GetConcreteInstance ();
0042 //
0043 // This ensures your code will link even if G4VisExecutive is not
0044 // instantiated or even if not provided in a library.  Please protect
0045 // your code by testing the pointer, for example, by:
0046 //
0047 //   if (pVVMan) pVVMan -> Draw (polyline);
0048 //
0049 // The Draw functions draw only "transient" objects.  This is useful
0050 // for debugging, e.g., drawing the step in your UserSteppingAction,
0051 // since G4Steps are not kept.
0052 //
0053 // Note: "permanent" objects, i.e., objects which are always
0054 // available, such as detector geometry components, or available in an
0055 // event after tracking has finished, such as hits, digitisations and
0056 // trajectories, can be drawn in a transient way if you wish but it is
0057 // usually possible to draw them in a permanent way with /vis/
0058 // commands.  The advantage is that permanent objects can be redrawn,
0059 // e.g., when you change view or viewer; transient objects get
0060 // forgotten.  Also, it is possible to write a G4VUserVisAction class
0061 // and register it to "promote" your Draw messages to "permanent" -
0062 // see documentation.
0063 //
0064 // Note that the G4Transform3D argument refers to the transformation
0065 // of the *object*, not the transformation of the coordinate syste.
0066 //
0067 // Note also that where a G4VisAttributes argument is specified, it
0068 // overrides any attributes belonging to the object itself.
0069 
0070 #ifndef G4VVISMANAGER_HH
0071 #define G4VVISMANAGER_HH
0072 
0073 #include "G4Transform3D.hh"
0074 #include "G4ThreeVector.hh"       // Just a typedef Hep3Vector.
0075 #include "G4RotationMatrix.hh"    // Just a typedef HepRotation.
0076 
0077 class G4Polyline;
0078 class G4Text;
0079 class G4Circle;
0080 class G4Square;
0081 class G4Polymarker;
0082 class G4Polyhedron;
0083 class G4VSolid;
0084 class G4VHit;
0085 class G4VDigi;
0086 class G4VTrajectory;
0087 class G4LogicalVolume;
0088 class G4VPhysicalVolume;
0089 class G4VisAttributes;
0090 
0091 class G4VVisManager {
0092 
0093 public: // With description
0094 
0095   static G4VVisManager* GetConcreteInstance ();
0096   // Returns pointer to actual visualization manager if a view is
0097   // available for drawing, else returns null.  Always check value.
0098 
0099 public:
0100 
0101   G4VVisManager ();
0102   virtual ~G4VVisManager ();
0103 
0104 public: // With description
0105 
0106   ///////////////////////////////////////////////////////////////////////
0107   // Draw methods for Geant4 Visualization Primitives, useful
0108   // for representing hits, digis, etc.
0109 
0110   virtual void Draw (const G4Circle&,
0111     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0112 
0113   virtual void Draw (const G4Polyhedron&,
0114     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0115 
0116   virtual void Draw (const G4Polyline&,
0117     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0118 
0119   virtual void Draw (const G4Polymarker&,
0120     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0121 
0122   virtual void Draw (const G4Square&,
0123     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0124 
0125   virtual void Draw (const G4Text&,
0126     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0127 
0128   ///////////////////////////////////////////////////////////////////////
0129   // For 2D methods, the x,y coordinates are interpreted as screen
0130   // coordinates, -1 < x,y < 1.  The z-coordinate is ignored.
0131 
0132   virtual void Draw2D (const G4Circle&,
0133     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0134 
0135   virtual void Draw2D (const G4Polyhedron&,
0136     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0137 
0138   virtual void Draw2D (const G4Polyline&,
0139     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0140 
0141   virtual void Draw2D (const G4Polymarker&,
0142     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0143 
0144   virtual void Draw2D (const G4Square&,
0145     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0146 
0147   virtual void Draw2D (const G4Text&,
0148     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0149 
0150   ///////////////////////////////////////////////////////////////////////
0151   // Draw methods for Geant4 Objects as if they were Visualization
0152   // Primitives.  Note that the visualization attributes needed in
0153   // some cases override any visualization attributes that are
0154   // associated with the object itself - thus you can, for example,
0155   // change the colour of a physical volume.
0156 
0157   virtual void Draw (const G4VTrajectory&) = 0;
0158 
0159   virtual void Draw (const G4VHit&) = 0;
0160 
0161   virtual void Draw (const G4VDigi&) = 0;
0162 
0163   virtual void Draw (const G4LogicalVolume&, const G4VisAttributes&,
0164     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0165 
0166   virtual void Draw (const G4VPhysicalVolume&, const G4VisAttributes&,
0167     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0168 
0169   virtual void Draw (const G4VSolid&, const G4VisAttributes&,
0170     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0171 
0172   virtual void DrawGeometry
0173   (G4VPhysicalVolume*, const G4Transform3D& t = G4Transform3D());
0174   // Draws a geometry tree starting at the specified physical volume.
0175 
0176   //////////////////////////////////////////////////////////////////////
0177   // Optional methods that you may use to bracket a series of Draw
0178   // messages that have identical objectTransformation to improve
0179   // drawing speed.  Use Begin/EndDraw for a series of Draw messages,
0180   // Begin/EndDraw2D for a series of Draw2D messages.  Do not mix Draw
0181   // and Draw2D messages.
0182 
0183   virtual void BeginDraw
0184   (const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0185 
0186   virtual void EndDraw () = 0;
0187 
0188   virtual void BeginDraw2D
0189   (const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0190 
0191   virtual void EndDraw2D () = 0;
0192 
0193   //////////////////////////////////////////////////////////////////////
0194   // Other methods...
0195 
0196   virtual void GeometryHasChanged () = 0;
0197   // This is used by the run manager to notify a change of geometry.
0198 
0199   virtual void IgnoreStateChanges(G4bool);
0200   // This method shoud be invoked by a class that has its own event loop,
0201   // such as the RayTracer, material scanner, etc. If the argument is true,
0202   // the following state changes among Idle, GeomClosed and EventProc are
0203   // caused by such a class, and thus not by the ordinary event simulation.
0204   // The same method with false should be invoked once such an event loop
0205   // is over.
0206 
0207   virtual void NotifyHandlers () {}
0208   // Notify scene handlers (G4VGraphicsScene objects) that the scene
0209   // has changed so that they may rebuild their graphics database, if
0210   // any, and redraw all views.
0211 
0212   virtual void DispatchToModel(const G4VTrajectory&) = 0;
0213   // Draw the trajectory.
0214 
0215   virtual G4bool FilterTrajectory(const G4VTrajectory&) = 0;
0216   // Trajectory filter
0217 
0218   virtual G4bool FilterHit(const G4VHit&) = 0;
0219   // Hit filter
0220 
0221   virtual G4bool FilterDigi(const G4VDigi&) = 0;
0222   // Digi filter
0223 
0224 #ifdef G4MULTITHREADED
0225 
0226   virtual void SetUpForAThread() = 0;
0227   // This method is invoked by G4WorkerRunManager
0228 
0229 #endif
0230 
0231 protected:
0232 
0233   static void SetConcreteInstance (G4VVisManager*);
0234 
0235   static G4VVisManager* fpConcreteInstance;  // Pointer to real G4VisManager.
0236 
0237 };
0238 
0239 #endif