Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-17 07:06:08

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 // G4GDMLReadDefine
0027 //
0028 // Class description:
0029 //
0030 // GDML class for positionings and transformations according to
0031 // specifications in Geant4.
0032 
0033 // Author: Zoltan Torzsok, November 2007
0034 // --------------------------------------------------------------------
0035 #ifndef G4GDMLREADDEFINE_HH
0036 #define G4GDMLREADDEFINE_HH 1
0037 
0038 #include <map>
0039 
0040 #include "G4ThreeVector.hh"
0041 #include "G4RotationMatrix.hh"
0042 
0043 #include "G4GDMLRead.hh"
0044 
0045 class G4GDMLMatrix
0046 {
0047   public:
0048 
0049     G4GDMLMatrix();
0050     G4GDMLMatrix(std::size_t rows0, std::size_t cols0);
0051     G4GDMLMatrix(const G4GDMLMatrix& rhs);
0052     G4GDMLMatrix& operator=(const G4GDMLMatrix& rhs);
0053     ~G4GDMLMatrix();
0054 
0055     void Set(std::size_t r, std::size_t c, G4double a);
0056     G4double Get(std::size_t r, std::size_t c) const;
0057     std::size_t GetRows() const;
0058     std::size_t GetCols() const;
0059 
0060   private:
0061 
0062     G4double* m = nullptr;
0063     std::size_t rows = 0, cols = 0;
0064 };
0065 
0066 class G4GDMLReadDefine : public G4GDMLRead
0067 {
0068   public:
0069 
0070     G4bool IsValidID(const G4String&) const;
0071     G4double GetConstant(const G4String&);
0072     G4double GetVariable(const G4String&);
0073     G4double GetQuantity(const G4String&);
0074     G4ThreeVector GetPosition(const G4String&);
0075     G4ThreeVector GetRotation(const G4String&);
0076     G4ThreeVector GetScale(const G4String&);
0077     G4GDMLMatrix GetMatrix(const G4String&);
0078 
0079     virtual void DefineRead(const xercesc::DOMElement* const);
0080 
0081     inline void SetReverseSearch(G4bool flag)
0082     { reverseSearch = flag; }
0083 
0084   protected:
0085 
0086     G4GDMLReadDefine();
0087     virtual ~G4GDMLReadDefine();
0088 
0089     G4RotationMatrix GetRotationMatrix(const G4ThreeVector&);
0090     void VectorRead(const xercesc::DOMElement* const, G4ThreeVector&);
0091     G4String RefRead(const xercesc::DOMElement* const);
0092 
0093     void ConstantRead(const xercesc::DOMElement* const);
0094     void MatrixRead(const xercesc::DOMElement* const);
0095     void PositionRead(const xercesc::DOMElement* const);
0096     void RotationRead(const xercesc::DOMElement* const);
0097     void ScaleRead(const xercesc::DOMElement* const);
0098     void VariableRead(const xercesc::DOMElement* const);
0099     void QuantityRead(const xercesc::DOMElement* const);
0100     void ExpressionRead(const xercesc::DOMElement* const);
0101 
0102   protected:
0103     G4bool reverseSearch = false;
0104     std::map<G4String, G4double> quantityMap;
0105     std::map<G4String, G4ThreeVector> positionMap;
0106     std::map<G4String, G4ThreeVector> rotationMap;
0107     std::map<G4String, G4ThreeVector> scaleMap;
0108     std::map<G4String, G4GDMLMatrix> matrixMap;
0109 };
0110 
0111 #endif