Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // 28 // ---------------------- 29 // Class description: 30 // 31 // This class is a temporary representation of G3 volume. 32 // Its methods enables successive updating of its instances 33 // during the phase of filling the G3 tables (defining G3 geometry, 34 // eg. by parsing the G3 input via clparse.cc). 35 // See G3VolTable class description, too. 36 // 37 // Data members: 38 // fVname volume name; 39 // fShape G3 shape name; 40 // fRpar array of G3 volumes parameters; 41 // fNpar number of G3 volumes parameters; 42 // fNmed G3 tracking medium number; 43 // fSolid the G4VSolid of this volume; 44 // fLV the G4LogicalVolume; 45 // fHasNegPars true if G3 volume was defined with incomplete 46 // parameters; 47 // fDaughters vector of daughter VTEs (VTEs of volumes placed inside 48 // this volume); 49 // fMothers vector of mother VTEs (VTEs of volumes inside which this 50 // volume is placed); 51 // fClones vector of clone VTEs (see explanation below); 52 // fG3Pos vector of G3 positions (G3Pos objects) 53 // fDivision G3Division object created in case the G4 volume 54 // was defined as division; 55 // 56 // Clone volumes: 57 // In case a G3 volume (e.g. XYZ) has changed its solid parameters 58 // with its new position (placement with GSPOSP) a new G3VolTableEntry 59 // (associated with this new solid) with a new name (XYZ_N) 60 // is created and registered as a clone volume in the fClones vector 61 // data member of its master G3VolTableEntry object. 62 63 // ---------------------- 64 // 65 // by I.Hrivnacova, 13.10.99 66 67 #ifndef G3VOLTABLEENTRY_HH 68 #define G3VOLTABLEENTRY_HH 1 69 70 #include "globals.hh" 71 #include "G3Pos.hh" 72 #include "G3Division.hh" 73 #include <vector> 74 75 class G4LogicalVolume; 76 class G4Material; 77 class G4VSolid; 78 79 class G3VolTableEntry 80 { 81 public: // with description 82 83 G3VolTableEntry(G4String& vname, G4String& shape, G4double* rpar, 84 G4int npar, G4int nmed, G4VSolid* solid, 85 G4bool hasNegPars); 86 virtual ~G3VolTableEntry(); 87 88 // operators 89 G4bool operator == ( const G3VolTableEntry& vte) const; 90 91 // methods 92 void AddG3Pos(G3Pos* aG3Pos); 93 void AddDaughter(G3VolTableEntry* aDaughter); 94 void AddMother(G3VolTableEntry* aDaughter); 95 void AddClone(G3VolTableEntry* aDaughter); 96 void AddOverlap(G3VolTableEntry* aOverlap); 97 void ReplaceDaughter(G3VolTableEntry* vteOld, G3VolTableEntry* vteNew); 98 void ReplaceMother(G3VolTableEntry* vteOld, G3VolTableEntry* vteNew); 99 G3VolTableEntry* FindDaughter(const G4String& vname); 100 G3VolTableEntry* FindMother(const G4String& vname); 101 G3VolTableEntry* FindClone(const G4String& vname); 102 void PrintSolidInfo(); 103 104 // set methods 105 void SetName(G4String name); 106 void SetLV(G4LogicalVolume* lv); 107 void SetSolid(G4VSolid* solid); 108 void SetNmed(G4int nmed); 109 void SetNRpar(G4int npar, G4double* Rpar); 110 void SetDivision(G3Division* division); 111 void SetHasNegPars(G4bool hasNegPars); 112 void SetHasMANY(G4bool hasMANY); 113 void ClearG3PosCopy(G4int copy); 114 void ClearDivision(); 115 116 // get methods 117 G4String GetName(); 118 G4String GetShape(); 119 G4int GetNmed(); 120 G4int GetNpar(); 121 G4double* GetRpar(); 122 G4int NPCopies(); 123 G3Pos* GetG3PosCopy(G4int copy=0); 124 G3Division* GetDivision(); 125 G4bool HasNegPars(); 126 G4bool HasMANY(); 127 G4VSolid* GetSolid(); 128 G4LogicalVolume* GetLV(); 129 G4int GetNoDaughters(); 130 G4int GetNoMothers(); 131 G4int GetNoClones(); 132 G4int GetNoOverlaps(); 133 G3VolTableEntry* GetDaughter(G4int i); 134 G3VolTableEntry* GetMother(G4int i); 135 G3VolTableEntry* GetMother(); 136 // return the first mother - to be removed 137 G3VolTableEntry* GetClone(G4int i); 138 G3VolTableEntry* GetMasterClone(); 139 std::vector<G3VolTableEntry*>* GetOverlaps(); 140 141 private: 142 G4String fVname; 143 G4String fShape; 144 G4double* fRpar; 145 G4int fNpar; 146 G4int fNmed; 147 G4VSolid* fSolid; 148 G4LogicalVolume* fLV; 149 G4bool fHasNegPars; 150 G4bool fHasMANY; 151 std::vector<G3VolTableEntry*> fDaughters; 152 std::vector<G3VolTableEntry*> fMothers; 153 std::vector<G3VolTableEntry*> fClones; 154 std::vector<G3VolTableEntry*> fOverlaps; 155 std::vector<G3Pos*> fG3Pos; 156 G3Division* fDivision; 157 }; 158 159 // inline methods 160 161 inline void G3VolTableEntry::SetDivision(G3Division* division) 162 { fDivision = division; } 163 164 inline G3Division* G3VolTableEntry::GetDivision() 165 { return fDivision; } 166 167 #endif 168