Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
@@ -0,0 +1,150 @@
//
// ********************************************************************
// * 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: G4DCIOcatalog.cc
//
// History:
// '01.09.12 Youhei Morita Initial creation
#include "G4DCIOcatalog.hh"
// Addtional Include:
#include "G4VDCIOentry.hh"
G4DCIOcatalog* G4DCIOcatalog::f_thePointer = 0;
// Implementation of Constructor #1
G4DCIOcatalog::G4DCIOcatalog()
: m_verbose(0)
{}
// Implementation of GetDCIOcatalog
G4DCIOcatalog* G4DCIOcatalog::GetDCIOcatalog()
{
if ( f_thePointer == 0 ) f_thePointer = new G4DCIOcatalog;
return f_thePointer;
}
// Implementation of RegisterEntry
void G4DCIOcatalog::RegisterEntry(G4VDCIOentry* d)
{
if ( m_verbose > 0 ) {
G4cout << "registering I/O manager entry \"" << d->GetName()
<< "\" " << d << "." << G4endl;
}
if ( theCatalog.find(d->GetName()) != theCatalog.end() ) {
G4cout << "Redefining I/O Managers list " << d->GetName() << G4endl;
} else {
theCatalog[d->GetName()] = d;
}
}
// Implementation of RegisterDCIOmanager
void G4DCIOcatalog::RegisterDCIOmanager(G4VPDigitsCollectionIO* d)
{
if ( m_verbose > 0 ) {
G4cout << "registering I/O manager \"" << d->DMname()
<< "\" " << d << "." << G4endl;
}
if ( theStore.find(d->DMname()) != theStore.end() ) {
G4cout << "Redefining I/O Manager " << d->DMname() << G4endl;
} else {
theStore[d->DMname()] = d;
}
}
// Implementation of GetEntry
G4VDCIOentry* G4DCIOcatalog::GetEntry(std::string name)
{
if ( theCatalog.find(name) == theCatalog.end() ) {
G4cout << "Digit Collection I/O manager entry \"" << name
<< "\" not found!" << G4endl;
return 0;
} else {
G4VDCIOentry* ds = theCatalog[name];
return ds;
}
}
// Implementation of GetDCIOmanager
G4VPDigitsCollectionIO* G4DCIOcatalog::GetDCIOmanager(std::string name)
{
if ( theStore.find(name) == theStore.end() ) {
G4cout << "Digit Collection I/O manager \"" << name
<< "\" not found!" << G4endl;
return 0;
} else {
G4VPDigitsCollectionIO* ds = theStore[name];
return ds;
}
}
// Implementation of PrintEntries
void G4DCIOcatalog::PrintEntries()
{
G4cout << "I/O manager entries: ";
G4cout << theCatalog.size() << G4endl;
DCIOmap::const_iterator it;
for ( it=theCatalog.begin(); it != theCatalog.end(); it++ ) {
G4cout << " --- " << (*it).first << G4endl;
}
}
// Implementation of CurrentDCIOmanager
std::string G4DCIOcatalog::CurrentDCIOmanager()
{
std::string list = "";
DCIOstore::const_iterator it;
for ( it=theStore.begin(); it != theStore.end(); it++ ) {
list += (*it).first + " ";
}
return list;
}
// Implementation of PrintDCIOmanager
void G4DCIOcatalog::PrintDCIOmanager()
{
G4cout << "I/O managers: ";
G4cout << theStore.size() << G4endl;
DCIOstore::const_iterator it;
for ( it=theStore.begin(); it != theStore.end(); it++ ) {
G4cout << " --- " << (*it).first
<< ", " << (*it).second << "." << G4endl;
}
}
// Implementation of GetDCIOmanager
G4VPDigitsCollectionIO* G4DCIOcatalog::GetDCIOmanager(int n)
{
int i = 0;
DCIOstore::const_iterator it;
for ( it=theStore.begin(); it != theStore.end(); it++ ) {
if (i++ == n) return (*it).second;
}
return 0;
}
// End of G4DCIOcatalog.cc
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * 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: G4FileUtilities.cc
//
// History:
// 01.08.24 Youhei Morita Initial creation
#ifndef WIN32
#include "G4FileUtilities.hh"
// Implementation of Default Constructor
G4FileUtilities::G4FileUtilities()
{
}
// Implementation of Default Destructor
G4FileUtilities::~G4FileUtilities()
{
}
// Implementation of FileExists
G4bool G4FileUtilities::FileExists(const std::string file)
{
char* c = (char *) file.c_str();
int fd = ::open( c, O_RDONLY );
// int error = errno;
if ( fd != -1 ) {
::close( fd );
return true;
} else {
return false;
}
}
// Implementation of CopyFile
int G4FileUtilities::CopyFile(const std::string srcFile, const std::string dstFile)
{
std::string cmd = "cp " + srcFile + " " + dstFile;
return Shell( cmd );
}
// Implementation of DeleteFile
int G4FileUtilities::DeleteFile(const std::string file, const std::string option)
{
std::string cmd = "rm " + option + " " + file;
return Shell( cmd );
}
#endif
@@ -0,0 +1,150 @@
//
// ********************************************************************
// * 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: G4HCIOcatalog.cc
//
// History:
// '01.09.12 Youhei Morita Initial creation
#include "G4HCIOcatalog.hh"
// Addtional Include:
#include "G4VHCIOentry.hh"
G4HCIOcatalog* G4HCIOcatalog::f_thePointer = 0;
// Implementation of Constructor #1
G4HCIOcatalog::G4HCIOcatalog()
: m_verbose(0)
{}
// Implementation of GetHCIOcatalog
G4HCIOcatalog* G4HCIOcatalog::GetHCIOcatalog()
{
if ( f_thePointer == 0 ) f_thePointer = new G4HCIOcatalog;
return f_thePointer;
}
// Implementation of RegisterEntry
void G4HCIOcatalog::RegisterEntry(G4VHCIOentry* d)
{
if ( m_verbose > 0 ) {
G4cout << "registering I/O manager entry \"" << d->GetName()
<< "\" " << d << "." << G4endl;
}
if ( theCatalog.find(d->GetName()) != theCatalog.end() ) {
G4cout << "Redefining I/O Managers list " << d->GetName() << G4endl;
} else {
theCatalog[d->GetName()] = d;
}
}
// Implementation of RegisterHCIOmanager
void G4HCIOcatalog::RegisterHCIOmanager(G4VPHitsCollectionIO* d)
{
if ( m_verbose > 0 ) {
G4cout << "registering I/O manager \"" << d->SDname()
<< "\" " << d << "." << G4endl;
}
if ( theStore.find(d->SDname()) != theStore.end() ) {
G4cout << "Redefining I/O Manager " << d->SDname() << G4endl;
} else {
theStore[d->SDname()] = d;
}
}
// Implementation of GetEntry
G4VHCIOentry* G4HCIOcatalog::GetEntry(std::string name)
{
if ( theCatalog.find(name) == theCatalog.end() ) {
G4cout << "Hit Collection I/O manager entry \"" << name
<< "\" not found!" << std::endl;
return 0;
} else {
G4VHCIOentry* ds = theCatalog[name];
return ds;
}
}
// Implementation of GetHCIOmanager
G4VPHitsCollectionIO* G4HCIOcatalog::GetHCIOmanager(std::string name)
{
if ( theStore.find(name) == theStore.end() ) {
G4cout << "Hit Collection I/O manager \"" << name
<< "\" not found!" << G4endl;
return 0;
} else {
G4VPHitsCollectionIO* ds = theStore[name];
return ds;
}
}
// Implementation of PrintEntries
void G4HCIOcatalog::PrintEntries()
{
G4cout << "I/O manager entries: ";
G4cout << theCatalog.size() << G4endl;
HCIOmap::const_iterator it;
for ( it=theCatalog.begin(); it != theCatalog.end(); it++ ) {
G4cout << " --- " << (*it).first << G4endl;
}
}
// Implementation of CurrentHCIOmanager
std::string G4HCIOcatalog::CurrentHCIOmanager()
{
std::string list = "";
HCIOstore::const_iterator it;
for ( it=theStore.begin(); it != theStore.end(); it++ ) {
list += (*it).first + " ";
}
return list;
}
// Implementation of PrintHCIOmanager
void G4HCIOcatalog::PrintHCIOmanager()
{
G4cout << "I/O managers: ";
G4cout << theStore.size() << G4endl;
HCIOstore::const_iterator it;
for ( it=theStore.begin(); it != theStore.end(); it++ ) {
G4cout << " --- " << (*it).first
<< ", " << (*it).second << "." << G4endl;
}
}
// Implementation of GetHCIOmanager
G4VPHitsCollectionIO* G4HCIOcatalog::GetHCIOmanager(int n)
{
int i = 0;
HCIOstore::const_iterator it;
for ( it=theStore.begin(); it != theStore.end(); it++ ) {
if (i++ == n) return (*it).second;
}
return 0;
}
// End of G4HCIOcatalog.cc
@@ -0,0 +1,124 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// G4MCTEvent.cc
//
// ====================================================================
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
#include "G4ios.hh"
#include "G4MCTEvent.hh"
#include "G4MCTGenEvent.hh"
#include "G4MCTSimEvent.hh"
#include "G4MCTSimParticle.hh"
// ====================================================================
//
// class description
//
// ====================================================================
////////////////////
G4MCTEvent::G4MCTEvent()
: eventNumber(0)
////////////////////
{
genEvent= new G4MCTGenEvent(); // will be reused.
simEvent= new G4MCTSimEvent();
}
/////////////////////
G4MCTEvent::~G4MCTEvent()
/////////////////////
{
delete genEvent;
delete simEvent;
}
/////////////////////////////////////////////////////
G4MCTSimParticle* G4MCTEvent::GetSimParticle
(const G4MCTGenParticle& genpart) const
/////////////////////////////////////////////////////
{
MCTGen2SimParticleMap::const_iterator pos= gen2simParticleMap.find(genpart);
if(pos != gen2simParticleMap.end()) {
return pos-> second;
} else {
return 0;
}
}
////////////////////////////////////////////////////
G4MCTGenParticle G4MCTEvent::GetGenParticle
(const G4MCTSimParticle* simpart) const
////////////////////////////////////////////////////
{
MCTSim2GenParticleMap::const_iterator
pos= sim2genParticleMap.find(const_cast<G4MCTSimParticle*>(simpart));
if(pos != sim2genParticleMap.end()) {
return pos-> second;
} else {
return G4MCTGenParticle(0,0);
}
}
////////////////////////////////////////////////////////
int G4MCTEvent::AddPrimaryPair(const G4MCTGenParticle& genp,
const G4MCTSimParticle* simp)
////////////////////////////////////////////////////////
{
gen2simParticleMap.insert(std::make_pair(const_cast<G4MCTGenParticle&>(genp),
const_cast<G4MCTSimParticle*>(simp)));
sim2genParticleMap.insert(std::make_pair(const_cast<G4MCTSimParticle*>(simp),
const_cast<G4MCTGenParticle&>(genp)));
return gen2simParticleMap.size();
}
///////////////////////////
void G4MCTEvent::ClearEvent()
///////////////////////////
{
gen2simParticleMap.clear();
sim2genParticleMap.clear();
genEvent-> ClearEvent();
simEvent-> ClearEvent();
}
//////////////////////////////////////////////
void G4MCTEvent::Print(std::ostream& ostr) const
//////////////////////////////////////////////
{
ostr << "Event#:" << eventNumber << G4endl;
genEvent-> Print(ostr);
simEvent-> Print(ostr);
}
#endif
#endif
@@ -0,0 +1,101 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// G4MCTGenEvent.cc
//
// ====================================================================
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
#include "G4MCTGenEvent.hh"
#include "CLHEP/HepMC/GenParticle.h"
#include "CLHEP/HepMC/GenVertex.h"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////
G4MCTGenEvent::G4MCTGenEvent()
//////////////////////////
{
}
///////////////////////////
G4MCTGenEvent::~G4MCTGenEvent()
///////////////////////////
{
eventList.clear();
}
/////////////////////////////////////////////////////////////
int G4MCTGenEvent::AddGenEvent(const HepMC::GenEvent* genevent)
/////////////////////////////////////////////////////////////
{
eventList.push_back(const_cast<HepMC::GenEvent*>(genevent));
return eventList.size();
}
/////////////////////////////////////
int G4MCTGenEvent::GetNofEvents() const
/////////////////////////////////////
{
return eventList.size();
}
//////////////////////////////////////////////////////
const HepMC::GenEvent* G4MCTGenEvent::GetGenEvent(int i)
//////////////////////////////////////////////////////
{
int size= eventList.size();
if(i>=0 && i< size) return eventList[i];
else return 0;
}
//////////////////////////////
void G4MCTGenEvent::ClearEvent()
//////////////////////////////
{
eventList.clear();
}
////////////////////////////////////////////////////////////
void G4MCTGenEvent::Print(std::ostream& ostr) const
////////////////////////////////////////////////////////////
{
int nev= eventList.size();
for(int iev=0; iev<nev; iev++) {
eventList[iev]-> print(ostr);
}
}
#endif
#endif
@@ -0,0 +1,177 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// G4MCTSimEvent.cc
//
// ====================================================================
#include "G4ios.hh"
#include "G4MCTSimEvent.hh"
#include "G4MCTSimParticle.hh"
#include "G4MCTSimVertex.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////
G4MCTSimEvent::G4MCTSimEvent()
//////////////////////////
{
}
///////////////////////////
G4MCTSimEvent::~G4MCTSimEvent()
///////////////////////////
{
ClearEvent();
}
//////////////////////////////////////////////////////////////
G4bool G4MCTSimEvent::AddParticle(const G4MCTSimParticle* aparticle)
//////////////////////////////////////////////////////////////
{
G4MCTSimParticle* qpart= const_cast<G4MCTSimParticle*>(aparticle);
int trackID= aparticle-> GetTrackID();
int nc= particleMap.count(trackID);
if(nc==0) {
particleMap.insert(std::make_pair(trackID, qpart));
return true;
} else {
return false;
}
}
////////////////////////////////////////////////////////
G4MCTSimParticle* G4MCTSimEvent::FindParticle(int tid) const
////////////////////////////////////////////////////////
{
G4MCTSimParticleContainer::const_iterator pos= particleMap.find(tid);
if(pos != particleMap.end()) {
return pos-> second;
} else {
return 0;
}
}
///////////////////////////////////////////////////
G4MCTSimVertex* G4MCTSimEvent::GetVertex(int vid) const
///////////////////////////////////////////////////
{
int nv= vertexVec.size();
if(vid>=1 && vid<=nv) {
return vertexVec[vid-1];
} else {
return 0;
}
}
////////////////////////////////////////
void G4MCTSimEvent::BuildVertexContainer()
////////////////////////////////////////
{
G4MCTSimParticleContainer::iterator itr;
int vid=1;
for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
G4MCTSimVertex* vertex= itr->second-> GetVertex();
if(vertex) {
if (vertex-> GetID()<0) { // ID not yet assigned
vertex-> SetID(vid);
vid++;
if (vertex) vertexVec.push_back(vertex);
}
}
}
}
//////////////////////////////
void G4MCTSimEvent::ClearEvent()
//////////////////////////////
{
G4MCTSimParticleContainer::iterator itr;
for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
delete itr->second;
}
particleMap.clear();
G4MCTSimVertexContainer::iterator itrv;
for(itrv= vertexVec.begin(); itrv!= vertexVec.end(); ++itrv) {
delete (*itrv);
}
vertexVec.clear();
}
//////////////////////////////////////////////
int G4MCTSimEvent::GetNofStoredParticles() const
//////////////////////////////////////////////
{
int n=0;
G4MCTSimParticleContainer::const_iterator itr;
for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
if(itr-> second-> GetStoreFlag()) n++;
}
return n;
}
/////////////////////////////////////////////
int G4MCTSimEvent::GetNofStoredVertices() const
/////////////////////////////////////////////
{
int n=0;
G4MCTSimVertexContainer::const_iterator itr;
for(itr= vertexVec.begin(); itr!= vertexVec.end(); ++itr) {
if((*itr)->GetStoreFlag()) n++;
}
return n;
}
/////////////////////////////////////////////////
void G4MCTSimEvent::Print(std::ostream& ostr) const
/////////////////////////////////////////////////
{
ostr << "____________________________________________________"
"____________________________" << G4endl;
ostr << "SimEvent:" << G4endl << G4endl;
ostr << "Current Memory Usage: "
<< particleMap.size() << " particles, "
<< vertexVec.size() << " vertices."
<< G4endl;
ostr << "trk#<ptrk#: P(Px(GeV), Py, Pz, E ) @PDG %proc\n"
<< " vtx#- X( X(mm), Y, Z, T(ns)) @vname-#"
<< G4endl;
ostr << "____________________________________________________"
"____________________________" << G4endl;
G4MCTSimParticleContainer::const_iterator itr;
for(itr= particleMap.begin(); itr!= particleMap.end(); ++itr) {
itr-> second-> PrintSingle(ostr);
}
ostr << "____________________________________________________"
"____________________________" << G4endl;
}
@@ -0,0 +1,206 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// G4MCTSimParticle.cc
//
// ====================================================================
#include "globals.hh"
#include <sstream>
#include <iomanip>
#include "G4ios.hh"
#include "G4MCTSimParticle.hh"
#include "G4MCTSimVertex.hh"
// ====================================================================
//
// class description
//
// ====================================================================
/////////////////////////////////
G4MCTSimParticle::G4MCTSimParticle()
: parentParticle(0),
trackID(0), parentTrackID(0),
primaryFlag(false),
vertex(0), storeFlag(false)
/////////////////////////////////
{
}
/////////////////////////////////////////////////////////////
G4MCTSimParticle::G4MCTSimParticle(std::string aname, int apcode,
int atid, int ptid,
const G4LorentzVector& p)
: parentParticle(0),
name(aname), pdgID(apcode),
trackID(atid), parentTrackID(ptid),
primaryFlag(false),momentumAtVertex(p),
vertex(0), storeFlag(false)
///////////////////////////////////////////////////////////////
{
}
/////////////////////////////////////////////////////////////
G4MCTSimParticle::G4MCTSimParticle(std::string aname, int apcode,
int atid, int ptid,
const G4LorentzVector& p,
const G4MCTSimVertex* v )
: parentParticle(0),
name(aname), pdgID(apcode),
trackID(atid), parentTrackID(ptid),
primaryFlag(false),momentumAtVertex(p),
vertex(const_cast<G4MCTSimVertex*>(v)), storeFlag(false)
///////////////////////////////////////////////////////////////
{
}
/////////////////////////////////
G4MCTSimParticle::~G4MCTSimParticle()
/////////////////////////////////
{
associatedParticleList.clear();
}
////////////////////////////////////////////////////////
int G4MCTSimParticle::AssociateParticle(G4MCTSimParticle* p)
////////////////////////////////////////////////////////
{
associatedParticleList.push_back(p);
p-> SetParentParticle(this);
return associatedParticleList.size();
}
/////////////////////////////////////////////////////
int G4MCTSimParticle::GetNofAssociatedParticles() const
/////////////////////////////////////////////////////
{
return associatedParticleList.size();
}
//////////////////////////////////////////////////////////////////
G4MCTSimParticle* G4MCTSimParticle::GetAssociatedParticle(int i) const
//////////////////////////////////////////////////////////////////
{
int size= associatedParticleList.size();
if(i>=0 && i< size) return associatedParticleList[i];
else return 0;
}
////////////////////////////////////////
int G4MCTSimParticle::GetTreeLevel() const
////////////////////////////////////////
{
const G4MCTSimParticle* p= this;
int nlevel;
for(nlevel=1;;nlevel++) {
p= p-> GetParentParticle();
if(p==0) return nlevel;
}
}
/////////////////////////////////////////////////////
void G4MCTSimParticle::SetStoreFlagToParentTree(G4bool q)
/////////////////////////////////////////////////////
{
storeFlag=q;
if(vertex) vertex-> SetStoreFlag(q);
if(primaryFlag) return;
if(parentParticle) parentParticle-> SetStoreFlagToParentTree(q);
}
//////////////////////////////////////////////////////////
void G4MCTSimParticle::PrintSingle(std::ostream& ostr) const
//////////////////////////////////////////////////////////
{
std::ostringstream os;
char cqp=' ';
if(storeFlag) cqp='+';
os << cqp << trackID << '\0';
std::string stid(os.str());
ostr << std::setw(6) << stid;
//ostr << std::setw(4) << trackID;
if(primaryFlag) ostr << "*";
else ostr << " ";
ostr << "<" << std::setw(5) << parentTrackID;
ostr.setf(std::ios::fixed);
ostr << ": P("
<< std::setw(7) << std::setprecision(3) << momentumAtVertex.x()/GeV
<< "," << std::setw(7) << std::setprecision(3)
<< momentumAtVertex.y()/GeV
<< "," << std::setw(7) << std::setprecision(3)
<< momentumAtVertex.z()/GeV
<< "," << std::setw(7) << std::setprecision(3)
<< momentumAtVertex.e()/GeV << ") @";
ostr << name << "(" << pdgID << ")";
if(vertex) {
ostr << " %" << vertex-> GetCreatorProcessName() << G4endl;
std::ostringstream osv;
char cqv=' ';
if(vertex->GetStoreFlag()) cqv='+';
osv << cqv << vertex-> GetID() << '\0';
std::string svid(osv.str());
ostr << " " << std::setw(6) << svid;
//ostr << " " << std::setw(4) << vertex-> GetID();
ostr.unsetf(std::ios::fixed);
ostr.setf(std::ios::scientific|std::ios::right|std::ios::showpoint);
ostr << "- X(" << std::setw(9) << std::setprecision(2)
<< vertex-> GetPosition().x()/mm
<< "," << std::setw(9) << std::setprecision(2)
<< vertex-> GetPosition().y()/mm
<< "," << std::setw(9) << std::setprecision(2)
<< vertex-> GetPosition().z()/mm
<< "," << std::setw(9) << std::setprecision(2)
<< vertex-> GetTime()/ns << ")";
ostr.unsetf(std::ios::scientific);
ostr << " @" << vertex-> GetVolumeName()
<< "-" << vertex-> GetVolumeNumber();
}
ostr << G4endl;
}
////////////////////////////////////////////////////////////////////
void G4MCTSimParticle::Print(std::ostream& ostr, G4bool qrevorder) const
////////////////////////////////////////////////////////////////////
{
PrintSingle(ostr);
// recursively print associated particles
if (!qrevorder) { // parent -> child
SimParticleList::const_iterator itr;
for(itr= associatedParticleList.begin();
itr!= associatedParticleList.end(); ++itr) {
(*itr)-> Print(ostr);
}
} else { // child -> parent
if(parentParticle) parentParticle-> Print(ostr, true);
}
}
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// G4MCTSimVertex.cc
//
// ====================================================================
#include "globals.hh"
#include <sstream>
#include <iomanip>
#include "G4ios.hh"
#include "G4MCTSimParticle.hh"
#include "G4MCTSimVertex.hh"
// ====================================================================
//
// class description
//
// ====================================================================
/////////////////////////////////////
G4MCTSimVertex::G4MCTSimVertex()
: inParticleTrackID(0),id(-1),
volumeName(""), volumeNumber(-1),
creatorProcessName("none"),
storeFlag(false)
/////////////////////////////////////
{
}
/////////////////////////////////////////////////////////
G4MCTSimVertex::G4MCTSimVertex(const G4ThreeVector& x, double t)
: inParticleTrackID(0), id(-1), position(x), time(t),
volumeName(""), volumeNumber(-1),
creatorProcessName("none"), storeFlag(false)
/////////////////////////////////////////////////////////
{
}
///////////////////////////////////////////////////////////////
G4MCTSimVertex::G4MCTSimVertex(const G4ThreeVector& x, double t,
std::string vname, int ncopy, std::string pname)
: inParticleTrackID(0), id(-1), position(x), time(t),
volumeName(vname), volumeNumber(ncopy),
creatorProcessName(pname), storeFlag(false)
///////////////////////////////////////////////////////////////
{
}
/////////////////////////////
G4MCTSimVertex::~G4MCTSimVertex()
/////////////////////////////
{
outParticleTrackIDList.clear();
}
//////////////////////////////////////////////////
void G4MCTSimVertex::Print(std::ostream& ostr) const
//////////////////////////////////////////////////
{
std::ostringstream os;
char cq=' ';
if(storeFlag) cq='+';
os << cq << id << '\0';
std::string sid(os.str());
ostr.unsetf(std::ios::fixed);
ostr.setf(std::ios::scientific|std::ios::right|std::ios::showpoint);
//ostr << std::setw(4) << id;
ostr << std::setw(6) << sid;
ostr << " : X(" << std::setw(9) << std::setprecision(2)
<< position.x()/mm
<< "," << std::setw(9) << std::setprecision(2)
<< position.y()/mm
<< "," << std::setw(9) << std::setprecision(2)
<< position.z()/mm
<< "," << std::setw(9) << std::setprecision(2)
<< time/ns << ")";
ostr.unsetf(std::ios::scientific);
ostr << "@" << volumeName
<< "-" << volumeNumber
<< "%" << creatorProcessName
<< G4endl;
ostr << " " << std::setw(4) << inParticleTrackID << "-> ";
size_t np= outParticleTrackIDList.size();
for (size_t i=0; i<np; i++) ostr << outParticleTrackIDList[i] << ", ";
ostr << G4endl;
}
@@ -0,0 +1,426 @@
//
// ********************************************************************
// * 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: G4PersistencyCenter.cc
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
#include "G4PersistencyCenter.hh"
// Forward Declarations:
#include "G4PersistencyCenterMessenger.hh"
// Addtional Include:
#include "G4UImanager.hh"
#include "G4PersistencyManager.hh"
G4PersistencyCenter* G4PersistencyCenter::f_thePointer=G4PersistencyCenter::GetPersistencyCenter();
// Implementation of Constructor #1
G4PersistencyCenter::G4PersistencyCenter()
: m_verbose(0)
{
f_wrObj[0] = "HepMC";
f_wrObj[1] = "MCTruth";
f_wrObj[2] = "Hits";
f_wrObj[3] = "Digits";
f_rdObj[0] = "Hits";
f_rdObj[1] = "HitsBG";
ObjMap::iterator itr;
for ( itr = f_wrObj.begin(); itr != f_wrObj.end(); itr++ ) {
f_writeFileName[(*itr).second] = "G4defaultOutput";
}
for ( itr = f_rdObj.begin(); itr != f_rdObj.end(); itr++ ) {
f_readFileName[(*itr).second] = "G4defaultInput";
}
f_writeFileMode["HepMC"] = kRecycle;
f_writeFileMode["MCTruth"] = kOn;
f_writeFileMode["Hits"] = kOn;
f_writeFileMode["Digits"] = kOff;
f_readFileMode["Hits"] = false;
f_readFileMode["HitsBG"] = false;
f_theMessenger = new G4PersistencyCenterMessenger(this);
f_currentManager = new G4PersistencyManager(this, "Default");
}
// Implementation of Constructor #2
G4PersistencyCenter::G4PersistencyCenter(const G4PersistencyCenter&)
{}
// Implementation of Destructor #1
G4PersistencyCenter::~G4PersistencyCenter()
{
delete f_theMessenger;
delete f_currentManager;
}
// Implementation of GetPersistencyCenter
G4PersistencyCenter* G4PersistencyCenter::GetPersistencyCenter()
{
if ( f_thePointer == 0 ) f_thePointer = new G4PersistencyCenter;
return f_thePointer;
}
// Implementation of SelectSystem
void G4PersistencyCenter::SelectSystem(std::string systemName)
{
int st = 0;
if (f_currentManager!=0) delete f_currentManager;
G4PersistencyManager* pm = 0;
if (systemName=="None")
{
G4cout<<" G4PersistencyCenter: Default is selected."<< G4endl;
pm = new G4PersistencyManager(this, "Default");
}
else if (systemName=="ROOT")
{
G4cout<<" G4PersistencyCenter: \"ROOT\" Persistency Package is selected."
<<G4endl;
// G4UImanager *man=G4UImanager::GetUIpointer();
// std::string libs="Cint:Core:Tree:Rint:Matrix:Physics:fadsROOT";
// st = man->ApplyCommand("/load "+libs);
if ( st == 0 ) {
pm = GetPersistencyManager("ROOT");
}
}
else if (systemName=="ODBMS")
{
G4cout<<" G4PersistencyCenter: \"ODBMS\" package is selected."<<G4endl;
// G4UImanager *man=G4UImanager::GetUIpointer();
// std::string libs="fadsODBMS";
// st = man->ApplyCommand("/load "+libs);
if ( st == 0 ) {
pm = GetPersistencyManager("ODBMS");
}
}
if ( st == 0 ) {
f_currentManager = pm->Create();
if (f_currentManager!=0) f_currentManager->SetVerboseLevel(m_verbose);
f_currentSystemName = systemName;
}
}
// Implementation of SetHepMCObjyReaderFile
void G4PersistencyCenter::SetHepMCObjyReaderFile(std::string file)
{
if ( SetReadFile("HepMC", file) ) {
SetRetrieveMode("HepMC", true);
}
}
// Implementation of CurrentHepMCObjyReaderFile
std::string G4PersistencyCenter::CurrentHepMCObjyReaderFile()
{
if ( CurrentRetrieveMode("HepMC") ) {
return CurrentReadFile("HepMC");
} else {
return "";
}
}
// Implementation of SetStoreMode
void G4PersistencyCenter::SetStoreMode(std::string objName, StoreMode mode)
{
if ( (*(f_writeFileName.find(objName))).second != "" ) {
f_writeFileMode[objName] = mode;
} else {
G4cerr << "!! unknown object type " << objName << " for output."
<< G4endl;
}
}
// Implementation of SetRetrieveMode
void G4PersistencyCenter::SetRetrieveMode(std::string objName, G4bool mode)
{
if ( (*(f_readFileName.find(objName))).second != "" ) {
f_readFileMode[objName] = mode;
} else {
G4cerr << "!! unknown object type " << objName << " for input."
<< G4endl;
}
}
// Implementation of CurrentStoreMode
StoreMode G4PersistencyCenter::CurrentStoreMode(std::string objName)
{
if ( (*(f_writeFileName.find(objName))).second != "" ) {
return f_writeFileMode[objName];
} else {
return kOff;
}
}
// Implementation of CurrentRetrieveMode
G4bool G4PersistencyCenter::CurrentRetrieveMode(std::string objName)
{
if ( (*(f_readFileName.find(objName))).second != "" ) {
return f_readFileMode[objName];
} else {
return false;
}
}
// Implementation of SetWriteFile
G4bool G4PersistencyCenter::SetWriteFile(std::string objName, std::string writeFileName)
{
if ( (*(f_writeFileName.find(objName))).second != "" ) {
f_writeFileName[objName] = writeFileName;
} else {
G4cerr << "!! unknown object type " << objName << " for output."
<< G4endl;
return false;
}
return true;
}
// Implementation of SetReadFile
G4bool G4PersistencyCenter::SetReadFile(std::string objName, std::string readFileName)
{
#ifndef WIN32
if ( f_ut.FileExists(readFileName) )
{
f_readFileName[objName] = readFileName;
}
else
{
G4cerr << "!! File \"" << objName << "\" does not exist."
<< G4endl;
return false;
}
#endif
return true;
}
// Implementation of CurrentWriteFile
std::string G4PersistencyCenter::CurrentWriteFile(std::string objName)
{
if ( (*(f_writeFileName.find(objName))).second != "" ) {
return f_writeFileName[objName];
} else {
return "?????";
}
}
// Implementation of CurrentReadFile
std::string G4PersistencyCenter::CurrentReadFile(std::string objName)
{
if ( (*(f_readFileName.find(objName))).second != "" ) {
return f_readFileName[objName];
} else {
return "?????";
}
}
// Implementation of CurrentObject
std::string G4PersistencyCenter::CurrentObject(std::string file)
{
FileMap::iterator itr;
for ( itr = f_readFileName.begin(); itr != f_readFileName.end(); itr++ ) {
if ( file == (*itr).second ) return (*itr).first;
}
for ( itr = f_writeFileName.begin(); itr != f_writeFileName.end(); itr++ ) {
if ( file == (*itr).second ) return (*itr).first;
}
return "?????";
}
// Implementation of AddHCIOmanager
void G4PersistencyCenter::AddHCIOmanager(std::string detName, std::string colName)
{
G4HCIOcatalog* ioc = G4HCIOcatalog::GetHCIOcatalog();
G4VHCIOentry* ioe = ioc->GetEntry(detName);
if ( ioe != 0 ) {
ioe->CreateHCIOmanager(detName, colName);
} else {
G4cerr << "Error! -- HCIO assignment failed for detector " << detName
<< ", collection " << colName << G4endl;
}
}
// Implementation of CurrentHCIOmanager
std::string G4PersistencyCenter::CurrentHCIOmanager()
{
G4HCIOcatalog* ioc = G4HCIOcatalog::GetHCIOcatalog();
return ioc->CurrentHCIOmanager();
}
// Implementation of AddDCIOmanager
void G4PersistencyCenter::AddDCIOmanager(std::string detName)
{
G4DCIOcatalog* ioc = G4DCIOcatalog::GetDCIOcatalog();
std::string colName = "";
G4VDCIOentry* ioe = ioc->GetEntry(detName);
if ( ioe != 0 ) {
ioe->CreateDCIOmanager(detName, colName);
} else {
G4cerr << "Error! -- DCIO assignment failed for detector " << detName
<< ", collection " << colName << G4endl;
}
}
// Implementation of CurrentDCIOmanager
std::string G4PersistencyCenter::CurrentDCIOmanager()
{
G4DCIOcatalog* ioc = G4DCIOcatalog::GetDCIOcatalog();
return ioc->CurrentDCIOmanager();
}
// Implementation of PrintAll
void G4PersistencyCenter::PrintAll()
{
G4cout << "Persistency Package: " << CurrentSystem() << G4endl;
G4cout << G4endl;
ObjMap::iterator itr;
std::string name;
std::string file;
StoreMode mode;
G4cout << "Output object types and file names:" << G4endl;
for ( itr = f_wrObj.begin(); itr != f_wrObj.end(); itr++ ) {
name = (*itr).second;
// disabled HepMC and MCTruth for now
if ( name != "HepMC" && name != "MCTruth" ) {
G4cout << " Object: " << PadString(name, 9);
mode = CurrentStoreMode(name);
if ( mode == kOn ) {
G4cout << " <on> ";
} else if ( mode == kOff ) {
G4cout << " <off> ";
} else if ( mode == kRecycle ) {
G4cout << "<recycle>";
}
file = CurrentWriteFile(name);
if ( file == "" ) file = " <N/A>";
G4cout << " File: " << file << G4endl;
}
}
G4cout << G4endl;
G4cout << "Input object types and file names:" << G4endl;
for ( itr = f_rdObj.begin(); itr != f_rdObj.end(); itr++ ) {
name = (*itr).second;
// disabled HepMC and MCTruth for now
if ( name != "HepMC" && name != "MCTruth" ) {
G4cout << " Object: " << PadString(name, 9);
if ( CurrentRetrieveMode(name) ) {
G4cout << " <on> ";
} else {
G4cout << " <off> ";
}
file = CurrentReadFile(name);
if ( file == "" ) file = " <N/A>";
G4cout << " File: " << CurrentReadFile(name) << G4endl;
}
}
G4cout << G4endl;
G4HCIOcatalog* hioc = G4HCIOcatalog::GetHCIOcatalog();
if ( hioc != 0 ) {
G4cout << "Hit IO Managers:" << G4endl;
hioc->PrintEntries();
hioc->PrintHCIOmanager();
G4cout << G4endl;
} else {
G4cout << "Hit IO Manager catalog is not registered." << G4endl;
}
G4DCIOcatalog* dioc = G4DCIOcatalog::GetDCIOcatalog();
if ( dioc != 0 ) {
G4cout << "Digit IO Managers:" << G4endl;
dioc->PrintEntries();
dioc->PrintDCIOmanager();
G4cout << G4endl;
} else {
G4cout << "Digit IO Manager catalog is not registered." << G4endl;
}
}
// Implementation of SetPersistencyManager
void G4PersistencyCenter::SetPersistencyManager(G4PersistencyManager* pm,
std::string name)
{
f_currentManager=pm;
f_currentSystemName=name;
}
// Implementation of GetPersistencyManager
G4PersistencyManager* G4PersistencyCenter::GetPersistencyManager(std::string nam)
{
if (f_theCatalog.find(nam)!=f_theCatalog.end())
return f_theCatalog[nam];
return 0;
}
// Implementation of RegisterPersistencyManager
void G4PersistencyCenter::RegisterPersistencyManager(G4PersistencyManager* pm)
{
f_theCatalog[pm->GetName()]=pm;
}
// Implementation of DeletePersistencyManager
void G4PersistencyCenter::DeletePersistencyManager()
{
if (f_currentManager!=0) delete f_currentManager;
f_currentManager=0;
}
// Implementation of SetVerboseLevel
void G4PersistencyCenter::SetVerboseLevel(int v)
{
m_verbose = v;
if ( f_currentManager != 0 ) f_currentManager->SetVerboseLevel(m_verbose);
}
// Implementation of PadString
std::string G4PersistencyCenter::PadString(std::string name, unsigned int width)
{
if ( name.length() > width ) {
return name.substr(0,width-1) + "#";
} else {
std::string wname = name;
for ( unsigned int i=0; i < width-name.length(); i++) wname = wname + " ";
return wname;
}
}
// End of G4PersistencyCenter.cc
@@ -0,0 +1,278 @@
//
// ********************************************************************
// * 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: G4PersistencyCenterMessenger.cc
//
// History:
// 01.07.18 Youhei Morita Initial creation (with "fadsclass")
#include "G4PersistencyCenterMessenger.hh"
// Implementation of Constructor #1
G4PersistencyCenterMessenger::G4PersistencyCenterMessenger(G4PersistencyCenter* p)
: pc(p)
{
std::string name = "/persistency/";
directory=new G4UIdirectory(name.c_str());
directory->SetGuidance("Control commands for Persistency package");
std::string cmd = name + "verbose";
verboseCmd = new G4UIcmdWithAnInteger(cmd.c_str(),this);
verboseCmd->SetGuidance("Set the verbose level of G4PersistencyManager.");
verboseCmd->SetGuidance(" 0 : Silent (default)");
verboseCmd->SetGuidance(" 1 : Display main topics");
verboseCmd->SetGuidance(" 2 : Display event-level topics");
verboseCmd->SetGuidance(" 3 : Display debug information");
verboseCmd->SetParameterName("level",true);
verboseCmd->SetDefaultValue(0);
verboseCmd->SetRange("level >=0 && level <=3");
std::string vname = name + "select";
cmd = vname;
select = new G4UIcmdWithAString(cmd.c_str(),this);
select->SetGuidance("Selection of a persistency package");
select->SetParameterName("Persistency package name", true, true);
select->SetCandidates("ODBMS ROOT None");
vname = name + "store/";
subdir1 = new G4UIdirectory(vname.c_str());
subdir1->SetGuidance("Specifiy object types for store");
wrObj.push_back("HepMC");
wrObj.push_back("MCTruth");
wrObj.push_back("Hits");
std::string guidance;
int i;
for ( i = 0; i < 3; i++ )
{
cmd = vname + wrObj[i];
guidance = "Store " + wrObj[i] + " objects for output";
storeObj.push_back(new G4UIcmdWithAString(cmd.c_str(),this));
storeObj[i]->SetGuidance(guidance.c_str());
if ( wrObj[i] == "HepMC" ) {
storeObj[i]->SetCandidates("on off recycle");
} else {
storeObj[i]->SetCandidates("on off");
}
}
vname += "using/";
subdir2 = new G4UIdirectory(vname.c_str());
subdir2->SetGuidance("Select I/O manager for store");
cmd = vname + "hitIO";
regHitIO = new G4UIcmdWithAString(cmd.c_str(),this);
regHitIO->SetGuidance("Resiter Hits I/O Manager");
regHitIO->SetParameterName("Name of Hits I/O Manager", true, true);
vname = name + "set/";
subdir3 = new G4UIdirectory(vname.c_str());
subdir3->SetGuidance("Set various parameters");
vname += "writeFile/";
subdir4 = new G4UIdirectory(vname.c_str());
subdir4->SetGuidance("Set output file names for object types");
for ( i = 0; i < 3; i++ )
{
cmd = vname + wrObj[i];
guidance = "Set an output file name for " + wrObj[i] + ".";
setWrFile.push_back(new G4UIcmdWithAString(cmd.c_str(),this));
setWrFile[i]->SetGuidance(guidance.c_str());
setWrFile[i]->SetParameterName("file name", true, true);
}
vname = name + "set/ReadFile/";
subdir5 = new G4UIdirectory(vname.c_str());
subdir5->SetGuidance("Set input file names for object types");
rdObj.push_back("Hits");
cmd = vname + rdObj[0];
guidance = "Set an input file name for " + rdObj[0] + ".";
setRdFile.push_back(new G4UIcmdWithAString(cmd.c_str(),this));
setRdFile[0]->SetGuidance(guidance.c_str());
setRdFile[0]->SetParameterName("file name", true, true);
cmd = name + "printall";
printAll = new G4UIcmdWithoutParameter(cmd.c_str(),this);
printAll->SetGuidance("Print all parameters.");
}
// Implementation of Destructor #1
G4PersistencyCenterMessenger::~G4PersistencyCenterMessenger()
{
delete directory;
delete subdir1;
delete subdir2;
delete subdir3;
delete subdir4;
delete subdir5;
delete verboseCmd;
delete select;
delete regHitIO;
for ( int i = 0; i < 3; i++ )
{
delete storeObj[i];
delete setWrFile[i];
}
delete setRdFile[0];
delete printAll;
}
// Implementation of SetNewValue
void G4PersistencyCenterMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
{
if (command==verboseCmd)
{
pc->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues));
}
else if (command==select)
{
pc->SelectSystem(newValues);
}
else if (command==regHitIO)
{
pc->AddHCIOmanager(PopWord(newValues,1," "),PopWord(newValues,2," "));
}
else if (command==setRdFile[0])
{
pc -> SetReadFile ( rdObj[0],newValues);
}
else if (command==printAll)
{
pc->PrintAll();
}
else
{
for( int i=0; i<3; i++ ) {
if( command==storeObj[i] )
{
StoreMode mode = kOff;
if( newValues == "on" ) {
mode = kOn;
} else if ( newValues == "off" ) {
mode = kOff;
} else if ( newValues == "recycle" ) {
mode = kRecycle;
} else {
G4cerr << "Unrecognized keyword - \"" << newValues << "\"."
<< G4endl;
}
pc->SetStoreMode(wrObj[i],mode);
break;
}
else if( command==setWrFile[i] )
{
pc->SetWriteFile(wrObj[i],newValues);
break;
}
}
}
}
// Implementation of GetCurrentValue
G4String G4PersistencyCenterMessenger::GetCurrentValue(G4UIcommand* command)
{
G4String s="Undefined";
if (command==select)
{
return pc->VerboseLevel();
}
else if (command==select)
{
return pc->CurrentSystem();
}
else if (command==regHitIO)
{
return pc->CurrentHCIOmanager();
}
else if (command==setRdFile[0])
{
return pc->CurrentReadFile(rdObj[0]);
}
else
{
for( int i=0; i<3; i++ ) {
if( command==storeObj[i] )
{
switch (pc->CurrentStoreMode(wrObj[i])) {
case kOn:
return "on";
break;
case kOff:
return "off";
break;
case kRecycle:
return "recycle";
break;
default:
return "?????";
break;
};
}
else if( command==setWrFile[i] )
{
return pc->CurrentWriteFile(wrObj[i]);
}
}
}
return s;
}
// Implementation of PopWord
std::string G4PersistencyCenterMessenger::PopWord(std::string text, int n, std::string delim)
{
if ( text.length() <= 0 ) return "";
int p = 0, p0 = 0;
int p1 = 0;
for ( int i = 0; i < n; i++ ) {
p1 = text.find_first_of(delim,p0+1);
while( p1 == p0+1 ) {
p0 = p1;
p1 = text.find_first_of(delim,p0+1);
}
p = p0;
if ( p1 < 0 ) {
if ( i+1 < n ) return "";
p1 = text.length();
break;
}
p0 = p1;
}
if (p > 0) p++;
return text.substr(p,p1-p);
}
// End of G4PersistencyCenterMessenger.cc
@@ -0,0 +1,433 @@
//
// ********************************************************************
// * 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: G4PersistencyManager.cc
//
// History:
// 01.07.17 Youhei Morita Initial creation (with "fadsclass")
#include "G4PersistencyManager.hh"
// Addtional Include:
#include <iomanip>
#include "G4PersistencyCenter.hh"
// Implementation of Constructor #1
G4PersistencyManager::G4PersistencyManager(G4PersistencyCenter* pc, std::string n)
: f_pc(pc), nameMgr(n), f_is_initialized(false)
{
m_verbose = f_pc->VerboseLevel();
// G4cout << "G4PersistencyManager is constructed with name \"" << nameMgr
// << "\", " << this << ", verbose = " << m_verbose << G4endl;
// f_GenCenter = GeneratorCenter::GetGeneratorCenter();
// f_MCTman = G4MCTManager::GetPointer();
}
// Implementation of Destructor #1
G4PersistencyManager::~G4PersistencyManager()
{}
// Implementation of GetPersistencyManager
G4PersistencyManager* G4PersistencyManager::GetPersistencyManager()
{
return G4PersistencyCenter::GetPersistencyCenter()->CurrentPersistencyManager();
}
// Implementation of SetVerboseLevel
void G4PersistencyManager::SetVerboseLevel(int v)
{
m_verbose = v;
if ( m_verbose > 2 ) {
G4cout << "G4PersistencyManager[\"" << nameMgr << "\"," << this
<< "]: verbose level is set to " << m_verbose << "."
<< G4endl;
}
if ( EventIO() != 0 ) EventIO()->SetVerboseLevel(m_verbose);
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
if ( HepMCIO() != 0 ) HepMCIO()->SetVerboseLevel(m_verbose);
if ( MCTruthIO() != 0 ) MCTruthIO()->SetVerboseLevel(m_verbose);
#endif
#endif
if ( HitIO() != 0 ) HitIO()->SetVerboseLevel(m_verbose);
if ( DigitIO() != 0 ) DigitIO()->SetVerboseLevel(m_verbose);
if (TransactionManager() != 0) TransactionManager()->SetVerboseLevel(m_verbose);
size_t i;
G4HCIOcatalog* hcio = G4HCIOcatalog::GetHCIOcatalog();
if ( hcio != 0 ) {
hcio->SetVerboseLevel(m_verbose);
for ( i = 0; i < hcio->NumberOfHCIOmanager(); i++ ) {
hcio->GetHCIOmanager(i)->SetVerboseLevel(m_verbose);
}
}
G4DCIOcatalog* dcio = G4DCIOcatalog::GetDCIOcatalog();
if ( dcio != 0 ) {
dcio->SetVerboseLevel(m_verbose);
for ( i = 0; i < dcio->NumberOfDCIOmanager(); i++ ) {
dcio->GetDCIOmanager(i)->SetVerboseLevel(m_verbose);
}
}
}
// Implementation of Store
G4bool G4PersistencyManager::Store(const G4Event* evt)
{
if ( m_verbose > 2 ) {
G4cout << "G4PersistencyManager::Store() is called for event# "
<< evt->GetEventID() << "." << G4endl;
}
if ( TransactionManager() == 0 ) return true;
G4bool is_store = f_pc->CurrentStoreMode("HepMC") != kOff ||
f_pc->CurrentStoreMode("MCTruth") != kOff ||
f_pc->CurrentStoreMode("Hits") != kOff ||
f_pc->CurrentStoreMode("Digits") != kOff;
if ( ! is_store ) return true;
// Call package dependent Initialize()
//
if ( ! f_is_initialized ) {
f_is_initialized = true;
if ( m_verbose > 1 ) {
G4cout << "G4PersistencyManager:: Initializing Transaction ... "
<< G4endl;
}
Initialize();
}
G4bool st1 = true, st2 = true;
// Start event IO transaction
//
if ( TransactionManager()->StartUpdate() ) {
if ( m_verbose > 2 ) {
G4cout << "G4PersistencyManager: Update transaction started for event#"
<< evt->GetEventID() << "." << G4endl;
}
} else {
G4cerr << "TransactionManager::Store(G4Event) - StartUpdate() failed."
<< G4endl;
return false;
}
std::string file;
std::string obj;
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
G4bool sthep = true, stmct = true, st3 = true;
// Store HepMC event
//
obj = "HepMC";
HepMC::GenEvent* hepevt = 0;
if ( f_pc->CurrentStoreMode(obj) == kOn ) {
// Note: This part of code will not be activated until a method
// to obtain the current pointer of HepMC::GenEvent* become available.
// if ( (hepevt = f_GenCenter->GetGenEvent()) !=0 ) {
if ( hepevt !=0 ) {
file = f_pc->CurrentWriteFile(obj);
if ( TransactionManager()->SelectWriteFile(obj, file) ) {
sthep = HepMCIO()->Store(hepevt);
if ( sthep && m_verbose > 1 ) {
G4cout << " -- File : " << file << " -- Event# "
<< evt->GetEventID() << " -- HepMC Stored." << G4endl;
}
} else {
sthep = false;
}
} // end of if ( hepevt != 0 )
} else { // recycle or off
// hepevt= f_GenCenter-> GetGenEvent();
}
// Store MCTruth event
//
obj = "MCTruth";
G4MCTEvent* mctevt = 0;
if ( f_pc->CurrentStoreMode(obj) == kOn ) {
// Note: This part of code will not be activated until a method
// to obtain the current pointer of G4MCTEvent* become available.
// if ( (mctevt = f_MCTman->GetCurrentEvent()) != 0 ) {
if ( mctevt != 0 ) {
file = f_pc->CurrentWriteFile(obj);
if ( TransactionManager()->SelectWriteFile(obj, file) ) {
stmct = MCTruthIO()->Store(mctevt);
if ( stmct && m_verbose > 1 ) {
G4cout << " -- File : " << file << " -- Event# "
<< evt->GetEventID() << " -- G4MCTEvent Stored." << G4endl;
}
} else {
stmct = false;
}
} // end of if ( mctevt != 0 )
}
#endif
#endif
// Store hits collection
//
obj = "Hits";
if ( f_pc->CurrentStoreMode(obj) == kOn ) {
if ( G4HCofThisEvent* hc = evt->GetHCofThisEvent() ) {
file = f_pc->CurrentWriteFile(obj);
if ( TransactionManager()->SelectWriteFile(obj, file) ) {
st1 = HitIO()->Store(hc);
if ( st1 && m_verbose > 1 ) {
G4cout << " -- File : " << file << " -- Event# "
<< evt->GetEventID()
<< " -- Hit Collections Stored." << G4endl;
}
} else {
st1 = false;
}
}
}
// Store digits collection
//
obj = "Digits";
if ( f_pc->CurrentStoreMode(obj) == kOn ) {
if ( G4DCofThisEvent* dc = evt->GetDCofThisEvent() ) {
file = f_pc->CurrentWriteFile(obj);
if ( TransactionManager()->SelectWriteFile(obj, file) ) {
st2 = DigitIO()->Store(dc);
if ( st2 && m_verbose > 1 ) {
G4cout << " -- File : " << file << " -- Event# "
<< evt->GetEventID()
<< " -- Digit Collections Stored." << G4endl;
}
} else {
st2 = false;
}
}
}
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
// Store this G4EVENT
//
if ( hepevt!=0 || mctevt!=0 || evt!=0 ) {
obj = "Hits";
file = f_pc->CurrentWriteFile(obj);
if ( TransactionManager()->SelectWriteFile(obj, file) ) {
// st3 = EventIO()->Store(hepevt, mctevt, evt);
st3 = EventIO()->Store(hepevt, evt);
if ( st3 && m_verbose > 1 ) {
G4cout << " -- File name: " << f_pc->CurrentWriteFile("Hits")
<< " -- Event# " << evt->GetEventID()
<< " -- G4Pevent is Stored." << G4endl;
}
} else {
st3 = false;
}
}
G4bool st = sthep && stmct && st1 && st2 && st3;
#else
G4bool st = st1 && st2;
#endif
#else
G4bool st = st1 && st2;
#endif
if ( st ) {
TransactionManager()->Commit();
if ( m_verbose > 0 )
G4cout << "G4PersistencyManager: event# "
<< evt->GetEventID() << " is stored." << G4endl;
} else {
G4cerr << "G4PersistencyManager::Store(G4Event) - Transaction aborted."
<< G4endl;
TransactionManager()->Abort();
}
return st;
}
// Implementation of Retrieve
G4bool G4PersistencyManager::Retrieve(G4Event*& evt)
{
if ( m_verbose > 2 ) {
G4cout << "G4PersistencyManager::Retrieve(G4Event*&) is called."
<< G4endl;
}
if ( TransactionManager() == 0 ) return true;
if ( f_pc->CurrentRetrieveMode("HepMC") == false &&
f_pc->CurrentRetrieveMode("MCTruth") == false &&
f_pc->CurrentRetrieveMode("Hits") == false &&
f_pc->CurrentRetrieveMode("Digits") == false ) {
return true;
}
// Call package dependent Initialize()
//
if ( ! f_is_initialized ) {
f_is_initialized = true;
if ( m_verbose > 1 ) {
G4cout << "G4PersistencyManager:: Initializing Transaction ... "
<< G4endl;
}
Initialize();
}
// Start event IO transaction
//
if ( TransactionManager()->StartRead() ) {
if ( m_verbose > 2 ) {
G4cout << "G4PersistencyManager: Read transaction started."
<< G4endl;
}
} else {
G4cerr << "TransactionManager::Retrieve(G4Event) - StartRead() failed."
<< G4endl;
return false;
}
G4bool st = false;
std::string file;
// Retrieve a G4EVENT
//
std::string obj = "Hits";
if ( f_pc->CurrentRetrieveMode(obj) == true ) {
file = f_pc->CurrentReadFile(obj);
if ( TransactionManager()->SelectReadFile(obj, file) ) {
st = EventIO()->Retrieve(evt);
if ( st && m_verbose > 1 ) {
G4cout << " -- File : " << file << " -- Event# "
<< evt->GetEventID()
<< " -- G4Event is Retrieved." << G4endl;
}
} else {
st = false;
}
}
if ( st ) {
TransactionManager()->Commit();
} else {
G4cerr << "G4PersistencyManager::Retrieve() - Transaction aborted."
<< G4endl;
TransactionManager()->Abort();
}
return st;
}
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
// Implementation of Retrieve
G4bool G4PersistencyManager::Retrieve(HepMC::GenEvent*& evt, int id)
{
if ( m_verbose > 2 ) {
G4cout << "G4PersistencyManager::Retrieve(HepMC::GenEvent*&) is called."
<< G4endl;
}
if ( TransactionManager() == 0 ) return true;
// Call package dependent Initialize()
//
if ( ! f_is_initialized ) {
f_is_initialized = true;
if ( m_verbose > 1 ) {
G4cout << "G4PersistencyManager:: Initializing Transaction ... "
<< G4endl;
}
Initialize();
}
// Start event IO transaction
//
if ( TransactionManager()->StartRead() ) {
if ( m_verbose > 2 ) {
G4cout << "G4PersistencyManager: Read transaction started."
<< G4endl;
}
} else {
G4cerr << "TransactionManager::Retrieve(HepMC) - StartRead() failed."
<< G4endl;
return false;
}
G4bool st = false;
std::string file;
// Retrieve a HepMC GenEvent
//
std::string obj = "HepMC";
if ( f_pc->CurrentRetrieveMode(obj) == true ) {
file = f_pc->CurrentReadFile(obj);
if ( TransactionManager()->SelectReadFile(obj, file) ) {
st = HepMCIO()->Retrieve(evt, id);
if ( st && m_verbose > 1 ) {
G4cout << " -- File: " << file
<< " - Event# " << HepMCIO()->LastEventID()
<< " - HepMC event is Retrieved." << G4endl;
}
} else {
st = false;
}
}
if ( st ) {
TransactionManager()->Commit();
} else {
G4cerr << "G4PersistencyManager::Retrieve(HepMC) - Transaction aborted."
<< G4endl;
TransactionManager()->Abort();
}
return st;
}
#endif
#endif
// End of G4PersistencyManager.cc
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * 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: G4Pevent.cc
//
// History:
// '01.11.18 Youhei Morita Initial creation
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
#include "G4Pevent.hh"
//G4Pevent::G4Pevent( HepMC::GenEvent* hepevt, G4MCTEvent* mctevt, G4Event* g4evt )
// : f_hepevt(hepevt), genEventID(-1), f_mctevt(mctevt), f_g4evt(g4evt)
G4Pevent::G4Pevent( HepMC::GenEvent* hepevt, G4Event* g4evt )
: f_hepevt(hepevt), genEventID(-1), f_g4evt(g4evt)
{
m_id = g4evt->GetEventID();
if (hepevt) genEventID= hepevt->event_number();
}
G4Pevent::~G4Pevent()
{
delete f_g4evt;
}
#endif
#endif
@@ -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: G4VDCIOentry.cc
//
// History:
// '01.09.12 Youhei Morita Initial creation
#include "G4VDCIOentry.hh"
// Addtional Include:
#include "G4DCIOcatalog.hh"
// Implementation of Constructor #1
G4VDCIOentry::G4VDCIOentry(std::string n)
: m_name(n)
{
G4DCIOcatalog* c = G4DCIOcatalog::GetDCIOcatalog();
c->RegisterEntry(this);
m_verbose = G4PersistencyCenter::GetPersistencyCenter()->VerboseLevel();
}
// End of G4VDCIOentry.cc
@@ -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: G4VHCIOentry.cc
//
// History:
// '01.09.12 Youhei Morita Initial creation
#include "G4VHCIOentry.hh"
// Addtional Include:
#include "G4HCIOcatalog.hh"
// Implementation of Constructor #1
G4VHCIOentry::G4VHCIOentry(std::string n)
: m_name(n)
{
G4HCIOcatalog* c = G4HCIOcatalog::GetHCIOcatalog();
c->RegisterEntry(this);
m_verbose = G4PersistencyCenter::GetPersistencyCenter()->VerboseLevel();
}
// End of G4VHCIOentry.cc
@@ -0,0 +1,44 @@
//
// ********************************************************************
// * 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: G4VHepMCIO.cc
//
// History:
// '01.11.18 Youhei Morita Initial creation
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
#include "G4VHepMCIO.hh"
// Implementation of Constructor #1
G4VHepMCIO::G4VHepMCIO()
: m_verbose(0)
{}
// End of G4VHepMCIO.cc
#endif
#endif
@@ -0,0 +1,42 @@
//
// ********************************************************************
// * 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: G4VMCTruthIO.cc
//
// History:
// '01.11.18 Youhei Morita Initial creation
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
#include "G4VMCTruthIO.hh"
// Implementation of Constructor #1
G4VMCTruthIO::G4VMCTruthIO()
: m_verbose(0)
{}
#endif
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * 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: G4VPDigitIO.cc
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
#include "G4VPDigitIO.hh"
G4VPDigitIO* G4VPDigitIO::f_G4VPDigitIO = 0;
// Implementation of Constructor #1
G4VPDigitIO::G4VPDigitIO()
: m_verbose(0)
{
f_catalog = G4DCIOcatalog::GetDCIOcatalog();
}
// Implementation of SetVerboseLevel
void G4VPDigitIO::SetVerboseLevel(int v)
{
m_verbose = v;
// Loop through the registered Digit I/O managers
for ( size_t i=0; i < f_catalog->NumberOfDCIOmanager(); i++ ) {
G4VPDigitsCollectionIO* digitIOman = f_catalog->GetDCIOmanager(i);
digitIOman->SetVerboseLevel(v);
}
}
// End of G4VPDigitIO.cc
@@ -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: G4VPDigitsCollectionIO.cc
//
// History:
// '01.08.16 Youhei Morita Initial creation
#include "G4VPDigitsCollectionIO.hh"
// Implementation of Constructor #1
G4VPDigitsCollectionIO::G4VPDigitsCollectionIO( std::string detName,
std::string colName )
: m_verbose(0), f_detName(detName), f_colName(colName)
{}
// Implementation of operator==
G4bool G4VPDigitsCollectionIO::operator== (const G4VPDigitsCollectionIO& right) const
{
return ( (f_detName == right.f_detName) &&
(f_colName == right.f_colName) );
}
// End of G4VPDigitsCollectionIO.cc
@@ -0,0 +1,39 @@
//
// ********************************************************************
// * 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: G4VPEventIO.cc
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
#include "G4VPEventIO.hh"
// Implementation of Default Constructor
G4VPEventIO::G4VPEventIO()
: m_verbose(0), m_currentEvtID(0)
{
}
// End of G4VPEventIO.cc
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * 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: G4VPHitIO.cc
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
#include "G4VPHitIO.hh"
G4VPHitIO* G4VPHitIO::f_G4VPHitIO = 0;
// Implementation of Constructor #1
G4VPHitIO::G4VPHitIO()
: m_verbose(0)
{
f_catalog = G4HCIOcatalog::GetHCIOcatalog();
}
// Implementation of SetVerboseLevel
void G4VPHitIO::SetVerboseLevel(int v)
{
m_verbose = v;
// Loop through the registered Hit I/O managers
for ( size_t i=0; i < f_catalog->NumberOfHCIOmanager(); i++ ) {
G4VPHitsCollectionIO* hitIOman = f_catalog->GetHCIOmanager(i);
hitIOman->SetVerboseLevel(v);
}
}
// End of G4VPHitIO.cc
@@ -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: G4VPHitsCollectionIO.cc
//
// History:
// '01.08.16 Youhei Morita Initial creation
#include "G4VPHitsCollectionIO.hh"
// Implementation of Constructor #1
G4VPHitsCollectionIO::G4VPHitsCollectionIO( std::string detName,
std::string colName )
: m_verbose(0), f_detName(detName), f_colName(colName)
{}
// Implementation of operator==
G4bool G4VPHitsCollectionIO::operator== (const G4VPHitsCollectionIO& right) const
{
return ( (f_detName == right.f_detName) &&
(f_colName == right.f_colName) );
}
// End of G4VPHitsCollectionIO.cc