Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -58,36 +58,10 @@ namespace G4Hbook {
typedef ExG4HbookAnalysisManager G4AnalysisManager;
}
struct h1_booking {
h1_booking(G4int nbins, G4double xmin, G4double xmax)
: fTitle(""),
fNbins(nbins),
fXmin(xmin),
fXmax(xmax) {}
G4String fTitle;
G4int fNbins;
G4double fXmin;
G4double fXmax;
};
struct h2_booking {
h2_booking(G4int nxbins, G4double xmin, G4double xmax,
G4int nybins, G4double ymin, G4double ymax)
: fTitle(""),
fNxbins(nxbins),
fXmin(xmin),
fXmax(xmax),
fNybins(nybins),
fYmin(ymin),
fYmax(ymax) {}
G4String fTitle;
G4int fNxbins;
G4double fXmin;
G4double fXmax;
G4int fNybins;
G4double fYmin;
G4double fYmax;
};
class ExG4HbookFileManager;
class ExG4HbookH1Manager;
class ExG4HbookH2Manager;
class ExG4HbookNtupleManager;
/// HBook Analysis manager
///
@@ -102,102 +76,9 @@ class ExG4HbookAnalysisManager : public G4VAnalysisManager
virtual ~ExG4HbookAnalysisManager();
// static methods
static ExG4HbookAnalysisManager* Create(G4bool isMaster = true);
static ExG4HbookAnalysisManager* Instance();
// Methods to manipulate files
using G4VAnalysisManager::OpenFile;
virtual G4bool OpenFile(const G4String& fileName);
virtual G4bool Write();
virtual G4bool CloseFile();
// Methods to create histogrammes, ntuples
virtual G4int CreateH1(const G4String& name, const G4String& title,
G4int nbins, G4double xmin, G4double xmax,
const G4String& unitName = "none",
const G4String& fcnName = "none");
virtual G4int CreateH2(const G4String& name, const G4String& title,
G4int nxbins, G4double xmin, G4double xmax,
G4int nybins, G4double ymin, G4double ymax,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none");
virtual G4bool SetH1(G4int id,
G4int nbins, G4double xmin, G4double xmax,
const G4String& unitName = "none",
const G4String& fcnName = "none");
virtual G4bool SetH2(G4int id,
G4int nxbins, G4double xmin, G4double xmax,
G4int nybins, G4double ymin, G4double ymax,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none");
virtual G4bool ScaleH1(G4int id, G4double factor);
virtual G4bool ScaleH2(G4int id, G4double factor);
virtual void CreateNtuple(const G4String& name, const G4String& title);
virtual G4int CreateNtupleIColumn(const G4String& name);
virtual G4int CreateNtupleFColumn(const G4String& name);
virtual G4int CreateNtupleDColumn(const G4String& name);
virtual void FinishNtuple();
// Methods to fill histogrammes, ntuples
virtual G4bool FillH1(G4int id, G4double value, G4double weight = 1.0);
virtual G4bool FillH2(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0);
virtual G4bool FillNtupleIColumn(G4int id, G4int value);
virtual G4bool FillNtupleFColumn(G4int id, G4float value);
virtual G4bool FillNtupleDColumn(G4int id, G4double value);
virtual G4bool AddNtupleRow();
// Access methods
virtual tools::hbook::h1* GetH1(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
virtual tools::hbook::h2* GetH2(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
virtual tools::hbook::wntuple* GetNtuple() const;
// Access methods via names
virtual G4int GetH1Id(const G4String& name, G4bool warn = true) const;
virtual G4int GetH2Id(const G4String& name, G4bool warn = true) const;
// Access to H1 parameters
virtual G4int GetH1Nbins(G4int id) const;
virtual G4double GetH1Xmin(G4int id) const;
virtual G4double GetH1Xmax(G4int id) const;
virtual G4double GetH1Width(G4int id) const;
// Access to H2 parameters
virtual G4int GetH2Nxbins(G4int id) const;
virtual G4double GetH2Xmin(G4int id) const;
virtual G4double GetH2Xmax(G4int id) const;
virtual G4double GetH2XWidth(G4int id) const;
virtual G4int GetH2Nybins(G4int id) const;
virtual G4double GetH2Ymin(G4int id) const;
virtual G4double GetH2Ymax(G4int id) const;
virtual G4double GetH2YWidth(G4int id) const;
// Setters for attributes for plotting
virtual G4bool SetH1Title(G4int id, const G4String& title);
virtual G4bool SetH1XAxisTitle(G4int id, const G4String& title);
virtual G4bool SetH1YAxisTitle(G4int id, const G4String& title);
virtual G4bool SetH2Title(G4int id, const G4String& title);
virtual G4bool SetH2XAxisTitle(G4int id, const G4String& title);
virtual G4bool SetH2YAxisTitle(G4int id, const G4String& title);
virtual G4bool SetH2ZAxisTitle(G4int id, const G4String& title);
// Access attributes for plotting
virtual G4String GetH1Title(G4int id) const;
virtual G4String GetH1XAxisTitle(G4int id) const;
virtual G4String GetH1YAxisTitle(G4int id) const;
virtual G4String GetH2Title(G4int id) const;
virtual G4String GetH2XAxisTitle(G4int id) const;
virtual G4String GetH2YAxisTitle(G4int id) const;
virtual G4String GetH2ZAxisTitle(G4int id) const;
// HBOOK does not allow IDs the same IDs for H1 and H2,
// and also IDs starting from 0; thats why there is defined an offset
// with respect to the G4AnalysisManager generic Ids.
@@ -206,89 +87,51 @@ class ExG4HbookAnalysisManager : public G4VAnalysisManager
// Set the offset of HBOOK ID for H1
// ( default value = firstHistoID if firstHistoID > 0; otherwise = 1)
G4bool SetH1HbookIdOffset(G4int offset);
//
// Set the offset of HBOOK ID for H2
// ( default value = firstHistoID + 100 if firstHistoID > 0; otherwise = 101 )
G4bool SetH2HbookIdOffset(G4int offset);
//
// Set the HBOOK ID for the ntuple
// (default value = 1 )
G4bool SetNtupleHbookId(G4int ntupleId);
G4int GetH1HbookIdOffset() const;
G4int GetH2HbookIdOffset() const;
G4int GetNtupleHbookId() const;
protected:
virtual G4bool WriteOnAscii(std::ofstream& output);
// Set the offset of HBOOK ID for H2
// ( default value = firstHistoID + 100 if firstHistoID > 0;
// otherwise = 101 )
G4bool SetH2HbookIdOffset(G4int offset);
G4int GetH2HbookIdOffset() const;
// Set the offset of NTUPLE ID for ntuples
// ( default value = firstNtupleID if firstNtupleID > 0; otherwise = 1)
G4bool SetNtupleHbookIdOffset(G4int offset);
G4int GetNtupleHbookIdOffset() const;
// Access methods
//
tools::hbook::h1* GetH1(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
tools::hbook::h2* GetH2(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
tools::hbook::wntuple* GetNtuple() const;
tools::hbook::wntuple* GetNtuple(G4int ntupleId) const;
protected:
// virtual methods from base class
virtual G4bool OpenFileImpl(const G4String& fileName);
virtual G4bool WriteImpl();
virtual G4bool CloseFileImpl();
private:
// static data members
//
static ExG4HbookAnalysisManager* fgInstance;
static const G4int fgkDefaultH2HbookIdOffset;
static const G4int fgkDefaultNtupleHbookId;
static const G4String fgkDefaultNtupleDirectoryName;
// methods
//
void SetH1HbookIdOffset();
void SetH2HbookIdOffset();
void CreateH1FromBooking();
void CreateH2FromBooking();
void CreateNtupleFromBooking();
tools::hbook::wntuple::column<int>* GetNtupleIColumn(G4int id) const;
tools::hbook::wntuple::column<float>* GetNtupleFColumn(G4int id) const;
tools::hbook::wntuple::column<double>* GetNtupleDColumn(G4int id) const;
void Reset();
virtual h1_booking* GetH1Booking(G4int id, G4bool warn = true) const;
virtual h2_booking* GetH2Booking(G4int id, G4bool warn = true) const;
virtual tools::hbook::h1* GetH1InFunction(G4int id, G4String function,
G4bool warn = true,
G4bool onlyIfActive = true) const;
virtual tools::hbook::h2* GetH2InFunction(G4int id, G4String function,
G4bool warn = true,
G4bool onlyIfActive = true) const;
void UpdateTitle(G4String& title,
const G4String& unitName, const G4String& fcnName) const;
// data members
//
G4int fH1HbookIdOffset;
G4int fH2HbookIdOffset;
G4int fNtupleHbookId;
tools::hbook::wfile* fFile;
std::vector<tools::hbook::h1*> fH1Vector;
std::vector<tools::hbook::h2*> fH2Vector;
std::vector<h1_booking*> fH1BookingVector;
std::vector<h2_booking*> fH2BookingVector;
std::map<G4String, G4int> fH1NameIdMap;
std::map<G4String, G4int> fH2NameIdMap;
tools::hbook::wntuple* fNtuple;
tools::ntuple_booking* fNtupleBooking;
std::map<G4int, tools::hbook::wntuple::column<int>* > fNtupleIColumnMap;
std::map<G4int, tools::hbook::wntuple::column<float>* > fNtupleFColumnMap;
std::map<G4int, tools::hbook::wntuple::column<double>* > fNtupleDColumnMap;
ExG4HbookH1Manager* fH1Manager;
ExG4HbookH2Manager* fH2Manager;
ExG4HbookNtupleManager* fNtupleManager;
ExG4HbookFileManager* fFileManager;
};
// inline functions
inline G4int ExG4HbookAnalysisManager::GetH1HbookIdOffset() const {
return fH1HbookIdOffset;
}
inline G4int ExG4HbookAnalysisManager::GetH2HbookIdOffset() const {
return fH2HbookIdOffset;
}
inline G4int ExG4HbookAnalysisManager::GetNtupleHbookId() const {
return fNtupleHbookId;
}
#include "ExG4HbookAnalysisManager.icc"
#endif