[807] | 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 | // File name: RadmonPhysicsLayout.cc |
---|
| 28 | // Creation date: Nov 2005 |
---|
| 29 | // Main author: Riccardo Capra <capra@ge.infn.it> |
---|
| 30 | // |
---|
| 31 | // Id: $Id: RadmonPhysicsLayout.cc,v 1.4 2006/06/29 16:18:55 gunter Exp $ |
---|
| 32 | // Tag: $Name: $ |
---|
| 33 | // |
---|
| 34 | |
---|
| 35 | // Include files |
---|
| 36 | #include "RadmonPhysicsLayout.hh" |
---|
| 37 | |
---|
| 38 | RadmonPhysicsLayout :: RadmonPhysicsLayout() |
---|
| 39 | { |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | RadmonPhysicsLayout :: ~RadmonPhysicsLayout() |
---|
| 45 | { |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | void RadmonPhysicsLayout :: AddPhysicsList(const G4String & physicsListName) |
---|
| 53 | { |
---|
| 54 | if (subPhysicsListCollection.ExistsItemByLabel(physicsListName)) |
---|
| 55 | { |
---|
| 56 | G4cout << "RadmonPhysicsLayout::AddPhysicsList: Physics list \"" << physicsListName << "\" is just present." << G4endl; |
---|
| 57 | return; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | RadmonSubPhysicsListLayout & physicsList(subPhysicsListCollection.AppendItem()); |
---|
| 61 | physicsList.SetLabel(physicsListName); |
---|
| 62 | NotifyChange(); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | void RadmonPhysicsLayout :: RemovePhysicsList(const G4String & physicsListName) |
---|
| 68 | { |
---|
| 69 | if (!subPhysicsListCollection.ExistsItemByLabel(physicsListName)) |
---|
| 70 | { |
---|
| 71 | G4cout << "RadmonPhysicsLayout::RemovePhysicsList: Physics list \"" << physicsListName << "\" is not present." << G4endl; |
---|
| 72 | return; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | subPhysicsListCollection.RemoveItemByLabel(physicsListName); |
---|
| 76 | NotifyChange(); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | G4int RadmonPhysicsLayout :: GetNPhysicsLists(void) const |
---|
| 82 | { |
---|
| 83 | return subPhysicsListCollection.GetNItems(); |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | const G4String & RadmonPhysicsLayout :: GetPhysicsListName(G4int index) const |
---|
| 89 | { |
---|
| 90 | return subPhysicsListCollection.GetItem(index).GetLabel(); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | void RadmonPhysicsLayout :: SetPhysicsListAttribute(const G4String & physicsListName, const G4String & attributeName, const G4String & attributeValue) |
---|
| 98 | { |
---|
| 99 | if (!subPhysicsListCollection.ExistsItemByLabel(physicsListName)) |
---|
| 100 | { |
---|
| 101 | G4cout << "RadmonPhysicsLayout::SetPhysicsListAttribute: Physics list \"" << physicsListName << "\" is not present." << G4endl; |
---|
| 102 | return; |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | RadmonSubPhysicsListLayout & subPhysicsList(subPhysicsListCollection.FindItemByLabel(physicsListName)); |
---|
| 106 | |
---|
| 107 | if (subPhysicsList.GetAttribute(attributeName, attributeValue+"#")==attributeValue) |
---|
| 108 | return; |
---|
| 109 | |
---|
| 110 | subPhysicsList.SetAttribute(attributeName, attributeValue); |
---|
| 111 | NotifyChange(); |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | void RadmonPhysicsLayout :: ClearPhysicsListAttribute(const G4String & physicsListName, const G4String & attributeName) |
---|
| 117 | { |
---|
| 118 | if (!subPhysicsListCollection.ExistsItemByLabel(physicsListName)) |
---|
| 119 | { |
---|
| 120 | G4cout << "RadmonPhysicsLayout::ClearPhysicsListAttribute: Physics list \"" << physicsListName << "\" is not present." << G4endl; |
---|
| 121 | return; |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | RadmonSubPhysicsListLayout & subPhysicsList(subPhysicsListCollection.FindItemByLabel(physicsListName)); |
---|
| 125 | subPhysicsList.ClearAttribute(attributeName); |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | G4int RadmonPhysicsLayout :: GetPhysicsListNAttributes(const G4String & physicsListName) const |
---|
| 131 | { |
---|
| 132 | if (!subPhysicsListCollection.ExistsItemByLabel(physicsListName)) |
---|
| 133 | { |
---|
| 134 | G4cout << "RadmonPhysicsLayout::GetPhysicsListNAttributes: Physics list \"" << physicsListName << "\" is not present." << G4endl; |
---|
| 135 | return 0; |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | const RadmonSubPhysicsListLayout & subPhysicsList(subPhysicsListCollection.FindItemByLabel(physicsListName)); |
---|
| 139 | return subPhysicsList.GetNAttributes(); |
---|
| 140 | } |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | const G4String & RadmonPhysicsLayout :: GetPhysicsListAttributeName(const G4String & physicsListName, G4int index) const |
---|
| 145 | { |
---|
| 146 | if (!subPhysicsListCollection.ExistsItemByLabel(physicsListName)) |
---|
| 147 | { |
---|
| 148 | G4cout << "RadmonPhysicsLayout::GetPhysicsListAttributeName: Physics list \"" << physicsListName << "\" is not present." << G4endl; |
---|
| 149 | return GetNullStr(); |
---|
| 150 | } |
---|
| 151 | |
---|
| 152 | const RadmonSubPhysicsListLayout & subPhysicsList(subPhysicsListCollection.FindItemByLabel(physicsListName)); |
---|
| 153 | return subPhysicsList.GetAttributeName(index); |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | |
---|
| 157 | |
---|
| 158 | G4String RadmonPhysicsLayout :: GetPhysicsListAttribute(const G4String & physicsListName, const G4String & attributeName, const G4String & defaultAttributeValue) const |
---|
| 159 | { |
---|
| 160 | if (!subPhysicsListCollection.ExistsItemByLabel(physicsListName)) |
---|
| 161 | { |
---|
| 162 | G4cout << "RadmonPhysicsLayout::GetPhysicsListAttributeName: Physics list \"" << physicsListName << "\" is not present." << G4endl; |
---|
| 163 | return GetNullStr(); |
---|
| 164 | } |
---|
| 165 | |
---|
| 166 | const RadmonSubPhysicsListLayout & subPhysicsList(subPhysicsListCollection.FindItemByLabel(physicsListName)); |
---|
| 167 | return subPhysicsList.GetAttribute(attributeName, defaultAttributeValue); |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | |
---|
| 173 | |
---|
| 174 | void RadmonPhysicsLayout :: DumpLayout(std::ostream & out) const |
---|
| 175 | { |
---|
| 176 | out << "- Physics list\n"; |
---|
| 177 | const G4int n(subPhysicsListCollection.GetNItems()); |
---|
| 178 | |
---|
| 179 | if (n==0) |
---|
| 180 | { |
---|
| 181 | out << " - No physics list defined.\n"; |
---|
| 182 | return; |
---|
| 183 | } |
---|
| 184 | |
---|
| 185 | const G4String indent(" - "); |
---|
| 186 | |
---|
| 187 | for(G4int i(0); i<n; i++) |
---|
| 188 | { |
---|
| 189 | out << " - Physics list # " << i << '\n'; |
---|
| 190 | |
---|
| 191 | subPhysicsListCollection.GetItem(i).DumpLayout(out, indent); |
---|
| 192 | } |
---|
| 193 | } |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | |
---|
| 198 | |
---|
| 199 | G4bool RadmonPhysicsLayout :: Load(std::istream & /* in */) |
---|
| 200 | { |
---|
| 201 | // TO BE DONE |
---|
| 202 | G4cout << "RadmonPhysicsLayout::Load(): PLEASE CHECK" << G4endl; |
---|
| 203 | |
---|
| 204 | return false; |
---|
| 205 | } |
---|
| 206 | |
---|
| 207 | |
---|
| 208 | |
---|
| 209 | G4bool RadmonPhysicsLayout :: Save(std::ostream & /* out */) const |
---|
| 210 | { |
---|
| 211 | // TO BE DONE |
---|
| 212 | G4cout << "RadmonPhysicsLayout::Save(): PLEASE CHECK" << G4endl; |
---|
| 213 | |
---|
| 214 | return false; |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | |
---|
| 218 | |
---|
| 219 | |
---|
| 220 | |
---|
| 221 | inline G4String & RadmonPhysicsLayout :: GetNullStr() const |
---|
| 222 | { |
---|
| 223 | static G4String null(""); |
---|
| 224 | |
---|
| 225 | return null; |
---|
| 226 | } |
---|
| 227 | |
---|
| 228 | |
---|
| 229 | |
---|