Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
+27 -1
View File
@@ -1,4 +1,4 @@
$Id: History 96535 2016-04-20 12:14:15Z gcosmo $
$Id: History 101678 2016-11-21 09:28:32Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,32 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov 15, 2016, A.Dotti (digits_hits-V10-02-09,-10)
- Fix bug #1908, remove implicit addition to manager of
SD passed via G4MultiSD proxy
Sep 8, 2016, G.Cosmo (digits_hits-V10-02-08)
- G4THitsMap, G4VScoringMesh : further clean up with C++11 template
Sep 7, 2016, G.Cosmo (digits_hits-V10-02-07)
- Fixed utils/GNUmakefile for missing dependency on global/HEPNumerics,
now required.
Sep 6, 2016, M.Asai (digits_hits-V10-02-06)
- Further refinements.
Sep 2, 2016, M.Asai (digits_hits-V10-02-05)
- Built-in scorer now uses G4StatDouble.
Files modified :
utils/include/G4ScoringBox.hh
utils/include/G4ScoringCylinder.hh
utils/include/G4VScoringMesh.hh
utils/sources.cmake
utils/src/G4ScoringBox.cc
utils/src/G4ScoringCylinder.cc
utils/src/G4VScoreWriter.cc
utils/src/G4VScoringMesh.cc
Apr 20, 2016, G.Cosmo (digits_hits-V10-02-04)
- Fixed shadowing compilation warnings in G4VScoringMesh for 'ps'.
@@ -77,7 +77,7 @@ public:
sdsConstIter GetBegin() const { return fSensitiveDetectors.begin(); }
sdsConstIter GetEnd() const { return fSensitiveDetectors.end(); }
void ClearSDs() { fSensitiveDetectors.clear(); }
void AddSD( G4VSensitiveDetector* sd);
void AddSD( G4VSensitiveDetector* sd) { fSensitiveDetectors.push_back(sd); }
private:
sds_t fSensitiveDetectors;
};
@@ -133,10 +133,3 @@ G4VSensitiveDetector* G4MultiSensitiveDetector::Clone() const
newInst->AddSD( sd->Clone() );
return newInst;
}
void G4MultiSensitiveDetector::AddSD(G4VSensitiveDetector* sd)
{
// making sure this sensitive detector is registered to G4SDManager
G4SDManager::GetSDMpointer()->AddNewDetector(sd);
fSensitiveDetectors.push_back(sd);
}
+132 -74
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4THitsMap.hh 67992 2013-03-13 10:59:57Z gcosmo $
// $Id: G4THitsMap.hh 99262 2016-09-09 13:18:19Z gcosmo $
//
#ifndef G4THitsMap_h
#define G4THitsMap_h 1
@@ -33,6 +33,8 @@
#include "globals.hh"
#include <map>
class G4StatDouble;
// class description:
//
// This is a template class of hits map and parametrized by
@@ -53,7 +55,36 @@ template <typename T> class G4THitsMap : public G4HitsCollection
public:
virtual ~G4THitsMap();
G4int operator==(const G4THitsMap<T> &right) const;
G4THitsMap<T> & operator+=(const G4THitsMap<T> &right) const;
public: // with description
// Operator += between same kind of classes
template <typename U = T,
typename std::enable_if<std::is_same<U,T>::value,int>::type=0>
G4THitsMap<T> & operator+=(const G4THitsMap<T> &right) const
{
std::map<G4int,T*> * aHitsMap = right.GetMap();
typename std::map<G4int,T*>::iterator itr = aHitsMap->begin();
for(; itr != aHitsMap->end(); itr++) {
add(itr->first, *(itr->second));
}
return (G4THitsMap<T>&)(*this);
}
// Operator for G4THitsMap<G4StatDouble> += G4THitsMap<G4double>
template <typename U = T,
typename std::enable_if<std::is_same<U,G4double>::value &&
std::is_same<T,G4StatDouble>::value,int>::type=0>
G4THitsMap<T> & operator+=(const G4THitsMap<U> &right) const
{
std::map<G4int,U*> * aHitsMap = right.GetMap();
typename std::map<G4int,U*>::iterator itr = aHitsMap->begin();
for(; itr != aHitsMap->end(); itr++) {
typename std::map<G4int,T*>::iterator mapItr = this->GetMap()->find(itr->first);
if(mapItr==this->GetMap()->end())
{ (*this->GetMap())[itr->first] = new T(0.); }
add(itr->first, *(itr->second));
}
return (G4THitsMap<T>&)(*this);
}
public: // with description
virtual void DrawAllHits();
@@ -62,23 +93,114 @@ template <typename T> class G4THitsMap : public G4HitsCollection
// hit objects stored in this map, respectively.
public: // with description
inline T* operator[](G4int key) const;
// Returns a pointer to a concrete hit object.
inline T* operator[](G4int key) const;
// Returns a collection map.
inline std::map<G4int,T*>* GetMap() const
{ return (std::map<G4int,T*>*)theCollection; }
// Returns a collection map.
inline G4int add(const G4int & key, T * &aHit) const;
inline G4int add(const G4int & key, T &aHit) const;
// Insert a hit object. Total number of hit objects stored in this
// map is returned.
inline G4int set(const G4int & key, T * &aHit) const;
inline G4int set(const G4int & key, T &aHit) const;
template <typename U = T,
typename std::enable_if<std::is_same<U,T>::value,int>::type=0>
inline G4int add(const G4int & key, T * &aHit) const
{
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) != theHitsMap->end()) {
*(*theHitsMap)[key] += *aHit;
} else {
(*theHitsMap)[key] = aHit;
}
return theHitsMap->size();
}
template <typename U = T,
typename std::enable_if<std::is_same<U,T>::value,int>::type=0>
inline G4int add(const G4int & key, T &aHit) const
{
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) == theHitsMap->end()) {
(*theHitsMap)[key] = new T(0.);
}
*(*theHitsMap)[key] += aHit;
return theHitsMap->size();
}
template <typename U = T,
typename std::enable_if<std::is_same<U,G4double>::value &&
std::is_same<T,G4StatDouble>::value,int>::type=0>
inline G4int add(const G4int & key, U * &aHit) const
{
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) == theHitsMap->end()) {
(*theHitsMap)[key] = new T(0.);
}
*(*theHitsMap)[key] += *aHit;
return theHitsMap->size();
}
template <typename U = T,
typename std::enable_if<std::is_same<U,G4double>::value &&
std::is_same<T,G4StatDouble>::value,int>::type=0>
inline G4int add(const G4int & key, U &aHit) const
{
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) == theHitsMap->end()) {
(*theHitsMap)[key] = new T(0.);
}
*(*theHitsMap)[key] += aHit;
return theHitsMap->size();
}
// Overwrite a hit object. Total number of hit objects stored in this
// map is returned.
template <typename U = T,
typename std::enable_if<std::is_same<U,T>::value,int>::type=0>
inline G4int set(const G4int & key, T * &aHit) const
{
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) != theHitsMap->end()) {
delete (*theHitsMap)[key]->second;
}
(*theHitsMap)[key] = aHit;
return theHitsMap->size();
}
template <typename U = T,
typename std::enable_if<std::is_same<U,T>::value,int>::type=0>
inline G4int set(const G4int & key, T &aHit) const
{
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) == theHitsMap->end())
{ (*theHitsMap)[key] = new T(0.); }
*(*theHitsMap)[key] = aHit;
return theHitsMap->size();
}
template <typename U = T,
typename std::enable_if<std::is_same<U,G4double>::value &&
std::is_same<T,G4StatDouble>::value,int>::type=0>
inline G4int set(const G4int & key, U * &aHit) const
{
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) != theHitsMap->end()) {
delete (*theHitsMap)[key]->second;
}
(*theHitsMap)[key] = aHit;
return theHitsMap->size();
}
template <typename U = T,
typename std::enable_if<std::is_same<U,G4double>::value &&
std::is_same<T,G4StatDouble>::value,int>::type=0>
inline G4int set(const G4int & key, U &aHit) const
{
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) == theHitsMap->end())
{ (*theHitsMap)[key] = new T(0.); }
*(*theHitsMap)[key] = aHit;
return theHitsMap->size();
}
// Returns the number of hit objects stored in this map
inline G4int entries() const
{ return ((std::map<G4int,T*>*)theCollection)->size(); }
// Returns the number of hit objects stored in this map
// Clear the entry
inline void clear();
public:
@@ -113,17 +235,6 @@ template <typename T> G4THitsMap<T>::~G4THitsMap()
template <typename T> G4int G4THitsMap<T>::operator==(const G4THitsMap<T> &right) const
{ return (collectionName==right.collectionName); }
template <typename T> G4THitsMap<T> &
G4THitsMap<T>::operator+=(const G4THitsMap<T> &right) const
{
std::map<G4int,T*> * aHitsMap = right.GetMap();
typename std::map<G4int,T*>::iterator itr = aHitsMap->begin();
for(; itr != aHitsMap->end(); itr++) {
add(itr->first, *(itr->second));
}
return (G4THitsMap<T>&)(*this);
}
template <typename T> inline T*
G4THitsMap<T>::operator[](G4int key) const {
std::map<G4int,T*> * theHitsMap = GetMap();
@@ -134,59 +245,6 @@ G4THitsMap<T>::operator[](G4int key) const {
}
}
template <typename T> inline G4int
G4THitsMap<T>::add(const G4int & key, T * &aHit) const {
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) != theHitsMap->end()) {
*(*theHitsMap)[key] += *aHit;
} else {
(*theHitsMap)[key] = aHit;
}
return theHitsMap->size();
}
template <typename T> inline G4int
G4THitsMap<T>::add(const G4int & key, T &aHit) const {
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) != theHitsMap->end()) {
*(*theHitsMap)[key] += aHit;
} else {
T * hit = new T;
*hit = aHit;
(*theHitsMap)[key] = hit;
}
return theHitsMap->size();
}
template <typename T> inline G4int
G4THitsMap<T>::set(const G4int & key, T * &aHit) const {
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) != theHitsMap->end()) {
delete (*theHitsMap)[key]->second;
}
(*theHitsMap)[key] = aHit;
return theHitsMap->size();
}
template <typename T> inline G4int
G4THitsMap<T>::set(const G4int & key, T &aHit) const {
typename std::map<G4int,T*> * theHitsMap = GetMap();
if(theHitsMap->find(key) != theHitsMap->end()) {
*(*theHitsMap)[key] = aHit;
} else {
T * hit = new T;
*hit = aHit;
(*theHitsMap)[key] = hit;
}
return theHitsMap->size();
}
template <typename T> void G4THitsMap<T>::DrawAllHits()
{;}
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 66892 2013-01-17 10:57:59Z gunter $
# $Id: GNUmakefile 99169 2016-09-07 09:29:14Z gcosmo $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
@@ -16,6 +16,7 @@ CPPFLAGS += \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/materials/include \
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoringBox.hh 83518 2014-08-27 12:57:10Z gcosmo $
// $Id: G4ScoringBox.hh 99154 2016-09-07 08:06:30Z gcosmo $
//
#ifndef G4ScoringBox_h
@@ -52,8 +52,8 @@ protected:
public:
void List() const;
void Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg=111);
void DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
void Draw(RunScore * map, G4VScoreColorMap* colorMap, G4int axflg=111);
void DrawColumn(RunScore * map, G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn);
// set a direction to segment this mesh
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoringCylinder.hh 83518 2014-08-27 12:57:10Z gcosmo $
// $Id: G4ScoringCylinder.hh 99154 2016-09-07 08:06:30Z gcosmo $
//
#ifndef G4ScoringCylinder_h
@@ -49,8 +49,8 @@ class G4ScoringCylinder : public G4VScoringMesh
public:
virtual void List() const;
virtual void Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg=111);
virtual void DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
virtual void Draw(RunScore * map, G4VScoreColorMap* colorMap, G4int axflg=111);
virtual void DrawColumn(RunScore * map, G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn);
void SetRMax(G4double rMax) {fSize[0] = rMax;}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VScoringMesh.hh 94772 2015-12-09 09:46:45Z gcosmo $
// $Id: G4VScoringMesh.hh 99154 2016-09-07 08:06:30Z gcosmo $
//
#ifndef G4VScoringMesh_h
@@ -33,6 +33,7 @@
#include "globals.hh"
#include "G4THitsMap.hh"
#include "G4RotationMatrix.hh"
#include "G4StatDouble.hh"
class G4VPhysicalVolume;
class G4LogicalVolume;
@@ -45,7 +46,9 @@ class G4ParallelWorldProcess;
#include <map>
enum MeshShape { boxMesh, cylinderMesh, sphereMesh , undefinedMesh = -1};
typedef std::map<G4String,G4THitsMap<G4double>* > MeshScoreMap;
typedef G4THitsMap< G4double > EventScore;
typedef G4THitsMap< G4StatDouble > RunScore;
typedef std::map< G4String, RunScore* > MeshScoreMap;
// class description:
//
// This class represents a parallel world for interactive scoring purposes.
@@ -85,6 +88,7 @@ class G4VScoringMesh
{ return fShape; }
// accumulate hits in a registered primitive scorer
void Accumulate(G4THitsMap<G4double> * map);
void Accumulate(G4THitsMap<G4StatDouble> * map);
// merge same kind of meshes
void Merge(const G4VScoringMesh * scMesh);
// dump information of primitive socrers registered in this mesh
@@ -94,9 +98,9 @@ class G4VScoringMesh
// draw a column of a quantity on a current viewer
void DrawMesh(const G4String& psName,G4int idxPlane,G4int iColumn,G4VScoreColorMap* colorMap);
// draw a projected quantity on a current viewer
virtual void Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg=111) = 0;
virtual void Draw(RunScore * map, G4VScoreColorMap* colorMap, G4int axflg=111) = 0;
// draw a column of a quantity on a current viewer
virtual void DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
virtual void DrawColumn(RunScore * map, G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn) = 0;
// reset registered primitive scorers
void ResetScore();
@@ -180,7 +184,7 @@ protected:
G4RotationMatrix * fRotationMatrix;
G4int fNSegment[3];
std::map<G4String, G4THitsMap<G4double>* > fMap;
MeshScoreMap fMap;
G4MultiFunctionalDetector * fMFD;
G4int verboseLevel;
+2 -1
View File
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 66892 2013-01-17 10:57:59Z gunter $
# $Id: sources.cmake 99154 2016-09-07 08:06:30Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -30,6 +30,7 @@ include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPNumerics/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
+14 -13
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoringBox.cc 89031 2015-03-18 08:40:48Z gcosmo $
// $Id: G4ScoringBox.cc 99154 2016-09-07 08:06:30Z gcosmo $
//
#include "G4ScoringBox.hh"
@@ -46,6 +46,7 @@
#include "G4Polyhedron.hh"
#include "G4ScoringManager.hh"
#include "G4StatDouble.hh"
#include <map>
#include <fstream>
@@ -236,7 +237,7 @@ void G4ScoringBox::List() const {
G4VScoringMesh::List();
}
void G4ScoringBox::Draw(std::map<G4int, G4double*> * map,
void G4ScoringBox::Draw(RunScore * map,
G4VScoreColorMap* colorMap, G4int axflg) {
G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
@@ -263,13 +264,13 @@ void G4ScoringBox::Draw(std::map<G4int, G4double*> * map,
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
std::map<G4int, G4StatDouble*>::iterator itr = map->GetMap()->begin();
for(; itr != map->GetMap()->end(); itr++) {
GetXYZ(itr->first, q);
xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
xycell[q[0]][q[1]] += (itr->second->sum_wx())/fDrawUnitValue;
yzcell[q[1]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
xzcell[q[0]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
}
// search max. & min. values in each slice
@@ -518,7 +519,7 @@ G4int G4ScoringBox::GetIndex(G4int x, G4int y, G4int z) const {
return x + y*fNSegment[0] + z*fNSegment[0]*fNSegment[1];
}
void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map,
void G4ScoringBox::DrawColumn(RunScore * map,
G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn)
{
@@ -555,18 +556,18 @@ void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map,
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
std::map<G4int, G4StatDouble*>::iterator itr = map->GetMap()->begin();
for(; itr != map->GetMap()->end(); itr++) {
GetXYZ(itr->first, q);
if(idxProj == 0 && q[2] == idxColumn) { // xy plane
xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
xycell[q[0]][q[1]] += (itr->second->sum_wx())/fDrawUnitValue;
}
if(idxProj == 1 && q[0] == idxColumn) { // yz plane
yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
yzcell[q[1]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
}
if(idxProj == 2 && q[1] == idxColumn) { // zx plane
xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
xzcell[q[0]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoringCylinder.cc 89031 2015-03-18 08:40:48Z gcosmo $
// $Id: G4ScoringCylinder.cc 99154 2016-09-07 08:06:30Z gcosmo $
//
#include "G4ScoringCylinder.hh"
@@ -50,6 +50,7 @@
#include "G4PSTrackLength.hh"
#include "G4PSNofStep.hh"
#include "G4ScoringManager.hh"
#include "G4StatDouble.hh"
G4ScoringCylinder::G4ScoringCylinder(G4String wName)
@@ -206,7 +207,7 @@ void G4ScoringCylinder::List() const {
}
void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map,
void G4ScoringCylinder::Draw(RunScore * map,
G4VScoreColorMap* colorMap, G4int axflg) {
G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
@@ -224,16 +225,16 @@ void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map,
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
std::map<G4int, G4StatDouble*>::iterator itr = map->GetMap()->begin();
for(; itr != map->GetMap()->end(); itr++) {
if(itr->first < 0) {
G4cout << itr->first << G4endl;
continue;
}
GetRZPhi(itr->first, q);
zphicell[q[IZ]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
rphicell[q[IR]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
zphicell[q[IZ]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue;
rphicell[q[IR]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue;
}
// search min./max. values
@@ -353,7 +354,7 @@ void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map,
}
}
void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
void G4ScoringCylinder::DrawColumn(RunScore * map, G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn)
{
G4int projAxis = 0;
@@ -399,8 +400,8 @@ void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreCol
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
std::map<G4int,G4StatDouble*>::iterator itr = map->GetMap()->begin();
for(; itr != map->GetMap()->end(); itr++) {
if(itr->first < 0) {
G4cout << itr->first << G4endl;
continue;
@@ -408,13 +409,13 @@ void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreCol
GetRZPhi(itr->first, q);
if(projAxis == IR && q[IR] == idxColumn) { // zphi plane
zphicell[q[IZ]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
zphicell[q[IZ]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue;
}
if(projAxis == IZ && q[IZ] == idxColumn) { // rphi plane
rphicell[q[IR]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
rphicell[q[IR]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue;
}
if(projAxis == IPHI && q[IPHI] == idxColumn) { // rz plane
rzcell[q[IR]][q[IZ]] += *(itr->second)/fDrawUnitValue;
rzcell[q[IR]][q[IZ]] += (itr->second->sum_wx())/fDrawUnitValue;
}
}
+18 -14
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VScoreWriter.cc 94772 2015-12-09 09:46:45Z gcosmo $
// $Id: G4VScoreWriter.cc 99154 2016-09-07 08:06:30Z gcosmo $
//
#include "G4VScoreWriter.hh"
@@ -89,7 +89,7 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
}
std::map<G4int, G4double*> * score = msMapItr->second->GetMap();
std::map<G4int, G4StatDouble*> * score = msMapItr->second->GetMap();
ofile << "# primitive scorer name: " << msMapItr->first << std::endl;
@@ -102,9 +102,9 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
<< ", i" << divisionAxisNames[1]
<< ", i" << divisionAxisNames[2];
// unit of scored value
ofile << ", value ";
ofile << ", total(value) ";
if(unit.size() > 0) ofile << "[" << unit << "]";
ofile << G4endl;
ofile << ", total(val^2), entry" << G4endl;
// "sequence" option: write header info
if(opt.find("sequence") != std::string::npos) {
@@ -123,11 +123,13 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
if(opt.find("csv") != std::string::npos)
ofile << x << "," << y << "," << z << ",";
std::map<G4int, G4double*>::iterator value = score->find(idx);
std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
if(value == score->end()) {
ofile << 0.;
ofile << 0. << "," << 0. << "," << 0;
} else {
ofile << *(value->second)/unitValue;
ofile << (value->second->sum_wx())/unitValue << ","
<< (value->second->sum_wx2())/unitValue/unitValue << ","
<< value->second->n();
}
if(opt.find("csv") != std::string::npos) {
@@ -175,7 +177,7 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
// retrieve the map
MeshScoreMap fSMap = fScoringMesh->GetScoreMap();
MeshScoreMap::const_iterator msMapItr = fSMap.begin();
std::map<G4int, G4double*> * score;
std::map<G4int, G4StatDouble*> * score;
for(; msMapItr != fSMap.end(); msMapItr++) {
G4String psname = msMapItr->first;
@@ -192,9 +194,9 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
<< ", i" << divisionAxisNames[1]
<< ", i" << divisionAxisNames[2];
// unit of scored value
ofile << ", value ";
ofile << ", total(value) ";
if(unit.size() > 0) ofile << "[" << unit << "]";
ofile << G4endl;
ofile << ", total(val^2), entry" << G4endl;
// "sequence" option: write header info
@@ -214,11 +216,13 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
if(opt.find("csv") != std::string::npos)
ofile << x << "," << y << "," << z << ",";
std::map<G4int, G4double*>::iterator value = score->find(idx);
if(value == score->end()) {
ofile << 0.;
std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
if(value == score->end()) {
ofile << 0. << "," << 0. << "," << 0;
} else {
ofile << *(value->second)/unitValue;
ofile << (value->second->sum_wx())/unitValue << ","
<< (value->second->sum_wx2())/unitValue/unitValue << ","
<< value->second->n();
}
if(opt.find("csv") != std::string::npos) {
+32 -13
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VScoringMesh.cc 96535 2016-04-20 12:14:15Z gcosmo $
// $Id: G4VScoringMesh.cc 99262 2016-09-09 13:18:19Z gcosmo $
//
// ---------------------------------------------------------------------
// Modifications
@@ -35,7 +35,7 @@
// ---------------------------------------------------------------------
#include "G4VScoringMesh.hh"
#include "G4THitsMap.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPhysicalVolume.hh"
#include "G4MultiFunctionalDetector.hh"
@@ -139,7 +139,7 @@ void G4VScoringMesh::SetPrimitiveScorer(G4VPrimitiveScorer * prs) {
prs->SetNijk(fNSegment[0], fNSegment[1], fNSegment[2]);
fCurrentPS = prs;
fMFD->RegisterPrimitive(prs);
G4THitsMap<G4double> * map = new G4THitsMap<G4double>(fWorldName, prs->GetName());
G4THitsMap<G4StatDouble> * map = new G4THitsMap<G4StatDouble>(fWorldName, prs->GetName());
fMap[prs->GetName()] = map;
}
@@ -172,13 +172,13 @@ void G4VScoringMesh::SetCurrentPrimitiveScorer(const G4String & name) {
}
G4bool G4VScoringMesh::FindPrimitiveScorer(const G4String & psname) {
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
MeshScoreMap::iterator itr = fMap.find(psname);
if(itr == fMap.end()) return false;
return true;
}
G4String G4VScoringMesh::GetPSUnit(const G4String & psname) {
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
MeshScoreMap::iterator itr = fMap.find(psname);
if(itr == fMap.end()) {
return G4String("");
} else {
@@ -209,7 +209,7 @@ void G4VScoringMesh::SetCurrentPSUnit(const G4String& unit){
}
G4double G4VScoringMesh::GetPSUnitValue(const G4String & psname) {
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
MeshScoreMap::iterator itr = fMap.find(psname);
if(itr == fMap.end()) {
return 1.;
} else {
@@ -287,11 +287,11 @@ void G4VScoringMesh::Dump() {
void G4VScoringMesh::DrawMesh(const G4String& psName,G4VScoreColorMap* colorMap,G4int axflg)
{
fDrawPSName = psName;
std::map<G4String, G4THitsMap<G4double>* >::const_iterator fMapItr = fMap.find(psName);
MeshScoreMap::const_iterator fMapItr = fMap.find(psName);
if(fMapItr!=fMap.end()) {
fDrawUnit = GetPSUnit(psName);
fDrawUnitValue = GetPSUnitValue(psName);
Draw(fMapItr->second->GetMap(), colorMap,axflg);
Draw(fMapItr->second, colorMap,axflg);
} else {
G4cerr << "Scorer <" << psName << "> is not defined. Method ignored." << G4endl;
}
@@ -300,11 +300,11 @@ void G4VScoringMesh::DrawMesh(const G4String& psName,G4VScoreColorMap* colorMap,
void G4VScoringMesh::DrawMesh(const G4String& psName,G4int idxPlane,G4int iColumn,G4VScoreColorMap* colorMap)
{
fDrawPSName = psName;
std::map<G4String, G4THitsMap<G4double>* >::const_iterator fMapItr = fMap.find(psName);
MeshScoreMap::const_iterator fMapItr = fMap.find(psName);
if(fMapItr!=fMap.end()) {
fDrawUnit = GetPSUnit(psName);
fDrawUnitValue = GetPSUnitValue(psName);
DrawColumn(fMapItr->second->GetMap(),colorMap,idxPlane,iColumn);
DrawColumn(fMapItr->second,colorMap,idxPlane,iColumn);
} else {
G4cerr << "Scorer <" << psName << "> is not defined. Method ignored." << G4endl;
}
@@ -313,7 +313,7 @@ void G4VScoringMesh::DrawMesh(const G4String& psName,G4int idxPlane,G4int iColum
void G4VScoringMesh::Accumulate(G4THitsMap<G4double> * map)
{
G4String psName = map->GetName();
std::map<G4String, G4THitsMap<G4double>* >::const_iterator fMapItr = fMap.find(psName);
MeshScoreMap::const_iterator fMapItr = fMap.find(psName);
*(fMapItr->second) += *map;
if(verboseLevel > 9) {
@@ -321,8 +321,27 @@ void G4VScoringMesh::Accumulate(G4THitsMap<G4double> * map)
G4cout << "G4VScoringMesh::Accumulate()" << G4endl;
G4cout << " PS name : " << psName << G4endl;
if(fMapItr == fMap.end()) {
G4cout << " "
<< psName << " was not found." << G4endl;
G4cout << " " << psName << " was not found." << G4endl;
} else {
G4cout << " map size : " << map->GetSize() << G4endl;
map->PrintAllHits();
}
G4cout << G4endl;
}
}
void G4VScoringMesh::Accumulate(G4THitsMap<G4StatDouble> * map)
{
G4String psName = map->GetName();
MeshScoreMap::const_iterator fMapItr = fMap.find(psName);
*(fMapItr->second) += *map;
if(verboseLevel > 9) {
G4cout << G4endl;
G4cout << "G4VScoringMesh::Accumulate()" << G4endl;
G4cout << " PS name : " << psName << G4endl;
if(fMapItr == fMap.end()) {
G4cout << " " << psName << " was not found." << G4endl;
} else {
G4cout << " map size : " << map->GetSize() << G4endl;
map->PrintAllHits();