source: trunk/examples/advanced/radiation_monitor/generator/src/RadmonGeneratorSourceLayout.cc @ 1321

Last change on this file since 1321 was 807, checked in by garnier, 16 years ago

update

File size: 5.7 KB
Line 
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:     RadmonGeneratorSourceLayout.cc
28// Creation date: Oct 2005
29// Main author:   Riccardo Capra <capra@ge.infn.it>
30//
31// Id:            $Id: RadmonGeneratorSourceLayout.cc,v 1.3 2006/06/29 16:16:31 gunter Exp $
32// Tag:           $Name:  $
33//
34
35// Include files
36#include "RadmonGeneratorSourceLayout.hh"
37#include "RadmonDumpStyle.hh"
38
39#include <iomanip>
40
41
42
43                                                RadmonGeneratorSourceLayout :: RadmonGeneratorSourceLayout(const RadmonGeneratorSourceLayout & copy)
44:
45 algorithmsCollection(copy.algorithmsCollection),
46 sourceLabel(copy.sourceLabel),
47 sourceIntensity(copy.sourceIntensity)
48{
49}
50
51
52
53
54
55RadmonGeneratorSourceLayout &                   RadmonGeneratorSourceLayout :: operator=(const RadmonGeneratorSourceLayout & copy)
56{
57 algorithmsCollection=copy.algorithmsCollection;
58 sourceLabel=copy.sourceLabel;
59 sourceIntensity=copy.sourceIntensity;
60 
61 return (*this);
62}
63
64
65
66
67
68RadmonGeneratorSourceAlgorithmLayout &          RadmonGeneratorSourceLayout :: AppendAlgorithm(void)
69{
70 return algorithmsCollection.AppendItem();
71}
72
73
74
75
76
77RadmonGeneratorSourceAlgorithmLayout &          RadmonGeneratorSourceLayout :: GetAlgorithm(G4int index)
78{
79 return algorithmsCollection.GetItem(index);
80}
81
82
83
84const RadmonGeneratorSourceAlgorithmLayout &    RadmonGeneratorSourceLayout :: GetAlgorithm(G4int index) const
85{
86 return algorithmsCollection.GetItem(index);
87}
88
89
90
91G4bool                                          RadmonGeneratorSourceLayout :: ExistsAlgorithmByLabel(const G4String & label) const
92{
93 return algorithmsCollection.ExistsItemByLabel(label);
94}
95
96
97
98G4int                                           RadmonGeneratorSourceLayout :: MultiplicityAlgorithmByLabel(const G4String & label) const
99{
100 return algorithmsCollection.MultiplicityItemByLabel(label);
101}
102
103
104
105RadmonGeneratorSourceAlgorithmLayout &          RadmonGeneratorSourceLayout :: FindAlgorithmByLabel(const G4String & label, G4int count)
106{
107 return algorithmsCollection.FindItemByLabel(label, count);
108}
109
110
111
112const RadmonGeneratorSourceAlgorithmLayout &    RadmonGeneratorSourceLayout :: FindAlgorithmByLabel(const G4String & label, G4int count) const
113{
114 return algorithmsCollection.FindItemByLabel(label, count);
115}
116
117
118
119
120
121void                                            RadmonGeneratorSourceLayout :: RemoveAlgorithmByLabel(const G4String & label, G4int count)
122{
123 return algorithmsCollection.RemoveItemByLabel(label, count);
124}
125
126
127
128void                                            RadmonGeneratorSourceLayout :: RemoveAlgorithmsByLabel(const G4String & label)
129{
130 return algorithmsCollection.RemoveItemsByLabel(label);
131}
132
133
134
135void                                            RadmonGeneratorSourceLayout :: RemoveAlgorithm(G4int index)
136{
137 return algorithmsCollection.RemoveItem(index);
138}
139
140
141
142void                                            RadmonGeneratorSourceLayout :: RemoveAlgorithmsByRange(G4int first, G4int last)
143{
144 return algorithmsCollection.RemoveItemsByRange(first, last);
145}
146
147
148
149void                                            RadmonGeneratorSourceLayout :: RemoveAllAlgorithms(void)
150{
151 return algorithmsCollection.RemoveAllItems();
152}
153
154
155
156
157
158void                                            RadmonGeneratorSourceLayout :: DumpLayout(std::ostream & out, const G4String & indent) const
159{
160 G4int width(RADMONDUMP_INDENT_WIDTH-indent.length());
161 if (width<0)
162  width=0;
163
164 out << indent << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Label"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = \"" << sourceLabel << "\"\n"
165     << indent << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Insensity";  out.setf(std::ostream::right, std::ostream::adjustfield); out << " = " << sourceIntensity << '\n';
166
167 G4String indent2(indent);
168 indent2.prepend("  ");
169
170 const G4int n(algorithmsCollection.GetNItems());
171
172 if (n==0)
173 {
174  out << indent2 << "No algorithms defined.\n";
175  return;
176 }
177
178 G4String indent3(indent2);
179 indent3.prepend("  ");
180
181 for(G4int i(0); i<n; i++)
182 {
183  out << indent2 << "Algorithm # " << i << '\n';
184   
185  GetAlgorithm(i).DumpLayout(out, indent3);
186 }
187}
Note: See TracBrowser for help on using the repository browser.