Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CellScorerStore.cc
Go to the documentation of this file.
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// $Id$
28//
29// ----------------------------------------------------------------------
30// GEANT 4 class source file
31//
32// G4CellScorerStore.cc
33//
34// ----------------------------------------------------------------------
35
36#include "G4CellScorerStore.hh"
37
38#include "G4CellScorer.hh"
39
41 fAutoCreate(false)
42{
43 G4cout << "--------------------------------------------------------" << G4endl
44 << "WARNING: Class <G4CellScorerStore> is now obsolete |" << G4endl
45 << " and will be removed starting from next Geant4 |" << G4endl
46 << " major release. Please, consider switching to |" << G4endl
47 << " general purpose scoring functionality. |" << G4endl
48 << "--------------------------------------------------------"
49 << G4endl;
50}
51
53{}
54
56 fAutoCreate = true;
57}
58
61 G4CellScorer *cs = 0;
62 cs = new G4CellScorer;
63 if (!cs) {
64 G4Exception("G4CellScorerStore::AddCellScorer","Event0801",FatalException,
65 "failed to create G4CellScorer!");
66 }
67 fMapGeometryCellCellScorer[G4GeometryCell(vol, repnum)] = cs;
68 return cs;
69}
70
72AddCellScorer(const G4GeometryCell &gCell) {
73 G4CellScorer *cs = 0;
74 cs = new G4CellScorer;
75 if (!cs) {
76 G4Exception("G4CellScorerStore::AddCellScorer","Event0801",FatalException,
77 "failed to create G4CellScorer!");
78 }
79 fMapGeometryCellCellScorer[gCell] = cs;
80 return cs;
81}
82
84 return fMapGeometryCellCellScorer;
85}
86
88GetCellScore(const G4GeometryCell &gCell){
89 G4VCellScorer *cs=0;
90 G4MapGeometryCellCellScorer::iterator it = fMapGeometryCellCellScorer.find(gCell);
91 if (it != fMapGeometryCellCellScorer.end()) {
92 cs = (*it).second;
93 }
94 else {
95 if (fAutoCreate) {
96 cs = AddCellScorer(gCell);
97 }
98 }
99 return cs;
100}
101
103 for(G4MapGeometryCellCellScorer::iterator it =
104 fMapGeometryCellCellScorer.begin();
105 it!=fMapGeometryCellCellScorer.end();
106 ++it){
107 delete it->second;
108 }
109 fMapGeometryCellCellScorer.clear();
110}
std::map< G4GeometryCell, G4CellScorer *, G4GeometryCellComp > G4MapGeometryCellCellScorer
@ FatalException
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4CellScorer * AddCellScorer(const G4GeometryCell &gCell)
virtual G4VCellScorer * GetCellScore(const G4GeometryCell &gCell)
const G4MapGeometryCellCellScorer & GetMapGeometryCellCellScorer() const
virtual ~G4CellScorerStore()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41