Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
@@ -0,0 +1,164 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file hbook/include/ExG4HbookAnalysisManager.hh
/// \brief Definition of the ExG4HbookAnalysisManager class
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
#ifdef G4_USE_HBOOK
#ifndef ExG4HbookAnalysisManager_h
#define ExG4HbookAnalysisManager_h 1
#include "G4VAnalysisManager.hh"
#include "globals.hh"
#include <tools/hbook/wfile>
#include <tools/hbook/h1>
#include <tools/hbook/h2>
#include <tools/hbook/p1>
#include <tools/hbook/wntuple>
#include <vector>
#include <map>
#define setpawc setpawc_
#define setntuc setntuc_
//#define ntuc ntuc_
class ExG4HbookAnalysisManager;
namespace G4Hbook {
typedef tools::hbook::h1 G4AnaH1;
typedef tools::hbook::h1 G4H1;
typedef tools::hbook::h2 G4AnaH2;
typedef tools::hbook::h2 G4H2;
typedef tools::hbook::p1 G4P1;
typedef tools::hbook::wntuple G4Ntuple;
typedef ExG4HbookAnalysisManager G4AnalysisManager;
}
class ExG4HbookFileManager;
class ExG4HbookH1Manager;
class ExG4HbookH2Manager;
class ExG4HbookH3DummyManager;
class ExG4HbookP1Manager;
class ExG4HbookP2DummyManager;
class ExG4HbookNtupleManager;
/// HBook Analysis manager
///
/// The class implements the G4VAnalysisManager manager for HBook.
/// It is provided separately from geant4/source/analysis in order
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
class ExG4HbookAnalysisManager : public G4VAnalysisManager
{
public:
ExG4HbookAnalysisManager();
virtual ~ExG4HbookAnalysisManager();
// static methods
static ExG4HbookAnalysisManager* Create(G4bool isMaster = true);
static ExG4HbookAnalysisManager* Instance();
// 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.
// The default values of these offsets can be changed by the user.
//
// Set the offset of HBOOK ID for H1
// ( default value = firstHistoID if firstHistoID > 0; otherwise = 1)
G4bool SetH1HbookIdOffset(G4int offset);
G4int GetH1HbookIdOffset() const;
// 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;
// Iterators
std::vector<tools::hbook::h1*>::iterator BeginH1();
std::vector<tools::hbook::h1*>::iterator EndH1();
std::vector<tools::hbook::h1*>::const_iterator BeginConstH1() const;
std::vector<tools::hbook::h1*>::const_iterator EndConstH1() const;
std::vector<tools::hbook::h2*>::iterator BeginH2();
std::vector<tools::hbook::h2*>::iterator EndH2();
std::vector<tools::hbook::h2*>::const_iterator BeginConstH2() const;
std::vector<tools::hbook::h2*>::const_iterator EndConstH2() const;
std::vector<tools::hbook::wntuple*>::iterator BeginNtuple();
std::vector<tools::hbook::wntuple*>::iterator EndNtuple();
std::vector<tools::hbook::wntuple*>::const_iterator BeginConstNtuple() const;
std::vector<tools::hbook::wntuple*>::const_iterator EndConstNtuple() 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;
// methods
//
void Reset();
ExG4HbookH1Manager* fH1Manager;
ExG4HbookH2Manager* fH2Manager;
ExG4HbookH3DummyManager* fH3Manager;
ExG4HbookP1Manager* fP1Manager;
ExG4HbookP2DummyManager* fP2Manager;
ExG4HbookNtupleManager* fNtupleManager;
ExG4HbookFileManager* fFileManager;
};
#include "ExG4HbookAnalysisManager.icc"
#endif
#endif
@@ -0,0 +1,196 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExG4HbookAnalysisManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
/// \file hbook/include/ExG4HbookAnalysisManager.icc
/// \brief Inline functions of the ExG4HbookAnalysisManager class
#include "ExG4HbookH1Manager.hh"
#include "ExG4HbookH2Manager.hh"
#include "ExG4HbookNtupleManager.hh"
//_____________________________________________________________________________
inline
G4bool ExG4HbookAnalysisManager::SetH1HbookIdOffset(G4int offset)
{
return fH1Manager->SetH1HbookIdOffset(offset);
}
//_____________________________________________________________________________
inline
G4int ExG4HbookAnalysisManager::GetH1HbookIdOffset() const
{
return fH1Manager->GetH1HbookIdOffset();
}
//_____________________________________________________________________________
inline
G4bool ExG4HbookAnalysisManager::SetH2HbookIdOffset(G4int offset)
{
return fH2Manager->SetH2HbookIdOffset(offset);
}
//_____________________________________________________________________________
inline
G4int ExG4HbookAnalysisManager::GetH2HbookIdOffset() const
{
return fH2Manager->GetH2HbookIdOffset();
}
//_____________________________________________________________________________
inline
G4bool ExG4HbookAnalysisManager::SetNtupleHbookIdOffset(G4int offset)
{
return fNtupleManager->SetNtupleHbookIdOffset(offset);
}
//_____________________________________________________________________________
inline
G4int ExG4HbookAnalysisManager::GetNtupleHbookIdOffset() const
{
return fNtupleManager->GetNtupleHbookIdOffset();
}
//_____________________________________________________________________________
inline
tools::hbook::h1* ExG4HbookAnalysisManager::GetH1(G4int id, G4bool warn,
G4bool onlyIfActive) const
{
return fH1Manager->GetH1(id, warn, onlyIfActive);
}
//_____________________________________________________________________________
inline
tools::hbook::h2* ExG4HbookAnalysisManager::GetH2(G4int id, G4bool warn,
G4bool onlyIfActive) const
{
return fH2Manager->GetH2(id, warn, onlyIfActive);
}
//_____________________________________________________________________________
inline
tools::hbook::wntuple* ExG4HbookAnalysisManager::GetNtuple() const
{
return fNtupleManager->GetNtuple();
}
//_____________________________________________________________________________
inline
tools::hbook::wntuple* ExG4HbookAnalysisManager::GetNtuple(G4int ntupleId) const
{
return fNtupleManager->GetNtuple(ntupleId);
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::h1*>::iterator ExG4HbookAnalysisManager::BeginH1()
{
return fH1Manager->BeginH1();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::h1*>::iterator ExG4HbookAnalysisManager::EndH1()
{
return fH1Manager->EndH1();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::h1*>::const_iterator
ExG4HbookAnalysisManager::BeginConstH1() const
{
return fH1Manager->BeginConstH1();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::h1*>::const_iterator
ExG4HbookAnalysisManager::EndConstH1() const
{
return fH1Manager->EndConstH1();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::h2*>::iterator ExG4HbookAnalysisManager::BeginH2()
{
return fH2Manager->BeginH2();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::h2*>::iterator ExG4HbookAnalysisManager::EndH2()
{
return fH2Manager->EndH2();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::h2*>::const_iterator
ExG4HbookAnalysisManager::BeginConstH2() const
{
return fH2Manager->BeginConstH2();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::h2*>::const_iterator
ExG4HbookAnalysisManager::EndConstH2() const
{
return fH2Manager->EndConstH2();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::wntuple*>::iterator ExG4HbookAnalysisManager::BeginNtuple()
{
return fNtupleManager->BeginNtuple();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::wntuple*>::iterator ExG4HbookAnalysisManager::EndNtuple()
{
return fNtupleManager->EndNtuple();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::wntuple*>::const_iterator
ExG4HbookAnalysisManager::BeginConstNtuple() const
{
return fNtupleManager->BeginConstNtuple();
}
//_____________________________________________________________________________
inline
std::vector<tools::hbook::wntuple*>::const_iterator
ExG4HbookAnalysisManager::EndConstNtuple() const
{
return fNtupleManager->EndConstNtuple();
}
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
/// \file hbook/include/ExG4HbookBaseHnManager.hh
/// \brief Definition of the ExG4HbookBaseHnManager class
// Author: Ivana Hrivnacova, 03/11/2014 (ivana@ipno.in2p3.fr)
#ifndef ExG4HbookBaseHnManager_h
#define ExG4HbookBaseHnManager_h 1
#include "globals.hh"
#include "tools/hbook/base_histo"
#include "tools/hbook/axis"
/// Manager class for tools::hbook::base_histo functions.
///
/// It implements functions common to all hbook histograms and profiles.
class ExG4HbookBaseHnManager //: public G4VH1Manager
{
public:
ExG4HbookBaseHnManager(const G4String& hnType);
virtual ~ExG4HbookBaseHnManager();
friend class ExG4HbookH1Manager;
friend class ExG4HbookH2Manager;
friend class ExG4HbookP1Manager;
protected:
typedef tools::hbook::base_histo G4HbookBaseHisto;
// Access to datA parameters
G4int GetNbins(const tools::hbook::axis& axis) const;
G4double GetMin(const tools::hbook::axis& axis) const;
G4double GetMax(const tools::hbook::axis& axis) const;
G4double GetWidth(const tools::hbook::axis& axis) const;
// Attributes for plotting
//
// Setters
//G4bool SetTitle(G4HbookBaseHisto& baseHisto, const G4String& title);
G4bool SetAxisTitle(G4HbookBaseHisto& baseHisto, G4int dimension, const G4String& title);
// Accessors
//G4String GetTitle(const G4HbookBaseHisto& baseHisto) const;
G4String GetAxisTitle(const G4HbookBaseHisto& baseHisto, G4int dimension) const;
// Static data members
static const G4int kX;
static const G4int kY;
static const G4int kZ;
private:
// Data members
G4String fHnType;
};
#endif
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file hbook/include/ExG4HbookFileManager.hh
/// \brief Definition of the ExG4HbookFileManager class
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
#ifdef G4_USE_HBOOK
#ifndef ExG4HbookFileManager_h
#define ExG4HbookFileManager_h 1
#include "G4VFileManager.hh"
#include "globals.hh"
#include <tools/hbook/wfile>
/// Manager class for HBook file operations.
///
/// The class implements the G4VFileManager manager for HBook.
/// It is provided separately from geant4/source/analysis in order
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
class ExG4HbookFileManager : public G4VFileManager
{
public:
ExG4HbookFileManager(const G4AnalysisManagerState& state);
virtual ~ExG4HbookFileManager();
// Methods to manipulate files
using G4VFileManager::OpenFile;
virtual G4bool OpenFile(const G4String& fileName);
virtual G4bool WriteFile();
virtual G4bool CloseFile();
// Specific methods for files per objects
void CreateNtupleDirectory();
// Get method
G4bool IsFile() const;
private:
static const G4String fgkDefaultNtupleDirectoryName;
// data members
tools::hbook::wfile* fFile;
};
// inline functions
inline G4bool ExG4HbookFileManager::IsFile() const
{ return fFile; }
#endif
#endif
@@ -0,0 +1,237 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file hbook/include/ExG4HbookH1Manager.hh
/// \brief Definition of the ExG4HbookH1Manager class
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
#ifdef G4_USE_HBOOK
#ifndef ExG4HbookH1Manager_h
#define ExG4HbookH1Manager_h 1
#include "G4VH1Manager.hh"
#include "G4HnInformation.hh"
#include "ExG4HbookBaseHnManager.hh"
#include "globals.hh"
#include <tools/hbook/h1>
#include <vector>
#include <map>
class ExG4HbookFileManager;
struct h1_booking {
h1_booking(G4int nbins, G4double xmin, G4double xmax)
: fTitle(""),
fNbins(nbins),
fXmin(xmin),
fXmax(xmax),
fEdges() {}
h1_booking(const std::vector<G4double>& edges)
: fTitle(""),
fNbins(0),
fXmin(0),
fXmax(0),
fEdges() {
for (G4int i=0; i<=G4int(edges.size()); ++i) fEdges.push_back(edges[i]);
}
G4String fTitle;
G4int fNbins;
G4double fXmin;
G4double fXmax;
std::vector<G4double> fEdges;
};
/// Manager class for HBook H1 histograms
///
/// The class implements the G4VH1Manager manager for HBook.
/// It is provided separately from geant4/source/analysis in order
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
class ExG4HbookH1Manager : public G4VH1Manager
{
friend class ExG4HbookAnalysisManager;
protected:
ExG4HbookH1Manager(const G4AnalysisManagerState& state);
virtual ~ExG4HbookH1Manager();
// Functions specific to the output type
//
// 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.
// The default values of these offsets can be changed by the user.
//
// Set the offset of HBOOK ID for H1
// ( default value = firstHistoID if firstHistoID > 0; otherwise = 1)
G4bool SetH1HbookIdOffset(G4int offset);
G4int GetH1HbookIdOffset() const;
// Set methods
void SetFileManager(ExG4HbookFileManager* fileManager);
// Access methods
//
tools::hbook::h1* GetH1(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
// Iterators
std::vector<tools::hbook::h1*>::iterator BeginH1();
std::vector<tools::hbook::h1*>::iterator EndH1();
std::vector<tools::hbook::h1*>::const_iterator BeginConstH1() const;
std::vector<tools::hbook::h1*>::const_iterator EndConstH1() const;
// Virtual functions from base class
//
// 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",
const G4String& binSchemeName = "linear");
virtual G4int CreateH1(const G4String& name, const G4String& title,
const std::vector<G4double>& edges,
const G4String& unitName = "none",
const G4String& fcnName = "none");
virtual G4bool SetH1(G4int id,
G4int nbins, G4double xmin, G4double xmax,
const G4String& unitName = "none",
const G4String& fcnName = "none",
const G4String& binSchemeName = "linear");
virtual G4bool SetH1(G4int id,
const std::vector<G4double>& edges,
const G4String& unitName = "none",
const G4String& fcnName = "none");
virtual G4bool ScaleH1(G4int id, G4double factor);
// Methods to fill histogrammes, ntuples
virtual G4bool FillH1(G4int id, G4double value, G4double weight = 1.0);
// Access methods
//
virtual G4int GetH1Id(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;
// 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);
// Access attributes for plotting
virtual G4String GetH1Title(G4int id) const;
virtual G4String GetH1XAxisTitle(G4int id) const;
virtual G4String GetH1YAxisTitle(G4int id) const;
// Write data on ASCII file
virtual G4bool WriteOnAscii(std::ofstream& output);
private:
// methods
//
void SetH1HbookIdOffset();
void AddH1Information(const G4String& name,
const G4String& unitName,
const G4String& fcnName,
G4BinScheme binScheme) const;
G4int CreateH1FromBooking(h1_booking* h1Booking,
G4bool chDir = true);
G4int RegisterH1Booking(const G4String& name,
h1_booking* h1Booking);
void BeginCreateH1(const G4String& name);
G4int FinishCreateH1(const G4String& name, h1_booking* h1Booking,
const G4String& unitName, const G4String& fcnName,
G4BinScheme binScheme);
G4bool BeginSetH1(G4int id,
h1_booking* h1Booking,
G4HnInformation* info);
G4bool FinishSetH1(G4int id,
G4HnInformation* info,
const G4String& unitName, const G4String& fcnName,
G4BinScheme binScheme);
void CreateH1sFromBooking();
void Reset();
virtual h1_booking* GetH1Booking(G4int id, G4bool warn = true) const;
virtual tools::hbook::h1* GetH1InFunction(G4int id, G4String function,
G4bool warn = true,
G4bool onlyIfActive = true) const;
// data members
//
ExG4HbookBaseHnManager fBaseToolsManager;
ExG4HbookFileManager* fFileManager;
G4int fH1HbookIdOffset;
std::vector<tools::hbook::h1*> fH1Vector;
std::vector<h1_booking*> fH1BookingVector;
std::map<G4String, G4int> fH1NameIdMap;
};
// inline functions
inline void ExG4HbookH1Manager::SetFileManager(ExG4HbookFileManager* fileManager)
{ fFileManager = fileManager; }
inline G4int ExG4HbookH1Manager::GetH1HbookIdOffset() const {
return fH1HbookIdOffset;
}
inline std::vector<tools::hbook::h1*>::iterator ExG4HbookH1Manager::BeginH1()
{ return fH1Vector.begin(); }
inline std::vector<tools::hbook::h1*>::iterator ExG4HbookH1Manager::EndH1()
{ return fH1Vector.end(); }
inline std::vector<tools::hbook::h1*>::const_iterator
ExG4HbookH1Manager::BeginConstH1() const
{ return fH1Vector.begin(); }
inline std::vector<tools::hbook::h1*>::const_iterator
ExG4HbookH1Manager::EndConstH1() const
{ return fH1Vector.end(); }
#endif
#endif
@@ -0,0 +1,232 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file hbook/include/ExG4HbookH2Manager.hh
/// \brief Definition of the ExG4HbookH2Manager class
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
#ifdef G4_USE_HBOOK
#ifndef ExG4HbookH2Manager_h
#define ExG4HbookH2Manager_h 1
#include "G4VH2Manager.hh"
#include "ExG4HbookBaseHnManager.hh"
#include "globals.hh"
#include <tools/hbook/h2>
#include <vector>
#include <map>
class ExG4HbookFileManager;
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;
};
/// Manager class for HBook H2 histograms
///
/// The class implements the G4VH2Manager manager for HBook.
/// It is provided separately from geant4/source/analysis in order
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
class ExG4HbookH2Manager : public G4VH2Manager
{
friend class ExG4HbookAnalysisManager;
protected:
ExG4HbookH2Manager(const G4AnalysisManagerState& state);
virtual ~ExG4HbookH2Manager();
// Functions specific to the output type
//
// 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 methods
void SetFileManager(ExG4HbookFileManager* fileManager);
// Access methods
tools::hbook::h2* GetH2(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
// Iterators
std::vector<tools::hbook::h2*>::iterator BeginH2();
std::vector<tools::hbook::h2*>::iterator EndH2();
std::vector<tools::hbook::h2*>::const_iterator BeginConstH2() const;
std::vector<tools::hbook::h2*>::const_iterator EndConstH2() const;
protected:
// Virtual functions from base class
//
// Methods to create histogrammes, ntuples
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",
const G4String& xbinScheme = "linear",
const G4String& ybinScheme = "linear");
virtual G4int CreateH2(const G4String& name, const G4String& title,
const std::vector<G4double>& xedges,
const std::vector<G4double>& yedges,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "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",
const G4String& xbinScheme = "linear",
const G4String& ybinScheme = "linear");
virtual G4bool SetH2(G4int id,
const std::vector<G4double>& xedges,
const std::vector<G4double>& yedges,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none");
virtual G4bool ScaleH2(G4int id, G4double factor);
// Methods to fill histogrammes, ntuples
virtual G4bool FillH2(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0);
// Access methods via names
virtual G4int GetH2Id(const G4String& name, G4bool warn = true) 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 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 GetH2Title(G4int id) const;
virtual G4String GetH2XAxisTitle(G4int id) const;
virtual G4String GetH2YAxisTitle(G4int id) const;
virtual G4String GetH2ZAxisTitle(G4int id) const;
// Write data on ASCII file
virtual G4bool WriteOnAscii(std::ofstream& output);
private:
// static data members
//
static const G4int fgkDefaultH2HbookIdOffset;
// methods
//
void SetH2HbookIdOffset();
void CreateH2sFromBooking();
void Reset();
virtual h2_booking* GetH2Booking(G4int id, G4bool warn = true) const;
virtual tools::hbook::h2* GetH2InFunction(G4int id, G4String function,
G4bool warn = true,
G4bool onlyIfActive = true) const;
// data members
//
ExG4HbookBaseHnManager fBaseToolsManager;
ExG4HbookFileManager* fFileManager;
G4int fH2HbookIdOffset;
std::vector<tools::hbook::h2*> fH2Vector;
std::vector<h2_booking*> fH2BookingVector;
std::map<G4String, G4int> fH2NameIdMap;
};
// inline functions
inline void ExG4HbookH2Manager::SetFileManager(ExG4HbookFileManager* fileManager)
{ fFileManager = fileManager; }
inline G4int ExG4HbookH2Manager::GetH2HbookIdOffset() const {
return fH2HbookIdOffset;
}
inline std::vector<tools::hbook::h2*>::iterator ExG4HbookH2Manager::BeginH2()
{ return fH2Vector.begin(); }
inline std::vector<tools::hbook::h2*>::iterator ExG4HbookH2Manager::EndH2()
{ return fH2Vector.end(); }
inline std::vector<tools::hbook::h2*>::const_iterator
ExG4HbookH2Manager::BeginConstH2() const
{ return fH2Vector.begin(); }
inline std::vector<tools::hbook::h2*>::const_iterator
ExG4HbookH2Manager::EndConstH2() const
{ return fH2Vector.end(); }
#endif
#endif
@@ -0,0 +1,170 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExG4HbookH3DummyManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
/// \file hbook/include/ExG4HbookH3DummyManager.hh
/// \brief Definition of the ExG4HbookH3DummyManager class
// Author: Ivana Hrivnacova, 03/11/2014 (ivana@ipno.in2p3.fr)
#ifndef ExG4HbookH3DummyManager_h
#define ExG4HbookH3DummyManager_h 1
#include "G4VH3Manager.hh"
#include "G4BaseToolsManager.hh"
#include "G4HnManager.hh"
#include "globals.hh"
#include <vector>
#include <map>
namespace tools {
namespace histo {
class h3d;
}
}
/// Manager class for H3 with dummy implementation.
///
/// It will just issue warnings.
class ExG4HbookH3DummyManager : public G4VH3Manager
{
public:
ExG4HbookH3DummyManager(const G4AnalysisManagerState& state);
virtual ~ExG4HbookH3DummyManager();
protected:
// Virtual functions from base class
//
// Methods to create histograms
//
virtual G4int CreateH3(const G4String& name, const G4String& title,
G4int nxbins, G4double xmin, G4double xmax,
G4int nybins, G4double ymin, G4double ymax,
G4int nzbins, G4double zmin, G4double zmax,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& zunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& zfcnName = "none",
const G4String& xbinScheme = "linear",
const G4String& ybinScheme = "linear",
const G4String& zbinScheme = "linear");
virtual G4int CreateH3(const G4String& name, const G4String& title,
const std::vector<G4double>& xedges,
const std::vector<G4double>& yedges,
const std::vector<G4double>& zedges,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& zunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& zfcnName = "none");
virtual G4bool SetH3(G4int id,
G4int nxbins, G4double xmin, G4double xmax,
G4int nybins, G4double ymin, G4double ymax,
G4int nzbins, G4double zmin, G4double zmax,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& zunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& zfcnName = "none",
const G4String& xbinScheme = "linear",
const G4String& ybinScheme = "linear",
const G4String& zbinScheme = "linear");
virtual G4bool SetH3(G4int id,
const std::vector<G4double>& xedges,
const std::vector<G4double>& yedges,
const std::vector<G4double>& zedges,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& zunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& zfcnName = "none");
virtual G4bool ScaleH3(G4int id, G4double factor);
// Method to fill histograms
//
virtual G4bool FillH3(G4int id,
G4double xvalue, G4double yvalue, G4double zvalue,
G4double weight = 1.0);
// Methods to manipulate histograms
//
// Access methods
virtual G4int GetH3Id(const G4String& name, G4bool warn = true) const;
// Access to H3 parameters
virtual G4int GetH3Nxbins(G4int id) const;
virtual G4double GetH3Xmin(G4int id) const;
virtual G4double GetH3Xmax(G4int id) const;
virtual G4double GetH3XWidth(G4int id) const;
virtual G4int GetH3Nybins(G4int id) const;
virtual G4double GetH3Ymin(G4int id) const;
virtual G4double GetH3Ymax(G4int id) const;
virtual G4double GetH3YWidth(G4int id) const;
virtual G4int GetH3Nzbins(G4int id) const;
virtual G4double GetH3Zmin(G4int id) const;
virtual G4double GetH3Zmax(G4int id) const;
virtual G4double GetH3ZWidth(G4int id) const;
// Setters for attributes for plotting
virtual G4bool SetH3Title(G4int id, const G4String& title);
virtual G4bool SetH3XAxisTitle(G4int id, const G4String& title);
virtual G4bool SetH3YAxisTitle(G4int id, const G4String& title);
virtual G4bool SetH3ZAxisTitle(G4int id, const G4String& title);
// Access attributes for plotting
virtual G4String GetH3Title(G4int id) const;
virtual G4String GetH3XAxisTitle(G4int id) const;
virtual G4String GetH3YAxisTitle(G4int id) const;
virtual G4String GetH3ZAxisTitle(G4int id) const;
// Write data on ASCII file
virtual G4bool WriteOnAscii(std::ofstream& output);
private:
// methods
void ExceptionForHistograms(const G4String& functionName);
void ExceptionForHistogramsConst(const G4String& functionName) const;
// data members
G4bool fWarn;
};
#endif
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HnInformation.hh 66310 2012-12-17 11:56:35Z ihrivnac $
/// \file hbook/include/ExG4HbookNtupleDescription.hh
/// \brief Definition of the ExG4HbookNtupleDescription structure
// Author: Ivana Hrivnacova, 04/07/2012 (ivana@ipno.in2p3.fr)
#ifdef G4_USE_HBOOK
#ifndef ExG4HbookNtupleDescription_h
#define ExG4HbookNtupleDescription_h 1
#include "tools/hbook/wntuple"
#include "tools/ntuple_booking"
#include <map>
/// Structure containing the information related to one Hbook ntuple
struct ExG4HbookNtupleDescription
{
ExG4HbookNtupleDescription()
: fNtuple(0),
fNtupleBooking(0),
fNtupleIColumnMap(),
fNtupleFColumnMap(),
fNtupleDColumnMap() {}
~ExG4HbookNtupleDescription()
{ delete fNtupleBooking; }
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;
};
#endif
#endif
@@ -0,0 +1,186 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file hbook/include/ExG4HbookNtupleManager.hh
/// \brief Definition of the ExG4HbookNtupleManager class
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
#ifdef G4_USE_HBOOK
#ifndef ExG4HbookNtupleManager_h
#define ExG4HbookNtupleManager_h 1
#include "G4VNtupleManager.hh"
#include "ExG4HbookNtupleDescription.hh"
#include "globals.hh"
#include <tools/hbook/wntuple>
#include <vector>
#include <map>
class ExG4HbookFileManager;
/// Manager class for HBook ntuples
///
/// The class implements the G4VAnalysisManager manager for HBook.
/// It is provided separately from geant4/source/analysis in order
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
class ExG4HbookNtupleManager : public G4VNtupleManager
{
friend class ExG4HbookAnalysisManager;
protected:
ExG4HbookNtupleManager(const G4AnalysisManagerState& state);
virtual ~ExG4HbookNtupleManager();
// Functions specific to the output type
//
// Set the offset of NTUPLE ID for ntuples
// ( default value = firstNtupleID if firstNtupleID > 0; otherwise = 1)
G4bool SetNtupleHbookIdOffset(G4int offset);
G4int GetNtupleHbookIdOffset() const;
// Set methods
void SetFileManager(ExG4HbookFileManager* fileManager);
// Access methods
tools::hbook::wntuple* GetNtuple() const;
tools::hbook::wntuple* GetNtuple(G4int ntupleId) const;
// Iterators
std::vector<tools::hbook::wntuple*>::iterator BeginNtuple();
std::vector<tools::hbook::wntuple*>::iterator EndNtuple();
std::vector<tools::hbook::wntuple*>::const_iterator BeginConstNtuple() const;
std::vector<tools::hbook::wntuple*>::const_iterator EndConstNtuple() const;
// Virtual functions from base class
//
// Methods to create ntuples
virtual G4int CreateNtuple(const G4String& name, const G4String& title);
// Create columns in the last created ntuple
virtual G4int CreateNtupleIColumn(
const G4String& name, std::vector<int>* vector);
virtual G4int CreateNtupleFColumn(
const G4String& name, std::vector<float>* vector);
virtual G4int CreateNtupleDColumn(
const G4String& name, std::vector<double>* vector);
virtual G4int CreateNtupleSColumn(const G4String& name);
virtual void FinishNtuple();
// Create columns in the ntuple with given id
virtual G4int CreateNtupleIColumn(G4int ntupleId,
const G4String& name, std::vector<int>* vector);
virtual G4int CreateNtupleFColumn(G4int ntupleId,
const G4String& name, std::vector<float>* vector);
virtual G4int CreateNtupleDColumn(G4int ntupleId,
const G4String& name, std::vector<double>* vector);
virtual G4int CreateNtupleSColumn(G4int ntupleId, const G4String& name);
virtual void FinishNtuple(G4int ntupleId);
// Methods to fill ntuples
// Methods for ntuple with id = FirstNtupleId
virtual G4bool FillNtupleIColumn(G4int columnId, G4int value);
virtual G4bool FillNtupleFColumn(G4int columnId, G4float value);
virtual G4bool FillNtupleDColumn(G4int columnId, G4double value);
virtual G4bool FillNtupleSColumn(G4int columnId, const G4String& value);
virtual G4bool AddNtupleRow();
// Methods for ntuple with id > FirstNtupleId (when more ntuples exist)
virtual G4bool FillNtupleIColumn(
G4int ntupleId, G4int columnId, G4int value);
virtual G4bool FillNtupleFColumn(
G4int ntupleId, G4int columnId, G4float value);
virtual G4bool FillNtupleDColumn(
G4int ntupleId, G4int columnId, G4double value);
virtual G4bool FillNtupleSColumn(
G4int ntupleId, G4int columnId, const G4String& value);
virtual G4bool AddNtupleRow(G4int ntupleId);
// Access methods
virtual G4int GetNofNtuples() const;
private:
// methods
//
void SetNtupleHbookIdOffset();
void CreateNtuplesFromBooking();
tools::hbook::wntuple::column<int>*
GetNtupleIColumn(G4int ntupleId, G4int columnId) const;
tools::hbook::wntuple::column<float>*
GetNtupleFColumn(G4int ntupleId, G4int columnId) const;
tools::hbook::wntuple::column<double>*
GetNtupleDColumn(G4int ntupleId, G4int columnId) const;
void Reset();
ExG4HbookNtupleDescription* GetNtupleInFunction(G4int id,
G4String function,
G4bool warn = true,
G4bool onlyIfActive = true) const;
// data members
//
ExG4HbookFileManager* fFileManager;
G4int fNtupleHbookIdOffset;
std::vector<ExG4HbookNtupleDescription*> fNtupleDescriptionVector;
std::vector<tools::hbook::wntuple*> fNtupleVector;
};
// inline functions
inline void ExG4HbookNtupleManager::SetFileManager(ExG4HbookFileManager* fileManager)
{ fFileManager = fileManager; }
inline G4int ExG4HbookNtupleManager::GetNtupleHbookIdOffset() const {
return fNtupleHbookIdOffset;
}
inline std::vector<tools::hbook::wntuple*>::iterator
ExG4HbookNtupleManager::BeginNtuple()
{ return fNtupleVector.begin(); }
inline std::vector<tools::hbook::wntuple*>::iterator
ExG4HbookNtupleManager::EndNtuple()
{ return fNtupleVector.end(); }
inline std::vector<tools::hbook::wntuple*>::const_iterator
ExG4HbookNtupleManager::BeginConstNtuple() const
{ return fNtupleVector.begin(); }
inline std::vector<tools::hbook::wntuple*>::const_iterator
ExG4HbookNtupleManager::EndConstNtuple() const
{ return fNtupleVector.end(); }
inline G4int ExG4HbookNtupleManager::GetNofNtuples() const
{ return fNtupleVector.size(); }
#endif
#endif
@@ -0,0 +1,267 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file hbook/include/ExG4HbookP1Manager.hh
/// \brief Definition of the ExG4HbookP1Manager class
// Author: Ivana Hrivnacova, 03/11/2014 (ivana@ipno.in2p3.fr)
#ifdef G4_USE_HBOOK
#ifndef ExG4HbookP1Manager_h
#define ExG4HbookP1Manager_h 1
#include "G4VP1Manager.hh"
#include "G4HnInformation.hh"
#include "ExG4HbookBaseHnManager.hh"
#include "globals.hh"
#include <tools/hbook/p1>
#include <vector>
#include <map>
class ExG4HbookFileManager;
struct p1_booking {
p1_booking(G4int nbins, G4double xmin, G4double xmax,
G4double ymin, G4double ymax)
: fTitle(""),
fNbins(nbins),
fXmin(xmin),
fXmax(xmax),
fYmin(ymin),
fYmax(ymax),
fEdges() {}
p1_booking(const std::vector<G4double>& edges,
G4double ymin, G4double ymax)
: fTitle(""),
fNbins(0),
fXmin(0),
fXmax(0),
fYmin(ymin),
fYmax(ymax),
fEdges() {
for (G4int i=0; i<=G4int(edges.size()); ++i) fEdges.push_back(edges[i]);
}
G4String fTitle;
G4int fNbins;
G4double fXmin;
G4double fXmax;
G4double fYmin;
G4double fYmax;
std::vector<G4double> fEdges;
};
/// Manager class for HBook P1 histograms
///
/// The class implements the G4VP1Manager manager for HBook.
/// It is provided separately from geant4/source/analysis in order
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
class ExG4HbookP1Manager : public G4VP1Manager
{
friend class ExG4HbookAnalysisManager;
protected:
ExG4HbookP1Manager(const G4AnalysisManagerState& state);
virtual ~ExG4HbookP1Manager();
// Functions specific to the output type
//
// HBOOK does not allow IDs the same IDs for P1 and H2,
// and also IDs starting from 0; thats why there is defined an offset
// with respect to the G4AnalysisManager generic Ids.
// The default values of these offsets can be changed by the user.
//
// Set the offset of HBOOK ID for P1
// ( default value = firstHistoID if firstHistoID > 0; otherwise = 1)
G4bool SetP1HbookIdOffset(G4int offset);
G4int GetP1HbookIdOffset() const;
// Set methods
void SetFileManager(ExG4HbookFileManager* fileManager);
// Access methods
//
tools::hbook::p1* GetP1(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
// Iterators
std::vector<tools::hbook::p1*>::iterator BeginP1();
std::vector<tools::hbook::p1*>::iterator EndP1();
std::vector<tools::hbook::p1*>::const_iterator BeginConstP1() const;
std::vector<tools::hbook::p1*>::const_iterator EndConstP1() const;
// Virtual functions from base class
//
// Methods to create profiles
virtual G4int CreateP1(const G4String& name, const G4String& title,
G4int nbins, G4double xmin, G4double xmax,
G4double ymin = 0, G4double ymax = 0,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& xbinScheme = "linear");
virtual G4int CreateP1(const G4String& name, const G4String& title,
const std::vector<G4double>& edges,
G4double ymin = 0, G4double ymax = 0,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none");
virtual G4bool SetP1(G4int id,
G4int nbins, G4double xmin, G4double xmax,
G4double ymin = 0, G4double ymax = 0,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& xbinScheme = "linear");
virtual G4bool SetP1(G4int id,
const std::vector<G4double>& edges,
G4double ymin = 0, G4double ymax = 0,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none");
virtual G4bool ScaleP1(G4int id, G4double factor);
// Methods to fill profiles
virtual G4bool FillP1(G4int id, G4double value, G4double yvalue,
G4double weight = 1.0);
// Access methods
//
virtual G4int GetP1Id(const G4String& name, G4bool warn = true) const;
// Access to P1 parameters
virtual G4int GetP1Nbins(G4int id) const;
virtual G4double GetP1Xmin(G4int id) const;
virtual G4double GetP1Xmax(G4int id) const;
virtual G4double GetP1XWidth(G4int id) const;
virtual G4double GetP1Ymin(G4int id) const;
virtual G4double GetP1Ymax(G4int id) const;
// Setters for attributes for plotting
virtual G4bool SetP1Title(G4int id, const G4String& title);
virtual G4bool SetP1XAxisTitle(G4int id, const G4String& title);
virtual G4bool SetP1YAxisTitle(G4int id, const G4String& title);
// Access attributes for plotting
virtual G4String GetP1Title(G4int id) const;
virtual G4String GetP1XAxisTitle(G4int id) const;
virtual G4String GetP1YAxisTitle(G4int id) const;
// Write data on ASCII file
// virtual G4bool WriteOnAscii(std::ofstream& output);
private:
// methods
//
void SetP1HbookIdOffset();
void AddP1Information(const G4String& name,
const G4String& xunitName,
const G4String& yunitName,
const G4String& xfcnName,
const G4String& yfcnName,
G4BinScheme xbinScheme) const;
G4int CreateP1FromBooking(p1_booking* p1Booking,
G4bool chDir = true);
G4int RegisterP1Booking(const G4String& name,
p1_booking* p1Booking);
void BeginCreateP1(const G4String& name);
G4int FinishCreateP1(const G4String& name, p1_booking* p1Booking,
const G4String& xunitName,
const G4String& yunitName,
const G4String& xfcnName,
const G4String& yfcnName,
G4BinScheme xbinScheme) ;
G4bool BeginSetP1(G4int id,
p1_booking* p1Booking,
G4HnInformation* info);
G4bool FinishSetP1(G4int id,
G4HnInformation* info,
const G4String& xunitName,
const G4String& yunitName,
const G4String& xfcnName,
const G4String& yfcnName,
G4BinScheme xbinScheme) ;
void CreateP1sFromBooking();
void Reset();
virtual p1_booking* GetP1Booking(G4int id, G4bool warn = true) const;
virtual tools::hbook::p1* GetP1InFunction(G4int id, G4String function,
G4bool warn = true,
G4bool onlyIfActive = true) const;
// data members
//
ExG4HbookBaseHnManager fBaseToolsManager;
ExG4HbookFileManager* fFileManager;
G4int fP1HbookIdOffset;
std::vector<tools::hbook::p1*> fP1Vector;
std::vector<p1_booking*> fP1BookingVector;
std::map<G4String, G4int> fP1NameIdMap;
};
// inline functions
inline void ExG4HbookP1Manager::SetFileManager(ExG4HbookFileManager* fileManager)
{ fFileManager = fileManager; }
inline G4int ExG4HbookP1Manager::GetP1HbookIdOffset() const
{ return fP1HbookIdOffset; }
inline std::vector<tools::hbook::p1*>::iterator ExG4HbookP1Manager::BeginP1()
{ return fP1Vector.begin(); }
inline std::vector<tools::hbook::p1*>::iterator ExG4HbookP1Manager::EndP1()
{ return fP1Vector.end(); }
inline std::vector<tools::hbook::p1*>::const_iterator
ExG4HbookP1Manager::BeginConstP1() const
{ return fP1Vector.begin(); }
inline std::vector<tools::hbook::p1*>::const_iterator
ExG4HbookP1Manager::EndConstP1() const
{ return fP1Vector.end(); }
#endif
#endif
@@ -0,0 +1,160 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExG4HbookP2DummyManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
/// \file hbook/include/ExG4HbookP2DummyManager.hh
/// \brief Definition of the ExG4HbookP2DummyManager class
// Author: Ivana Hrivnacova, 24/07/2014 (ivana@ipno.in2p3.fr)
#ifndef ExG4HbookP2DummyManager_h
#define ExG4HbookP2DummyManager_h 1
#include "G4VP2Manager.hh"
namespace tools {
namespace histo {
class h3d;
}
}
/// Manager class for P2 with dummy implementation.
///
/// It will just issue warnings.
class ExG4HbookP2DummyManager : public G4VP2Manager
{
public:
ExG4HbookP2DummyManager(const G4AnalysisManagerState& state);
virtual ~ExG4HbookP2DummyManager();
protected:
// Virtual functions from base class
//
// Methods to create histograms
//
virtual G4int CreateP2(const G4String& name, const G4String& title,
G4int nxbins, G4double xmin, G4double xmax,
G4int nybins, G4double ymin, G4double ymax,
G4double zmin = 0, G4double zmax = 0,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& zunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& zfcnName = "none",
const G4String& xbinScheme = "linear",
const G4String& ybinScheme = "linear");
virtual G4int CreateP2(const G4String& name, const G4String& title,
const std::vector<G4double>& xedges,
const std::vector<G4double>& yedges,
G4double zmin = 0, G4double zmax = 0,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& zunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& zfcnName = "none");
virtual G4bool SetP2(G4int id,
G4int nxbins, G4double xmin, G4double xmax,
G4int nybins, G4double ymin, G4double ymax,
G4double zmin = 0, G4double zmax = 0,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& zunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& zfcnName = "none",
const G4String& xbinScheme = "linear",
const G4String& ybinScheme = "linear");
virtual G4bool SetP2(G4int id,
const std::vector<G4double>& xedges,
const std::vector<G4double>& yedges,
G4double zmin = 0, G4double zmax = 0,
const G4String& xunitName = "none",
const G4String& yunitName = "none",
const G4String& zunitName = "none",
const G4String& xfcnName = "none",
const G4String& yfcnName = "none",
const G4String& zfcnName = "none");
virtual G4bool ScaleP2(G4int id, G4double factor);
// Method to fill histograms
//
virtual G4bool FillP2(G4int id,
G4double xvalue, G4double yvalue, G4double zvalue,
G4double weight = 1.0);
// Methods to manipulate histograms
//
// Access methods
virtual G4int GetP2Id(const G4String& name, G4bool warn = true) const;
// Access to P2 parameters
virtual G4int GetP2Nxbins(G4int id) const;
virtual G4double GetP2Xmin(G4int id) const;
virtual G4double GetP2Xmax(G4int id) const;
virtual G4double GetP2XWidth(G4int id) const;
virtual G4int GetP2Nybins(G4int id) const;
virtual G4double GetP2Ymin(G4int id) const;
virtual G4double GetP2Ymax(G4int id) const;
virtual G4double GetP2YWidth(G4int id) const;
virtual G4double GetP2Zmin(G4int id) const;
virtual G4double GetP2Zmax(G4int id) const;
// Setters for attributes for plotting
virtual G4bool SetP2Title(G4int id, const G4String& title);
virtual G4bool SetP2XAxisTitle(G4int id, const G4String& title);
virtual G4bool SetP2YAxisTitle(G4int id, const G4String& title);
virtual G4bool SetP2ZAxisTitle(G4int id, const G4String& title);
// Access attributes for plotting
virtual G4String GetP2Title(G4int id) const;
virtual G4String GetP2XAxisTitle(G4int id) const;
virtual G4String GetP2YAxisTitle(G4int id) const;
virtual G4String GetP2ZAxisTitle(G4int id) const;
// Write data on ASCII file
virtual G4bool WriteOnAscii(std::ofstream& output);
private:
// methods
void ExceptionForProfiles(const G4String& functionName);
void ExceptionForProfilesConst(const G4String& functionName) const;
// data members
G4bool fWarn;
};
#endif
@@ -0,0 +1,42 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file hbook/include/g4hbook.hh
/// \brief Definition of the G4Hbook analysis typedefs
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
#ifndef g4hbook_h
#define g4hbook_h
#include "g4hbook_defs.hh"
using namespace G4Hbook;
#endif
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file hbook/include/g4hbook_defs.hh
/// \brief Definition of the G4Hbook analysis typedefs
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
#ifndef g4hbook_defs_h
#define g4hbook_defs_h
#include <tools/hbook/h1>
#include <tools/hbook/h2>
#include <tools/hbook/wntuple>
#include "ExG4HbookAnalysisManager.hh"
namespace G4Hbook {
// H1 types
typedef tools::hbook::h1 G4AnaH1; // keep for backward compatibility
typedef tools::hbook::h1 G4H1;
typedef std::vector<tools::hbook::h1*>::iterator G4H1Iterator;
typedef std::vector<tools::hbook::h1*>::const_iterator G4H1ConstIterator;
// H2 types
typedef tools::hbook::h2 G4AnaH2; // keep for backward compatibility
typedef tools::hbook::h2 G4H2;
typedef std::vector<tools::hbook::h2*>::iterator G4H2Iterator;
typedef std::vector<tools::hbook::h2*>::const_iterator G4H2ConstIterator;
// Ntuple types
typedef tools::hbook::wntuple G4Ntuple;
typedef std::vector<tools::hbook::wntuple*>::iterator G4NtupleIterator;
typedef std::vector<tools::hbook::wntuple*>::const_iterator G4NtupleConstIterator;
// Managers
typedef ExG4HbookAnalysisManager G4AnalysisManager;
}
#endif