Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:21:50

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  * =============================================================================
0028  *
0029  *       Filename:  CexmcScenePrimitives.hh
0030  *
0031  *    Description:  auxiliary scene primitives (radial lines etc.)
0032  *
0033  *        Version:  1.0
0034  *        Created:  03.01.2011 11:27:34
0035  *       Revision:  none
0036  *       Compiler:  gcc
0037  *
0038  *         Author:  Alexey Radkov (), 
0039  *        Company:  PNPI
0040  *
0041  * =============================================================================
0042  */
0043 
0044 #ifndef CEXMC_SCENE_PRIMITIVES_HH
0045 #define CEXMC_SCENE_PRIMITIVES_HH
0046 
0047 #include <vector>
0048 #include <map>
0049 #include <G4Colour.hh>
0050 #include <G4ThreeVector.hh>
0051 #include <G4VModel.hh>
0052 #include <G4VVisManager.hh>
0053 
0054 class  G4VGraphicsScene;
0055 class  CexmcSetup;
0056 class  CexmcScenePrimitivesMessenger;
0057 
0058 
0059 enum  CexmcSPType
0060 {
0061     CexmcTargetCenterMark_SP,
0062     CexmcRadialLine_SP,
0063     CexmcInnerCrystalsHl_SP
0064 };
0065 
0066 
0067 class  CexmcScenePrimitives : public G4VModel
0068 {
0069     private:
0070         struct  CexmcRadialLine
0071         {
0072             CexmcRadialLine( const G4ThreeVector &  line ) :
0073                 theta( line.x() ), phi( line.y() ), length( line.z() )
0074             {}
0075 
0076             G4double  theta;
0077 
0078             G4double  phi;
0079 
0080             G4double  length;
0081         };
0082 
0083         typedef std::vector< CexmcRadialLine >      CexmcRadialLines;
0084 
0085         typedef std::map< CexmcSPType, G4Colour >   CexmcSPColourMap;
0086 
0087     public:
0088         explicit CexmcScenePrimitives( CexmcSetup *  setup );
0089 
0090         ~CexmcScenePrimitives();
0091 
0092     public:
0093         void  DescribeYourselfTo( G4VGraphicsScene &  scene );
0094 
0095     public:
0096         void  MarkTargetCenter( G4bool  on = true );
0097 
0098         void  DrawRadialLine( const G4ThreeVector &  line );
0099 
0100         void  HighlightInnerCrystals( G4bool = true );
0101 
0102         void  ClearRadialLines( void );
0103 
0104         void  SetColour( CexmcSPType  primitive, const G4Colour &  colour );
0105 
0106     private:
0107         void  DrawRadialLine( G4VGraphicsScene &  scene,
0108                               const CexmcRadialLine *  rLine );
0109 
0110         void  MarkTargetCenter( G4VGraphicsScene &  scene );
0111 
0112         void  HighlightInnerCrystals( G4VGraphicsScene &  scene );
0113 
0114     private:
0115         void  UpdateScene( void );
0116 
0117     private:
0118         CexmcSetup *                     setup;
0119 
0120         G4bool                           markTargetCenter;
0121 
0122         G4bool                           highlightInnerCrystals;
0123 
0124         CexmcRadialLines                 radialLines;
0125 
0126         CexmcSPColourMap                 spColours;
0127 
0128     private:
0129         CexmcScenePrimitivesMessenger *  messenger;
0130 };
0131 
0132 
0133 inline void  CexmcScenePrimitives::SetColour( CexmcSPType  primitive,
0134                                               const G4Colour &  colour )
0135 {
0136     spColours[ primitive ] = colour;
0137 }
0138 
0139 
0140 inline void  CexmcScenePrimitives::DrawRadialLine( const G4ThreeVector &  line )
0141 {
0142     radialLines.push_back( line );
0143     UpdateScene();
0144 }
0145 
0146 
0147 inline void  CexmcScenePrimitives::MarkTargetCenter( G4bool  on )
0148 {
0149     markTargetCenter = on;
0150     UpdateScene();
0151 }
0152 
0153 
0154 inline void  CexmcScenePrimitives::HighlightInnerCrystals( G4bool  on )
0155 {
0156     highlightInnerCrystals = on;
0157     UpdateScene();
0158 }
0159 
0160 
0161 inline void  CexmcScenePrimitives::ClearRadialLines( void )
0162 {
0163     radialLines.clear();
0164     UpdateScene();
0165 }
0166 
0167 
0168 inline void CexmcScenePrimitives::UpdateScene( void )
0169 {
0170     G4VVisManager *  visManager( G4VVisManager::GetConcreteInstance() );
0171     if ( visManager )
0172         visManager->NotifyHandlers();
0173 }
0174 
0175 
0176 #endif
0177