Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:19:38

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 // File: CCalVisualisable.hh
0028 // Description: Sets visualisable attributes from the information in flat file
0029 ///////////////////////////////////////////////////////////////////////////////
0030 #ifndef CCalVisualisable_hh
0031 #define CCalVisualisable_hh 1
0032 
0033 #include "globals.hh"
0034 
0035 class CCalVisualisable
0036 {
0037 public:
0038 
0039   //Here we define the different type of volumes we consider.
0040   enum visType {Sensitive=0,
0041                 Electronics=1,
0042                 Support=2,
0043                 Cable=3, 
0044                 Absorber=4,
0045                 OtherServices=5,
0046                 PseudoVolumes=6,
0047                 TotalVisTypes=7,
0048                 Undefined=-1};
0049 
0050 private:
0051 
0052   //This class groups the important visualization parameters.
0053   class visParameters
0054   {
0055    public:
0056      visParameters(G4bool v=false, G4double r=1,G4double g=1,
0057                    G4double b=1, G4bool w=true)
0058        : visibility(v),rColor(r),gColor(g),bColor(b),wireframe(w) {}
0059      G4bool visibility;
0060      G4double rColor;
0061      G4double gColor;
0062      G4double bColor;
0063      G4bool wireframe;
0064   };
0065   
0066 public:
0067   //Constructs this object from this file
0068   CCalVisualisable(G4String file);
0069   
0070   virtual ~CCalVisualisable() {}
0071 
0072   //Reads this object from file
0073   G4bool readFile(G4String file);
0074 
0075   //Sets visibility to true for Sensitive and to false otherwise.
0076   void setDefault();
0077 
0078   //Get & Set methods.
0079   G4bool isVisible (visType v) const
0080     {return theParameters[v].visibility;}
0081   void setVisible(visType v, G4bool flag=true)
0082     {theParameters[v].visibility=flag;}
0083 
0084   G4double colorRed  (visType v) const {return theParameters[v].rColor;}
0085   G4double colorGreen(visType v) const {return theParameters[v].gColor;}
0086   G4double colorBlue (visType v) const {return theParameters[v].bColor;}
0087   void setColorRed  (visType v, G4double r) {theParameters[v].rColor=r;}
0088   void setColorGreen(visType v, G4double g) {theParameters[v].gColor=g;}
0089   void setColorBlue (visType v, G4double b) {theParameters[v].bColor=b;}
0090   void setColor(visType v, G4double r, G4double g, G4double b);
0091 
0092   G4bool isWireFrame (visType v) const {return theParameters[v].wireframe;}
0093   void setWireFrame(visType v, G4bool wf=true){theParameters[v].wireframe=wf;}
0094 
0095 protected:
0096   //Read this object from visFile
0097   static void setPath();
0098   G4bool readFile();
0099 
0100 private:
0101   static const char* pathName;                //Path in which to look for files
0102   G4String visFile;                           //File with visualization info
0103   visParameters theParameters[TotalVisTypes]; //Visualisation parameters
0104 
0105   G4double checkColorRange(G4double color, char type) const;
0106 };
0107 
0108 #endif