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
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CsvAnalysisManager.hh 74257 2013-10-02 14:24:55Z gcosmo $
// $Id: G4CsvAnalysisManager.hh 85025 2014-10-23 09:57:57Z gcosmo $
// The main manager for Csv analysis.
// It delegates most of functions to the object specific managers.
@@ -38,14 +38,22 @@
#include "G4CsvNtupleDescription.hh"
#include "globals.hh"
#include "tools/histo/h1d"
#include "tools/histo/h2d"
#include "tools/histo/h3d"
#include "tools/histo/p1d"
#include "tools/histo/p2d"
#include "tools/wcsv_ntuple"
#include <fstream>
#include <vector>
#include <map>
class G4H1DummyManager;
class G4H2DummyManager;
class G4H1ToolsManager;
class G4H2ToolsManager;
class G4H3ToolsManager;
class G4P1ToolsManager;
class G4P2ToolsManager;
class G4CsvFileManager;
class G4CsvNtupleManager;
@@ -59,9 +67,55 @@ class G4CsvAnalysisManager : public G4VAnalysisManager
static G4CsvAnalysisManager* Instance();
// Access methods
tools::histo::h1d* GetH1(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
tools::histo::h2d* GetH2(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
tools::histo::h3d* GetH3(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
tools::histo::p1d* GetP1(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
tools::histo::p2d* GetP2(G4int id, G4bool warn = true,
G4bool onlyIfActive = true) const;
tools::wcsv::ntuple* GetNtuple() const;
tools::wcsv::ntuple* GetNtuple(G4int ntupleId) const;
// Iterators
std::vector<tools::histo::h1d*>::iterator BeginH1();
std::vector<tools::histo::h1d*>::iterator EndH1();
std::vector<tools::histo::h1d*>::const_iterator BeginConstH1() const;
std::vector<tools::histo::h1d*>::const_iterator EndConstH1() const;
std::vector<tools::histo::h2d*>::iterator BeginH2();
std::vector<tools::histo::h2d*>::iterator EndH2();
std::vector<tools::histo::h2d*>::const_iterator BeginConstH2() const;
std::vector<tools::histo::h2d*>::const_iterator EndConstH2() const;
std::vector<tools::histo::h3d*>::iterator BeginH3();
std::vector<tools::histo::h3d*>::iterator EndH3();
std::vector<tools::histo::h3d*>::const_iterator BeginConstH3() const;
std::vector<tools::histo::h3d*>::const_iterator EndConstH3() const;
std::vector<tools::histo::p1d*>::iterator BeginP1();
std::vector<tools::histo::p1d*>::iterator EndP1();
std::vector<tools::histo::p1d*>::const_iterator BeginConstP1() const;
std::vector<tools::histo::p1d*>::const_iterator EndConstP1() const;
std::vector<tools::histo::p2d*>::iterator BeginP2();
std::vector<tools::histo::p2d*>::iterator EndP2();
std::vector<tools::histo::p2d*>::const_iterator BeginConstP2() const;
std::vector<tools::histo::p2d*>::const_iterator EndConstP2() const;
std::vector<tools::wcsv::ntuple*>::iterator BeginNtuple();
std::vector<tools::wcsv::ntuple*>::iterator EndNtuple();
std::vector<tools::wcsv::ntuple*>::const_iterator BeginConstNtuple() const;
std::vector<tools::wcsv::ntuple*>::const_iterator EndConstNtuple() const;
// Csv format specific option
void SetIsCommentedHeader(G4bool isCommentedHeader);
void SetIsHippoHeader(G4bool isHippoHeader);
protected:
// virtual methods from base class
virtual G4bool OpenFileImpl(const G4String& fileName);
@@ -73,15 +127,24 @@ class G4CsvAnalysisManager : public G4VAnalysisManager
//
static G4CsvAnalysisManager* fgMasterInstance;
static G4ThreadLocal G4CsvAnalysisManager* fgInstance;
// methods
//
G4bool WriteH1();
G4bool WriteH2();
G4bool WriteH3();
G4bool WriteP1();
G4bool WriteP2();
G4bool CloseNtupleFiles();
G4bool Reset();
// data members
//
G4H1DummyManager* fH1Manager;
G4H2DummyManager* fH2Manager;
G4H1ToolsManager* fH1Manager;
G4H2ToolsManager* fH2Manager;
G4H3ToolsManager* fH3Manager;
G4P1ToolsManager* fP1Manager;
G4P2ToolsManager* fP2Manager;
G4CsvNtupleManager* fNtupleManager;
G4CsvFileManager* fFileManager;
};
@@ -25,8 +25,53 @@
//
// $Id: G4CsvAnalysisManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
#include "G4H1ToolsManager.hh"
#include "G4H2ToolsManager.hh"
#include "G4H3ToolsManager.hh"
#include "G4P1ToolsManager.hh"
#include "G4P2ToolsManager.hh"
#include "G4CsvNtupleManager.hh"
//_____________________________________________________________________________
inline
tools::histo::h1d* G4CsvAnalysisManager::GetH1(G4int id, G4bool warn,
G4bool onlyIfActive) const
{
return fH1Manager->GetH1(id, warn, onlyIfActive);
}
//_____________________________________________________________________________
inline
tools::histo::h2d* G4CsvAnalysisManager::GetH2(G4int id, G4bool warn,
G4bool onlyIfActive) const
{
return fH2Manager->GetH2(id, warn, onlyIfActive);
}
//_____________________________________________________________________________
inline
tools::histo::h3d* G4CsvAnalysisManager::GetH3(G4int id, G4bool warn,
G4bool onlyIfActive) const
{
return fH3Manager->GetH3(id, warn, onlyIfActive);
}
//_____________________________________________________________________________
inline
tools::histo::p1d* G4CsvAnalysisManager::GetP1(G4int id, G4bool warn,
G4bool onlyIfActive) const
{
return fP1Manager->GetP1(id, warn, onlyIfActive);
}
//_____________________________________________________________________________
inline
tools::histo::p2d* G4CsvAnalysisManager::GetP2(G4int id, G4bool warn,
G4bool onlyIfActive) const
{
return fP2Manager->GetP2(id, warn, onlyIfActive);
}
//_____________________________________________________________________________
inline
tools::wcsv::ntuple* G4CsvAnalysisManager::GetNtuple() const
@@ -40,3 +85,197 @@ tools::wcsv::ntuple* G4CsvAnalysisManager::GetNtuple(G4int ntupleId) const
{
return fNtupleManager->GetNtuple(ntupleId);
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h1d*>::iterator G4CsvAnalysisManager::BeginH1()
{
return fH1Manager->BeginH1();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h1d*>::iterator G4CsvAnalysisManager::EndH1()
{
return fH1Manager->EndH1();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h1d*>::const_iterator
G4CsvAnalysisManager::BeginConstH1() const
{
return fH1Manager->BeginConstH1();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h1d*>::const_iterator
G4CsvAnalysisManager::EndConstH1() const
{
return fH1Manager->EndConstH1();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h2d*>::iterator G4CsvAnalysisManager::BeginH2()
{
return fH2Manager->BeginH2();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h2d*>::iterator G4CsvAnalysisManager::EndH2()
{
return fH2Manager->EndH2();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h2d*>::const_iterator
G4CsvAnalysisManager::BeginConstH2() const
{
return fH2Manager->BeginConstH2();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h2d*>::const_iterator
G4CsvAnalysisManager::EndConstH2() const
{
return fH2Manager->EndConstH2();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h3d*>::iterator G4CsvAnalysisManager::BeginH3()
{
return fH3Manager->BeginH3();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h3d*>::iterator G4CsvAnalysisManager::EndH3()
{
return fH3Manager->EndH3();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h3d*>::const_iterator
G4CsvAnalysisManager::BeginConstH3() const
{
return fH3Manager->BeginConstH3();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::h3d*>::const_iterator
G4CsvAnalysisManager::EndConstH3() const
{
return fH3Manager->EndConstH3();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::p1d*>::iterator G4CsvAnalysisManager::BeginP1()
{
return fP1Manager->BeginP1();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::p1d*>::iterator G4CsvAnalysisManager::EndP1()
{
return fP1Manager->EndP1();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::p1d*>::const_iterator
G4CsvAnalysisManager::BeginConstP1() const
{
return fP1Manager->BeginConstP1();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::p1d*>::const_iterator
G4CsvAnalysisManager::EndConstP1() const
{
return fP1Manager->EndConstP1();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::p2d*>::iterator G4CsvAnalysisManager::BeginP2()
{
return fP2Manager->BeginP2();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::p2d*>::iterator G4CsvAnalysisManager::EndP2()
{
return fP2Manager->EndP2();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::p2d*>::const_iterator
G4CsvAnalysisManager::BeginConstP2() const
{
return fP2Manager->BeginConstP2();
}
//_____________________________________________________________________________
inline
std::vector<tools::histo::p2d*>::const_iterator
G4CsvAnalysisManager::EndConstP2() const
{
return fP2Manager->EndConstP2();
}
//_____________________________________________________________________________
inline
std::vector<tools::wcsv::ntuple*>::iterator G4CsvAnalysisManager::BeginNtuple()
{
return fNtupleManager->BeginNtuple();
}
//_____________________________________________________________________________
inline
std::vector<tools::wcsv::ntuple*>::iterator G4CsvAnalysisManager::EndNtuple()
{
return fNtupleManager->EndNtuple();
}
//_____________________________________________________________________________
inline
std::vector<tools::wcsv::ntuple*>::const_iterator
G4CsvAnalysisManager::BeginConstNtuple() const
{
return fNtupleManager->BeginConstNtuple();
}
//_____________________________________________________________________________
inline
std::vector<tools::wcsv::ntuple*>::const_iterator
G4CsvAnalysisManager::EndConstNtuple() const
{
return fNtupleManager->EndConstNtuple();
}
//_____________________________________________________________________________
inline
void G4CsvAnalysisManager::SetIsCommentedHeader(G4bool isCommentedHeader)
{
fNtupleManager->SetIsCommentedHeader(isCommentedHeader);
}
//_____________________________________________________________________________
inline
void G4CsvAnalysisManager::SetIsHippoHeader(G4bool isHippoHeader)
{
fNtupleManager->SetIsHippoHeader(isHippoHeader);
}
@@ -0,0 +1,120 @@
//
// ********************************************************************
// * 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: G4CsvAnalysisReader.hh 74257 2013-10-02 14:24:55Z gcosmo $
// The main manager for Csv analysis reader.
// It delegates most of functions to the object specific managers.
// Author: Ivana Hrivnacova, 05/09/2014 (ivana@ipno.in2p3.fr)
#ifndef G4CsvAnalysisReader_h
#define G4CsvAnalysisReader_h 1
#include "G4VAnalysisReader.hh"
#include "globals.hh"
#include "tools/histo/h1d"
#include "tools/histo/h2d"
#include "tools/histo/h3d"
#include "tools/histo/p1d"
#include "tools/histo/p2d"
#include "tools/rcsv_ntuple"
class G4H1ToolsManager;
class G4H2ToolsManager;
class G4H3ToolsManager;
class G4P1ToolsManager;
class G4P2ToolsManager;
class G4CsvRNtupleManager;
class G4CsvRFileManager;
class G4CsvAnalysisReader : public G4VAnalysisReader
{
public:
G4CsvAnalysisReader(G4bool isMaster = true);
virtual ~G4CsvAnalysisReader();
// static methods
static G4CsvAnalysisReader* Instance();
// Access methods
tools::histo::h1d* GetH1(G4int id, G4bool warn = true) const;
tools::histo::h2d* GetH2(G4int id, G4bool warn = true) const;
tools::histo::h3d* GetH3(G4int id, G4bool warn = true) const;
tools::histo::p1d* GetP1(G4int id, G4bool warn = true) const;
tools::histo::p2d* GetP2(G4int id, G4bool warn = true) const;
tools::rcsv::ntuple* GetNtuple() const;
tools::rcsv::ntuple* GetNtuple(G4int ntupleId) const;
using G4VAnalysisReader::GetNtuple;
protected:
// virtual methods from base class
virtual G4int ReadH1Impl(const G4String& h1Name,
const G4String& fileName,
G4bool isUserFileName);
virtual G4int ReadH2Impl(const G4String& h1Name,
const G4String& fileName,
G4bool isUserFileName);
virtual G4int ReadH3Impl(const G4String& h1Name,
const G4String& fileName,
G4bool isUserFileName);
virtual G4int ReadP1Impl(const G4String& h1Name,
const G4String& fileName,
G4bool isUserFileName);
virtual G4int ReadP2Impl(const G4String& h1Name,
const G4String& fileName,
G4bool isUserFileName);
virtual G4int ReadNtupleImpl(const G4String& ntupleName,
const G4String& fileName,
G4bool isUserFileName);
private:
// static data members
static G4CsvAnalysisReader* fgMasterInstance;
static G4ThreadLocal G4CsvAnalysisReader* fgInstance;
// methods
G4String GetHnFileName(const G4String& hnType,
const G4String& hnName,
const G4String& baseFileName,
G4bool isUserFileName) const;
G4bool Reset();
// data members
G4H1ToolsManager* fH1Manager;
G4H2ToolsManager* fH2Manager;
G4H3ToolsManager* fH3Manager;
G4P1ToolsManager* fP1Manager;
G4P2ToolsManager* fP2Manager;
G4CsvRNtupleManager* fNtupleManager;
G4CsvRFileManager* fFileManager;
};
#include "G4CsvAnalysisReader.icc"
#endif
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * 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: G4CsvAnalysisReader.hh 70604 2013-06-03 11:27:06Z ihrivnac $
// Author: Ivana Hrivnacova, 05/09/2014 (ivana@ipno.in2p3.fr)
#include "G4H1ToolsManager.hh"
#include "G4H2ToolsManager.hh"
#include "G4H3ToolsManager.hh"
#include "G4P1ToolsManager.hh"
#include "G4P2ToolsManager.hh"
#include "G4CsvRNtupleManager.hh"
//_____________________________________________________________________________
inline
tools::histo::h1d* G4CsvAnalysisReader::GetH1(G4int id, G4bool warn) const
{
return fH1Manager->GetH1(id, warn, false);
}
//_____________________________________________________________________________
inline
tools::histo::h2d* G4CsvAnalysisReader::GetH2(G4int id, G4bool warn) const
{
return fH2Manager->GetH2(id, warn, false);
}
//_____________________________________________________________________________
inline
tools::histo::h3d* G4CsvAnalysisReader::GetH3(G4int id, G4bool warn) const
{
return fH3Manager->GetH3(id, warn, false);
}
//_____________________________________________________________________________
inline
tools::histo::p1d* G4CsvAnalysisReader::GetP1(G4int id, G4bool warn) const
{
return fP1Manager->GetP1(id, warn, false);
}
//_____________________________________________________________________________
inline
tools::histo::p2d* G4CsvAnalysisReader::GetP2(G4int id, G4bool warn) const
{
return fP2Manager->GetP2(id, warn, false);
}
//_____________________________________________________________________________
inline
tools::rcsv::ntuple* G4CsvAnalysisReader::GetNtuple() const
{
return fNtupleManager->GetNtuple();
}
//_____________________________________________________________________________
inline
tools::rcsv::ntuple* G4CsvAnalysisReader::GetNtuple(G4int ntupleId) const
{
return fNtupleManager->GetNtuple(ntupleId);
}
@@ -25,7 +25,7 @@
//
// $Id: G4CsvFileManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
// The manager for Csv file operations.
// The manager for Csv output file operations.
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
@@ -50,6 +50,7 @@ class G4CsvFileManager : public G4VFileManager
virtual G4bool WriteFile();
virtual G4bool CloseFile();
// Specific methods for files per objects
G4bool CreateNtupleFile(G4CsvNtupleDescription* ntupleDescription);
G4bool CloseNtupleFile(G4CsvNtupleDescription* ntupleDescription);
};
@@ -34,6 +34,7 @@
#include "tools/wcsv_ntuple"
#include <string>
#include <fstream>
#include <map>
@@ -49,7 +50,8 @@ struct G4CsvNtupleDescription
fNtupleBooking(0),
fNtupleIColumnMap(),
fNtupleFColumnMap(),
fNtupleDColumnMap() {}
fNtupleDColumnMap(),
fNtupleSColumnMap() {}
~G4CsvNtupleDescription()
{ delete fFile;
@@ -63,6 +65,7 @@ struct G4CsvNtupleDescription
std::map<G4int, tools::wcsv::ntuple::column<int>* > fNtupleIColumnMap;
std::map<G4int, tools::wcsv::ntuple::column<float>* > fNtupleFColumnMap;
std::map<G4int, tools::wcsv::ntuple::column<double>* > fNtupleDColumnMap;
std::map<G4int, tools::wcsv::ntuple::column<std::string>* > fNtupleSColumnMap;
};
#endif
@@ -65,9 +65,15 @@ class G4CsvNtupleManager : public G4VNtupleManager
// Access methods
tools::wcsv::ntuple* GetNtuple() const;
tools::wcsv::ntuple* GetNtuple(G4int ntupleId) const;
// Iterators
std::vector<tools::wcsv::ntuple*>::iterator BeginNtuple();
std::vector<tools::wcsv::ntuple*>::iterator EndNtuple();
std::vector<tools::wcsv::ntuple*>::const_iterator BeginConstNtuple() const;
std::vector<tools::wcsv::ntuple*>::const_iterator EndConstNtuple() const;
// Access to ntuple vector (needed for Write())
const std::vector<G4CsvNtupleDescription*>& GetNtupleVector() const;
const std::vector<G4CsvNtupleDescription*>& GetNtupleDescriptionVector() const;
// Functions independent from the output type
//
@@ -75,14 +81,22 @@ class G4CsvNtupleManager : public G4VNtupleManager
// 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);
virtual G4int CreateNtupleFColumn(const G4String& name);
virtual G4int CreateNtupleDColumn(const G4String& name);
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);
virtual G4int CreateNtupleFColumn(G4int ntupleId, const G4String& name);
virtual G4int CreateNtupleDColumn(G4int ntupleId, const G4String& name);
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
@@ -90,16 +104,23 @@ class G4CsvNtupleManager : public G4VNtupleManager
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;
// Csv format specific option
void SetIsCommentedHeader(G4bool isCommentedHeader);
void SetIsHippoHeader(G4bool isHippoHeader);
private:
// methods
//
@@ -109,16 +130,23 @@ class G4CsvNtupleManager : public G4VNtupleManager
GetNtupleFColumn(G4int ntupleId, G4int columnId) const;
tools::wcsv::ntuple::column<double>*
GetNtupleDColumn(G4int ntupleId, G4int columnId) const;
tools::wcsv::ntuple::column<std::string>*
GetNtupleSColumn(G4int ntupleId, G4int columnId) const;
virtual G4CsvNtupleDescription* GetNtupleInFunction(G4int id,
G4String function,
G4bool warn = true,
G4bool onlyIfActive = true) const;
G4bool WriteHeader(tools::wcsv::ntuple* ntuple) const;
// data members
//
G4CsvFileManager* fFileManager;
std::vector<G4CsvNtupleDescription*> fNtupleVector;
std::vector<G4CsvNtupleDescription*> fNtupleDescriptionVector;
std::vector<tools::wcsv::ntuple*> fNtupleVector;
G4bool fIsCommentedHeader;
G4bool fIsHippoHeader;
};
// inline functions
@@ -126,11 +154,34 @@ class G4CsvNtupleManager : public G4VNtupleManager
inline void G4CsvNtupleManager::SetFileManager(G4CsvFileManager* fileManager)
{ fFileManager = fileManager; }
inline G4int G4CsvNtupleManager::GetNofNtuples() const
{ return fNtupleVector.size(); }
inline std::vector<tools::wcsv::ntuple*>::iterator
G4CsvNtupleManager::BeginNtuple()
{ return fNtupleVector.begin(); }
inline const std::vector<G4CsvNtupleDescription*>& G4CsvNtupleManager::GetNtupleVector() const
{ return fNtupleVector; }
inline std::vector<tools::wcsv::ntuple*>::iterator
G4CsvNtupleManager::EndNtuple()
{ return fNtupleVector.end(); }
inline std::vector<tools::wcsv::ntuple*>::const_iterator
G4CsvNtupleManager::BeginConstNtuple() const
{ return fNtupleVector.begin(); }
inline std::vector<tools::wcsv::ntuple*>::const_iterator
G4CsvNtupleManager::EndConstNtuple() const
{ return fNtupleVector.end(); }
inline G4int G4CsvNtupleManager::GetNofNtuples() const
{ return fNtupleDescriptionVector.size(); }
inline const std::vector<G4CsvNtupleDescription*>&
G4CsvNtupleManager::GetNtupleDescriptionVector() const
{ return fNtupleDescriptionVector; }
inline void G4CsvNtupleManager::SetIsCommentedHeader(G4bool isCommentedHeader)
{ fIsCommentedHeader = isCommentedHeader; }
inline void G4CsvNtupleManager::SetIsHippoHeader(G4bool isHippoHeader)
{ fIsHippoHeader = isHippoHeader; }
#endif
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * 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: G4CsvRFileManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
// The manager for Csv file input operations.
// Author: Ivana Hrivnacova, 21/10/2014 (ivana@ipno.in2p3.fr)
#ifndef G4CsvRFileManager_h
#define G4CsvRFileManager_h 1
#include "G4BaseFileManager.hh"
#include "globals.hh"
#include <fstream>
#include <map>
class G4AnalysisManagerState;
class G4CsvRFileManager : public G4BaseFileManager
{
public:
G4CsvRFileManager(const G4AnalysisManagerState& state);
~G4CsvRFileManager();
// Methods to manipulate input files
virtual G4bool OpenRFile(const G4String& fileName);
// Specific methods for files per objects
std::ifstream* GetRFile(const G4String& fileName) const;
private:
// data members
std::map<G4String, std::ifstream*> fRFiles;
};
#endif
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * 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$
// Structure containing the information related to rroot ntuple
//
// Author: Ivana Hrivnacova, 09/04/2014 (ivana@ipno.in2p3.fr)
#ifndef G4CsvRNtupleDescription_h
#define G4CsvRNtupleDescription_h 1
#include "tools/rcsv_ntuple"
#include "tools/ntuple_binding"
namespace tools {
class ntuple_binding;
}
struct G4CsvRNtupleDescription
{
G4CsvRNtupleDescription(
tools::rcsv::ntuple* rntuple)
: fNtuple(rntuple),
fNtupleBinding(new tools::ntuple_binding()),
fIsInitialized(false) {}
~G4CsvRNtupleDescription()
{
delete fNtupleBinding;
delete fNtuple; // CHECK
}
tools::rcsv::ntuple* fNtuple;
tools::ntuple_binding* fNtupleBinding;
G4bool fIsInitialized;
private:
// disabled (not implemented) copy constructor
G4CsvRNtupleDescription(const G4CsvRNtupleDescription& rhs);
// disabled (not implemented) assignement operator
G4CsvRNtupleDescription& operator=(G4CsvRNtupleDescription& rhs);
};
#endif
@@ -0,0 +1,119 @@
//
// ********************************************************************
// * 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$
// Manager class for Csv read ntuples.
// It implements functions specific to Csv read ntuples.
//
// Author: Ivana Hrivnacova, 25/07/2014 (ivana@ipno.in2p3.fr)
#ifndef G4CsvRNtupleManager_h
#define G4CsvRNtupleManager_h 1
#include "G4VRNtupleManager.hh"
#include "globals.hh"
#include "tools/rcsv_ntuple"
#include <vector>
struct G4CsvRNtupleDescription;
class G4CsvRNtupleManager : public G4VRNtupleManager
{
friend class G4CsvAnalysisReader;
protected:
G4CsvRNtupleManager(const G4AnalysisManagerState& state);
virtual ~G4CsvRNtupleManager();
// Methods to manipulate ntuples
G4bool IsEmpty() const;
G4bool Reset();
// Access methods
tools::rcsv::ntuple* GetNtuple() const;
tools::rcsv::ntuple* GetNtuple(G4int ntupleId) const;
// Functions independent from the output type
//
// Methods to read ntuple from a file
G4int SetNtuple(G4CsvRNtupleDescription* rntupleDescription);
// Methods for ntuple with id = FirstNtupleId
virtual G4bool SetNtupleIColumn(const G4String& columnName,
G4int& value);
virtual G4bool SetNtupleFColumn(const G4String& columnName,
G4float& value);
virtual G4bool SetNtupleDColumn(const G4String& columnName,
G4double& value);
virtual G4bool SetNtupleSColumn(const G4String& columnName,
G4String& value);
// Bind the ntuple columns of vector type
virtual G4bool SetNtupleIColumn(const G4String& columnName,
std::vector<G4int>& vector);
virtual G4bool SetNtupleFColumn(const G4String& columnName,
std::vector<G4float>& vector);
virtual G4bool SetNtupleDColumn(const G4String& columnName,
std::vector<G4double>& vector);
// Methods for ntuple with id > FirstNtupleId
virtual G4bool SetNtupleIColumn(G4int ntupleId,
const G4String& columnName, G4int& value);
virtual G4bool SetNtupleFColumn(G4int ntupleId,
const G4String& columnName, G4float& value);
virtual G4bool SetNtupleDColumn(G4int ntupleId,
const G4String& columnName, G4double& value);
virtual G4bool SetNtupleSColumn(G4int ntupleId,
const G4String& columnName, G4String& value);
// Bind the ntuple columns of vector type
virtual G4bool SetNtupleIColumn(G4int ntupleId, const G4String& columnName,
std::vector<G4int>& vector);
virtual G4bool SetNtupleFColumn(G4int ntupleId, const G4String& columnName,
std::vector<G4float>& vector);
virtual G4bool SetNtupleDColumn(G4int ntupleId, const G4String& columnName,
std::vector<G4double>& vector);
virtual G4bool GetNtupleRow();
virtual G4bool GetNtupleRow(G4int ntupleId) ;
// Access methods
virtual G4int GetNofNtuples() const;
private:
// methods
G4CsvRNtupleDescription* GetNtupleInFunction(G4int id,
G4String function,
G4bool warn = true) const;
// data members
std::vector<G4CsvRNtupleDescription*> fNtupleVector;
};
// inline functions
inline G4int G4CsvRNtupleManager::GetNofNtuples() const
{ return fNtupleVector.size(); }
#endif
+40 -1
View File
@@ -23,20 +23,59 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: g4csv_defs.hh 74257 2013-10-02 14:24:55Z gcosmo $
// $Id: g4csv_defs.hh 84303 2014-10-13 13:14:26Z gcosmo $
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
#ifndef g4csv_defs_h
#define g4csv_defs_h
#include "tools/histo/h1d"
#include "tools/histo/h2d"
#include "tools/histo/h3d"
#include "tools/histo/p1d"
#include "tools/histo/p2d"
#include "tools/wcsv_ntuple"
#include "G4CsvAnalysisManager.hh"
#include "G4CsvAnalysisReader.hh"
namespace G4Csv {
// H1 types
typedef tools::histo::h1d G4AnaH1; // keep for backward compatibility
typedef tools::histo::h1d G4H1;
typedef std::vector<tools::histo::h1d*>::iterator G4H1Iterator;
typedef std::vector<tools::histo::h1d*>::const_iterator G4H1ConstIterator;
// H2 types
typedef tools::histo::h2d G4AnaH2; // keep for backward compatibility
typedef tools::histo::h2d G4H2;
typedef std::vector<tools::histo::h2d*>::iterator G4H2Iterator;
typedef std::vector<tools::histo::h2d*>::const_iterator G4H2ConstIterator;
// H3 types
typedef tools::histo::h3d G4H3;
typedef std::vector<tools::histo::h3d*>::iterator G4H3Iterator;
typedef std::vector<tools::histo::h3d*>::const_iterator G4H3ConstIterator;
// P1 types
typedef tools::histo::p1d G4P1;
typedef std::vector<tools::histo::p1d*>::iterator G4P1Iterator;
typedef std::vector<tools::histo::p1d*>::const_iterator G4P1ConstIterator;
// P2 types
typedef tools::histo::p2d G4P2;
typedef std::vector<tools::histo::p2d*>::iterator G4P2Iterator;
typedef std::vector<tools::histo::p2d*>::const_iterator G4P2ConstIterator;
// Ntuple types
typedef tools::wcsv::ntuple G4Ntuple;
typedef std::vector<tools::wcsv::ntuple*>::iterator G4NtupleIterator;
typedef std::vector<tools::wcsv::ntuple*>::const_iterator G4NtupleConstIterator;
// Managers
typedef G4CsvAnalysisManager G4AnalysisManager;
typedef G4CsvAnalysisReader G4AnalysisReader;
}
#endif