Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
@@ -23,13 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4DCIOcatalog.hh
// G4DCIOcatalog
//
// History:
// '01.09.12 Youhei Morita Initial creation
// Class Description:
//
// Catalog for the I/O manager of digits collection for each detector
#ifndef DCIO_CATALOG_HH
#define DCIO_CATALOG_HH 1
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4DCIOCATALOG_HH
#define G4DCIOCATALOG_HH 1
#include <map>
#include "G4Types.hh"
@@ -37,63 +40,60 @@
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.
using DCIOmap = std::map<G4String, G4VDCIOentry*,
std::less<G4String>>;
using DCIOstore = std::map<G4String, G4VPDigitsCollectionIO*,
std::less<G4String>>;
class G4DCIOcatalog
{
public: // With description
G4DCIOcatalog();
public:
G4DCIOcatalog();
// Constructor
virtual ~G4DCIOcatalog() {};
virtual ~G4DCIOcatalog() {}
// Destructor
public: // With description
static G4DCIOcatalog* GetDCIOcatalog();
static G4DCIOcatalog* GetDCIOcatalog();
// Construct G4DCIOcatalog and returns the pointer
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
void SetVerboseLevel(int v) { m_verbose = v; }
// Set verbose level
void RegisterEntry(G4VDCIOentry* d);
void RegisterEntry(G4VDCIOentry* d);
// Register I/O manager entry
void RegisterDCIOmanager(G4VPDigitsCollectionIO* d);
void RegisterDCIOmanager(G4VPDigitsCollectionIO* d);
// Register I/O manager
G4VDCIOentry* GetEntry(std::string name);
G4VDCIOentry* GetEntry(const G4String& name);
// Returns the I/O manager entry
G4VPDigitsCollectionIO* GetDCIOmanager(std::string name);
G4VPDigitsCollectionIO* GetDCIOmanager(const G4String& name);
// Returns the registered I/O manager entry
void PrintEntries();
void PrintEntries();
// Prints the list of I/O manager entries
std::string CurrentDCIOmanager();
G4String CurrentDCIOmanager();
// Returns the list of I/O managers
void PrintDCIOmanager();
void PrintDCIOmanager();
// Prints the list of I/O managers
size_t NumberOfDCIOmanager() { return theStore.size(); };
// Returns the number of registered I/O managers.
std::size_t NumberOfDCIOmanager() { return theStore.size(); }
// Returns the number of registered I/O managers
G4VPDigitsCollectionIO* GetDCIOmanager(int n);
G4VPDigitsCollectionIO* GetDCIOmanager(G4int n);
// Returns the n-th registered I/O manager entry
private:
int m_verbose;
static G4ThreadLocal G4DCIOcatalog* f_thePointer;
DCIOmap theCatalog;
DCIOstore theStore;
private:
}; // End of class G4DCIOcatalog
G4int m_verbose = 0;
static G4ThreadLocal G4DCIOcatalog* f_thePointer;
DCIOmap theCatalog;
DCIOstore theStore;
};
#endif
@@ -25,11 +25,14 @@
//
// File: G4DCIOentryT.hh
//
// History:
// '01.09.12 Youhei Morita Initial creation
// Class Description:
//
// Template class of DigitsCollection I/O Manager for late binding
#ifndef DCIO_ENTRY_T_HH
#define DCIO_ENTRY_T_HH 1
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4DCIOENTRYT_HH
#define G4DCIOENTRYT_HH 1
#include <string>
#include "G4Types.hh"
@@ -38,50 +41,53 @@
// Class inherited:
#include "G4VDCIOentry.hh"
// Class Description:
// Template class of DigitsCollection I/O Manager for late binding
template <class T> class G4DCIOentryT
: public G4VDCIOentry
template <class T>
class G4DCIOentryT : public G4VDCIOentry
{
public: // With description
G4DCIOentryT<T>(std::string n)
: G4VDCIOentry(n), f_manager(0)
public:
G4DCIOentryT<T>(std::string n) : G4VDCIOentry(n)
{
if(m_verbose > 2)
{
if ( m_verbose > 2 ) {
G4cout << "G4DCIOentryT: Registering DigitsCollection IO manager"
<< " for \"" << n << "\"" << G4endl;
}
G4cout << "G4DCIOentryT: Registering DigitsCollection IO manager"
<< " for \"" << n << "\"" << G4endl;
}
}
// Constructor
~G4DCIOentryT() {};
~G4DCIOentryT() {}
// Destructor
public: // With description
void CreateDCIOmanager(std::string detName, std::string colName)
void CreateDCIOmanager(const G4String& detName, const G4String& colName)
{
if(f_manager == nullptr)
{
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();
}
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; };
void DeleteDCIOmanager()
{
if(f_manager != nullptr) { delete f_manager; }
}
// Delete a digits collection I/O manager
private:
G4VPDigitsCollectionIO* f_manager;
private:
}; // End of class G4DCIOentryT
G4VPDigitsCollectionIO* f_manager = nullptr;
};
#endif
@@ -23,15 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4FileUtilities.hh
// G4FileUtilities
//
// History:
// 01.08.24 Youhei Morita Initial creation
// Class Description:
//
// File utilities to access files with POSIX interface
#ifndef FILE_UTILITIES_HH
#define FILE_UTILITIES_HH 1
// Author: Youhei Morita, 24.08.2001
// --------------------------------------------------------------------
#ifndef G4FILE_UTILITIES_HH
#define G4FILE_UTILITIES_HH 1
#include "G4Types.hh"
#include "G4String.hh"
#include <sys/types.h>
#include <fcntl.h>
@@ -42,39 +46,34 @@
#include <string>
#include <iostream>
// Class Description:
// File utilities to access files with POSIX interface.
class G4FileUtilities
{
public: // With description
G4FileUtilities();
public:
G4FileUtilities();
// Constructor
~G4FileUtilities();
~G4FileUtilities();
// Destructor
public: // With description
G4bool FileExists(const std::string file);
// checks if the "file" exists. returns true if it does.
G4bool FileExists(const G4String& 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.
std::string StrErrNo() const { return ::strerror(errno); }
// returns the error message of the last system call as string
G4int Shell(std::string str) { return ::system(str.c_str()); };
// execute the shell command. returns zero if success.
G4int Shell(const G4String& str) { return ::system(str.c_str()); }
// executes the shell command. returns zero if success
G4int CopyFile(const std::string srcFile, const std::string dstFile);
// copies the "srcFile" to "dstFile". returns zero if success.
G4int CopyFile(const G4String& srcFile, const G4String& dstFile);
// copies the "srcFile" to "dstFile". returns zero if success
G4int DeleteFile(const std::string file, const std::string option);
// deletes the "file" with the "option". returns zero if success.
G4int DeleteFile(const G4String& file, const G4String& 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.
std::string GetEnv(const G4String& env) { return ::getenv(env.c_str()); }
// retuns the value of environment variable as string
}; // End of class G4FileUtilities
};
#endif
@@ -23,77 +23,78 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4HCIOcatalog.hh
// G4HCIOcatalog
//
// History:
// '01.09.12 Youhei Morita Initial creation
// Class Description:
//
// Catalog for the I/O manager of hits collection for each detector.
#ifndef HCIO_CATALOG_HH
#define HCIO_CATALOG_HH 1
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4HCIOCATALOG_HH
#define G4HCIOCATALOG_HH 1
#include <map>
#include "G4Types.hh"
#include "G4String.hh"
#include "G4VPHitsCollectionIO.hh"
class G4VHCIOentry;
typedef std::map<std::string, G4VHCIOentry*, std::less<std::string> > HCIOmap;
using HCIOmap = std::map<std::string, G4VHCIOentry*, std::less<std::string>>;
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.
using HCIOstore = std::map<G4String, G4VPHitsCollectionIO*,
std::less<G4String>>;
class G4HCIOcatalog
{
public: // With description
G4HCIOcatalog();
public:
G4HCIOcatalog();
// Constructor
virtual ~G4HCIOcatalog() {};
virtual ~G4HCIOcatalog() {}
// Destructor
public: // With description
static G4HCIOcatalog* GetHCIOcatalog();
static G4HCIOcatalog* GetHCIOcatalog();
// Construct G4HCIOcatalog and returns the pointer
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Set verbose level
void RegisterEntry(G4VHCIOentry* d);
void RegisterEntry(G4VHCIOentry* d);
// Register I/O manager entry
void RegisterHCIOmanager(G4VPHitsCollectionIO* d);
void RegisterHCIOmanager(G4VPHitsCollectionIO* d);
// Register I/O manager
G4VHCIOentry* GetEntry(std::string name);
G4VHCIOentry* GetEntry(const G4String& name);
// Returns the I/O manager entry
G4VPHitsCollectionIO* GetHCIOmanager(std::string name);
G4VPHitsCollectionIO* GetHCIOmanager(const G4String& name);
// Returns the registered I/O manager entry
void PrintEntries();
void PrintEntries();
// Prints the list of I/O manager entries
std::string CurrentHCIOmanager();
G4String CurrentHCIOmanager();
// Returns the list of I/O managers
void PrintHCIOmanager();
void PrintHCIOmanager();
// Prints the list of I/O managers
size_t NumberOfHCIOmanager() { return theStore.size(); };
std::size_t NumberOfHCIOmanager() { return theStore.size(); }
// Returns the number of registered I/O managers.
G4VPHitsCollectionIO* GetHCIOmanager(int n);
G4VPHitsCollectionIO* GetHCIOmanager(G4int n);
// Returns the n-th registered I/O manager entry
private:
int m_verbose;
static G4ThreadLocal G4HCIOcatalog* f_thePointer;
HCIOmap theCatalog;
HCIOstore theStore;
private:
}; // End of class G4HCIOcatalog
G4int m_verbose = 0;
static G4ThreadLocal G4HCIOcatalog* f_thePointer;
HCIOmap theCatalog;
HCIOstore theStore;
};
#endif
@@ -23,65 +23,70 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4HCIOentryT.hh
// G4HCIOentryT
//
// History:
// '01.09.12 Youhei Morita Initial creation
// Class Description:
//
// Template class of HitsCollection I/O Manager for late binding.
#ifndef HCIO_ENTRY_T_HH
#define HCIO_ENTRY_T_HH 1
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4HCIOENTRYT_HH
#define G4HCIOENTRYT_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
template <class T>
class G4HCIOentryT : public G4VHCIOentry
{
public: // With description
G4HCIOentryT<T>(std::string n)
: G4VHCIOentry(n), f_manager(0)
public:
G4HCIOentryT<T>(const G4String& n) : G4VHCIOentry(n)
{
if(m_verbose > 2)
{
if ( m_verbose > 2 ) {
G4cout << "G4HCIOentryT: Registering HitsCollection IO manager"
<< " for \"" << n << "\"" << G4endl;
}
G4cout << "G4HCIOentryT: Registering HitsCollection IO manager"
<< " for \"" << n << "\"" << G4endl;
}
}
// Constructor
~G4HCIOentryT() {};
~G4HCIOentryT() {}
// Destructor
public: // With description
void CreateHCIOmanager(std::string detName, std::string colName)
void CreateHCIOmanager(const G4String& detName, const G4String& colName)
{
if(f_manager == nullptr)
{
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();
}
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; };
void DeleteHCIOmanager()
{
if(f_manager != nullptr)
delete f_manager;
}
// Delete a hits collection I/O manager
private:
G4VPHitsCollectionIO* f_manager;
private:
}; // End of class G4HCIOentryT
G4VPHitsCollectionIO* f_manager = nullptr;
};
#endif
+103 -77
View File
@@ -23,114 +23,140 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4MCTEvent.hh
//
// ====================================================================
#ifndef MCT_EVENT_H
#define MCT_EVENT_H
// G4MCTEvent
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4MCTEVENT_HH
#define G4MCTEVENT_HH 1
#include "G4Types.hh"
#include <iostream>
#include <map>
#include "G4Types.hh"
#include "G4MCTGenParticle.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4MCTGenEvent;
class G4MCTSimEvent;
class G4MCTSimParticle;
typedef std::map<G4MCTGenParticle, G4MCTSimParticle*> MCTGen2SimParticleMap;
typedef std::map<G4MCTSimParticle*, G4MCTGenParticle> MCTSim2GenParticleMap;
using MCTGen2SimParticleMap = std::map<G4MCTGenParticle, G4MCTSimParticle*>;
using MCTSim2GenParticleMap = std::map<G4MCTSimParticle*, G4MCTGenParticle>;
class G4MCTEvent {
protected:
int eventNumber;
G4MCTGenEvent* genEvent;
G4MCTSimEvent* simEvent;
class G4MCTEvent
{
public:
// primary table (bidirectional)
MCTGen2SimParticleMap gen2simParticleMap;
MCTSim2GenParticleMap sim2genParticleMap;
G4MCTEvent();
virtual ~G4MCTEvent();
public:
G4MCTEvent();
virtual ~G4MCTEvent();
// copy constructor and assignment operator
G4MCTEvent(const G4MCTEvent& right);
const G4MCTEvent& operator=(const G4MCTEvent& right);
inline G4MCTEvent(const G4MCTEvent& right);
inline G4MCTEvent& operator=(const G4MCTEvent& right);
// copy constructor and assignment operator
// set/get functions
void SetEventNumber(int n);
int GetEventNumber() const;
inline void SetEventNumber(G4int n);
inline G4int GetEventNumber() const;
// set/get functions
G4MCTGenEvent* GetGenEvent() const;
G4MCTSimEvent* GetSimEvent() const;
inline G4MCTGenEvent* GetGenEvent() const;
inline 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;
inline G4int GetNofPrimaries() const;
G4MCTSimParticle* GetSimParticle(const G4MCTGenParticle& genpart) const;
G4MCTGenParticle GetGenParticle(const G4MCTSimParticle* simpart) const;
G4int 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;
// iterators
using genprimary_const_iterator = MCTGen2SimParticleMap::const_iterator;
inline genprimary_const_iterator genprimaries_begin() const;
inline genprimary_const_iterator genprimaries_end() const;
using simprimary_const_iterator = MCTSim2GenParticleMap::const_iterator;
inline simprimary_const_iterator simprimaries_begin() const;
inline simprimary_const_iterator simprimaries_end() const;
protected:
G4int eventNumber = 0;
G4MCTGenEvent* genEvent = nullptr;
G4MCTSimEvent* simEvent = nullptr;
// primary table (bidirectional)
MCTGen2SimParticleMap gen2simParticleMap;
MCTSim2GenParticleMap sim2genParticleMap;
};
// ====================================================================
// inline functions
// inline methods
// ====================================================================
inline G4MCTEvent::G4MCTEvent(const G4MCTEvent& right)
{
*this= right;
}
inline const G4MCTEvent& G4MCTEvent::operator=(const G4MCTEvent& right)
{
eventNumber= right.eventNumber;
inline G4MCTEvent::G4MCTEvent(const G4MCTEvent& right) { *this = right; }
simEvent= right.simEvent; // shallow copy...
genEvent= right.genEvent;
inline G4MCTEvent& G4MCTEvent::operator=(const G4MCTEvent& right)
{
eventNumber = right.eventNumber;
gen2simParticleMap= right.gen2simParticleMap;
sim2genParticleMap= right.sim2genParticleMap;
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 void G4MCTEvent::SetEventNumber(G4int n)
{
eventNumber = n;
}
inline int G4MCTEvent::GetNofPrimaries() const
{ return gen2simParticleMap.size(); }
inline G4MCTSimEvent* G4MCTEvent::GetSimEvent() const { return simEvent; }
inline G4MCTGenEvent* G4MCTEvent::GetGenEvent() const { return genEvent; }
inline G4int G4MCTEvent::GetEventNumber() const
{
return eventNumber;
}
inline G4int 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_begin() const
{
return gen2simParticleMap.cbegin();
}
inline G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_end() const
{ return gen2simParticleMap.end(); }
inline
G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_end() const
{
return gen2simParticleMap.cend();
}
inline G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_begin() const
{ return sim2genParticleMap.begin(); }
inline
G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_begin() const
{
return sim2genParticleMap.cbegin();
}
inline G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_end() const
{ return sim2genParticleMap.end(); }
inline
G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_end() const
{
return sim2genParticleMap.cend();
}
#endif
@@ -23,54 +23,52 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4MCTGenEvent.hh
//
// ====================================================================
#ifndef MCT_GEN_EVENT_H
#define MCT_GEN_EVENT_H
// G4MCTGenEvent
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4MCTGENEVENT_HH
#define G4MCTGENEVENT_HH 1
#include "G4Types.hh"
#include <iostream>
#include <vector>
// ====================================================================
//
// class definition
//
// ====================================================================
class G4MCTGenEvent {
protected:
std::vector<void*> eventList;
#include "G4Types.hh"
public:
G4MCTGenEvent();
virtual ~G4MCTGenEvent();
// copy constructor and assignment operator
G4MCTGenEvent(const G4MCTGenEvent& right);
const G4MCTGenEvent& operator=(const G4MCTGenEvent& right);
// methods...
int AddGenEvent(const void* genevent);
int GetNofEvents() const;
const void* GetGenEvent(int i);
class G4MCTGenEvent
{
public:
void ClearEvent();
G4MCTGenEvent();
virtual ~G4MCTGenEvent();
inline G4MCTGenEvent(const G4MCTGenEvent& right);
inline G4MCTGenEvent& operator=(const G4MCTGenEvent& right);
// copy constructor and assignment operator
G4int AddGenEvent(const void* genevent);
G4int GetNofEvents() const;
const void* GetGenEvent(G4int i);
void ClearEvent();
protected:
std::vector<void*> eventList;
};
// ====================================================================
// inline functions
// inline methods
// ====================================================================
inline G4MCTGenEvent::G4MCTGenEvent(const G4MCTGenEvent& right)
{
*this= right;
*this = right;
}
inline const G4MCTGenEvent& G4MCTGenEvent::operator=(const G4MCTGenEvent& right)
inline G4MCTGenEvent& G4MCTGenEvent::operator=(const G4MCTGenEvent& right)
{
eventList= right.eventList; // shallow copy
eventList = right.eventList; // shallow copy
return *this;
}
@@ -23,16 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4MCTGenParticle.hh
//
// ====================================================================
#ifndef MCT_GEN_PARTICLE_H
#define MCT_GEN_PARTICLE_H
// G4MCTGenParticle
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4MCTGENPARTICLE_HH
#define G4MCTGENPARTICLE_HH 1
#include "G4Types.hh"
#include <algorithm>
typedef std::pair<void*, void*> G4MCTGenParticle; // <event, particle>
using G4MCTGenParticle = std::pair<void*, void*>; // <event, particle>
#endif
@@ -23,120 +23,137 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4MCTSimEvent.hh
//
// ====================================================================
#ifndef MCT_SIM_EVENT_H
#define MCT_SIM_EVENT_H
// G4MCTSimEvent
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4MCTSIMEVENT_HH
#define G4MCTSIMEVENT_HH 1
#include "G4Types.hh"
#include <iostream>
#include <vector>
#include <map>
// ====================================================================
//
// class definition
//
// ====================================================================
#include "G4Types.hh"
class G4MCTSimParticle;
class G4MCTSimVertex;
typedef std::map<int, G4MCTSimParticle*> G4MCTSimParticleContainer;
typedef std::vector<G4MCTSimVertex*> G4MCTSimVertexContainer;
using G4MCTSimParticleContainer = std::map<int, G4MCTSimParticle*>;
using G4MCTSimVertexContainer = std::vector<G4MCTSimVertex*>;
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);
class G4MCTSimEvent
{
public:
// 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;
G4MCTSimEvent();
~G4MCTSimEvent();
void BuildVertexContainer();
void ClearEvent();
void Print(std::ostream& ostr= std::cout) const;
inline G4MCTSimEvent(const G4MCTSimEvent& right);
inline G4MCTSimEvent& operator=(const G4MCTSimEvent& right);
// copy constructor and assignment operator
// 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;
G4bool AddParticle(const G4MCTSimParticle* aparticle);
inline G4int GetNofParticles() const;
inline G4int GetNofVertices() const;
G4int GetNofStoredParticles() const;
G4int GetNofStoredVertices() const;
G4MCTSimParticle* FindParticle(G4int tid) const;
G4MCTSimVertex* GetVertex(G4int vid) const;
void BuildVertexContainer();
void ClearEvent();
void Print(std::ostream& ostr = std::cout) const;
// iterators
using particle_iterator = G4MCTSimParticleContainer::iterator;
using particle_const_iterator = G4MCTSimParticleContainer::const_iterator;
inline particle_iterator particles_begin();
inline particle_iterator particles_end();
inline particle_const_iterator particles_begin() const;
inline particle_const_iterator particles_end() const;
using vertex_iterator = G4MCTSimVertexContainer::iterator;
using vertex_const_iterator = G4MCTSimVertexContainer::const_iterator;
inline vertex_iterator vertices_begin();
inline vertex_iterator vertices_end();
inline vertex_const_iterator vertices_begin() const;
inline vertex_const_iterator vertices_end() const;
protected:
G4MCTSimParticleContainer particleMap;
G4MCTSimVertexContainer vertexVec;
};
// ====================================================================
// inline functions
// inline methods
// ====================================================================
inline G4MCTSimEvent::G4MCTSimEvent(const G4MCTSimEvent& right)
{
*this= right;
*this = right;
}
inline const G4MCTSimEvent& G4MCTSimEvent::operator=(const G4MCTSimEvent& right)
inline G4MCTSimEvent& G4MCTSimEvent::operator=(const G4MCTSimEvent& right)
{
particleMap= right.particleMap; // shallow copy
particleMap = right.particleMap; // shallow copy
return *this;
}
inline int G4MCTSimEvent::GetNofParticles() const
inline G4int G4MCTSimEvent::GetNofParticles() const
{
return particleMap.size();
}
inline int G4MCTSimEvent::GetNofVertices() const
inline G4int G4MCTSimEvent::GetNofVertices() const
{
return vertexVec.size();
}
// iterators
inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_begin()
{ return particleMap.begin(); }
{
return particleMap.begin();
}
inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_end()
{ return particleMap.end(); }
{
return particleMap.end();
}
inline G4MCTSimEvent::particle_const_iterator
G4MCTSimEvent::particles_begin() const
{ return particleMap.begin(); }
inline G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_begin()
const
{
return particleMap.cbegin();
}
inline G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_end() const
{ return particleMap.end(); }
inline G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_end()
const
{
return particleMap.cend();
}
inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_begin()
{ return vertexVec.begin(); }
{
return vertexVec.begin();
}
inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_end()
{ return vertexVec.end(); }
{
return vertexVec.end();
}
inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_begin() const
{ return vertexVec.begin(); }
inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_begin()
const
{
return vertexVec.cbegin();
}
inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_end() const
{ return vertexVec.end(); }
{
return vertexVec.cend();
}
#endif
@@ -23,162 +23,207 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4MCTSimParticle.hh
//
// ====================================================================
#ifndef MCT_SIM_PARTICLE_H
#define MCT_SIM_PARTICLE_H
// G4MCTSimParticle
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4MCTSIMPARTICLE_HH
#define G4MCTSIMPARTICLE_HH 1
#include "G4Types.hh"
#include <vector>
#include <string>
#include <iostream>
#include "G4Types.hh"
#include "G4LorentzVector.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4MCTSimVertex;
class G4MCTSimParticle;
typedef std::vector<G4MCTSimParticle*> SimParticleList;
using SimParticleList = std::vector<G4MCTSimParticle*>;
class G4MCTSimParticle {
protected:
G4MCTSimParticle* parentParticle;
std::vector<G4MCTSimParticle*> associatedParticleList;
class G4MCTSimParticle
{
public:
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);
G4MCTSimParticle();
G4MCTSimParticle(const G4String& aname,
G4int apcode, G4int atid, G4int ptid,
const G4LorentzVector& p);
G4MCTSimParticle(const G4String& aname,
G4int apcode, G4int atid, G4int ptid,
const G4LorentzVector& p, const G4MCTSimVertex* v);
virtual ~G4MCTSimParticle();
// set/get functions
void SetParentParticle(const G4MCTSimParticle* p);
G4MCTSimParticle* GetParentParticle() const;
inline G4MCTSimParticle(const G4MCTSimParticle& right);
inline G4MCTSimParticle& operator=(const G4MCTSimParticle& right);
// copy constructor and assignment operator
void SetParticleName(std::string aname);
const std::string& GetParticleName() const;
inline void SetParentParticle(const G4MCTSimParticle* p);
inline G4MCTSimParticle* GetParentParticle() const;
void SetPdgID(int id);
int GetPdgID() const;
inline void SetParticleName(std::string aname);
inline const G4String& GetParticleName() const;
void SetTrackID(int id);
int GetTrackID() const;
inline void SetPdgID(G4int id);
inline G4int GetPdgID() const;
void SetParentTrackID(int id);
int GetParentTrackID() const;
inline void SetTrackID(G4int id);
inline G4int GetTrackID() const;
void SetPrimaryFlag(G4bool q);
G4bool GetPrimaryFlag() const;
inline void SetParentTrackID(G4int id);
inline G4int GetParentTrackID() const;
void SetMomentumAtVertex(const G4LorentzVector& p);
const G4LorentzVector& GetMomentumAtVertex() const;
inline void SetPrimaryFlag(G4bool q);
inline G4bool GetPrimaryFlag() const;
void SetVertex(const G4MCTSimVertex* v);
G4MCTSimVertex* GetVertex() const;
inline void SetMomentumAtVertex(const G4LorentzVector& p);
inline const G4LorentzVector& GetMomentumAtVertex() const;
void SetStoreFlag(G4bool q);
G4bool GetStoreFlag() const;
inline void SetVertex(const G4MCTSimVertex* v);
inline G4MCTSimVertex* GetVertex() const;
// methods...
int AssociateParticle(G4MCTSimParticle* p);
int GetNofAssociatedParticles() const;
G4MCTSimParticle* GetAssociatedParticle(int i) const;
int GetTreeLevel() const;
void SetStoreFlagToParentTree(G4bool q=true);
inline void SetStoreFlag(G4bool q);
inline G4bool GetStoreFlag() const;
void Print(std::ostream& ostr= std::cout, G4bool qrevorder=false) const;
void PrintSingle(std::ostream& ostr= std::cout) const;
G4int AssociateParticle(G4MCTSimParticle* p);
G4int GetNofAssociatedParticles() const;
G4MCTSimParticle* GetAssociatedParticle(G4int i) const;
G4int 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;
protected:
G4MCTSimParticle* parentParticle = nullptr;
std::vector<G4MCTSimParticle*> associatedParticleList;
G4String name;
G4LorentzVector momentumAtVertex;
G4MCTSimVertex* vertex = nullptr;
G4int pdgID = 0;
G4int trackID = 0;
G4int parentTrackID = 0;
G4bool primaryFlag = false;
G4bool storeFlag = false;
};
// ====================================================================
// inline functions
// inline methods
// ====================================================================
inline G4MCTSimParticle::G4MCTSimParticle(const G4MCTSimParticle& right)
{
*this= 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;
inline 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); }
{
parentParticle = const_cast<G4MCTSimParticle*>(p);
}
inline G4MCTSimParticle* G4MCTSimParticle::GetParentParticle() const
{ return parentParticle; }
{
return parentParticle;
}
inline void G4MCTSimParticle::SetParticleName(std::string aname)
{ name= aname; }
inline void G4MCTSimParticle::SetParticleName(std::string aname)
{
name = aname;
}
inline const std::string& G4MCTSimParticle::GetParticleName() const
{ return name; }
inline const G4String& G4MCTSimParticle::GetParticleName() const
{
return name;
}
inline void G4MCTSimParticle::SetPdgID(int id) { pdgID= id; }
inline void G4MCTSimParticle::SetPdgID(G4int id)
{
pdgID = id;
}
inline int G4MCTSimParticle::GetPdgID() const { return pdgID; }
inline G4int G4MCTSimParticle::GetPdgID() const
{
return pdgID;
}
inline void G4MCTSimParticle::SetTrackID(int id) { trackID= id; }
inline void G4MCTSimParticle::SetTrackID(G4int id)
{
trackID = id;
}
inline int G4MCTSimParticle::GetTrackID() const { return trackID; }
inline G4int G4MCTSimParticle::GetTrackID() const
{
return trackID;
}
inline void G4MCTSimParticle::SetPrimaryFlag(G4bool q) { primaryFlag= q; }
inline void G4MCTSimParticle::SetPrimaryFlag(G4bool q)
{
primaryFlag = q;
}
inline G4bool G4MCTSimParticle::GetPrimaryFlag() const { return primaryFlag; }
inline G4bool G4MCTSimParticle::GetPrimaryFlag() const
{
return primaryFlag;
}
inline void G4MCTSimParticle::SetParentTrackID(int id)
{ parentTrackID= id; }
inline void G4MCTSimParticle::SetParentTrackID(G4int id)
{
parentTrackID = id;
}
inline int G4MCTSimParticle::GetParentTrackID() const
{ return parentTrackID; }
inline G4int G4MCTSimParticle::GetParentTrackID() const
{
return parentTrackID;
}
inline void G4MCTSimParticle::SetMomentumAtVertex(const G4LorentzVector& p)
{ momentumAtVertex= p; }
inline void G4MCTSimParticle::SetMomentumAtVertex(const G4LorentzVector& p)
{
momentumAtVertex = p;
}
inline const G4LorentzVector& G4MCTSimParticle::GetMomentumAtVertex() const
{ return momentumAtVertex; }
inline const G4LorentzVector& G4MCTSimParticle::GetMomentumAtVertex() const
{
return momentumAtVertex;
}
inline void G4MCTSimParticle::SetVertex(const G4MCTSimVertex* v)
{ vertex= const_cast<G4MCTSimVertex*>(v); }
inline void G4MCTSimParticle::SetVertex(const G4MCTSimVertex* v)
{
vertex = const_cast<G4MCTSimVertex*>(v);
}
inline G4MCTSimVertex* G4MCTSimParticle::GetVertex() const
{ return vertex; }
{
return vertex;
}
inline void G4MCTSimParticle::SetStoreFlag(G4bool q) { storeFlag= q; }
inline void G4MCTSimParticle::SetStoreFlag(G4bool q)
{
storeFlag = q;
}
inline G4bool G4MCTSimParticle::GetStoreFlag() const { return storeFlag; }
inline G4bool G4MCTSimParticle::GetStoreFlag() const
{
return storeFlag;
}
#endif
@@ -23,174 +23,216 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4MCTSimVertex.hh
//
// ====================================================================
#ifndef MCT_SIM_VERTEX_H
#define MCT_SIM_VERTEX_H
// G4MCTSimVertex
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4MCTSIMVERTEX_HH
#define G4MCTSIMVERTEX_HH 1
#include "G4Types.hh"
#include <iostream>
#include <vector>
#include <string>
#include "G4Types.hh"
#include "G4ThreeVector.hh"
#include "G4MCTSimParticle.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4MCTSimVertex
{
public:
class G4MCTSimVertex {
private:
int inParticleTrackID;
std::vector<int> outParticleTrackIDList;
G4MCTSimVertex();
G4MCTSimVertex(const G4ThreeVector& x, G4double t);
G4MCTSimVertex(const G4ThreeVector& x, G4double t,
const G4String& vname, G4int ncopy,
const G4String& pname);
~G4MCTSimVertex();
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);
inline G4MCTSimVertex(const G4MCTSimVertex& right);
inline G4MCTSimVertex& operator=(const G4MCTSimVertex& right);
// copy constructor and assignment operator
// set/get functions
void SetID(int i);
int GetID() const;
inline void SetID(G4int i);
inline G4int GetID() const;
void SetPosition(const G4ThreeVector& x);
const G4ThreeVector& GetPosition() const;
inline void SetPosition(const G4ThreeVector& x);
inline const G4ThreeVector& GetPosition() const;
void SetTime(double t);
double GetTime() const;
inline void SetTime(G4double t);
inline G4double GetTime() const;
void SetVolumeName(std::string vname);
const std::string& GetVolumeName() const;
inline void SetVolumeName(const G4String& vname);
inline const G4String& GetVolumeName() const;
void SetVolumeNumber(int n);
int GetVolumeNumber() const;
inline void SetVolumeNumber(G4int n);
inline G4int GetVolumeNumber() const;
void SetCreatorProcessName(std::string pname);
const std::string& GetCreatorProcessName() const;
inline void SetCreatorProcessName(const G4String& pname);
inline const G4String& GetCreatorProcessName() const;
void SetStoreFlag(G4bool q);
G4bool GetStoreFlag() const;
inline void SetStoreFlag(G4bool q);
inline G4bool GetStoreFlag() const;
// methods...
void SetInParticle(const G4MCTSimParticle* in);
void SetInParticle(int in);
int GetInParticleTrackID() const;
inline void SetInParticle(const G4MCTSimParticle* in);
inline void SetInParticle(G4int in);
inline G4int GetInParticleTrackID() const;
int GetNofOutParticles() const;
int AddOutParticle(const G4MCTSimParticle* out);
int AddOutParticle(int out);
int GetOutParticleTrackID(int i) const;
inline G4int GetNofOutParticles() const;
inline G4int AddOutParticle(const G4MCTSimParticle* out);
inline G4int AddOutParticle(G4int out);
inline G4int GetOutParticleTrackID(G4int i) const;
void Print(std::ostream& ostr= std::cout) const;
void Print(std::ostream& ostr = std::cout) const;
private:
G4int inParticleTrackID = 0;
std::vector<G4int> outParticleTrackIDList;
G4String volumeName = "";
G4String creatorProcessName = "none";
G4ThreeVector position;
G4double time = 0.0;
G4int id = -1; // assigned independently from G4
G4int volumeNumber = -1;
G4bool storeFlag = false;
};
// ====================================================================
// inline functions
// inline methods
// ====================================================================
inline G4MCTSimVertex::G4MCTSimVertex(const G4MCTSimVertex& right)
{
*this= 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;
inline 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::SetID(G4int i)
{
id = i;
}
inline void G4MCTSimVertex::SetPosition(const G4ThreeVector& x)
{ position= x; }
inline G4int G4MCTSimVertex::GetID() const
{
return id;
}
inline const G4ThreeVector& G4MCTSimVertex::GetPosition() const
{ return position; }
inline void G4MCTSimVertex::SetPosition(const G4ThreeVector& x)
{
position = x;
}
inline void G4MCTSimVertex::SetTime(double t)
{ time= t; }
inline const G4ThreeVector& G4MCTSimVertex::GetPosition() const
{
return position;
}
inline double G4MCTSimVertex::GetTime() const
{ return time; }
inline void G4MCTSimVertex::SetTime(G4double t)
{
time = t;
}
inline void G4MCTSimVertex::SetVolumeName(std::string vname)
{ volumeName= vname; }
inline G4double G4MCTSimVertex::GetTime() const
{
return time;
}
inline const std::string& G4MCTSimVertex::GetVolumeName() const
{ return volumeName; }
inline void G4MCTSimVertex::SetVolumeName(const G4String& vname)
{
volumeName = vname;
}
inline void G4MCTSimVertex::SetVolumeNumber(int n)
{ volumeNumber= n; }
inline const G4String& G4MCTSimVertex::GetVolumeName() const
{
return volumeName;
}
inline int G4MCTSimVertex::GetVolumeNumber() const
{ return volumeNumber; }
inline void G4MCTSimVertex::SetVolumeNumber(G4int n)
{
volumeNumber = n;
}
inline void G4MCTSimVertex::SetCreatorProcessName(std::string pname)
{ creatorProcessName= pname; }
inline G4int G4MCTSimVertex::GetVolumeNumber() const
{
return volumeNumber;
}
inline const std::string& G4MCTSimVertex::GetCreatorProcessName() const
{ return creatorProcessName; }
inline void G4MCTSimVertex::SetCreatorProcessName(const G4String& pname)
{
creatorProcessName = pname;
}
inline void G4MCTSimVertex::SetStoreFlag(G4bool q) { storeFlag= q; }
inline const G4String& G4MCTSimVertex::GetCreatorProcessName() const
{
return creatorProcessName;
}
inline G4bool G4MCTSimVertex::GetStoreFlag() const { return storeFlag; }
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(); }
{
inParticleTrackID = in->GetTrackID();
}
inline void G4MCTSimVertex::SetInParticle(int in)
{ inParticleTrackID= in; }
inline void G4MCTSimVertex::SetInParticle(G4int in)
{
inParticleTrackID = in;
}
inline int G4MCTSimVertex::GetInParticleTrackID() const
{ return inParticleTrackID; }
inline G4int G4MCTSimVertex::GetInParticleTrackID() const
{
return inParticleTrackID;
}
inline int G4MCTSimVertex::GetNofOutParticles() const
{ return outParticleTrackIDList.size(); }
inline G4int G4MCTSimVertex::GetNofOutParticles() const
{
return outParticleTrackIDList.size();
}
inline int G4MCTSimVertex::AddOutParticle(const G4MCTSimParticle* out)
{
inline G4int G4MCTSimVertex::AddOutParticle(const G4MCTSimParticle* out)
{
outParticleTrackIDList.push_back(out->GetTrackID());
return outParticleTrackIDList.size();
}
inline int G4MCTSimVertex::AddOutParticle(int out)
inline G4int G4MCTSimVertex::AddOutParticle(G4int out)
{
outParticleTrackIDList.push_back(out);
return outParticleTrackIDList.size();
}
inline int G4MCTSimVertex::GetOutParticleTrackID(int i) const
inline G4int G4MCTSimVertex::GetOutParticleTrackID(G4int i) const
{
int size= outParticleTrackIDList.size();
if(i>=0 && i< size) return outParticleTrackIDList[i];
else return 0;
G4int size = outParticleTrackIDList.size();
if(i >= 0 && i < size)
return outParticleTrackIDList[i];
else
return 0;
}
#endif
@@ -23,13 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4PersistencyCenter.hh
// G4PersistencyCenter
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
// Class Description:
//
// Class to handle loading of the G4PersistencyManager.
#ifndef PERSISTENCY_CENTER_HH
#define PERSISTENCY_CENTER_HH 1
// Author: Youhei Morita, 10.08.2001
// --------------------------------------------------------------------
#ifndef G4PERSISTENCYCENTER_HH
#define G4PERSISTENCYCENTER_HH 1
#include "G4Types.hh"
#include <string>
@@ -39,137 +42,140 @@
#include "G4DCIOcatalog.hh"
#ifndef WIN32
#include "G4FileUtilities.hh"
# include "G4FileUtilities.hh"
#endif
// Forward Declaration to avoid circular dependencies.
// Forward Declarations
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.
using PMap = std::map<G4String, G4PersistencyManager*, std::less<G4String>>;
using ObjMap = std::map<G4int, G4String, std::less<G4int>>;
using FileMap = std::map<G4String, G4String, std::less<G4String>>;
enum StoreMode
{
kOn,
kOff,
kRecycle
};
using StoreMap = std::map<G4String, StoreMode, std::less<G4String>>;
using BoolMap = std::map<G4String, G4bool, std::less<G4String>>;
class G4PersistencyCenter
{
public: // With description
public:
static G4PersistencyCenter* GetPersistencyCenter();
// returns the pointer of singleton G4PersistencyCenter
static G4PersistencyCenter* GetPersistencyCenter();
// Returns the pointer of singleton G4PersistencyCenter
void SelectSystem(std::string systemName);
void SelectSystem(const G4String& systemName);
// Select the persistency package
const std::string CurrentSystem() { return f_currentSystemName; };
// returns the current persistent package name
const G4String& 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.
void SetHepMCObjyReaderFile(const G4String& 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.
G4String 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 SetStoreMode(const G4String& 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.
void SetRetrieveMode(const G4String& objName, G4bool mode);
// Sets the object retrieve mode. Modes are true or false
StoreMode CurrentStoreMode(std::string objName);
// returns the current object store mode.
StoreMode CurrentStoreMode(const G4String& objName);
// Returns the current object store mode
G4bool CurrentRetrieveMode(std::string objName);
// returns the current object store mode.
G4bool CurrentRetrieveMode(const G4String& objName);
// Returns the current object store mode
G4bool SetWriteFile(std::string objName, std::string writeFileName);
// Sets the output filename.
G4bool SetWriteFile(const G4String& objName, const G4String& writeFileName);
// Sets the output filename
G4bool SetReadFile(std::string objName, std::string readFileName);
// Sets the input filename.
G4bool SetReadFile(const G4String& objName, const G4String& readFileName);
// Sets the input filename
std::string CurrentWriteFile(std::string objName);
// returns the current output filename.
G4String CurrentWriteFile(const G4String& objName);
// Returns the current output filename
std::string CurrentReadFile(std::string objName);
// returns the current input filename.
G4String CurrentReadFile(const G4String& objName);
// Returns the current input filename
std::string CurrentObject(std::string file);
// returns the current object type
G4String CurrentObject(const G4String& file);
// Returns the current object type
void AddHCIOmanager(std::string detName, std::string colName);
// add a hits colleciton I/O manager to the catalog
void AddHCIOmanager(const G4String& detName, const G4String& colName);
// Adds a hits colleciton I/O manager to the catalog
std::string CurrentHCIOmanager();
G4String 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
void AddDCIOmanager(const G4String& detName);
// Adds a digits colleciton I/O manager to the catalog
std::string CurrentDCIOmanager();
// Returns a list of registered digits colleciton I/O managers
G4String CurrentDCIOmanager();
// Returns a list of registered digits collection I/O managers
void PrintAll();
// prints the current G4PersistencyCenter settings.
void PrintAll();
// Prints the current G4PersistencyCenter settings
G4PersistencyManager* CurrentPersistencyManager() { return f_currentManager; };
// returns the pointer of the currnet G4PersistencyManager.
G4PersistencyManager* CurrentPersistencyManager()
{
return f_currentManager;
}
// Returns the pointer of the current G4PersistencyManager
void SetPersistencyManager(G4PersistencyManager* pm, std::string name);
// returns the pointer of the currnet G4PersistencyManager.
void SetPersistencyManager(G4PersistencyManager* pm, const G4String& name);
// Returns the pointer of the current G4PersistencyManager
G4PersistencyManager* GetPersistencyManager(std::string nam);
// returns the pointer of the currnet G4PersistencyManager with name.
G4PersistencyManager* GetPersistencyManager(const G4String& nam);
// Returns the pointer of the current G4PersistencyManager with name
void RegisterPersistencyManager(G4PersistencyManager* pm);
// registers the persistency manager to the runtime catalog.
void RegisterPersistencyManager(G4PersistencyManager* pm);
// Registers the persistency manager to the runtime catalog
void DeletePersistencyManager();
// deletes the current G4PersistencyManager.
void DeletePersistencyManager();
// Deletes the current G4PersistencyManager
void SetVerboseLevel(int v);
// Set verbose level.
void SetVerboseLevel(G4int v);
// Sets verbose level
int VerboseLevel() { return m_verbose; };
// Return verbose level.
G4int VerboseLevel() { return m_verbose; }
// Returns verbose level
private:
private:
G4PersistencyCenter();
G4PersistencyCenter();
// Constructor
~G4PersistencyCenter();
~G4PersistencyCenter();
// Destructor
std::string PadString(std::string name, unsigned int width);
// truncate or pad a string up to the width.
G4String PadString(const G4String& name, unsigned int width);
// Truncates or pad a string up to the width
private:
G4PersistencyCenterMessenger* f_theMessenger;
static G4ThreadLocal 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;
private:
G4PersistencyCenterMessenger* f_theMessenger = nullptr;
static G4ThreadLocal G4PersistencyCenter* f_thePointer;
G4PersistencyManager* f_currentManager = nullptr;
G4String 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 = 0;
#ifndef WIN32
G4FileUtilities f_ut;
G4FileUtilities f_ut;
#endif
}; // End of class G4PersistencyCenter
};
#endif
@@ -23,13 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4PersistencyCenterMessenger.hh
// G4PersistencyCenterMessenger
//
// History:
// 01.07.18 Youhei Morita Initial creation (with "fadsclass")
// Class Description:
//
// User interface messenger class to interface G4PersistencyCenter.
#ifndef PERSISTENCY_CENTER_MESSENGER_HH
#define PERSISTENCY_CENTER_MESSENGER_HH 1
// Author: Youhei Morita, 18.07.2001
// --------------------------------------------------------------------
#ifndef G4PERSISTENCYCENTERMESSENGER_HH
#define G4PERSISTENCYCENTERMESSENGER_HH 1
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
@@ -37,49 +40,44 @@
#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
class G4PersistencyCenterMessenger : public G4UImessenger
{
public: // With description
G4PersistencyCenterMessenger(G4PersistencyCenter* p);
public:
G4PersistencyCenterMessenger(G4PersistencyCenter* p);
// Constructor
~G4PersistencyCenterMessenger();
~G4PersistencyCenterMessenger();
// Destructor
public: // With description
void SetNewValue(G4UIcommand* command, G4String newValues);
void SetNewValue(G4UIcommand* command, G4String newValues);
// User interface for setting a new value
G4String GetCurrentValue(G4UIcommand* command);
G4String GetCurrentValue(G4UIcommand* command);
// User interface for getting a value
private:
std::string PopWord(std::string text, int n, std::string delim);
private:
G4String PopWord(const G4String& text, G4int n, const G4String& 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;
private:
}; // End of class G4PersistencyCenterMessenger
G4PersistencyCenter* pc = nullptr;
G4UIdirectory *directory = nullptr,
*subdir1 = nullptr, *subdir2 = nullptr,
*subdir3 = nullptr, *subdir4 = nullptr, *subdir5 = nullptr;
G4UIcmdWithAnInteger* verboseCmd = nullptr;
G4UIcmdWithAString* select = nullptr;
G4UIcmdWithAString* regHitIO = nullptr;
std::vector<std::string> wrObj;
std::vector<std::string> rdObj;
std::vector<G4UIcmdWithAString*> storeObj;
std::vector<G4UIcmdWithAString*> setWrFile;
std::vector<G4UIcmdWithAString*> setRdFile;
G4UIcmdWithoutParameter* printAll = nullptr;
};
#endif
@@ -23,55 +23,33 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4PersistencyManager.hh
// G4PersistencyManager
//
// History:
// 01.07.17 Youhei Morita Initial creation (with "fadsclass")
#ifndef PERSISTENCY_MANAGER_HH
#define PERSISTENCY_MANAGER_HH 1
#include "G4Event.hh"
#include "G4VMCTruthIO.hh"
#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:
//
//
// 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() ...
// |
// | ... Commit() ...
// V
//
// Storing a Geant4 event:
//
//
// Storing a Geant4 event:
//
// G4PersistencyManager::Store( G4Pevent* )
// |
// | ... StartUpdate() ...
@@ -86,9 +64,9 @@ class G4PersistencyCenter;
// |
// | ... Commit() ...
// V
//
// Retrieving a Geant event:
//
//
// Retrieving a Geant4 event:
//
// G4PersistencyManager::Retrieve( event )
// |
// | ... StartRead() ...
@@ -97,97 +75,116 @@ class G4PersistencyCenter;
// |
// | ... 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
//
//
// 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.
//
// which is handled by G4PersistencyCenterMessenger.
//
// A static template declaration of G4HCIOentryT<class> must be
// implementated for each I/O manager.
class G4PersistencyManager
: public G4VPersistencyManager
// Author: Youhei Morita, 17.07.2001
// --------------------------------------------------------------------
#ifndef G4PERSISTENCYMANAGER_HH
#define G4PERSISTENCYMANAGER_HH 1
#include "G4Event.hh"
#include "G4VMCTruthIO.hh"
#include "G4HCIOcatalog.hh"
#include "G4DCIOcatalog.hh"
#include "G4VPEventIO.hh"
#include "G4VPHitIO.hh"
#include "G4VPDigitIO.hh"
#include "G4VTransactionManager.hh"
#include "G4VPersistencyManager.hh"
class G4PersistencyCenter;
class G4PersistencyManager : public G4VPersistencyManager
{
friend class G4PersistencyCenter;
friend class G4PersistencyCenter;
public: // With description
G4PersistencyManager(G4PersistencyCenter* pc, std::string n);
public:
G4PersistencyManager(G4PersistencyCenter* pc, const G4String& n);
// Constructor
virtual ~G4PersistencyManager();
virtual ~G4PersistencyManager();
// Destructor
public: // With description
virtual G4PersistencyManager* Create() {return 0;};
// Create a new persistency manager. To be used by G4PersistencyManagerT<>.
virtual G4PersistencyManager* Create() { return nullptr; }
// Create a new persistency manager.
// To be used by G4PersistencyManagerT<>
std::string GetName() {return nameMgr;};
const G4String& GetName() { return nameMgr; }
// Get the name of persistency manager
virtual G4VPEventIO* EventIO() { return 0; };
virtual G4VPEventIO* EventIO() { return nullptr; }
// Returns the current event I/O handling manager
// Each derived class should return the pointer of actual manager.
// Each derived class should return the pointer of actual manager
virtual G4VPHitIO* HitIO() { return 0; };
virtual G4VPHitIO* HitIO() { return nullptr; }
// Returns the current hit I/O handling manager
// Each derived class should return the pointer of actual manager.
// Each derived class should return the pointer of actual manager
virtual G4VPDigitIO* DigitIO() { return 0; };
virtual G4VPDigitIO* DigitIO() { return nullptr; }
// Returns the current digit I/O handling manager
// Each derived class should return the pointer of actual manager.
// Each derived class should return the pointer of actual manager
virtual G4VMCTruthIO* MCTruthIO() { return 0; };
virtual G4VMCTruthIO* MCTruthIO() { return nullptr; }
// Returns the current MCTruth I/O handling manager
// Each derived class should return the pointer of actual manager.
// Each derived class should return the pointer of actual manager
virtual G4VTransactionManager* TransactionManager() { return 0; };
virtual G4VTransactionManager* TransactionManager() { return nullptr; }
// Returns the current transaction manager
// Each derived class should return the pointer of actual manager.
// Each derived class should return the pointer of actual manager
virtual void Initialize() {};
virtual void Initialize() {}
// Initialize the persistency package.
// Each derived class should implement the acutal initialization sequence.
// Each derived class should implement the acutal initialization sequence
void SetVerboseLevel(int v);
// Set verbose level.
void SetVerboseLevel(G4int v);
// Set verbose level
G4bool Store(const G4Event* evt);
G4bool Store(const G4Event* evt);
// Store the G4Event and its associated objects
G4bool Retrieve(G4Event*& evt);
G4bool Retrieve(G4Event*& evt);
// Retrieve the G4Event and its associated objects
G4bool Store(const G4Run*) {return false;};
// not used
G4bool Store(const G4Run*) { return false; }
// Not used
G4bool Retrieve(G4Run*&) {return false;};
// not used
G4bool Retrieve(G4Run*&) { return false; }
// Not used
G4bool Store(const G4VPhysicalVolume*) {return false;};
// not used
G4bool Store(const G4VPhysicalVolume*) { return false; }
// Not used
G4bool Retrieve(G4VPhysicalVolume*&) {return false;};
// not used
G4bool Retrieve(G4VPhysicalVolume*&) { return false; }
// Not used
protected:
static G4PersistencyManager* GetPersistencyManager();
protected:
static G4PersistencyManager* GetPersistencyManager();
// Get the instance of persistency manager
protected:
G4PersistencyCenter* f_pc;
int m_verbose;
protected:
private:
std::string nameMgr;
G4bool f_is_initialized;
G4PersistencyCenter* f_pc = nullptr;
G4int m_verbose = 0;
}; // End of class G4PersistencyManager
private:
G4String nameMgr;
G4bool f_is_initialized = false;
};
#endif
@@ -23,108 +23,123 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4PersistencyManagerT.hh
// G4PersistencyManagerT
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
// Class Description:
//
// Template class of G4PersistencyManager for late binding.
#ifndef PERSISTENCY_MANAGER_T_HH
#define PERSISTENCY_MANAGER_T_HH 1
// Author: Youhei Morita, 10.08.2001
// --------------------------------------------------------------------
#ifndef G4PERSISTENCYMANAGERT_HH
#define G4PERSISTENCYMANAGERT_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
template <class T>
class G4PersistencyManagerT : public G4PersistencyManager
{
public: // With description
G4PersistencyManagerT(G4PersistencyCenter* pc, std::string n)
: G4PersistencyManager(pc, n), pm(0)
public:
G4PersistencyManagerT(G4PersistencyCenter* pc, const G4String& n)
: G4PersistencyManager(pc, n)
{
if(m_verbose > 2)
{
if ( m_verbose > 2 ) {
G4cout << "G4PersistencyManagerT: Registering G4PersistencyManager \""
<< n << "\"" << G4endl;
}
G4PersistencyCenter::GetPersistencyCenter()->
RegisterPersistencyManager(this);
G4cout << "G4PersistencyManagerT: Registering G4PersistencyManager \""
<< n << "\"" << G4endl;
}
G4PersistencyCenter::GetPersistencyCenter()
->RegisterPersistencyManager(this);
}
// Constructor
~G4PersistencyManagerT() {};
~G4PersistencyManagerT() {}
// Destructor
public: // With description
G4PersistencyManager* Create()
{
pm = new T(f_pc, GetName());
return pm;
}
G4PersistencyManager* Create()
{
pm = new T(f_pc, GetName());
return pm;
}
// Create a new persistency manager
void Delete() { if (pm!=0) delete pm; };
void Delete()
{
if(pm != nullptr) delete pm;
}
// Delete a persistency mamanger
G4VPEventIO* EventIO()
{
if (pm) return pm->EventIO();
else return 0;
};
G4VPEventIO* EventIO()
{
if(pm != nullptr)
return pm->EventIO();
else
return nullptr;
}
// Returns the current event I/O handling manager
G4VPHitIO* HitIO()
{
if (pm) return pm->HitIO();
else return 0;
};
G4VPHitIO* HitIO()
{
if(pm != nullptr)
return pm->HitIO();
else
return nullptr;
}
// Returns the current hit I/O handling manager
G4VPDigitIO* DigitIO()
{
if (pm) return pm->DigitIO();
else return 0;
};
G4VPDigitIO* DigitIO()
{
if(pm != nullptr)
return pm->DigitIO();
else
return nullptr;
}
// Returns the current digit I/O handling manager
G4VHepMCIO* HepMCIO()
{
if (pm) return pm->HepMCIO();
else return 0;
};
G4VHepMCIO* HepMCIO()
{
if(pm != nullptr)
return pm->HepMCIO();
else
return nullptr;
}
// Returns the current digit I/O handling manager
G4VMCTruthIO* MCTruthIO()
{
if (pm) return pm->MCTruthIO();
else return 0;
};
G4VMCTruthIO* MCTruthIO()
{
if(pm != nullptr)
return pm->MCTruthIO();
else
return nullptr;
}
// Returns the current digit I/O handling manager
G4VTransactionManager* TransactionManager()
{
if (pm) return pm->TransactionManager();
else return 0;
};
G4VTransactionManager* TransactionManager()
{
if(pm != nullptr)
return pm->TransactionManager();
else
return nullptr;
}
// Returns the current transaction manager
void Initialize() {};
void Initialize() {}
// Initialize the persistency package.
void SetVerboseLevel(int v)
{
if (pm) return pm->SetVerboseLevel();
else return 0;
};
void SetVerboseLevel(G4int v)
{
if(pm != nullptr)
return pm->SetVerboseLevel();
else
return nullptr;
}
// Sets the verbose level to the persistency manager
private:
G4PersistencyManager* pm;
private:
}; // End of class G4PersistencyManagerT
G4PersistencyManager* pm = nullptr;
};
#endif
+36 -37
View File
@@ -23,62 +23,61 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4Pevent.hh
// G4Pevent
//
// History:
// '01.11.18 Youhei Morita Initial creation
// Class Description:
//
// Geant4 event object for store.
//
// This class has pointers to 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().
// Author: Youhei Morita, 18.11.2001
// --------------------------------------------------------------------
#ifndef G4PEVENT_HH
#define G4PEVENT_HH 1
#include "G4Event.hh"
#include "G4MCTEvent.hh"
// Class Description:
// Geant4 event object for store.
//
// This class has pointers to 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( G4MCTEvent* mctevt, G4Event* g4evt );
public:
G4Pevent(G4MCTEvent* mctevt, G4Event* g4evt);
// Constructor
~G4Pevent();
~G4Pevent();
// Destructor
public: // With description
int GetEventID() { return m_id; };
// returns the event ID.
G4int GetEventID() { return m_id; }
// Returns the event ID
G4Event* GetEvent() { return f_g4evt; };
// returns the G4Event.
G4Event* GetEvent() { return f_g4evt; }
// Returns the G4Event
G4MCTEvent* GetMCTEvent() { return f_mctevt; };
// returns the MCTruth event.
G4MCTEvent* GetMCTEvent() { return f_mctevt; }
// Returns the MCTruth event
int GetGenEventID() const { return genEventID; };
// returns the GenEvent ID.
G4int GetGenEventID() const { return genEventID; }
// Returns the GenEvent ID
void SetGenEventID(int id) { genEventID=id; };
// set the GenEvent ID.
void SetGenEventID(G4int id) { genEventID = id; }
// Sets the GenEvent ID
private:
int genEventID;
G4MCTEvent* f_mctevt;
G4Event* f_g4evt;
int m_id;
private:
}; // End of class G4Pevent
G4MCTEvent* f_mctevt = nullptr;
G4Event* f_g4evt = nullptr;
G4int genEventID = -1;
G4int m_id = -1;
};
#endif
@@ -23,47 +23,46 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4VDCIOentry.hh
// G4VDCIOentry
//
// History:
// '01.09.12 Youhei Morita Initial creation
// Class Description:
//
// Abstract base class for digits collection I/O manager entry.
#ifndef VDCIO_ENTRY_T_HH
#define VDCIO_ENTRY_T_HH 1
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4VDCIOENTRYT_HH
#define G4VDCIOENTRYT_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);
public:
G4VDCIOentry(const G4String& n);
// Constructor
virtual ~G4VDCIOentry() {}
virtual ~G4VDCIOentry() {}
// Destructor
public: // With description
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Set verbose level.
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Sets verbose level
std::string GetName() { return m_name; }
const G4String& GetName() { return m_name; }
// Returns the name of the DC I/O manager entry
virtual void CreateDCIOmanager(std::string, std::string) {}
virtual void CreateDCIOmanager(const G4String&, const G4String&) {}
// virtual method for creating DC I/O manager for the detector
protected:
G4int m_verbose;
protected:
private:
std::string m_name;
G4int m_verbose = 0;
}; // End of class G4VDCIOentry
private:
G4String m_name;
};
#endif
@@ -23,47 +23,46 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4VHCIOentry.hh
// G4VHCIOentry
//
// History:
// '01.09.12 Youhei Morita Initial creation
// Class Description:
//
// Abstract base class for hits collection I/O manager entry.
#ifndef VHCIO_ENTRY_T_HH
#define VHCIO_ENTRY_T_HH 1
// Author: Youhei Morita, 12.09.2001
// --------------------------------------------------------------------
#ifndef G4VHCIOENTRYT_HH
#define G4VHCIOENTRYT_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);
public:
G4VHCIOentry(const G4String& n);
// Constructor
virtual ~G4VHCIOentry() {}
virtual ~G4VHCIOentry() {}
// Destructor
public: // With description
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Set verbose level.
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Sets verbose level.
std::string GetName() { return m_name; }
const G4String& 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
virtual void CreateHCIOmanager(const G4String&, const G4String&) {}
// Virtual method for creating HC I/O manager for the detector
protected:
G4int m_verbose;
protected:
private:
std::string m_name;
G4int m_verbose = 0;
}; // End of class G4VHCIOentry
private:
G4String m_name;
};
#endif
@@ -23,46 +23,45 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4VMCTruthIO.hh
// G4VMCTruthIO
//
// History:
// '01.11.18 Youhei Morita Initial creation
// Class Description:
//
// Abstract base class for storing and retrieving MCTruth events.
#ifndef V_M_C_TRUTH_I_O_HH
#define V_M_C_TRUTH_I_O_HH 1
// Author: Youhei Morita, 18.11.2001
// --------------------------------------------------------------------
#ifndef G4VMCTRUTHIO_HH
#define G4VMCTRUTHIO_HH 1
#include "G4MCTEvent.hh"
// Class Description:
// Abstract base class for storing and retrieving MCTruth events.
class G4VMCTruthIO
{
public: // With description
G4VMCTruthIO();
public:
G4VMCTruthIO();
// Constructor
virtual ~G4VMCTruthIO();
virtual ~G4VMCTruthIO();
// Destructor
public: // With description
virtual G4bool Store(G4MCTEvent*) =0;
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.
// of storing the G4MCTEvent with this signature
virtual G4bool Retrieve(G4MCTEvent*&) =0;
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.
// of storing the G4MCTEvent with this signature
void SetVerboseLevel(int v) { m_verbose = v; };
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Set verbose level.
protected:
G4int m_verbose;
protected:
}; // End of class G4VMCTruthIO
G4int m_verbose = 0;
};
#endif
@@ -23,57 +23,57 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4VPDigitIO.hh
// G4VPDigitIO
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
// Class Description:
//
// Abstract base class for storing and retrieving digit collections.
#ifndef V_P_DIGIT_I_O_HH
#define V_P_DIGIT_I_O_HH 1
// Author: Youhei Morita, 10.08.2001
// --------------------------------------------------------------------
#ifndef G4VPDIGITIO_HH
#define G4VPDIGITIO_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();
public:
G4VPDigitIO();
// Constructor
virtual ~G4VPDigitIO() {};
virtual ~G4VPDigitIO() {}
// Destructor
public: // With description
G4VPDigitIO* GetVPDigitIO() { return f_G4VPDigitIO; };
// Returns the pointer of the digit collection I/O manager.
G4VPDigitIO* GetVPDigitIO() { return f_G4VPDigitIO; }
// Returns the pointer of the digit collection I/O manager
virtual G4bool Store(const G4DCofThisEvent*) =0;
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.
// of storing the digit collection of this event with this signature
virtual G4bool Retrieve(G4DCofThisEvent*&) =0;
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.
// of storing the digit collection of this event with this signature
void SetVerboseLevel(int v);
// Set verbose level.
void SetVerboseLevel(G4int v);
// Sets verbose level
protected:
void SetG4VPDigitIO(G4VPDigitIO* digitMan) { f_G4VPDigitIO = digitMan; };
// Registers the digit collection I/O manager.
protected:
protected:
G4int m_verbose;
static G4ThreadLocal G4VPDigitIO* f_G4VPDigitIO;
G4DCIOcatalog* f_catalog;
void SetG4VPDigitIO(G4VPDigitIO* digitMan) { f_G4VPDigitIO = digitMan; }
// Registers the digit collection I/O manager
}; // End of class G4VPDigitIO
protected:
G4int m_verbose = 0;
static G4ThreadLocal G4VPDigitIO* f_G4VPDigitIO;
G4DCIOcatalog* f_catalog = nullptr;
};
#endif
@@ -23,57 +23,56 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4VPDigitsCollectionIO.hh
// G4VPDigitsCollectionIO
//
// History:
// '01.08.16 Youhei Morita Initial creation
// Class Description:
//
// Abstract base class for storing and retrieving digit collections.
#ifndef V_P_DIGITS_COLLECTION_I_O_HH
#define V_P_DIGITS_COLLECTION_I_O_HH 1
// Author: Youhei Morita, 16.08.2001
// --------------------------------------------------------------------
#ifndef G4VPDIGITSCOLLECTIONIO_HH
#define G4VPDIGITSCOLLECTIONIO_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 );
public:
G4VPDigitsCollectionIO(const G4String& detName, const G4String& colName);
// Constructor
virtual ~G4VPDigitsCollectionIO() {};
virtual ~G4VPDigitsCollectionIO() {}
// Destructor
public: // With description
virtual G4bool Store(const G4VDigiCollection*) =0;
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.
// with this signature
virtual G4bool Retrieve(G4VDigiCollection*&) =0;
virtual G4bool Retrieve(G4VDigiCollection*&) = 0;
// Pure virtual method for retrieving the digit collection.
// Each persistency package should implement a concrete method
// with this signature.
// with this signature
G4bool operator== (const G4VPDigitsCollectionIO& right) const;
// virtual operator for comparing digit collections with names.
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.
const G4String& DMname() { return f_detName; }
// Returns the digitizer module name
std::string CollectionName() { return f_colName; };
// Returns the digit collection name.
const G4String& CollectionName() { return f_colName; }
// Returns the digit collection name
void SetVerboseLevel(int v) { m_verbose = v; };
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Sets the verbose level
protected:
G4int m_verbose;
std::string f_detName;
std::string f_colName;
protected:
}; // End of class G4VPDigitsCollectionIO
G4int m_verbose = 0;
G4String f_detName;
G4String f_colName;
};
#endif
@@ -23,50 +23,49 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4VPEventIO.hh
// G4VPEventIO
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
// Class Description:
//
// Abstract base class for storing and retrieving an event object.
#ifndef V_P_EVENT_I_O_HH
#define V_P_EVENT_I_O_HH 1
// Author: Youhei Morita, 10.08.2001
// --------------------------------------------------------------------
#ifndef G4VPEVENTIO_HH
#define G4VPEVENTIO_HH 1
#include "G4Event.hh"
#include "G4Pevent.hh"
// Class Description:
// Abstract base class for storing and retrieving an event object
class G4VPEventIO
{
public: // With description
G4VPEventIO();
public:
G4VPEventIO();
// Constructor
virtual ~G4VPEventIO() {};
virtual ~G4VPEventIO() {}
// Destructor
public: // With description
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
inline void SetVerboseLevel(G4int v) { m_verbose = v; }
// Sets verbose level
inline G4int CurrentEventID() { return m_currentEvtID; };
// Returns the current event id.
inline G4int CurrentEventID() { return m_currentEvtID; }
// Returns the current event id
virtual G4bool Store( const G4Event* anEvent ) =0;
// Store a Geant4 event.
virtual G4bool Store(const G4Event* anEvent) = 0;
// Store a Geant4 event
virtual G4bool Retrieve( G4Pevent*& anEvent ) =0;
// Retrieve a Geant4 event.
virtual G4bool Retrieve(G4Pevent*& anEvent) = 0;
// Retrieve a Geant4 event
virtual G4bool Retrieve( G4Event*& anEvent ) =0;
// Retrieve a Geant4 event.
virtual G4bool Retrieve(G4Event*& anEvent) = 0;
// Retrieve a Geant4 event
protected:
G4int m_verbose;
G4int m_currentEvtID;
protected:
}; // End of class G4VPEventIO
G4int m_verbose = 0;
G4int m_currentEvtID = 0;
};
#endif
+29 -29
View File
@@ -23,57 +23,57 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4VPHitIO.hh
// G4VPHitIO
//
// History:
// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
// Class Description:
//
// Abstract base class for storing and retrieving hit collections.
#ifndef V_P_HIT_I_O_HH
#define V_P_HIT_I_O_HH 1
// Author: Youhei Morita, 10.08.2001
// --------------------------------------------------------------------
#ifndef G4VPHITIO_HH
#define G4VPHITIO_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();
public:
G4VPHitIO();
// Constructor
virtual ~G4VPHitIO() {};
virtual ~G4VPHitIO() {}
// Destructor
public: // With description
G4VPHitIO* GetVPHitIO() { return f_G4VPHitIO; };
// Returns the pointer of the hit collection I/O manager.
G4VPHitIO* GetVPHitIO() { return f_G4VPHitIO; }
// Returns the pointer of the hit collection I/O manager
virtual G4bool Store(const G4HCofThisEvent*) =0;
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.
// of storing the hit collection of this event with this signature
virtual G4bool Retrieve(G4HCofThisEvent*&) =0;
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.
// of storing the hit collection of this event with this signature
void SetVerboseLevel(int v);
// Set verbose level.
void SetVerboseLevel(G4int v);
// Sets verbose level
protected:
void SetG4VPHitIO(G4VPHitIO* hitMan) { f_G4VPHitIO = hitMan; };
// Registers the hit collection I/O manager.
protected:
protected:
G4int m_verbose;
static G4ThreadLocal G4VPHitIO* f_G4VPHitIO;
G4HCIOcatalog* f_catalog;
void SetG4VPHitIO(G4VPHitIO* hitMan) { f_G4VPHitIO = hitMan; }
// Registers the hit collection I/O manager
}; // End of class G4VPHitIO
protected:
G4int m_verbose = 0;
static G4ThreadLocal G4VPHitIO* f_G4VPHitIO;
G4HCIOcatalog* f_catalog = nullptr;
};
#endif
@@ -23,57 +23,56 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4VPHitsCollectionIO.hh
// G4VPHitsCollectionIO
//
// History:
// '01.08.16 Youhei Morita Initial creation
// Class Description:
//
// Abstract base class for storing and retrieving hit collections
#ifndef V_P_HITS_COLLECTION_I_O_HH
#define V_P_HITS_COLLECTION_I_O_HH 1
// Author: Youhei Morita, 16.08.2001
// --------------------------------------------------------------------
#ifndef G4VPHITSCOLLECTIONIO_HH
#define G4VPHITSCOLLECTIONIO_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 );
public:
G4VPHitsCollectionIO(const G4String& detName, const G4String& colName);
// Constructor
virtual ~G4VPHitsCollectionIO() {};
virtual ~G4VPHitsCollectionIO(){};
// Destructor
public: // With description
virtual G4bool Store(const G4VHitsCollection*) =0;
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.
// with this signature
virtual G4bool Retrieve(G4VHitsCollection*&) =0;
virtual G4bool Retrieve(G4VHitsCollection*&) = 0;
// Pure virtual method for retrieving the hit collection.
// Each persistency package should implement a concrete method
// with this signature.
// with this signature
G4bool operator== (const G4VPHitsCollectionIO& right) const;
// virtual operator for comparing hit collections with names.
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.
const G4String& SDname() { return f_detName; }
// Returns the sensitive detector name
std::string CollectionName() { return f_colName; };
// Returns the hit collection name.
const G4String& CollectionName() { return f_colName; }
// Returns the hit collection name
void SetVerboseLevel(int v) { m_verbose = v; };
void SetVerboseLevel(G4int v) { m_verbose = v; }
// Sets the verbose level
protected:
G4int m_verbose;
std::string f_detName;
std::string f_colName;
protected:
}; // End of class G4VPHitsCollectionIO
G4int m_verbose = 0;
G4String f_detName;
G4String f_colName;
};
#endif
@@ -23,55 +23,55 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// File: G4VTransactionManager.hh
// G4VTransactionManager
//
// History:
// 01.07.18 Youhei Morita Initial creation (with "fadsclass")
// Class Description:
//
// Abstract base class for starting and commiting or aborting data
// transaction.
#ifndef V_TRANSACTION_MANAGER_HH
#define V_TRANSACTION_MANAGER_HH 1
// Author: Youhei Morita, 18.07.2001
// --------------------------------------------------------------------
#ifndef G4VTRANSACTIONMANAGER_HH
#define G4VTRANSACTIONMANAGER_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) {};
public:
G4VTransactionManager() {}
// Constructor
virtual ~G4VTransactionManager() {};
virtual ~G4VTransactionManager() {}
// Destructor
public: // With description
void SetVerboseLevel(int v) { m_verbose = v; };
// Set verbose level.
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 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 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;
virtual G4bool StartUpdate() = 0;
// Start an update transaction for event store and retrieve
virtual G4bool StartRead()=0;
virtual G4bool StartRead() = 0;
// Start a read-only transaction for event store and retrieve
virtual void Commit()=0;
virtual void Commit() = 0;
// commit the transaction for event store and retrieve
virtual void Abort()=0;
virtual void Abort() = 0;
// abort the transaction for event store and retrieve
protected:
G4int m_verbose;
protected:
}; // End of class G4VTransactionManager
G4int m_verbose = 0;
};
#endif