Geant4-11
G4ScoringRealWorld.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#include "G4ScoringRealWorld.hh"
27
28#include "G4LogicalVolume.hh"
30#include "G4VPhysicalVolume.hh"
32#include "G4Region.hh"
33
35#include "G4SDParticleFilter.hh"
36#include "G4VPrimitiveScorer.hh"
37
38#include "G4ScoringManager.hh"
39#include "G4StatDouble.hh"
40
41#include "G4SystemOfUnits.hh"
42
44 : G4VScoringMesh(lvName)
45{
47 logVolName = lvName;
48 G4double size[] = { 0., 0., 0. };
49 SetSize(size);
50 G4int nBin[] = { 1, 1, 1 };
52}
53
55
57{
58 G4cout << "G4ScoringRealWorld : " << logVolName << G4endl;
60}
61
62#include "G4AutoLock.hh"
63namespace
64{
66}
68{
71 auto itr = store->begin();
72 for(; itr != store->end(); itr++)
73 {
74 if((*itr)->GetName() == logVolName)
75 {
76 fMeshElementLogical = (*itr); // Logical volume to score
77 G4int nb = 0;
79 auto pvItr = pvStore->begin();
80 for(; pvItr != pvStore->end(); pvItr++)
81 {
82 if((*pvItr)->GetLogicalVolume() == (*itr))
83 {
84 nb += (*pvItr)->GetMultiplicity();
85 }
86 }
87 G4int nBin[] = { nb, 1, 1 };
89 // check if this logical volume belongs to the real world
90 auto region = (*itr)->GetRegion();
91 if(region && !(region->IsInMassGeometry()))
92 {
94 ed << "Logical Volume with name <" << logVolName
95 << "> is not used in the mass world.";
96 G4Exception("G4ScoringRealWorld", "SWV0001", FatalException, ed);
97 }
98 // set the sensitive detector
100 return;
101 }
102 }
104 ed << "Logical Volume with name <" << logVolName << "> is not found";
105 G4Exception("G4ScoringRealWorld", "SWV0000", FatalException, ed);
106}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:85
std::mutex G4Mutex
Definition: G4Threading.hh:81
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4LogicalVolumeStore * GetInstance()
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
static G4PhysicalVolumeStore * GetInstance()
virtual void List() const
virtual void SetupGeometry(G4VPhysicalVolume *)
G4ScoringRealWorld(G4String lvName)
virtual void List() const
G4MultiFunctionalDetector * fMFD
G4LogicalVolume * fMeshElementLogical
void SetNumberOfSegments(G4int nSegment[3])
void SetSize(G4double size[3])