[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: RadmonDetectorMultilayerLayout.cc |
---|
| 28 | // Creation date: Sep 2005 |
---|
| 29 | // Main author: Riccardo Capra <capra@ge.infn.it> |
---|
| 30 | // |
---|
| 31 | // Id: $Id: RadmonDetectorMultilayerLayout.cc,v 1.6.2.2 2006/06/29 16:14:03 gunter Exp $ |
---|
| 32 | // Tag: $Name: geant4-09-01-patch-02 $ |
---|
| 33 | // |
---|
| 34 | |
---|
| 35 | // Include files |
---|
| 36 | #include "RadmonDetectorMultilayerLayout.hh" |
---|
| 37 | #include "RadmonDumpStyle.hh" |
---|
| 38 | #include "G4UnitsTable.hh" |
---|
| 39 | |
---|
| 40 | #include <iomanip> |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | RadmonDetectorMultilayerLayout :: RadmonDetectorMultilayerLayout(const RadmonDetectorMultilayerLayout & copy) |
---|
| 45 | : |
---|
| 46 | multilayerLabel(copy.multilayerLabel), |
---|
| 47 | multilayerWidth(copy.multilayerWidth), |
---|
| 48 | multilayerHeight(copy.multilayerHeight), |
---|
| 49 | multilayerLayersCollection(copy.multilayerLayersCollection) |
---|
| 50 | { |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | RadmonDetectorMultilayerLayout & RadmonDetectorMultilayerLayout :: operator=(const RadmonDetectorMultilayerLayout & copy) |
---|
| 58 | { |
---|
| 59 | multilayerLabel=copy.multilayerLabel; |
---|
| 60 | multilayerWidth=copy.multilayerWidth; |
---|
| 61 | multilayerHeight=copy.multilayerHeight; |
---|
| 62 | multilayerLayersCollection=copy.multilayerLayersCollection; |
---|
| 63 | |
---|
| 64 | return (*this); |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | G4double RadmonDetectorMultilayerLayout :: GetTotalThickness(void) const |
---|
| 72 | { |
---|
| 73 | G4int i(multilayerLayersCollection.GetNItems()); |
---|
| 74 | G4double thickness(0); |
---|
| 75 | |
---|
| 76 | while (i>0) |
---|
| 77 | { |
---|
| 78 | i--; |
---|
| 79 | thickness+=GetLayer(i).GetThickness(); |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | return thickness; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | G4int RadmonDetectorMultilayerLayout :: GetNLayers(void) const |
---|
| 90 | { |
---|
| 91 | return multilayerLayersCollection.GetNItems(); |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | G4bool RadmonDetectorMultilayerLayout :: Empty(void) const |
---|
| 97 | { |
---|
| 98 | return multilayerLayersCollection.Empty(); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | const RadmonDetectorLayerLayout & RadmonDetectorMultilayerLayout :: GetLayer(G4int index) const |
---|
| 106 | { |
---|
| 107 | return multilayerLayersCollection.GetItem(index); |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | RadmonDetectorLayerLayout & RadmonDetectorMultilayerLayout :: GetLayer(G4int index) |
---|
| 113 | { |
---|
| 114 | return multilayerLayersCollection.GetItem(index); |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | G4bool RadmonDetectorMultilayerLayout :: ExistsLayerByLabel(const G4String & layerLabel) const |
---|
| 122 | { |
---|
| 123 | return multilayerLayersCollection.ExistsItemByLabel(layerLabel); |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | G4int RadmonDetectorMultilayerLayout :: MultiplicityLayerByLabel(const G4String & layerLabel) const |
---|
| 129 | { |
---|
| 130 | return multilayerLayersCollection.MultiplicityItemByLabel(layerLabel); |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | const RadmonDetectorLayerLayout & RadmonDetectorMultilayerLayout :: FindLayerByLabel(const G4String & layerLabel, G4int count) const |
---|
| 138 | { |
---|
| 139 | return multilayerLayersCollection.FindItemByLabel(layerLabel, count); |
---|
| 140 | } |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | RadmonDetectorLayerLayout & RadmonDetectorMultilayerLayout :: FindLayerByLabel(const G4String & layerLabel, G4int count) |
---|
| 145 | { |
---|
| 146 | return multilayerLayersCollection.FindItemByLabel(layerLabel, count); |
---|
| 147 | } |
---|
| 148 | |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | |
---|
| 153 | RadmonDetectorLayerLayout & RadmonDetectorMultilayerLayout :: AppendLayer(void) |
---|
| 154 | { |
---|
| 155 | return multilayerLayersCollection.AppendItem(); |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | |
---|
| 160 | RadmonDetectorLayerLayout & RadmonDetectorMultilayerLayout :: PrependLayer(void) |
---|
| 161 | { |
---|
| 162 | return multilayerLayersCollection.PrependItem(); |
---|
| 163 | } |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | void RadmonDetectorMultilayerLayout :: RemoveLayerByLabel(const G4String & layerLabel, G4int count) |
---|
| 170 | { |
---|
| 171 | multilayerLayersCollection.RemoveItemByLabel(layerLabel, count); |
---|
| 172 | } |
---|
| 173 | |
---|
| 174 | |
---|
| 175 | |
---|
| 176 | void RadmonDetectorMultilayerLayout :: RemoveLayersByLabel(const G4String & layerLabel) |
---|
| 177 | { |
---|
| 178 | multilayerLayersCollection.RemoveItemsByLabel(layerLabel); |
---|
| 179 | } |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | |
---|
| 183 | void RadmonDetectorMultilayerLayout :: RemoveLayer(G4int index) |
---|
| 184 | { |
---|
| 185 | multilayerLayersCollection.RemoveItem(index); |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | |
---|
| 189 | |
---|
| 190 | void RadmonDetectorMultilayerLayout :: RemoveLayersByRange(G4int first, G4int last) |
---|
| 191 | { |
---|
| 192 | multilayerLayersCollection.RemoveItemsByRange(first, last); |
---|
| 193 | } |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | void RadmonDetectorMultilayerLayout :: RemoveAllLayers(void) |
---|
| 198 | { |
---|
| 199 | multilayerLayersCollection.RemoveAllItems(); |
---|
| 200 | } |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | |
---|
| 206 | void RadmonDetectorMultilayerLayout :: DumpLayout(std::ostream & out, const G4String & indent) const |
---|
| 207 | { |
---|
| 208 | G4int width(RADMONDUMP_INDENT_WIDTH-indent.length()); |
---|
| 209 | if (width<0) |
---|
| 210 | width=0; |
---|
| 211 | |
---|
| 212 | out << indent << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Label"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = \"" << multilayerLabel << "\"\n" |
---|
| 213 | << indent << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Size"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = (W) " << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << G4BestUnit(multilayerWidth, "Length") |
---|
| 214 | << " x (H) " << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << G4BestUnit(multilayerHeight, "Length") |
---|
| 215 | << " x (T) " << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << G4BestUnit(GetTotalThickness(), "Length") << '\n'; |
---|
| 216 | |
---|
| 217 | G4String indent2(indent); |
---|
| 218 | indent2.prepend(" "); |
---|
| 219 | |
---|
| 220 | const G4int n(multilayerLayersCollection.GetNItems()); |
---|
| 221 | |
---|
| 222 | if (n==0) |
---|
| 223 | { |
---|
| 224 | out << indent2 << "No layers defined.\n"; |
---|
| 225 | return; |
---|
| 226 | } |
---|
| 227 | |
---|
| 228 | G4String indent3(indent2); |
---|
| 229 | indent3.prepend(" "); |
---|
| 230 | |
---|
| 231 | for(G4int i(0); i<n; i++) |
---|
| 232 | { |
---|
| 233 | out << indent2 << "Layer # " << i << '\n'; |
---|
| 234 | |
---|
| 235 | GetLayer(i).DumpLayout(out, indent3); |
---|
| 236 | } |
---|
| 237 | } |
---|