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,99 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// '01.09.12 Youhei Morita Initial creation
#ifndef DCIO_CATALOG_HH
#define DCIO_CATALOG_HH 1
#include <map>
#include "G4Types.hh"
#include "G4VPDigitsCollectionIO.hh"
class G4VDCIOentry;
typedef std::map<std::string, G4VDCIOentry*, std::less<std::string> > DCIOmap;
typedef std::map<std::string, G4VPDigitsCollectionIO*, std::less<std::string> > DCIOstore;
// Class Description:
// Catalog for the I/O manager of digits collection for each detector.
class G4DCIOcatalog
{
public: // With description
G4DCIOcatalog();
// Constructor
virtual ~G4DCIOcatalog() {};
// Destructor
public: // With description
static G4DCIOcatalog* GetDCIOcatalog();
// Construct G4DCIOcatalog and returns the pointer
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
void RegisterEntry(G4VDCIOentry* d);
// Register I/O manager entry
void RegisterDCIOmanager(G4VPDigitsCollectionIO* d);
// Register I/O manager
G4VDCIOentry* GetEntry(std::string name);
// Returns the I/O manager entry
G4VPDigitsCollectionIO* GetDCIOmanager(std::string name);
// Returns the registered I/O manager entry
void PrintEntries();
// Prints the list of I/O manager entries
std::string CurrentDCIOmanager();
// Returns the list of I/O managers
void PrintDCIOmanager();
// Prints the list of I/O managers
size_t NumberOfDCIOmanager() { return theStore.size(); };
// Returns the number of registered I/O managers.
G4VPDigitsCollectionIO* GetDCIOmanager(int n);
// Returns the n-th registered I/O manager entry
private:
int m_verbose;
static G4DCIOcatalog* f_thePointer;
DCIOmap theCatalog;
DCIOstore theStore;
}; // End of class G4DCIOcatalog
#endif
@@ -0,0 +1,87 @@
//
// ********************************************************************
// * 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: G4DCIOentryT.hh
//
// History:
// '01.09.12 Youhei Morita Initial creation
#ifndef DCIO_ENTRY_T_HH
#define DCIO_ENTRY_T_HH 1
#include <string>
#include "G4Types.hh"
#include "G4VPDigitsCollectionIO.hh"
// Class inherited:
#include "G4VDCIOentry.hh"
// Class Description:
// Template class of DigitsCollection I/O Manager for late binding
template <class T> class G4DCIOentryT
: public G4VDCIOentry
{
public: // With description
G4DCIOentryT<T>(std::string n)
: G4VDCIOentry(n), f_manager(0)
{
if ( m_verbose > 2 ) {
G4cout << "G4DCIOentryT: Registering DigitsCollection IO manager"
<< " for \"" << n << "\"" << G4endl;
}
}
// Constructor
~G4DCIOentryT() {};
// Destructor
public: // With description
void CreateDCIOmanager(std::string detName, std::string colName)
{
if ( f_manager == 0 ) {
f_manager = new T( detName, colName );
if ( m_verbose > 2 ) {
G4cout << "G4DCIOentryT: Constructing DigitsCollection IO manager"
<< " for \"" << detName << "\" " << f_manager << G4endl;
}
G4DCIOcatalog::GetDCIOcatalog()->RegisterDCIOmanager(f_manager);
if ( m_verbose > 2 ) {
G4DCIOcatalog::GetDCIOcatalog()->PrintDCIOmanager();
}
}
}
// Create a new digits collection I/O manager
void DeleteDCIOmanager() { if (f_manager!=0) delete f_manager; };
// Delete a digits collection I/O manager
private:
G4VPDigitsCollectionIO* f_manager;
}; // End of class G4DCIOentryT
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// 01.08.24 Youhei Morita Initial creation
#ifndef FILE_UTILITIES_HH
#define FILE_UTILITIES_HH 1
#include "G4Types.hh"
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <iostream>
// Class Description:
// File utilities to access files with POSIX interface.
class G4FileUtilities
{
public: // With description
G4FileUtilities();
// Constructor
~G4FileUtilities();
// Destructor
public: // With description
G4bool FileExists(const std::string file);
// checks if the "file" exists. returns true if it does.
std::string StrErrNo() const { return ::strerror(errno); };
// returns the error message of the last system call as string.
int Shell(std::string s) { return ::system(s.c_str()); };
// execute the shell command. returns zero if success.
int CopyFile(const std::string srcFile, const std::string dstFile);
// copies the "srcFile" to "dstFile". returns zero if success.
int DeleteFile(const std::string file, const std::string option);
// deletes the "file" with the "option". returns zero if success.
std::string GetEnv(const std::string env) { return ::getenv(env.c_str()); };
// retuns the value of environment variable as string.
}; // End of class G4FileUtilities
#endif
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// '01.09.12 Youhei Morita Initial creation
#ifndef HCIO_CATALOG_HH
#define HCIO_CATALOG_HH 1
#include <map>
#include "G4Types.hh"
#include "G4VPHitsCollectionIO.hh"
class G4VHCIOentry;
typedef std::map<std::string, G4VHCIOentry*, std::less<std::string> > HCIOmap;
typedef std::map<std::string, G4VPHitsCollectionIO*, std::less<std::string> > HCIOstore;
// Class Description:
// Catalog for the I/O manager of hits collection for each detector.
class G4HCIOcatalog
{
public: // With description
G4HCIOcatalog();
// Constructor
virtual ~G4HCIOcatalog() {};
// Destructor
public: // With description
static G4HCIOcatalog* GetHCIOcatalog();
// Construct G4HCIOcatalog and returns the pointer
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
void RegisterEntry(G4VHCIOentry* d);
// Register I/O manager entry
void RegisterHCIOmanager(G4VPHitsCollectionIO* d);
// Register I/O manager
G4VHCIOentry* GetEntry(std::string name);
// Returns the I/O manager entry
G4VPHitsCollectionIO* GetHCIOmanager(std::string name);
// Returns the registered I/O manager entry
void PrintEntries();
// Prints the list of I/O manager entries
std::string CurrentHCIOmanager();
// Returns the list of I/O managers
void PrintHCIOmanager();
// Prints the list of I/O managers
size_t NumberOfHCIOmanager() { return theStore.size(); };
// Returns the number of registered I/O managers.
G4VPHitsCollectionIO* GetHCIOmanager(int n);
// Returns the n-th registered I/O manager entry
private:
int m_verbose;
static G4HCIOcatalog* f_thePointer;
HCIOmap theCatalog;
HCIOstore theStore;
}; // End of class G4HCIOcatalog
#endif
@@ -0,0 +1,87 @@
//
// ********************************************************************
// * 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: G4HCIOentryT.hh
//
// History:
// '01.09.12 Youhei Morita Initial creation
#ifndef HCIO_ENTRY_T_HH
#define HCIO_ENTRY_T_HH 1
#include <string>
#include "G4Types.hh"
#include "G4VPHitsCollectionIO.hh"
// Class inherited:
#include "G4VHCIOentry.hh"
// Class Description:
// Template class of HitsCollection I/O Manager for late binding
template <class T> class G4HCIOentryT
: public G4VHCIOentry
{
public: // With description
G4HCIOentryT<T>(std::string n)
: G4VHCIOentry(n), f_manager(0)
{
if ( m_verbose > 2 ) {
G4cout << "G4HCIOentryT: Registering HitsCollection IO manager"
<< " for \"" << n << "\"" << G4endl;
}
}
// Constructor
~G4HCIOentryT() {};
// Destructor
public: // With description
void CreateHCIOmanager(std::string detName, std::string colName)
{
if ( f_manager == 0 ) {
f_manager = new T( detName, colName );
if ( m_verbose > 2 ) {
G4cout << "G4HCIOentryT: Constructing HitsCollection IO manager"
<< " for \"" << detName << "\" " << f_manager << G4endl;
}
G4HCIOcatalog::GetHCIOcatalog()->RegisterHCIOmanager(f_manager);
if ( m_verbose > 2 ) {
G4HCIOcatalog::GetHCIOcatalog()->PrintHCIOmanager();
}
}
}
// Create a new hits collection I/O manager
void DeleteHCIOmanager() { if (f_manager!=0) delete f_manager; };
// Delete a hits collection I/O manager
private:
G4VPHitsCollectionIO* f_manager;
}; // End of class G4HCIOentryT
#endif
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * 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.hh
//
// ====================================================================
#ifndef MCT_EVENT_H
#define MCT_EVENT_H
#include "G4Types.hh"
#include <iostream>
#include <map>
#include "G4MCTGenParticle.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4MCTGenEvent;
class G4MCTSimEvent;
class G4MCTSimParticle;
typedef std::map<G4MCTGenParticle, G4MCTSimParticle*> MCTGen2SimParticleMap;
typedef std::map<G4MCTSimParticle*, G4MCTGenParticle> MCTSim2GenParticleMap;
class G4MCTEvent {
protected:
int eventNumber;
G4MCTGenEvent* genEvent;
G4MCTSimEvent* simEvent;
// primary table (bidirectional)
MCTGen2SimParticleMap gen2simParticleMap;
MCTSim2GenParticleMap sim2genParticleMap;
public:
G4MCTEvent();
virtual ~G4MCTEvent();
// copy constructor and assignment operator
G4MCTEvent(const G4MCTEvent& right);
const G4MCTEvent& operator=(const G4MCTEvent& right);
// set/get functions
void SetEventNumber(int n);
int GetEventNumber() const;
G4MCTGenEvent* GetGenEvent() const;
G4MCTSimEvent* GetSimEvent() const;
// methods...
int GetNofPrimaries() const;
G4MCTSimParticle* GetSimParticle(const G4MCTGenParticle& genpart) const;
G4MCTGenParticle GetGenParticle(const G4MCTSimParticle* simpart) const;
int AddPrimaryPair(const G4MCTGenParticle& genp,
const G4MCTSimParticle* simp);
void ClearEvent();
void Print(std::ostream& ostr= std::cout) const;
// iterators
typedef MCTGen2SimParticleMap::const_iterator genprimary_const_iterator;
genprimary_const_iterator genprimaries_begin() const;
genprimary_const_iterator genprimaries_end() const;
typedef MCTSim2GenParticleMap::const_iterator simprimary_const_iterator;
simprimary_const_iterator simprimaries_begin() const;
simprimary_const_iterator simprimaries_end() const;
};
// ====================================================================
// inline functions
// ====================================================================
inline G4MCTEvent::G4MCTEvent(const G4MCTEvent& right)
{
*this= right;
}
inline const G4MCTEvent& G4MCTEvent::operator=(const G4MCTEvent& right)
{
eventNumber= right.eventNumber;
simEvent= right.simEvent; // shallow copy...
genEvent= right.genEvent;
gen2simParticleMap= right.gen2simParticleMap;
sim2genParticleMap= right.sim2genParticleMap;
return *this;
}
inline void G4MCTEvent::SetEventNumber(int n) { eventNumber= n; }
inline int G4MCTEvent::GetEventNumber() const { return eventNumber; }
inline int G4MCTEvent::GetNofPrimaries() const
{ return gen2simParticleMap.size(); }
inline G4MCTSimEvent* G4MCTEvent::GetSimEvent() const { return simEvent; }
inline G4MCTGenEvent* G4MCTEvent::GetGenEvent() const { return genEvent; }
// iterators
inline G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_begin() const
{ return gen2simParticleMap.begin(); }
inline G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_end() const
{ return gen2simParticleMap.end(); }
inline G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_begin() const
{ return sim2genParticleMap.begin(); }
inline G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_end() const
{ return sim2genParticleMap.end(); }
#endif
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * 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.hh
//
// ====================================================================
#ifndef MCT_GEN_EVENT_H
#define MCT_GEN_EVENT_H
#include "G4Types.hh"
#include <iostream>
#include <vector>
#include "CLHEP/HepMC/GenEvent.h"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4MCTGenEvent {
protected:
std::vector<HepMC::GenEvent*> eventList;
public:
G4MCTGenEvent();
virtual ~G4MCTGenEvent();
// copy constructor and assignment operator
G4MCTGenEvent(const G4MCTGenEvent& right);
const G4MCTGenEvent& operator=(const G4MCTGenEvent& right);
// methods...
int AddGenEvent(const HepMC::GenEvent* genevent);
int GetNofEvents() const;
const HepMC::GenEvent* GetGenEvent(int i);
void ClearEvent();
void Print(std::ostream& ostr= std::cout) const;
};
// ====================================================================
// inline functions
// ====================================================================
inline G4MCTGenEvent::G4MCTGenEvent(const G4MCTGenEvent& right)
{
*this= right;
}
inline const G4MCTGenEvent& G4MCTGenEvent::operator=(const G4MCTGenEvent& right)
{
eventList= right.eventList; // shallow copy
return *this;
}
#endif
@@ -0,0 +1,40 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// G4MCTGenParticle.hh
//
// ====================================================================
#ifndef MCT_GEN_PARTICLE_H
#define MCT_GEN_PARTICLE_H
#include "G4Types.hh"
#include <algorithm>
#include "CLHEP/HepMC/GenEvent.h"
#include "CLHEP/HepMC/GenParticle.h"
typedef std::pair<HepMC::GenEvent*, HepMC::GenParticle*> G4MCTGenParticle;
#endif
@@ -0,0 +1,142 @@
//
// ********************************************************************
// * 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.hh
//
// ====================================================================
#ifndef MCT_SIM_EVENT_H
#define MCT_SIM_EVENT_H
#include "G4Types.hh"
#include <iostream>
#include <vector>
#include <map>
// ====================================================================
//
// class definition
//
// ====================================================================
class G4MCTSimParticle;
class G4MCTSimVertex;
typedef std::map<int, G4MCTSimParticle*> G4MCTSimParticleContainer;
typedef std::vector<G4MCTSimVertex*> G4MCTSimVertexContainer;
class G4MCTSimEvent {
protected:
G4MCTSimParticleContainer particleMap;
G4MCTSimVertexContainer vertexVec;
public:
G4MCTSimEvent();
~G4MCTSimEvent();
// copy constructor and assignment operator
G4MCTSimEvent(const G4MCTSimEvent& right);
const G4MCTSimEvent& operator=(const G4MCTSimEvent& right);
// methods...
G4bool AddParticle(const G4MCTSimParticle* aparticle);
int GetNofParticles() const;
int GetNofVertices() const;
int GetNofStoredParticles() const;
int GetNofStoredVertices() const;
G4MCTSimParticle* FindParticle(int tid) const;
G4MCTSimVertex* GetVertex(int vid) const;
void BuildVertexContainer();
void ClearEvent();
void Print(std::ostream& ostr= std::cout) const;
// iterators
typedef G4MCTSimParticleContainer::iterator particle_iterator;
typedef G4MCTSimParticleContainer::const_iterator particle_const_iterator;
particle_iterator particles_begin();
particle_iterator particles_end();
particle_const_iterator particles_begin() const;
particle_const_iterator particles_end() const;
typedef G4MCTSimVertexContainer::iterator vertex_iterator;
typedef G4MCTSimVertexContainer::const_iterator vertex_const_iterator;
vertex_iterator vertices_begin();
vertex_iterator vertices_end();
vertex_const_iterator vertices_begin() const;
vertex_const_iterator vertices_end() const;
};
// ====================================================================
// inline functions
// ====================================================================
inline G4MCTSimEvent::G4MCTSimEvent(const G4MCTSimEvent& right)
{
*this= right;
}
inline const G4MCTSimEvent& G4MCTSimEvent::operator=(const G4MCTSimEvent& right)
{
particleMap= right.particleMap; // shallow copy
return *this;
}
inline int G4MCTSimEvent::GetNofParticles() const
{
return particleMap.size();
}
inline int G4MCTSimEvent::GetNofVertices() const
{
return vertexVec.size();
}
// iterators
inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_begin()
{ return particleMap.begin(); }
inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_end()
{ return particleMap.end(); }
inline G4MCTSimEvent::particle_const_iterator
G4MCTSimEvent::particles_begin() const
{ return particleMap.begin(); }
inline G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_end() const
{ return particleMap.end(); }
inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_begin()
{ return vertexVec.begin(); }
inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_end()
{ return vertexVec.end(); }
inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_begin() const
{ return vertexVec.begin(); }
inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_end() const
{ return vertexVec.end(); }
#endif
@@ -0,0 +1,184 @@
//
// ********************************************************************
// * 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.hh
//
// ====================================================================
#ifndef MCT_SIM_PARTICLE_H
#define MCT_SIM_PARTICLE_H
#include "G4Types.hh"
#include <vector>
#include <string>
#include <iostream>
#include "G4LorentzVector.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4MCTSimVertex;
class G4MCTSimParticle;
typedef std::vector<G4MCTSimParticle*> SimParticleList;
class G4MCTSimParticle {
protected:
G4MCTSimParticle* parentParticle;
std::vector<G4MCTSimParticle*> associatedParticleList;
std::string name;
int pdgID;
int trackID;
int parentTrackID;
G4bool primaryFlag;
G4LorentzVector momentumAtVertex;
G4MCTSimVertex* vertex;
G4bool storeFlag;
public:
G4MCTSimParticle();
G4MCTSimParticle(std::string aname, int apcode, int atid, int ptid,
const G4LorentzVector& p);
G4MCTSimParticle(std::string aname, int apcode, int atid, int ptid,
const G4LorentzVector& p, const G4MCTSimVertex* v);
virtual ~G4MCTSimParticle();
// copy constructor and assignment operator
G4MCTSimParticle(const G4MCTSimParticle& right);
const G4MCTSimParticle& operator=(const G4MCTSimParticle& right);
// set/get functions
void SetParentParticle(const G4MCTSimParticle* p);
G4MCTSimParticle* GetParentParticle() const;
void SetParticleName(std::string aname);
const std::string& GetParticleName() const;
void SetPdgID(int id);
int GetPdgID() const;
void SetTrackID(int id);
int GetTrackID() const;
void SetParentTrackID(int id);
int GetParentTrackID() const;
void SetPrimaryFlag(G4bool q);
G4bool GetPrimaryFlag() const;
void SetMomentumAtVertex(const G4LorentzVector& p);
const G4LorentzVector& GetMomentumAtVertex() const;
void SetVertex(const G4MCTSimVertex* v);
G4MCTSimVertex* GetVertex() const;
void SetStoreFlag(G4bool q);
G4bool GetStoreFlag() const;
// methods...
int AssociateParticle(G4MCTSimParticle* p);
int GetNofAssociatedParticles() const;
G4MCTSimParticle* GetAssociatedParticle(int i) const;
int GetTreeLevel() const;
void SetStoreFlagToParentTree(G4bool q=true);
void Print(std::ostream& ostr= std::cout, G4bool qrevorder=false) const;
void PrintSingle(std::ostream& ostr= std::cout) const;
};
// ====================================================================
// inline functions
// ====================================================================
inline G4MCTSimParticle::G4MCTSimParticle(const G4MCTSimParticle& right)
{
*this= right;
}
inline const G4MCTSimParticle&
G4MCTSimParticle::operator=(const G4MCTSimParticle& right)
{
parentParticle= right.parentParticle;
associatedParticleList= right.associatedParticleList; // shallow copy
name= right.name;
pdgID= right.pdgID;
trackID= right.trackID;
parentTrackID= right.parentTrackID;
primaryFlag= right.primaryFlag;
momentumAtVertex= right.momentumAtVertex;
vertex= right.vertex;
return *this;
}
inline void G4MCTSimParticle::SetParentParticle(const G4MCTSimParticle* p)
{ parentParticle= const_cast<G4MCTSimParticle*>(p); }
inline G4MCTSimParticle* G4MCTSimParticle::GetParentParticle() const
{ return parentParticle; }
inline void G4MCTSimParticle::SetParticleName(std::string aname)
{ name= aname; }
inline const std::string& G4MCTSimParticle::GetParticleName() const
{ return name; }
inline void G4MCTSimParticle::SetPdgID(int id) { pdgID= id; }
inline int G4MCTSimParticle::GetPdgID() const { return pdgID; }
inline void G4MCTSimParticle::SetTrackID(int id) { trackID= id; }
inline int G4MCTSimParticle::GetTrackID() const { return trackID; }
inline void G4MCTSimParticle::SetPrimaryFlag(G4bool q) { primaryFlag= q; }
inline G4bool G4MCTSimParticle::GetPrimaryFlag() const { return primaryFlag; }
inline void G4MCTSimParticle::SetParentTrackID(int id)
{ parentTrackID= id; }
inline int G4MCTSimParticle::GetParentTrackID() const
{ return parentTrackID; }
inline void G4MCTSimParticle::SetMomentumAtVertex(const G4LorentzVector& p)
{ momentumAtVertex= p; }
inline const G4LorentzVector& G4MCTSimParticle::GetMomentumAtVertex() const
{ return momentumAtVertex; }
inline void G4MCTSimParticle::SetVertex(const G4MCTSimVertex* v)
{ vertex= const_cast<G4MCTSimVertex*>(v); }
inline G4MCTSimVertex* G4MCTSimParticle::GetVertex() const
{ return vertex; }
inline void G4MCTSimParticle::SetStoreFlag(G4bool q) { storeFlag= q; }
inline G4bool G4MCTSimParticle::GetStoreFlag() const { return storeFlag; }
#endif
@@ -0,0 +1,196 @@
//
// ********************************************************************
// * 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.hh
//
// ====================================================================
#ifndef MCT_SIM_VERTEX_H
#define MCT_SIM_VERTEX_H
#include "G4Types.hh"
#include <iostream>
#include <vector>
#include <string>
#include "G4ThreeVector.hh"
#include "G4MCTSimParticle.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4MCTSimVertex {
private:
int inParticleTrackID;
std::vector<int> outParticleTrackIDList;
int id; // assigned independently from G4
G4ThreeVector position;
double time;
std::string volumeName;
int volumeNumber;
std::string creatorProcessName;
G4bool storeFlag;
public:
G4MCTSimVertex();
G4MCTSimVertex(const G4ThreeVector& x, double t);
G4MCTSimVertex(const G4ThreeVector& x, double t,
std::string vname, int ncopy, std::string pname);
~G4MCTSimVertex();
// copy constructor and assignment operator
G4MCTSimVertex(const G4MCTSimVertex& right);
const G4MCTSimVertex& operator=(const G4MCTSimVertex& right);
// set/get functions
void SetID(int i);
int GetID() const;
void SetPosition(const G4ThreeVector& x);
const G4ThreeVector& GetPosition() const;
void SetTime(double t);
double GetTime() const;
void SetVolumeName(std::string vname);
const std::string& GetVolumeName() const;
void SetVolumeNumber(int n);
int GetVolumeNumber() const;
void SetCreatorProcessName(std::string pname);
const std::string& GetCreatorProcessName() const;
void SetStoreFlag(G4bool q);
G4bool GetStoreFlag() const;
// methods...
void SetInParticle(const G4MCTSimParticle* in);
void SetInParticle(int in);
int GetInParticleTrackID() const;
int GetNofOutParticles() const;
int AddOutParticle(const G4MCTSimParticle* out);
int AddOutParticle(int out);
int GetOutParticleTrackID(int i) const;
void Print(std::ostream& ostr= std::cout) const;
};
// ====================================================================
// inline functions
// ====================================================================
inline G4MCTSimVertex::G4MCTSimVertex(const G4MCTSimVertex& right)
{
*this= right;
}
inline const G4MCTSimVertex&
G4MCTSimVertex::operator=(const G4MCTSimVertex& right)
{
inParticleTrackID= right.inParticleTrackID;
outParticleTrackIDList= right.outParticleTrackIDList;
id= right.id;
position= right.position;
time= right.time;
volumeName= right.volumeName;
volumeNumber= right.volumeNumber;
creatorProcessName= right.creatorProcessName;
return *this;
}
inline void G4MCTSimVertex::SetID(int i) { id= i; }
inline int G4MCTSimVertex::GetID() const { return id; }
inline void G4MCTSimVertex::SetPosition(const G4ThreeVector& x)
{ position= x; }
inline const G4ThreeVector& G4MCTSimVertex::GetPosition() const
{ return position; }
inline void G4MCTSimVertex::SetTime(double t)
{ time= t; }
inline double G4MCTSimVertex::GetTime() const
{ return time; }
inline void G4MCTSimVertex::SetVolumeName(std::string vname)
{ volumeName= vname; }
inline const std::string& G4MCTSimVertex::GetVolumeName() const
{ return volumeName; }
inline void G4MCTSimVertex::SetVolumeNumber(int n)
{ volumeNumber= n; }
inline int G4MCTSimVertex::GetVolumeNumber() const
{ return volumeNumber; }
inline void G4MCTSimVertex::SetCreatorProcessName(std::string pname)
{ creatorProcessName= pname; }
inline const std::string& G4MCTSimVertex::GetCreatorProcessName() const
{ return creatorProcessName; }
inline void G4MCTSimVertex::SetStoreFlag(G4bool q) { storeFlag= q; }
inline G4bool G4MCTSimVertex::GetStoreFlag() const { return storeFlag; }
inline void G4MCTSimVertex::SetInParticle(const G4MCTSimParticle* in)
{ inParticleTrackID= in-> GetTrackID(); }
inline void G4MCTSimVertex::SetInParticle(int in)
{ inParticleTrackID= in; }
inline int G4MCTSimVertex::GetInParticleTrackID() const
{ return inParticleTrackID; }
inline int G4MCTSimVertex::GetNofOutParticles() const
{ return outParticleTrackIDList.size(); }
inline int G4MCTSimVertex::AddOutParticle(const G4MCTSimParticle* out)
{
outParticleTrackIDList.push_back(out->GetTrackID());
return outParticleTrackIDList.size();
}
inline int G4MCTSimVertex::AddOutParticle(int out)
{
outParticleTrackIDList.push_back(out);
return outParticleTrackIDList.size();
}
inline int G4MCTSimVertex::GetOutParticleTrackID(int i) const
{
int size= outParticleTrackIDList.size();
if(i>=0 && i< size) return outParticleTrackIDList[i];
else return 0;
}
#endif
@@ -0,0 +1,180 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
#ifndef PERSISTENCY_CENTER_HH
#define PERSISTENCY_CENTER_HH 1
#include "G4Types.hh"
#include <string>
#include <vector>
#include <map>
#include "G4HCIOcatalog.hh"
#include "G4VHCIOentry.hh"
#include "G4DCIOcatalog.hh"
#include "G4VDCIOentry.hh"
#ifndef WIN32
#include "G4FileUtilities.hh"
#endif
// Forward Declaration to avoid circular dependencies.
class G4PersistencyManager;
typedef std::map<std::string, G4PersistencyManager*,std::less<std::string> > PMap;
typedef std::map<int, std::string, std::less<int> > ObjMap;
typedef std::map<std::string, std::string, std::less<std::string> > FileMap;
enum StoreMode { kOn, kOff, kRecycle };
typedef std::map<std::string, StoreMode, std::less<std::string> > StoreMap;
typedef std::map<std::string, G4bool, std::less<std::string> > BoolMap;
// Forward Declarations:
class G4PersistencyCenterMessenger;
// Class Description:
// Class to handle loading of the G4PersistencyManager.
class G4PersistencyCenter
{
public: // With description
G4PersistencyCenter();
G4PersistencyCenter(const G4PersistencyCenter&);
// Constructor
~G4PersistencyCenter();
// Destructor
public: // With description
static G4PersistencyCenter* GetPersistencyCenter();
// returns the pointer of singleton G4PersistencyCenter
void SelectSystem(std::string systemName);
// Select the persistency package
const std::string CurrentSystem() { return f_currentSystemName; };
// returns the current persistent package name
void SetHepMCObjyReaderFile(std::string file);
// Sets the name of HepMCObjyReader file name. To be called by generator.
std::string CurrentHepMCObjyReaderFile();
// Sets the name of HepMCObjyReader file name. To be called by generator.
void SetStoreMode(std::string objName, StoreMode mode);
// Sets the object store mode. Modes are kOn, kOff or kRecycle.
void SetRetrieveMode(std::string objName, G4bool mode);
// Sets the object retrieve mode. Modes are true or false.
StoreMode CurrentStoreMode(std::string objName);
// returns the current object store mode.
G4bool CurrentRetrieveMode(std::string objName);
// returns the current object store mode.
G4bool SetWriteFile(std::string objName, std::string writeFileName);
// Sets the output filename.
G4bool SetReadFile(std::string objName, std::string readFileName);
// Sets the input filename.
std::string CurrentWriteFile(std::string objName);
// returns the current output filename.
std::string CurrentReadFile(std::string objName);
// returns the current input filename.
std::string CurrentObject(std::string file);
// returns the current object type
void AddHCIOmanager(std::string detName, std::string colName);
// add a hits colleciton I/O manager to the catalog
std::string CurrentHCIOmanager();
// Returns a list of registered hits colleciton I/O managers
void AddDCIOmanager(std::string detName);
// add a digits colleciton I/O manager to the catalog
std::string CurrentDCIOmanager();
// Returns a list of registered digits colleciton I/O managers
void PrintAll();
// prints the current G4PersistencyCenter settings.
G4PersistencyManager* CurrentPersistencyManager() { return f_currentManager; };
// returns the pointer of the currnet G4PersistencyManager.
void SetPersistencyManager(G4PersistencyManager* pm, std::string name);
// returns the pointer of the currnet G4PersistencyManager.
G4PersistencyManager* GetPersistencyManager(std::string nam);
// returns the pointer of the currnet G4PersistencyManager with name.
void RegisterPersistencyManager(G4PersistencyManager* pm);
// registers the persistency manager to the runtime catalog.
void DeletePersistencyManager();
// deletes the current G4PersistencyManager.
void SetVerboseLevel(int v);
// Set verbose level.
int VerboseLevel() { return m_verbose; };
// Return verbose level.
private:
std::string PadString(std::string name, unsigned int width);
// truncate or pad a string up to the width.
private:
G4PersistencyCenterMessenger* f_G4PersistencyCenterMessenger;
private:
G4PersistencyCenterMessenger* f_theMessenger;
static G4PersistencyCenter* f_thePointer;
G4PersistencyManager* f_currentManager;
std::string f_currentSystemName;
PMap f_theCatalog;
ObjMap f_wrObj;
ObjMap f_rdObj;
FileMap f_writeFileName;
FileMap f_readFileName;
StoreMap f_writeFileMode;
BoolMap f_readFileMode;
G4int m_verbose;
#ifndef WIN32
G4FileUtilities f_ut;
#endif
}; // End of class G4PersistencyCenter
#endif
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// 01.07.18 Youhei Morita Initial creation (with "fadsclass")
#ifndef PERSISTENCY_CENTER_MESSENGER_HH
#define PERSISTENCY_CENTER_MESSENGER_HH 1
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4PersistencyCenter.hh"
// Class inherited:
#include "G4UImessenger.hh"
// Class Description:
// User interface messenger class to interface G4PersistencyCenter
class G4PersistencyCenterMessenger
: public G4UImessenger
{
public: // With description
G4PersistencyCenterMessenger(G4PersistencyCenter* p);
// Constructor
~G4PersistencyCenterMessenger();
// Destructor
public: // With description
void SetNewValue(G4UIcommand* command, G4String newValues);
// User interface for setting a new value
G4String GetCurrentValue(G4UIcommand* command);
// User interface for getting a value
private:
std::string PopWord(std::string text, int n, std::string delim);
// Parse text and returns the n-th words separated by delim
private:
G4PersistencyCenter* pc;
G4UIdirectory* directory, *subdir1, *subdir2,
*subdir3, *subdir4, *subdir5;
G4UIcmdWithAnInteger* verboseCmd;
G4UIcmdWithAString* select;
G4UIcmdWithAString* regHitIO;
std::vector<std::string> wrObj;
std::vector<std::string> rdObj;
std::vector<G4UIcmdWithAString*> storeObj;
std::vector<G4UIcmdWithAString*> setWrFile;
std::vector<G4UIcmdWithAString*> setRdFile;
G4UIcmdWithoutParameter* printAll;
}; // End of class G4PersistencyCenterMessenger
#endif
@@ -0,0 +1,218 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// 01.07.17 Youhei Morita Initial creation (with "fadsclass")
#ifndef PERSISTENCY_MANAGER_HH
#define PERSISTENCY_MANAGER_HH 1
#include "G4Event.hh"
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
#include "CLHEP/HepMC/GenEvent.h"
#include "G4VHepMCIO.hh"
#include "G4VMCTruthIO.hh"
#endif
#endif
#include "G4HCIOcatalog.hh"
#include "G4DCIOcatalog.hh"
#include "G4VPEventIO.hh"
#include "G4VPHitIO.hh"
#include "G4VPDigitIO.hh"
#include "G4VTransactionManager.hh"
#include <string>
class G4PersistencyCenter;
// Class inherited:
#include "G4VPersistencyManager.hh"
// Class Description:
// Manager base class to handle event store and retrieve operation.
// Actual persistency implementation should be handled with
// derived classes.
//
// Each persistency package should implement derived classes of
// G4VHepMCIO, G4VMCTruthIO, G4VPHitIO, G4VPDigitIO, G4VPEventIO.
// Concreate G4PersistencyManager should implement the methods
// HepMCIO(), MCTruthIO(), HitIO(), DigitIO() and EventIO() to
// return the pointers of the above classes.
// G4PersistencyManager handles the sequence of the storing and
// retrieving of the persistent object of each type, along with
// the transaction handling.
//
// Retrieving a HepMC event:
//
// G4PersistencyManager::Retrieve( HepMC::GenEvent*& )
// |
// | ... StartRead() ...
// |
// | ... HepMCIO()->Retrieve() ...
// |
// | ... Commit() ...
// V
//
// Storing a Geant4 event:
//
// G4PersistencyManager::Store( G4Pevent* )
// |
// | ... StartUpdate() ...
// |
// | ... HepMCIO()->Store( HepMC event ) ...
// |
// | ... MCTruthIO()->Store( MCTruth event ) ...
// |
// | ... HitIO()->Store( hit_collection_of_event ) ...
// |
// | ... DigitIO()->Store( digit_collection_of_event ) ...
// |
// | ... EventIO()->Store( event with hits and digits ) ...
// |
// | ... Commit() ...
// V
//
// Retrieving a Geant event:
//
// G4PersistencyManager::Retrieve( event )
// |
// | ... StartRead() ...
// |
// | ... EventIO()->Retrieve( event ) ...
// |
// | ... Commit() ...
// V
//
// Hit collection and digit collection of each detector component
// should be handled by detector specific I/O manager, which
// should be registered to the G4PersistencyCenter with
// AddHCIOmanager() and AddDCIOmanager(). Usually this is done
// through a command
//
// /Persistency/Store/Using/HitIO <detector_io_manager_name>
//
// which is handled by G4PersistencyCenterMessenger.
//
// A static template declaration of G4HCIOentryT<class> must be
// implementated for each I/O manager.
class G4PersistencyManager
: public G4VPersistencyManager
{
friend class G4PersistencyCenter;
public: // With description
G4PersistencyManager(G4PersistencyCenter* pc, std::string n);
// Constructor
virtual ~G4PersistencyManager();
// Destructor
public: // With description
virtual G4PersistencyManager* Create() {return 0;};
// Create a new persistency manager. To be used by G4PersistencyManagerT<>.
std::string GetName() {return nameMgr;};
// Get the name of persistency manager
virtual G4VPEventIO* EventIO() { return 0; };
// Returns the current event I/O handling manager
// Each derived class should return the pointer of actual manager.
virtual G4VPHitIO* HitIO() { return 0; };
// Returns the current hit I/O handling manager
// Each derived class should return the pointer of actual manager.
virtual G4VPDigitIO* DigitIO() { return 0; };
// Returns the current digit I/O handling manager
// Each derived class should return the pointer of actual manager.
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
virtual G4VHepMCIO* HepMCIO() { return 0; };
// Returns the current HepMC I/O handling manager
// Each derived class should return the pointer of actual manager.
virtual G4VMCTruthIO* MCTruthIO() { return 0; };
// Returns the current MCTruth I/O handling manager
// Each derived class should return the pointer of actual manager.
#endif
#endif
virtual G4VTransactionManager* TransactionManager() { return 0; };
// Returns the current transaction manager
// Each derived class should return the pointer of actual manager.
virtual void Initialize() {};
// Initialize the persistency package.
// Each derived class should implement the acutal initialization sequence.
void SetVerboseLevel(int v);
// Set verbose level.
G4bool Store(const G4Event* evt);
// Store the G4Event and its associated objects
G4bool Retrieve(G4Event*& evt);
// Retrieve the G4Event and its associated objects
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
G4bool Retrieve(HepMC::GenEvent*& evt, int id=-1);
// retrieves HepMC GenEvent and its associated object.
// To be used by generator/HepMCObjyReader.
#endif
#endif
G4bool Store(const G4Run*) {return false;};
// not used
G4bool Retrieve(G4Run*&) {return false;};
// not used
G4bool Store(const G4VPhysicalVolume*) {return false;};
// not used
G4bool Retrieve(G4VPhysicalVolume*&) {return false;};
// not used
protected:
static G4PersistencyManager* GetPersistencyManager();
// Get the instance of persistency manager
protected:
G4PersistencyCenter* f_pc;
int m_verbose;
private:
std::string nameMgr;
// GeneratorCenter* f_GenCenter;
// G4MCTManager* f_MCTman;
G4bool f_is_initialized;
}; // End of class G4PersistencyManager
#endif
@@ -0,0 +1,130 @@
//
// ********************************************************************
// * 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: G4PersistencyManagerT.hh
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
#ifndef PERSISTENCY_MANAGER_T_HH
#define PERSISTENCY_MANAGER_T_HH 1
#include "G4PersistencyCenter.hh"
// Class inherited:
#include "G4PersistencyManager.hh"
// Class Description:
// Template class of G4PersistencyManager for late binding
template <class T> class G4PersistencyManagerT
: public G4PersistencyManager
{
public: // With description
G4PersistencyManagerT(G4PersistencyCenter* pc, std::string n)
: G4PersistencyManager(pc, n), pm(0)
{
if ( m_verbose > 2 ) {
G4cout << "G4PersistencyManagerT: Registering G4PersistencyManager \""
<< n << "\"" << G4endl;
}
G4PersistencyCenter::GetPersistencyCenter()->
RegisterPersistencyManager(this);
}
// Constructor
~G4PersistencyManagerT() {};
// Destructor
public: // With description
G4PersistencyManager* Create()
{
pm = new T(f_pc, GetName());
return pm;
}
// Create a new persistency manager
void Delete() { if (pm!=0) delete pm; };
// Delete a persistency mamanger
G4VPEventIO* EventIO()
{
if (pm) return pm->EventIO();
else return 0;
};
// Returns the current event I/O handling manager
G4VPHitIO* HitIO()
{
if (pm) return pm->HitIO();
else return 0;
};
// Returns the current hit I/O handling manager
G4VPDigitIO* DigitIO()
{
if (pm) return pm->DigitIO();
else return 0;
};
// Returns the current digit I/O handling manager
G4VHepMCIO* HepMCIO()
{
if (pm) return pm->HepMCIO();
else return 0;
};
// Returns the current digit I/O handling manager
G4VMCTruthIO* MCTruthIO()
{
if (pm) return pm->MCTruthIO();
else return 0;
};
// Returns the current digit I/O handling manager
G4VTransactionManager* TransactionManager()
{
if (pm) return pm->TransactionManager();
else return 0;
};
// Returns the current transaction manager
void Initialize() {};
// Initialize the persistency package.
void SetVerboseLevel(int v)
{
if (pm) return pm->SetVerboseLevel();
else return 0;
};
// Sets the verbose level to the persistency manager
private:
G4PersistencyManager* pm;
}; // End of class G4PersistencyManagerT
#endif
@@ -0,0 +1,90 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// '01.11.18 Youhei Morita Initial creation
#ifndef G4PEVENT_HH
#define G4PEVENT_HH 1
#include "G4Event.hh"
// not yet // #include "G4MCTEvent.hh"
#include "CLHEP/HepMC/GenEvent.h"
// Class Description:
// Geant4 event object for store.
//
// This class has pointers to HepMC::GenEvent, MCTruth and G4Event.
//
// In the event store operation, this object will be created in the concrete
// class of G4VPEventIO::Store() method, and will be deleted immediately after
// creating persistent Geant4 event.
//
// In the event retrieve operation, this object will be created in the
// concrete Persistency::Retrieve() method. The retrieved G4Pevent
// has to be deleted by the user method which called the Retrieve().
class G4Pevent
{
public: // With description
// G4Pevent( HepMC::GenEvent* hepevt, G4MCTEvent* mctevt, G4Event* g4evt );
G4Pevent( HepMC::GenEvent* hepevt, G4Event* g4evt );
// Constructor
~G4Pevent();
// Destructor
public: // With description
int GetEventID() { return m_id; };
// returns the event ID.
G4Event* GetEvent() { return f_g4evt; };
// returns the G4Event.
HepMC::GenEvent* GetHepMCGenEvent() { return f_hepevt; };
// returns the HepMC GenEvent.
// G4MCTEvent* GetMCTEvent() { return f_mctevt; };
// returns the MCTruth event.
int GetGenEventID() const { return genEventID; };
// returns the GenEvent ID.
void SetGenEventID(int id) { genEventID=id; };
// set the GenEvent ID.
private:
HepMC::GenEvent* f_hepevt;
int genEventID;
// G4MCTEvent* f_mctevt;
G4Event* f_g4evt;
int m_id;
}; // End of class G4Pevent
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// '01.09.12 Youhei Morita Initial creation
#ifndef VDCIO_ENTRY_T_HH
#define VDCIO_ENTRY_T_HH 1
#include "G4Types.hh"
#include <string>
#include "G4PersistencyCenter.hh"
// Class Description:
// Abstract base class for digits collection I/O manager entry
class G4VDCIOentry
{
public: // With description
G4VDCIOentry(std::string n);
// Constructor
virtual ~G4VDCIOentry() {}
// Destructor
public: // With description
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Set verbose level.
std::string GetName() { return m_name; }
// Returns the name of the DC I/O manager entry
virtual void CreateDCIOmanager(std::string, std::string) {}
// virtual method for creating DC I/O manager for the detector
protected:
G4int m_verbose;
private:
std::string m_name;
}; // End of class G4VDCIOentry
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// '01.09.12 Youhei Morita Initial creation
#ifndef VHCIO_ENTRY_T_HH
#define VHCIO_ENTRY_T_HH 1
#include "G4Types.hh"
#include <string>
#include "G4PersistencyCenter.hh"
// Class Description:
// Abstract base class for hits collection I/O manager entry
class G4VHCIOentry
{
public: // With description
G4VHCIOentry(std::string n);
// Constructor
virtual ~G4VHCIOentry() {}
// Destructor
public: // With description
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Set verbose level.
std::string GetName() { return m_name; }
// Returns the name of the HC I/O manager entry
virtual void CreateHCIOmanager(std::string, std::string) {}
// virtual method for creating HC I/O manager for the detector
protected:
G4int m_verbose;
private:
std::string m_name;
}; // End of class G4VHCIOentry
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// '01.11.18 Youhei Morita Initial creation
#ifndef G4V_HEPMC_IO_HH
#define G4V_HEPMC_IO_HH 1
#include "G4Types.hh"
#include "CLHEP/HepMC/GenEvent.h"
// Class Description:
// Abstract base class for storing and retrieving HepMC events.
class G4VHepMCIO
{
public: // With description
G4VHepMCIO();
// Constructor
virtual ~G4VHepMCIO() {};
// Destructor
public: // With description
virtual G4bool Store(HepMC::GenEvent*) =0;
// Pure virtual method for storing HepMC GenEvent.
// Each persistency package should implement a concrete method
// of storing the HepMC::GenEvent with this signature.
virtual G4bool Retrieve(HepMC::GenEvent*&, int id=-1) =0;
// Pure virtual method for retrieving HepMC GenEvent.
// Each persistency package should implement a concrete method
// of storing the HepMC::GenEvent with this signature.
virtual int LastEventID() =0;
// Pure virtual method for the event ID
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
protected:
G4int m_verbose;
}; // End of class G4VHepMCIO
#endif
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// '01.11.18 Youhei Morita Initial creation
#ifndef V_M_C_TRUTH_I_O_HH
#define V_M_C_TRUTH_I_O_HH 1
#include "G4MCTEvent.hh"
// Class Description:
// Abstract base class for storing and retrieving MCTruth events.
class G4VMCTruthIO
{
public: // With description
G4VMCTruthIO();
// Constructor
virtual ~G4VMCTruthIO() {};
// Destructor
public: // With description
virtual G4bool Store(G4MCTEvent*) =0;
// Pure virtual method for storing MCTruth Event.
// Each persistency package should implement a concrete method
// of storing the G4MCTEvent with this signature.
virtual G4bool Retrieve(G4MCTEvent*&) =0;
// Pure virtual method for retrieving MCTruth Event.
// Each persistency package should implement a concrete method
// of storing the G4MCTEvent with this signature.
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
protected:
G4int m_verbose;
}; // End of class G4VMCTruthIO
#endif
@@ -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: G4VPDigitIO.hh
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
#ifndef V_P_DIGIT_I_O_HH
#define V_P_DIGIT_I_O_HH 1
#include "G4DCofThisEvent.hh"
#include "G4DCIOcatalog.hh"
#include "G4VPDigitsCollectionIO.hh"
// Class Description:
// Abstract base class for storing and retrieving digit collections
class G4VPDigitIO
{
public: // With description
G4VPDigitIO();
// Constructor
virtual ~G4VPDigitIO() {};
// Destructor
public: // With description
G4VPDigitIO* GetVPDigitIO() { return f_G4VPDigitIO; };
// Returns the pointer of the digit collection I/O manager.
virtual G4bool Store(const G4DCofThisEvent*) =0;
// Pure virtual method for storing digit collections of this event.
// Each persistency package should implement a concrete method
// of storing the digit collection of this event with this signature.
virtual G4bool Retrieve(G4DCofThisEvent*&) =0;
// Pure virtual method for retrieving digit collections of this event.
// Each persistency package should implement a concrete method
// of storing the digit collection of this event with this signature.
void SetVerboseLevel(int v);
// Set verbose level.
protected:
void SetG4VPDigitIO(G4VPDigitIO* digitMan) { f_G4VPDigitIO = digitMan; };
// Registers the digit collection I/O manager.
protected:
G4int m_verbose;
static G4VPDigitIO* f_G4VPDigitIO;
G4DCIOcatalog* f_catalog;
}; // End of class G4VPDigitIO
#endif
@@ -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: G4VPDigitsCollectionIO.hh
//
// History:
// '01.08.16 Youhei Morita Initial creation
#ifndef V_P_DIGITS_COLLECTION_I_O_HH
#define V_P_DIGITS_COLLECTION_I_O_HH 1
#include "G4VDigiCollection.hh"
// Class Description:
// Abstract base class for storing and retrieving digit collections
class G4VPDigitsCollectionIO
{
public: // With description
G4VPDigitsCollectionIO( std::string detName, std::string colName );
// Constructor
virtual ~G4VPDigitsCollectionIO() {};
// Destructor
public: // With description
virtual G4bool Store(const G4VDigiCollection*) =0;
// Pure virtual method for storing the digit collection.
// Each persistency package should implement a concrete method
// with this signature.
virtual G4bool Retrieve(G4VDigiCollection*&) =0;
// Pure virtual method for retrieving the digit collection.
// Each persistency package should implement a concrete method
// with this signature.
G4bool operator== (const G4VPDigitsCollectionIO& right) const;
// virtual operator for comparing digit collections with names.
std::string DMname() { return f_detName; };
// Returns the digitizer module name.
std::string CollectionName() { return f_colName; };
// Returns the digit collection name.
void SetVerboseLevel(int v) { m_verbose = v; };
// Sets the verbose level
protected:
G4int m_verbose;
std::string f_detName;
std::string f_colName;
}; // End of class G4VPDigitsCollectionIO
#endif
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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.hh
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
#ifndef V_P_EVENT_I_O_HH
#define V_P_EVENT_I_O_HH 1
#include "G4Event.hh"
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
#include "CLHEP/HepMC/GenEvent.h"
// not yet // #include "G4MCTEvent.hh"
#include "G4Pevent.hh"
#endif
#endif
// Class Description:
// Abstract base class for storing and retrieving an event object
class G4VPEventIO
{
public: // With description
G4VPEventIO();
// Constructor
virtual ~G4VPEventIO() {};
// Destructor
public: // With description
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
inline G4int CurrentEventID() { return m_currentEvtID; };
// Returns the current event id.
virtual G4bool Store( const G4Event* anEvent ) =0;
// Store a Geant4 event.
#ifndef WIN32
#ifdef G4LIB_USE_HEPMC
// virtual G4bool Store( HepMC::GenEvent* hepevt, G4MCTEvent* mctevt, const G4Event* anEvent ) =0;
virtual G4bool Store( HepMC::GenEvent* hepevt, const G4Event* anEvent ) =0;
// Store a Geant4 event.
virtual G4bool Retrieve( G4Pevent*& anEvent ) =0;
// Retrieve a Geant4 event.
#endif
#endif
virtual G4bool Retrieve( G4Event*& anEvent ) =0;
// Retrieve a Geant4 event.
protected:
G4int m_verbose;
G4int m_currentEvtID;
}; // End of class G4VPEventIO
#endif
@@ -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: G4VPHitIO.hh
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
#ifndef V_P_HIT_I_O_HH
#define V_P_HIT_I_O_HH 1
#include "G4HCofThisEvent.hh"
#include "G4HCIOcatalog.hh"
#include "G4VPHitsCollectionIO.hh"
// Class Description:
// Abstract base class for storing and retrieving hit collections
class G4VPHitIO
{
public: // With description
G4VPHitIO();
// Constructor
virtual ~G4VPHitIO() {};
// Destructor
public: // With description
G4VPHitIO* GetVPHitIO() { return f_G4VPHitIO; };
// Returns the pointer of the hit collection I/O manager.
virtual G4bool Store(const G4HCofThisEvent*) =0;
// Pure virtual method for storing hit collections of this event.
// Each persistency package should implement a concrete method
// of storing the hit collection of this event with this signature.
virtual G4bool Retrieve(G4HCofThisEvent*&) =0;
// Pure virtual method for retrieving hit collections of this event.
// Each persistency package should implement a concrete method
// of storing the hit collection of this event with this signature.
void SetVerboseLevel(int v);
// Set verbose level.
protected:
void SetG4VPHitIO(G4VPHitIO* hitMan) { f_G4VPHitIO = hitMan; };
// Registers the hit collection I/O manager.
protected:
G4int m_verbose;
static G4VPHitIO* f_G4VPHitIO;
G4HCIOcatalog* f_catalog;
}; // End of class G4VPHitIO
#endif
@@ -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: G4VPHitsCollectionIO.hh
//
// History:
// '01.08.16 Youhei Morita Initial creation
#ifndef V_P_HITS_COLLECTION_I_O_HH
#define V_P_HITS_COLLECTION_I_O_HH 1
#include "G4VHitsCollection.hh"
// Class Description:
// Abstract base class for storing and retrieving hit collections
class G4VPHitsCollectionIO
{
public: // With description
G4VPHitsCollectionIO( std::string detName, std::string colName );
// Constructor
virtual ~G4VPHitsCollectionIO() {};
// Destructor
public: // With description
virtual G4bool Store(const G4VHitsCollection*) =0;
// Pure virtual method for storing the hit collection.
// Each persistency package should implement a concrete method
// with this signature.
virtual G4bool Retrieve(G4VHitsCollection*&) =0;
// Pure virtual method for retrieving the hit collection.
// Each persistency package should implement a concrete method
// with this signature.
G4bool operator== (const G4VPHitsCollectionIO& right) const;
// virtual operator for comparing hit collections with names.
std::string SDname() { return f_detName; };
// Returns the sensitive detector name.
std::string CollectionName() { return f_colName; };
// Returns the hit collection name.
void SetVerboseLevel(int v) { m_verbose = v; };
// Sets the verbose level
protected:
G4int m_verbose;
std::string f_detName;
std::string f_colName;
}; // End of class G4VPHitsCollectionIO
#endif
@@ -0,0 +1,77 @@
//
// ********************************************************************
// * 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: G4VTransactionManager.hh
//
// History:
// 01.07.18 Youhei Morita Initial creation (with "fadsclass")
#ifndef V_TRANSACTION_MANAGER_HH
#define V_TRANSACTION_MANAGER_HH 1
#include "G4Types.hh"
#include <string>
// Class Description:
// Abstract base class for starting and commiting or aborting data transaction
class G4VTransactionManager
{
public: // With description
G4VTransactionManager() : m_verbose(0) {};
// Constructor
virtual ~G4VTransactionManager() {};
// Destructor
public: // With description
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
virtual G4bool SelectReadFile(std::string obj, std::string file)=0;
// Set the input file name and open it for the object type "obj".
virtual G4bool SelectWriteFile(std::string obj, std::string file)=0;
// Set the output file name and open it for the object type "obj".
virtual G4bool StartUpdate()=0;
// Start an update transaction for event store and retrieve
virtual G4bool StartRead()=0;
// Start a read-only transaction for event store and retrieve
virtual void Commit()=0;
// commit the transaction for event store and retrieve
virtual void Abort()=0;
// abort the transaction for event store and retrieve
protected:
G4int m_verbose;
}; // End of class G4VTransactionManager
#endif