Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
@@ -0,0 +1,43 @@
# $Id: GNUmakefile,v 1.1 2005/11/24 02:31:47 capra Exp $
# --------------------------------------------------------------------
# GNUmakefile for exaple subpackage
# R. Capra, 09 Sep 2005
# --------------------------------------------------------------------
name := Radmon
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/G4UI_USE.gmk
include $(G4INSTALL)/config/G4VIS_USE.gmk
include $(G4INSTALL)/config/interactivity.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/interfaces/basic/include \
-I$(G4BASE)/interfaces/common/include \
-I$(G4BASE)/run/include \
-I$(G4BASE)/event/include \
-I$(G4BASE)/tracking/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/solids/CSG/include \
-I$(G4BASE)/geometry/solids/Boolean/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/digits_hits/hits/include \
-I$(G4BASE)/digits_hits/digits/include \
-I$(G4BASE)/digits_hits/detector/include \
-I$(G4BASE)/visualization/management/include \
-I$(G4BASE)/graphics_reps/include \
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonHit.hh
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonHit.hh,v 1.3 2006/06/29 16:20:14 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Description: Radmon hit
//
#ifndef RADMONHIT_HH
#define RADMONHIT_HH
// Include files
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "RadmonHitsManager.hh"
#include "globals.hh"
#include <map>
class RadmonHit : public G4VHit
{
public:
inline RadmonHit();
inline virtual ~RadmonHit();
void * operator new(size_t size);
void operator delete(void * hit);
G4double RetrieveById(G4int id) const;
void StoreById(G4int id, G4double value);
inline G4double RetrieveByLabel(const G4String & label) const;
inline void StoreByLabel(const G4String & label, G4double value);
private:
// Hidden constructors and operators
RadmonHit(const RadmonHit & copy);
RadmonHit & operator=(const RadmonHit & copy);
typedef std::map<G4int, G4double> HitData;
HitData hitData;
};
typedef G4THitsCollection<RadmonHit> RadmonHitsCollection;
// Inline implementations
#include "RadmonHit.icc"
#endif /* RADMONHIT_HH */
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonHit.icc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonHit.icc,v 1.3 2006/06/29 16:20:16 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
#ifndef RADMONHIT_HH
#error "RadmonHit.icc cannot be included directly. Please use RadmonHit.hh"
#else /* RADMONHIT_HH */
inline RadmonHit :: RadmonHit()
{
}
inline RadmonHit :: ~RadmonHit()
{
}
inline G4double RadmonHit :: RetrieveByLabel(const G4String & label) const
{
return RetrieveById(RadmonHitsManager::Instance()->ReserveIdByLabel(label));
}
inline void RadmonHit :: StoreByLabel(const G4String & label, G4double value)
{
StoreById(RadmonHitsManager::Instance()->ReserveIdByLabel(label), value);
}
#endif /* RADMONHIT_HH */
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonHitsManager.hh
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonHitsManager.hh,v 1.3 2006/06/29 16:20:18 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Description: Global features for hits
//
#ifndef RADMONHITSMANAGER_HH
#define RADMONHITSMANAGER_HH
// Include files
#include "G4Allocator.hh"
#include "globals.hh"
#include <map>
class RadmonHit;
class RadmonHitsManager
{
public:
typedef G4Allocator<RadmonHit> Allocator;
inline static RadmonHitsManager * Instance();
inline Allocator & HitsAllocator();
G4int ReserveIdByLabel(const G4String & label);
private:
RadmonHitsManager();
inline ~RadmonHitsManager();
// Hidden constructors and operators
RadmonHitsManager(const RadmonHitsManager & copy);
RadmonHitsManager & operator=(const RadmonHitsManager & copy);
typedef std::map<G4String, G4int> IdLabels;
static RadmonHitsManager * instance;
IdLabels idLabels;
G4int idCounter;
Allocator * allocator;
};
// Inline implementations
#include "RadmonHitsManager.icc"
#endif /* RADMONHITSMANAGER_HH */
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonHitsManager.icc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonHitsManager.icc,v 1.3 2006/06/29 16:20:20 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
#ifndef RADMONHITSMANAGER_HH
#error "RadmonHitsManager.icc cannot be included directly. Please use RadmonHitsManager.hh"
#else /* RADMONHITSMANAGER_HH */
inline RadmonHitsManager * RadmonHitsManager :: Instance()
{
if (!instance)
instance=new RadmonHitsManager;
return instance;
}
inline RadmonHitsManager::Allocator & RadmonHitsManager :: HitsAllocator()
{
return * allocator;
}
inline RadmonHitsManager :: ~RadmonHitsManager()
{
}
#endif /* RADMONHITSMANAGER_HH */
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonSensitiveDetector.hh
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonSensitiveDetector.hh,v 1.4 2006/06/29 16:20:22 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Description: Radmon sensitive detector class
//
#ifndef RADMONSENSITIVEDETECTOR_HH
#define RADMONSENSITIVEDETECTOR_HH
// Include files
#include "G4VSensitiveDetector.hh"
#include "RadmonHit.hh"
#include "globals.hh"
#include <set>
class RadmonSensitiveDetectorDataStorer;
class RadmonSensitiveDetector : public G4VSensitiveDetector
{
public:
RadmonSensitiveDetector(const G4String & name);
virtual ~RadmonSensitiveDetector();
void ClearDataStorersList();
void AttachDataStorer(RadmonSensitiveDetectorDataStorer * observer);
virtual void Initialize(G4HCofThisEvent * hitsCollections);
inline virtual void EndOfEvent(G4HCofThisEvent * hitsCollections);
virtual G4bool ProcessHits(G4Step * step, G4TouchableHistory * touchableHistory);
RadmonHitsCollection * GetDetectorCollection(void) const;
private:
// Hidden constructors and operators
RadmonSensitiveDetector();
RadmonSensitiveDetector(const RadmonSensitiveDetector & copy);
RadmonSensitiveDetector & operator=(const RadmonSensitiveDetector & copy);
// Private attributes
typedef std::set<RadmonSensitiveDetectorDataStorer *> DataStorersSet;
DataStorersSet dataStorersSet;
RadmonHitsCollection * hitsCollection;
G4String collName;
};
// Inline implementations
#include "RadmonSensitiveDetector.icc"
#endif /* RADMONSENSITIVEDETECTOR_HH */
@@ -0,0 +1,41 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonSensitiveDetector.icc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonSensitiveDetector.icc,v 1.3 2006/06/29 16:20:24 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
#ifndef RADMONSENSITIVEDETECTOR_HH
#error "RadmonSensitiveDetector.icc cannot be included directly. Please use RadmonSensitiveDetector.hh"
#else /* RADMONSENSITIVEDETECTOR_HH */
inline void RadmonSensitiveDetector :: EndOfEvent(G4HCofThisEvent * /* hitsCollections */)
{
}
#endif /* RADMONSENSITIVEDETECTOR_HH */
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonSensitiveDetectorDataStorer.hh
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonSensitiveDetectorDataStorer.hh,v 1.3 2006/06/29 16:20:26 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Description: Stores data step into a radmon hit
//
#ifndef RADMONSENSITIVEDETECTORDATASTORER_HH
#define RADMONSENSITIVEDETECTORDATASTORER_HH
// Include files
class RadmonHit;
class G4Step;
class RadmonSensitiveDetectorDataStorer
{
public:
virtual void StoreIntoHit(G4Step * step, RadmonHit * hit) = 0;
protected:
inline RadmonSensitiveDetectorDataStorer();
inline ~RadmonSensitiveDetectorDataStorer();
private:
// Hidden constructors and operators
RadmonSensitiveDetectorDataStorer(const RadmonSensitiveDetectorDataStorer & copy);
RadmonSensitiveDetectorDataStorer & operator=(const RadmonSensitiveDetectorDataStorer & copy);
};
// Inline implementations
#include "RadmonSensitiveDetectorDataStorer.icc"
#endif /* RADMONSENSITIVEDETECTORDATASTORER_HH */
@@ -0,0 +1,47 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonSensitiveDetectorDataStorer.icc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonSensitiveDetectorDataStorer.icc,v 1.3 2006/06/29 16:20:28 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
#ifndef RADMONSENSITIVEDETECTORDATASTORER_HH
#error "RadmonSensitiveDetectorDataStorer.icc cannot be included directly. Please use RadmonSensitiveDetectorDataStorer.hh"
#else /* RADMONSENSITIVEDETECTORDATASTORER_HH */
inline RadmonSensitiveDetectorDataStorer :: RadmonSensitiveDetectorDataStorer()
{
}
inline RadmonSensitiveDetectorDataStorer :: ~RadmonSensitiveDetectorDataStorer()
{
}
#endif /* RADMONSENSITIVEDETECTORDATASTORER_HH */
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonHit.cc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonHit.cc,v 1.3 2006/06/29 16:20:30 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonHit.hh"
#include "G4Allocator.hh"
void * RadmonHit :: operator new(size_t /* size */)
{
return reinterpret_cast<void *>(RadmonHitsManager::Instance()->HitsAllocator().MallocSingle());
}
void RadmonHit :: operator delete(void * hit)
{
RadmonHitsManager::Instance()->HitsAllocator().FreeSingle(reinterpret_cast<RadmonHit *>(hit));
}
G4double RadmonHit :: RetrieveById(G4int id) const
{
return const_cast<RadmonHit *>(this)->hitData[id];
}
void RadmonHit :: StoreById(G4int id, G4double value)
{
hitData[id]=value;
}
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonHitsManager.cc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonHitsManager.cc,v 1.3 2006/06/29 16:20:32 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonHitsManager.hh"
#include "RadmonHit.hh"
RadmonHitsManager :: RadmonHitsManager()
:
idCounter(0),
allocator(new Allocator)
{
}
G4int RadmonHitsManager :: ReserveIdByLabel(const G4String & label)
{
const IdLabels::const_iterator i(idLabels.find(label));
if (i!=idLabels.end())
return i->second;
G4int id(idCounter);
idCounter++;
idLabels[label]=id;
return id;
}
RadmonHitsManager * RadmonHitsManager :: instance(0);
@@ -0,0 +1,128 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// File name: RadmonSensitiveDetector.cc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonSensitiveDetector.cc,v 1.2.2.2 2006/06/29 16:20:34 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonSensitiveDetector.hh"
#include "RadmonSensitiveDetectorDataStorer.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#define RADMONSENSITIVEDETECTOR_COLLECTIONNAME "radmon_default_"
RadmonSensitiveDetector :: RadmonSensitiveDetector(const G4String & name)
:
G4VSensitiveDetector(name),
hitsCollection(0)
{
collName=name;
collName+=RADMONSENSITIVEDETECTOR_COLLECTIONNAME;
collectionName.insert(collName);
}
RadmonSensitiveDetector :: ~RadmonSensitiveDetector()
{
}
void RadmonSensitiveDetector :: ClearDataStorersList()
{
dataStorersSet.clear();
}
void RadmonSensitiveDetector :: AttachDataStorer(RadmonSensitiveDetectorDataStorer * observer)
{
dataStorersSet.insert(observer);
}
void RadmonSensitiveDetector :: Initialize(G4HCofThisEvent * hitsCollections)
{
hitsCollection=new RadmonHitsCollection(GetName(), collName);
hitsCollections->AddHitsCollection(GetCollectionID(0), hitsCollection);
}
G4bool RadmonSensitiveDetector :: ProcessHits(G4Step * step, G4TouchableHistory * /* touchableHistory */)
{
if (dataStorersSet.empty())
return false;
RadmonHit * hit(new RadmonHit);
hitsCollection->insert(hit);
DataStorersSet::iterator i(dataStorersSet.begin());
const DataStorersSet::iterator end(dataStorersSet.end());
while (i!=end)
{
(*i)->StoreIntoHit(step, hit);
i++;
}
return true;
}
RadmonHitsCollection * RadmonSensitiveDetector :: GetDetectorCollection(void) const
{
G4SDManager * sdManager(G4SDManager::GetSDMpointer());
if (!sdManager)
return 0;
G4RunManager * rManager(G4RunManager::GetRunManager());
if (!rManager)
return 0;
const G4Event * currentEvent(rManager->GetCurrentEvent());
G4HCofThisEvent * hitsCollections(currentEvent->GetHCofThisEvent());
return reinterpret_cast<RadmonHitsCollection *>(hitsCollections->GetHC(sdManager->GetCollectionID(collName)));
}