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: RadmonDataAnalysisLayout.cc |
---|
28 | // Creation date: Nov 2005 |
---|
29 | // Main author: Riccardo Capra <capra@ge.infn.it> |
---|
30 | // |
---|
31 | // Id: $Id: RadmonAnalysisLayout.cc,v 1.3 2006/06/29 16:07:37 gunter Exp $ |
---|
32 | // Tag: $Name: $ |
---|
33 | // |
---|
34 | |
---|
35 | // Include files |
---|
36 | #include "RadmonAnalysisLayout.hh" |
---|
37 | #include "RadmonDumpStyle.hh" |
---|
38 | #include "G4UnitsTable.hh" |
---|
39 | |
---|
40 | #include <iomanip> |
---|
41 | |
---|
42 | |
---|
43 | RadmonAnalysisLayout :: RadmonAnalysisLayout() |
---|
44 | { |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | RadmonAnalysisLayout :: ~RadmonAnalysisLayout() |
---|
50 | { |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | void RadmonAnalysisLayout :: SetOutputFileName(const G4String & outputFileName) |
---|
58 | { |
---|
59 | if (fileName==outputFileName) |
---|
60 | return; |
---|
61 | |
---|
62 | fileName=outputFileName; |
---|
63 | NotifyChange(); |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | const G4String & RadmonAnalysisLayout :: GetOutputFileName(void) const |
---|
69 | { |
---|
70 | return fileName; |
---|
71 | } |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | void RadmonAnalysisLayout :: SetOutputFileFormat(const G4String & outputFileFormat) |
---|
76 | { |
---|
77 | if (fileFormat==outputFileFormat) |
---|
78 | return; |
---|
79 | |
---|
80 | fileFormat=outputFileFormat; |
---|
81 | NotifyChange(); |
---|
82 | } |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | const G4String & RadmonAnalysisLayout :: GetOutputFileFormat(void) const |
---|
87 | { |
---|
88 | return fileFormat; |
---|
89 | } |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | |
---|
95 | void RadmonAnalysisLayout :: CreateSensitiveDetector(const G4String & sensitiveDetectorLabel, const G4String & sensitiveDetectorType) |
---|
96 | { |
---|
97 | if (ExistsSensitiveDetector(sensitiveDetectorLabel)) |
---|
98 | return; |
---|
99 | |
---|
100 | if (!FindSensitiveDetectorType(sensitiveDetectorType)) |
---|
101 | return; |
---|
102 | |
---|
103 | sensitiveDetectors.push_back(SensitiveDetector(sensitiveDetectorLabel, sensitiveDetectorType)); |
---|
104 | NotifyChange(); |
---|
105 | } |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | void RadmonAnalysisLayout :: SetSensitiveDetectorType(const G4String & sensitiveDetectorLabel, const G4String & sensitiveDetectorType) |
---|
110 | { |
---|
111 | SensitiveDetector * sensitiveDetector(FindSensitiveDetector(sensitiveDetectorLabel)); |
---|
112 | |
---|
113 | if (!sensitiveDetector) |
---|
114 | return; |
---|
115 | |
---|
116 | if (sensitiveDetectorType==sensitiveDetector->second) |
---|
117 | return; |
---|
118 | |
---|
119 | if (!FindSensitiveDetectorType(sensitiveDetectorType)) |
---|
120 | return; |
---|
121 | |
---|
122 | sensitiveDetector->second=sensitiveDetectorType; |
---|
123 | NotifyChange(); |
---|
124 | } |
---|
125 | |
---|
126 | |
---|
127 | |
---|
128 | const G4String & RadmonAnalysisLayout :: GetSensitiveDetectorType(const G4String & sensitiveDetectorLabel) const |
---|
129 | { |
---|
130 | const SensitiveDetector * sensitiveDetector(FindSensitiveDetector(sensitiveDetectorLabel)); |
---|
131 | |
---|
132 | if (!sensitiveDetector) |
---|
133 | return GetNullStr(); |
---|
134 | |
---|
135 | return sensitiveDetector->second; |
---|
136 | } |
---|
137 | |
---|
138 | |
---|
139 | |
---|
140 | void RadmonAnalysisLayout :: RemoveSensitiveDetector(const G4String & sensitiveDetectorLabel) |
---|
141 | { |
---|
142 | SensitiveDetectors::iterator i(sensitiveDetectors.begin()); |
---|
143 | const SensitiveDetectors::iterator end(sensitiveDetectors.end()); |
---|
144 | |
---|
145 | while (i<end) |
---|
146 | { |
---|
147 | if (i->first==sensitiveDetectorLabel) |
---|
148 | { |
---|
149 | sensitiveDetectors.erase(i); |
---|
150 | return; |
---|
151 | } |
---|
152 | |
---|
153 | i++; |
---|
154 | } |
---|
155 | |
---|
156 | G4cout << "RadmonAnalysisLayout::RemoveSensitiveDetector: Sensitive detector \"" << sensitiveDetectorLabel << "\" does not exist." << G4endl; |
---|
157 | } |
---|
158 | |
---|
159 | |
---|
160 | |
---|
161 | G4int RadmonAnalysisLayout :: GetNSensitiveDetectors(void) const |
---|
162 | { |
---|
163 | return sensitiveDetectors.size(); |
---|
164 | } |
---|
165 | |
---|
166 | |
---|
167 | |
---|
168 | const G4String & RadmonAnalysisLayout :: GetSensitiveDetectorLabel(G4int index) const |
---|
169 | { |
---|
170 | return sensitiveDetectors[index].first; |
---|
171 | } |
---|
172 | |
---|
173 | |
---|
174 | |
---|
175 | |
---|
176 | |
---|
177 | void RadmonAnalysisLayout :: CreateSensitiveDetectorType(const G4String & sensitiveDetectorTypeLabel) |
---|
178 | { |
---|
179 | if (sensitiveDetectorTypes.ExistsItemByLabel(sensitiveDetectorTypeLabel)) |
---|
180 | { |
---|
181 | G4cout << "RadmonAnalysisLayout::CreateSensitiveDetectorType: Sensitive detector \"" << sensitiveDetectorTypeLabel << "\" just exists." << G4endl; |
---|
182 | return; |
---|
183 | } |
---|
184 | |
---|
185 | RadmonAnalysisSensitiveDetectorTypeLayout & sensitiveDetectorType(sensitiveDetectorTypes.AppendItem()); |
---|
186 | sensitiveDetectorType.SetLabel(sensitiveDetectorTypeLabel); |
---|
187 | } |
---|
188 | |
---|
189 | |
---|
190 | |
---|
191 | void RadmonAnalysisLayout :: RemoveSensitiveDetectorType(const G4String & sensitiveDetectorTypeLabel) |
---|
192 | { |
---|
193 | if (!sensitiveDetectorTypes.ExistsItemByLabel(sensitiveDetectorTypeLabel)) |
---|
194 | { |
---|
195 | G4cout << "RadmonAnalysisLayout::RemoveSensitiveDetectorType: Sensitive detector \"" << sensitiveDetectorTypeLabel << "\" does not exist." << G4endl; |
---|
196 | return; |
---|
197 | } |
---|
198 | |
---|
199 | if (SensitiveDetectorTypeInUse(sensitiveDetectorTypeLabel)) |
---|
200 | { |
---|
201 | G4cout << "RadmonAnalysisLayout::RemoveSensitiveDetectorType: Sensitive detector \"" << sensitiveDetectorTypeLabel << "\" is in use. Cannot be removed." << G4endl; |
---|
202 | return; |
---|
203 | } |
---|
204 | |
---|
205 | sensitiveDetectorTypes.RemoveItemByLabel(sensitiveDetectorTypeLabel); |
---|
206 | } |
---|
207 | |
---|
208 | |
---|
209 | |
---|
210 | |
---|
211 | |
---|
212 | void RadmonAnalysisLayout :: AppendDataAnalysisToSensitiveDetectorType(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel) |
---|
213 | { |
---|
214 | RadmonAnalysisSensitiveDetectorTypeLayout * sensitiveDetectorType(FindSensitiveDetectorType(sensitiveDetectorTypeLabel)); |
---|
215 | |
---|
216 | if (! sensitiveDetectorType) |
---|
217 | return; |
---|
218 | |
---|
219 | if (sensitiveDetectorType->ExistsDataAnalysisByLabel(dataAnalysisLabel)) |
---|
220 | { |
---|
221 | G4cout << "RadmonAnalysisLayout::AppendDataAnalysisToSensitiveDetectorType: Data analysis label \"" << dataAnalysisLabel << "\" just exits in sensitive detector \"" << sensitiveDetectorTypeLabel << "\"." << G4endl; |
---|
222 | return; |
---|
223 | } |
---|
224 | |
---|
225 | RadmonDataAnalysisLayout & dataAnalysisLayout(sensitiveDetectorType->AppendDataAnalysis()); |
---|
226 | dataAnalysisLayout.SetLabel(dataAnalysisLabel); |
---|
227 | |
---|
228 | if (SensitiveDetectorTypeInUse(sensitiveDetectorTypeLabel)) |
---|
229 | NotifyChange(); |
---|
230 | } |
---|
231 | |
---|
232 | |
---|
233 | |
---|
234 | void RadmonAnalysisLayout :: SetDataAnalysisType(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel, const G4String & dataAnalysisType) |
---|
235 | { |
---|
236 | RadmonDataAnalysisLayout * dataAnalysis(FindDataAnalysis(sensitiveDetectorTypeLabel, dataAnalysisLabel)); |
---|
237 | |
---|
238 | if (!dataAnalysis) |
---|
239 | return; |
---|
240 | |
---|
241 | if (dataAnalysis->GetType()==dataAnalysisType) |
---|
242 | return; |
---|
243 | |
---|
244 | dataAnalysis->SetType(dataAnalysisType); |
---|
245 | |
---|
246 | if (SensitiveDetectorTypeInUse(sensitiveDetectorTypeLabel)) |
---|
247 | NotifyChange(); |
---|
248 | } |
---|
249 | |
---|
250 | |
---|
251 | |
---|
252 | void RadmonAnalysisLayout :: RemoveDataAnalysis(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel) |
---|
253 | { |
---|
254 | RadmonAnalysisSensitiveDetectorTypeLayout * sensitiveDetectorType(FindSensitiveDetectorType(sensitiveDetectorTypeLabel)); |
---|
255 | |
---|
256 | if (! sensitiveDetectorType) |
---|
257 | return; |
---|
258 | |
---|
259 | if (!sensitiveDetectorType->ExistsDataAnalysisByLabel(dataAnalysisLabel)) |
---|
260 | { |
---|
261 | G4cout << "RadmonAnalysisLayout::RemoveDataAnalysis: Data analysis label \"" << dataAnalysisLabel << "\" does not exit in sensitive detector \"" << sensitiveDetectorTypeLabel << "\"." << G4endl; |
---|
262 | return; |
---|
263 | } |
---|
264 | |
---|
265 | sensitiveDetectorType->RemoveDataAnalysisByLabel(dataAnalysisLabel); |
---|
266 | |
---|
267 | if (SensitiveDetectorTypeInUse(sensitiveDetectorTypeLabel)) |
---|
268 | NotifyChange(); |
---|
269 | } |
---|
270 | |
---|
271 | |
---|
272 | |
---|
273 | G4int RadmonAnalysisLayout :: GetNDataAnalyses(const G4String & sensitiveDetectorTypeLabel) const |
---|
274 | { |
---|
275 | const RadmonAnalysisSensitiveDetectorTypeLayout * sensitiveDetectorType(FindSensitiveDetectorType(sensitiveDetectorTypeLabel)); |
---|
276 | |
---|
277 | if (! sensitiveDetectorType) |
---|
278 | return 0; |
---|
279 | |
---|
280 | return sensitiveDetectorType->GetNDataAnalyses(); |
---|
281 | } |
---|
282 | |
---|
283 | |
---|
284 | |
---|
285 | const G4String & RadmonAnalysisLayout :: GetDataAnalysisLabel(const G4String & sensitiveDetectorTypeLabel, G4int index) const |
---|
286 | { |
---|
287 | const RadmonAnalysisSensitiveDetectorTypeLayout * sensitiveDetectorType(FindSensitiveDetectorType(sensitiveDetectorTypeLabel)); |
---|
288 | |
---|
289 | if (! sensitiveDetectorType) |
---|
290 | return GetNullStr(); |
---|
291 | |
---|
292 | return sensitiveDetectorType->GetDataAnalysis(index).GetLabel(); |
---|
293 | } |
---|
294 | |
---|
295 | |
---|
296 | |
---|
297 | const G4String & RadmonAnalysisLayout :: GetDataAnalysisType(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel) const |
---|
298 | { |
---|
299 | const RadmonDataAnalysisLayout * dataAnalysisType(FindDataAnalysis(sensitiveDetectorTypeLabel, dataAnalysisLabel)); |
---|
300 | |
---|
301 | if (!dataAnalysisType) |
---|
302 | return GetNullStr(); |
---|
303 | |
---|
304 | return dataAnalysisType->GetType(); |
---|
305 | } |
---|
306 | |
---|
307 | |
---|
308 | |
---|
309 | |
---|
310 | |
---|
311 | void RadmonAnalysisLayout :: SetDataAnalysisAttribute(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel, const G4String & attributeName, const G4String & attributeValue) |
---|
312 | { |
---|
313 | RadmonDataAnalysisLayout * dataAnalysisType(FindDataAnalysis(sensitiveDetectorTypeLabel, dataAnalysisLabel)); |
---|
314 | |
---|
315 | if (!dataAnalysisType) |
---|
316 | return; |
---|
317 | |
---|
318 | dataAnalysisType->SetAttribute(attributeName, attributeValue); |
---|
319 | |
---|
320 | if (SensitiveDetectorTypeInUse(sensitiveDetectorTypeLabel)) |
---|
321 | NotifyChange(); |
---|
322 | } |
---|
323 | |
---|
324 | |
---|
325 | |
---|
326 | void RadmonAnalysisLayout :: ClearDataAnalysisAttribute(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel, const G4String & attributeName) |
---|
327 | { |
---|
328 | RadmonDataAnalysisLayout * dataAnalysisType(FindDataAnalysis(sensitiveDetectorTypeLabel, dataAnalysisLabel)); |
---|
329 | |
---|
330 | if (!dataAnalysisType) |
---|
331 | return; |
---|
332 | |
---|
333 | if (!dataAnalysisType->ExistsAttribute(attributeName)) |
---|
334 | { |
---|
335 | G4cout << "RadmonAnalysisLayout::ClearDataAnalysisAttribute: Attribute \"" << attributeName << "\" does not exist in data analysis \"" << dataAnalysisLabel << "\" of sensitive detector \"" << sensitiveDetectorTypeLabel << "\"." << G4endl; |
---|
336 | return; |
---|
337 | } |
---|
338 | |
---|
339 | dataAnalysisType->ClearAttribute(attributeName); |
---|
340 | |
---|
341 | if (SensitiveDetectorTypeInUse(sensitiveDetectorTypeLabel)) |
---|
342 | NotifyChange(); |
---|
343 | } |
---|
344 | |
---|
345 | |
---|
346 | |
---|
347 | G4int RadmonAnalysisLayout :: GetDataAnalysisNAttributes(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel) const |
---|
348 | { |
---|
349 | const RadmonDataAnalysisLayout * dataAnalysisType(FindDataAnalysis(sensitiveDetectorTypeLabel, dataAnalysisLabel)); |
---|
350 | |
---|
351 | if (!dataAnalysisType) |
---|
352 | return 0; |
---|
353 | |
---|
354 | return dataAnalysisType->GetNAttributes(); |
---|
355 | } |
---|
356 | |
---|
357 | |
---|
358 | |
---|
359 | G4String RadmonAnalysisLayout :: GetDataAnalysisAttributeName(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel, G4int index) const |
---|
360 | { |
---|
361 | const RadmonDataAnalysisLayout * dataAnalysisType(FindDataAnalysis(sensitiveDetectorTypeLabel, dataAnalysisLabel)); |
---|
362 | |
---|
363 | if (!dataAnalysisType) |
---|
364 | return GetNullStr(); |
---|
365 | |
---|
366 | return dataAnalysisType->GetAttributeName(index); |
---|
367 | } |
---|
368 | |
---|
369 | |
---|
370 | |
---|
371 | G4String RadmonAnalysisLayout :: GetDataAnalysisAttribute(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel, const G4String & attributeName, const G4String & defaultAttributeValue) const |
---|
372 | { |
---|
373 | const RadmonDataAnalysisLayout * dataAnalysisType(FindDataAnalysis(sensitiveDetectorTypeLabel, dataAnalysisLabel)); |
---|
374 | |
---|
375 | if (!dataAnalysisType) |
---|
376 | return G4String(); |
---|
377 | |
---|
378 | return dataAnalysisType->GetAttribute(attributeName, defaultAttributeValue); |
---|
379 | } |
---|
380 | |
---|
381 | |
---|
382 | |
---|
383 | |
---|
384 | |
---|
385 | void RadmonAnalysisLayout :: DumpLayout(std::ostream & out) const |
---|
386 | { |
---|
387 | const G4String indent(" - "); |
---|
388 | |
---|
389 | out << "- " << std::setw(RADMONDUMP_INDENT_WIDTH-2); out.setf(std::ostream::left, std::ostream::adjustfield); out << "File name"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = \"" << fileName << "\"\n" |
---|
390 | " " << std::setw(RADMONDUMP_INDENT_WIDTH-2); out.setf(std::ostream::left, std::ostream::adjustfield); out << "File format"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = \"" << fileFormat << "\"\n" |
---|
391 | "\n- Sensitive detectors\n"; |
---|
392 | |
---|
393 | G4String indent2(indent); |
---|
394 | indent2.prepend(" "); |
---|
395 | |
---|
396 | if (sensitiveDetectors.empty()) |
---|
397 | out << indent << "No sensitive detectors defined.\n"; |
---|
398 | else |
---|
399 | { |
---|
400 | const G4int width(RADMONDUMP_INDENT_WIDTH-indent2.length()); |
---|
401 | const G4int n(sensitiveDetectors.size()); |
---|
402 | |
---|
403 | for (G4int i(0); i<n; i++) |
---|
404 | { |
---|
405 | out << indent << "Sensitive Detector # " << i << '\n' |
---|
406 | << indent2 << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Label"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = \"" << sensitiveDetectors[i].first << "\"\n" |
---|
407 | << indent2 << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Type"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = \"" << sensitiveDetectors[i].second << "\"\n"; |
---|
408 | } |
---|
409 | } |
---|
410 | |
---|
411 | out << "\n- Sensitive detector types\n"; |
---|
412 | G4int n(sensitiveDetectorTypes.GetNItems()); |
---|
413 | if (n==0) |
---|
414 | { |
---|
415 | out << indent << "No sensitive detector types defined.\n"; |
---|
416 | return; |
---|
417 | } |
---|
418 | |
---|
419 | for(G4int i(0); i<n; i++) |
---|
420 | { |
---|
421 | out << indent << "Sensitive detector type # " << i << '\n'; |
---|
422 | |
---|
423 | sensitiveDetectorTypes.GetItem(i).DumpLayout(out, indent2); |
---|
424 | } |
---|
425 | } |
---|
426 | |
---|
427 | |
---|
428 | |
---|
429 | |
---|
430 | |
---|
431 | G4bool RadmonAnalysisLayout :: Load(std::istream & /* in */) |
---|
432 | { |
---|
433 | // TO BE DONE |
---|
434 | G4cout << "RadmonAnalysisLayout::Load(): PLEASE CHECK" << G4endl; |
---|
435 | |
---|
436 | return false; |
---|
437 | } |
---|
438 | |
---|
439 | |
---|
440 | |
---|
441 | G4bool RadmonAnalysisLayout :: Save(std::ostream & /* out */) const |
---|
442 | { |
---|
443 | // TO BE DONE |
---|
444 | G4cout << "RadmonAnalysisLayout::Save(): PLEASE CHECK" << G4endl; |
---|
445 | |
---|
446 | return false; |
---|
447 | } |
---|
448 | |
---|
449 | |
---|
450 | |
---|
451 | |
---|
452 | |
---|
453 | inline G4bool RadmonAnalysisLayout :: SensitiveDetectorTypeInUse(const G4String & sensitiveDetectorType) |
---|
454 | { |
---|
455 | G4int i(0); |
---|
456 | G4int n(sensitiveDetectors.size()); |
---|
457 | |
---|
458 | for (; i<n; i++) |
---|
459 | if (sensitiveDetectors[i].second==sensitiveDetectorType) |
---|
460 | return true; |
---|
461 | |
---|
462 | return false; |
---|
463 | } |
---|
464 | |
---|
465 | |
---|
466 | |
---|
467 | inline G4bool RadmonAnalysisLayout :: ExistsSensitiveDetector(const G4String & sensitiveDetectorLabel) const |
---|
468 | { |
---|
469 | G4int i(0); |
---|
470 | G4int n(sensitiveDetectors.size()); |
---|
471 | |
---|
472 | for (; i<n; i++) |
---|
473 | if (sensitiveDetectors[i].first==sensitiveDetectorLabel) |
---|
474 | { |
---|
475 | G4cout << "RadmonAnalysisLayout::ExistsSensitiveDetector: Sensitive detector \"" << sensitiveDetectorLabel << "\" just exists." << G4endl; |
---|
476 | return true; |
---|
477 | } |
---|
478 | |
---|
479 | return false; |
---|
480 | } |
---|
481 | |
---|
482 | |
---|
483 | |
---|
484 | inline RadmonAnalysisLayout::SensitiveDetector * RadmonAnalysisLayout :: FindSensitiveDetector(const G4String & sensitiveDetectorLabel) |
---|
485 | { |
---|
486 | G4int i(0); |
---|
487 | G4int n(sensitiveDetectors.size()); |
---|
488 | |
---|
489 | for (; i<n; i++) |
---|
490 | if (sensitiveDetectors[i].first==sensitiveDetectorLabel) |
---|
491 | return &(sensitiveDetectors[i]); |
---|
492 | |
---|
493 | G4cout << "RadmonAnalysisLayout::FindSensitiveDetector: Sensitive detector \"" << sensitiveDetectorLabel << "\" does not exist." << G4endl; |
---|
494 | return 0; |
---|
495 | } |
---|
496 | |
---|
497 | |
---|
498 | |
---|
499 | inline const RadmonAnalysisLayout::SensitiveDetector * RadmonAnalysisLayout :: FindSensitiveDetector(const G4String & sensitiveDetectorLabel) const |
---|
500 | { |
---|
501 | return const_cast<RadmonAnalysisLayout *>(this)->FindSensitiveDetector(sensitiveDetectorLabel); |
---|
502 | } |
---|
503 | |
---|
504 | |
---|
505 | |
---|
506 | inline RadmonAnalysisSensitiveDetectorTypeLayout * RadmonAnalysisLayout :: FindSensitiveDetectorType(const G4String & sensitiveDetectorTypeLabel) |
---|
507 | { |
---|
508 | if (!sensitiveDetectorTypes.ExistsItemByLabel(sensitiveDetectorTypeLabel)) |
---|
509 | { |
---|
510 | G4cout << "RadmonAnalysisLayout::FindSensitiveDetectorType: Sensitive detector type \"" << sensitiveDetectorTypeLabel << "\" does not exist." << G4endl; |
---|
511 | return 0; |
---|
512 | } |
---|
513 | |
---|
514 | return & sensitiveDetectorTypes.FindItemByLabel(sensitiveDetectorTypeLabel); |
---|
515 | } |
---|
516 | |
---|
517 | |
---|
518 | |
---|
519 | inline const RadmonAnalysisSensitiveDetectorTypeLayout * RadmonAnalysisLayout :: FindSensitiveDetectorType(const G4String & sensitiveDetectorTypeLabel) const |
---|
520 | { |
---|
521 | return const_cast<RadmonAnalysisLayout *>(this)->FindSensitiveDetectorType(sensitiveDetectorTypeLabel); |
---|
522 | } |
---|
523 | |
---|
524 | |
---|
525 | |
---|
526 | inline RadmonDataAnalysisLayout * RadmonAnalysisLayout :: FindDataAnalysis(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel) |
---|
527 | { |
---|
528 | RadmonAnalysisSensitiveDetectorTypeLayout * sensitiveDetectorType(FindSensitiveDetectorType(sensitiveDetectorTypeLabel)); |
---|
529 | |
---|
530 | if (sensitiveDetectorType==0) |
---|
531 | return 0; |
---|
532 | |
---|
533 | if (!sensitiveDetectorType->ExistsDataAnalysisByLabel(dataAnalysisLabel)) |
---|
534 | { |
---|
535 | G4cout << "RadmonAnalysisLayout::FindDataAnalysis: Data analysis labelled \"" << dataAnalysisLabel << "\" does not exist in sensitive detector type \"" << sensitiveDetectorTypeLabel << "\"." << G4endl; |
---|
536 | return 0; |
---|
537 | } |
---|
538 | |
---|
539 | return & sensitiveDetectorType->FindDataAnalysisByLabel(dataAnalysisLabel); |
---|
540 | } |
---|
541 | |
---|
542 | |
---|
543 | |
---|
544 | inline const RadmonDataAnalysisLayout * RadmonAnalysisLayout :: FindDataAnalysis(const G4String & sensitiveDetectorTypeLabel, const G4String & dataAnalysisLabel) const |
---|
545 | { |
---|
546 | return const_cast<RadmonAnalysisLayout *>(this)->FindDataAnalysis(sensitiveDetectorTypeLabel, dataAnalysisLabel); |
---|
547 | } |
---|
548 | |
---|
549 | |
---|
550 | |
---|
551 | |
---|
552 | |
---|
553 | inline G4String & RadmonAnalysisLayout :: GetNullStr() const |
---|
554 | { |
---|
555 | static G4String *nullStr(0); |
---|
556 | |
---|
557 | if (nullStr==0) |
---|
558 | nullStr=new G4String(""); |
---|
559 | |
---|
560 | return *nullStr; |
---|
561 | } |
---|