00001 /* * BDSIM code. Version 1.0 00002 * Author: Grahame A. Blair, Royal Holloway, Univ. of London. 00003 * Last modified 24.7.2002 00004 * Copyright (c) 2002 by G.A.Blair. ALL RIGHTS RESERVED. 00005 00006 00007 Author of this code: John C. Carter, Royal Holloway, Univ. of London. 00008 Last modified 13.04.2005 00009 */ 00010 00011 00012 #ifndef BDSGeometrySQL_h 00013 #define BDSGeometrySQL_h 1 00014 00015 #include "globals.hh" 00016 #include "BDSMaterials.hh" 00017 #include "G4LogicalVolume.hh" 00018 #include "G4Cons.hh" 00019 #include "G4Tubs.hh" 00020 #include "G4EllipticalTube.hh" 00021 #include "G4VisAttributes.hh" 00022 #include "BDSMySQLTable.hh" 00023 #include "G4VPhysicalVolume.hh" 00024 #include "G4MagIntegratorStepper.hh" 00025 #include "G4Mag_UsualEqRhs.hh" 00026 #include "G4ChordFinder.hh" 00027 #include "G4FieldManager.hh" 00028 #include "BDSSamplerSD.hh" 00029 #include <fstream> 00030 #include <vector> 00031 #include <vector> 00032 #include "BDSMagFieldSQL.hh" 00033 00034 class BDSClassicalRK4; 00035 00036 class BDSGeometrySQL 00037 { 00038 public: 00039 BDSGeometrySQL(G4String DBfile, G4double markerlength); 00040 ~BDSGeometrySQL(); 00041 00042 void Construct(G4LogicalVolume *marker); 00043 00044 // For List of uniform fields for volumes 00045 std::list<G4ThreeVector> UniformField; 00046 std::list<G4String> Fieldvol; 00047 00048 // For List of Quad/Sext/Oct Fields 00049 std::list<G4double> QuadBgrad; 00050 std::list<G4String> Quadvol; 00051 std::list<G4double> SextBgrad; 00052 std::list<G4String> Sextvol; 00053 std::list<G4double> OctBgrad; 00054 std::list<G4String> Octvol; 00055 00056 std::map<G4String, G4ThreeVector> UniformFieldVolField; 00057 std::map<G4String, G4double> QuadVolBgrad; 00058 std::map<G4String, G4double> SextVolBgrad; 00059 std::map<G4String, G4double> OctVolBgrad; 00060 00061 G4VPhysicalVolume* align_in_volume; 00062 G4VPhysicalVolume* align_out_volume; 00063 std::vector<G4LogicalVolume*> SensitiveComponents; 00064 std::vector<G4LogicalVolume*> itsGFlashComponents; 00065 std::vector<G4VPhysicalVolume*> itsMultiplePhysicalVolumes; 00066 00067 std::vector<G4LogicalVolume*> VOL_LIST; 00068 G4bool HasFields; 00069 G4int nPoleField; 00070 G4bool HasUniformField; 00071 00072 std::vector<G4VPhysicalVolume*> GetMultiplePhysicalVolumes(); 00073 std::vector<G4LogicalVolume*> GetGFlashComponents(); 00074 00075 private: 00076 00077 void BuildSQLObjects(G4String file); 00078 void BuildCone(BDSMySQLTable* aSQLTable); 00079 void BuildEllipticalCone(BDSMySQLTable* aSQLTable); 00080 void BuildPolyCone(BDSMySQLTable* aSQLTable); 00081 void BuildBox(BDSMySQLTable* aSQLTable); 00082 void BuildTrap(BDSMySQLTable* aSQLTable); 00083 void BuildTorus(BDSMySQLTable* aSQLTable); 00084 void BuildSampler(BDSMySQLTable* aSQLTable); 00085 void BuildTube(BDSMySQLTable* aSQLTable); 00086 void BuildEllipticalTube(BDSMySQLTable* aSQLTable); 00087 void BuildPCLTube(BDSMySQLTable* aSQLTable); 00088 G4RotationMatrix* RotateComponent(G4double psi, 00089 G4double phi, 00090 G4double theta); 00091 G4RotationMatrix* rotateComponent; 00092 void PlaceComponents(BDSMySQLTable* aSQLTable, std::vector<G4LogicalVolume*> VOL_LIST); 00093 00094 G4double itsMarkerLength; 00095 std::ifstream ifs; 00096 G4LogicalVolume* itsMarkerVol; 00097 std::vector<BDSMySQLTable*> itsSQLTable; 00098 BDSMagFieldSQL* itsMagField; 00099 BDSSamplerSD* SensDet; 00100 00101 void SetMultiplePhysicalVolumes(G4VPhysicalVolume* aPhysVol); 00102 00103 protected: 00104 }; 00105 00106 inline void BDSGeometrySQL::SetMultiplePhysicalVolumes(G4VPhysicalVolume* aPhysVol) 00107 { itsMultiplePhysicalVolumes.push_back(aPhysVol);} 00108 00109 inline std::vector<G4VPhysicalVolume*> BDSGeometrySQL::GetMultiplePhysicalVolumes() 00110 {return itsMultiplePhysicalVolumes;} 00111 00112 inline std::vector<G4LogicalVolume*> BDSGeometrySQL::GetGFlashComponents() 00113 {return itsGFlashComponents;} 00114 00115 #endif