Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:59:51

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 class G4Event;
0091 
0092 class G4VVisManager {
0093 
0094 public: // With description
0095 
0096   static G4VVisManager* GetConcreteInstance ();
0097   // Returns pointer to actual visualization manager if a view is
0098   // available for drawing, else returns null.  Always check value.
0099 
0100 public:
0101 
0102   G4VVisManager ();
0103   virtual ~G4VVisManager ();
0104 
0105 public: // With description
0106 
0107   ///////////////////////////////////////////////////////////////////////
0108   // Draw methods for Geant4 Visualization Primitives, useful
0109   // for representing hits, digis, etc.
0110 
0111   virtual void Draw (const G4Circle&,
0112     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0113 
0114   virtual void Draw (const G4Polyhedron&,
0115     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0116 
0117   virtual void Draw (const G4Polyline&,
0118     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0119 
0120   virtual void Draw (const G4Polymarker&,
0121     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0122 
0123   virtual void Draw (const G4Square&,
0124     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0125 
0126   virtual void Draw (const G4Text&,
0127     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0128 
0129   ///////////////////////////////////////////////////////////////////////
0130   // For 2D methods, the x,y coordinates are interpreted as screen
0131   // coordinates, -1 < x,y < 1.  The z-coordinate is ignored.
0132 
0133   virtual void Draw2D (const G4Circle&,
0134     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0135 
0136   virtual void Draw2D (const G4Polyhedron&,
0137     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0138 
0139   virtual void Draw2D (const G4Polyline&,
0140     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0141 
0142   virtual void Draw2D (const G4Polymarker&,
0143     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0144 
0145   virtual void Draw2D (const G4Square&,
0146     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0147 
0148   virtual void Draw2D (const G4Text&,
0149     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0150 
0151   ///////////////////////////////////////////////////////////////////////
0152   // Draw methods for Geant4 Objects as if they were Visualization
0153   // Primitives.  Note that the visualization attributes needed in
0154   // some cases override any visualization attributes that are
0155   // associated with the object itself - thus you can, for example,
0156   // change the colour of a physical volume.
0157 
0158   virtual void Draw (const G4VTrajectory&) = 0;
0159 
0160   virtual void Draw (const G4VHit&) = 0;
0161 
0162   virtual void Draw (const G4VDigi&) = 0;
0163 
0164   virtual void Draw (const G4LogicalVolume&, const G4VisAttributes&,
0165     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0166 
0167   virtual void Draw (const G4VPhysicalVolume&, const G4VisAttributes&,
0168     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0169 
0170   virtual void Draw (const G4VSolid&, const G4VisAttributes&,
0171     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0172 
0173   virtual void DrawGeometry
0174   (G4VPhysicalVolume*, const G4Transform3D& t = G4Transform3D());
0175   // Draws a geometry tree starting at the specified physical volume.
0176 
0177   //////////////////////////////////////////////////////////////////////
0178   // Optional methods that you may use to bracket a series of Draw
0179   // messages that have identical objectTransformation to improve
0180   // drawing speed.  Use Begin/EndDraw for a series of Draw messages,
0181   // Begin/EndDraw2D for a series of Draw2D messages.  Do not mix Draw
0182   // and Draw2D messages.
0183 
0184   virtual void BeginDraw
0185   (const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0186 
0187   virtual void EndDraw () = 0;
0188 
0189   virtual void BeginDraw2D
0190   (const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
0191 
0192   virtual void EndDraw2D () = 0;
0193 
0194   //////////////////////////////////////////////////////////////////////
0195   // Other methods...
0196 
0197   virtual void GeometryHasChanged () = 0;
0198   // This is used by the run manager to notify a change of geometry.
0199 
0200   virtual void IgnoreStateChanges(G4bool);
0201   // This method shoud be invoked by a class that has its own event loop,
0202   // such as the RayTracer, material scanner, etc. If the argument is true,
0203   // the following state changes among Idle, GeomClosed and EventProc are
0204   // caused by such a class, and thus not by the ordinary event simulation.
0205   // The same method with false should be invoked once such an event loop
0206   // is over.
0207 
0208   virtual void NotifyHandlers () {}
0209   // Notify scene handlers (G4VGraphicsScene objects) that the scene
0210   // has changed so that they may rebuild their graphics database, if
0211   // any, and redraw all views.
0212 
0213   virtual void DispatchToModel(const G4VTrajectory&) = 0;
0214   // Draw the trajectory.
0215 
0216   virtual G4bool FilterTrajectory(const G4VTrajectory&) = 0;
0217   // Trajectory filter
0218 
0219   virtual G4bool FilterHit(const G4VHit&) = 0;
0220   // Hit filter
0221 
0222   virtual G4bool FilterDigi(const G4VDigi&) = 0;
0223   // Digi filter
0224 
0225   virtual void SetUpForAThread() {}
0226   // This method is invoked by G4WorkerRunManager
0227 
0228   virtual void EventReadyForVis(const G4Event*) {}
0229   // This is invoked by G4SubEvtRunManager
0230 
0231 protected:
0232 
0233   static void SetConcreteInstance (G4VVisManager*);
0234 
0235   static G4VVisManager* fpConcreteInstance;  // Pointer to real G4VisManager.
0236 
0237 };
0238 
0239 #endif