Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4RootAnalysisManager.hh 74257 2013-10-02 14:24:55Z gcosmo $
|
||||
// $Id: G4RootAnalysisManager.hh 83432 2014-08-21 15:51:10Z gcosmo $
|
||||
|
||||
// The main manager for Root analysis.
|
||||
// It delegates most of functions to the object specific managers.
|
||||
@@ -38,11 +38,17 @@
|
||||
|
||||
#include "tools/histo/h1d"
|
||||
#include "tools/histo/h2d"
|
||||
#include "tools/histo/h3d"
|
||||
#include "tools/histo/p1d"
|
||||
#include "tools/histo/p2d"
|
||||
#include "tools/wroot/ntuple"
|
||||
|
||||
class G4RootFileManager;
|
||||
class G4H1ToolsManager;
|
||||
class G4H2ToolsManager;
|
||||
class G4H3ToolsManager;
|
||||
class G4P1ToolsManager;
|
||||
class G4P2ToolsManager;
|
||||
class G4RootNtupleManager;
|
||||
|
||||
|
||||
@@ -60,9 +66,46 @@ class G4RootAnalysisManager : public G4VAnalysisManager
|
||||
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::wroot::ntuple* GetNtuple() const;
|
||||
tools::wroot::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::wroot::ntuple*>::iterator BeginNtuple();
|
||||
std::vector<tools::wroot::ntuple*>::iterator EndNtuple();
|
||||
std::vector<tools::wroot::ntuple*>::const_iterator BeginConstNtuple() const;
|
||||
std::vector<tools::wroot::ntuple*>::const_iterator EndConstNtuple() const;
|
||||
|
||||
protected:
|
||||
// virtual methods from base class
|
||||
@@ -78,11 +121,17 @@ class G4RootAnalysisManager : public G4VAnalysisManager
|
||||
// methods
|
||||
G4bool WriteH1();
|
||||
G4bool WriteH2();
|
||||
G4bool WriteH3();
|
||||
G4bool WriteP1();
|
||||
G4bool WriteP2();
|
||||
G4bool Reset();
|
||||
|
||||
// data members
|
||||
G4H1ToolsManager* fH1Manager;
|
||||
G4H2ToolsManager* fH2Manager;
|
||||
G4H3ToolsManager* fH3Manager;
|
||||
G4P1ToolsManager* fP1Manager;
|
||||
G4P2ToolsManager* fP2Manager;
|
||||
G4RootNtupleManager* fNtupleManager;
|
||||
G4RootFileManager* fFileManager;
|
||||
};
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
|
||||
#include "G4H1ToolsManager.hh"
|
||||
#include "G4H2ToolsManager.hh"
|
||||
#include "G4H3ToolsManager.hh"
|
||||
#include "G4P1ToolsManager.hh"
|
||||
#include "G4P2ToolsManager.hh"
|
||||
#include "G4RootNtupleManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -45,6 +48,30 @@ tools::histo::h2d* G4RootAnalysisManager::GetH2(G4int id, G4bool warn,
|
||||
return fH2Manager->GetH2(id, warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::h3d* G4RootAnalysisManager::GetH3(G4int id, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
return fH3Manager->GetH3(id, warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::p1d* G4RootAnalysisManager::GetP1(G4int id, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
return fP1Manager->GetP1(id, warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::p2d* G4RootAnalysisManager::GetP2(G4int id, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
return fP2Manager->GetP2(id, warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::wroot::ntuple* G4RootAnalysisManager::GetNtuple() const
|
||||
@@ -58,3 +85,183 @@ tools::wroot::ntuple* G4RootAnalysisManager::GetNtuple(G4int ntupleId) const
|
||||
{
|
||||
return fNtupleManager->GetNtuple(ntupleId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h1d*>::iterator G4RootAnalysisManager::BeginH1()
|
||||
{
|
||||
return fH1Manager->BeginH1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h1d*>::iterator G4RootAnalysisManager::EndH1()
|
||||
{
|
||||
return fH1Manager->EndH1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h1d*>::const_iterator
|
||||
G4RootAnalysisManager::BeginConstH1() const
|
||||
{
|
||||
return fH1Manager->BeginConstH1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h1d*>::const_iterator
|
||||
G4RootAnalysisManager::EndConstH1() const
|
||||
{
|
||||
return fH1Manager->EndConstH1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h2d*>::iterator G4RootAnalysisManager::BeginH2()
|
||||
{
|
||||
return fH2Manager->BeginH2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h2d*>::iterator G4RootAnalysisManager::EndH2()
|
||||
{
|
||||
return fH2Manager->EndH2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h2d*>::const_iterator
|
||||
G4RootAnalysisManager::BeginConstH2() const
|
||||
{
|
||||
return fH2Manager->BeginConstH2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h2d*>::const_iterator
|
||||
G4RootAnalysisManager::EndConstH2() const
|
||||
{
|
||||
return fH2Manager->EndConstH2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h3d*>::iterator G4RootAnalysisManager::BeginH3()
|
||||
{
|
||||
return fH3Manager->BeginH3();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h3d*>::iterator G4RootAnalysisManager::EndH3()
|
||||
{
|
||||
return fH3Manager->EndH3();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h3d*>::const_iterator
|
||||
G4RootAnalysisManager::BeginConstH3() const
|
||||
{
|
||||
return fH3Manager->BeginConstH3();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::h3d*>::const_iterator
|
||||
G4RootAnalysisManager::EndConstH3() const
|
||||
{
|
||||
return fH3Manager->EndConstH3();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::p1d*>::iterator G4RootAnalysisManager::BeginP1()
|
||||
{
|
||||
return fP1Manager->BeginP1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::p1d*>::iterator G4RootAnalysisManager::EndP1()
|
||||
{
|
||||
return fP1Manager->EndP1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::p1d*>::const_iterator
|
||||
G4RootAnalysisManager::BeginConstP1() const
|
||||
{
|
||||
return fP1Manager->BeginConstP1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::p1d*>::const_iterator
|
||||
G4RootAnalysisManager::EndConstP1() const
|
||||
{
|
||||
return fP1Manager->EndConstP1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::p2d*>::iterator G4RootAnalysisManager::BeginP2()
|
||||
{
|
||||
return fP2Manager->BeginP2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::p2d*>::iterator G4RootAnalysisManager::EndP2()
|
||||
{
|
||||
return fP2Manager->EndP2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::p2d*>::const_iterator
|
||||
G4RootAnalysisManager::BeginConstP2() const
|
||||
{
|
||||
return fP2Manager->BeginConstP2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::histo::p2d*>::const_iterator
|
||||
G4RootAnalysisManager::EndConstP2() const
|
||||
{
|
||||
return fP2Manager->EndConstP2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::wroot::ntuple*>::iterator G4RootAnalysisManager::BeginNtuple()
|
||||
{
|
||||
return fNtupleManager->BeginNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::wroot::ntuple*>::iterator G4RootAnalysisManager::EndNtuple()
|
||||
{
|
||||
return fNtupleManager->EndNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::wroot::ntuple*>::const_iterator
|
||||
G4RootAnalysisManager::BeginConstNtuple() const
|
||||
{
|
||||
return fNtupleManager->BeginConstNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::wroot::ntuple*>::const_iterator
|
||||
G4RootAnalysisManager::EndConstNtuple() const
|
||||
{
|
||||
return fNtupleManager->EndConstNtuple();
|
||||
}
|
||||
|
||||
@@ -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: G4RootAnalysisReader.hh 74257 2013-10-02 14:24:55Z gcosmo $
|
||||
|
||||
// The main manager for Root analysis reader.
|
||||
// It delegates most of functions to the object specific managers.
|
||||
|
||||
// Author: Ivana Hrivnacova, 09/04/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4RootAnalysisReader_h
|
||||
#define G4RootAnalysisReader_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/rroot/ntuple"
|
||||
|
||||
class G4RootRFileManager;
|
||||
class G4H1ToolsManager;
|
||||
class G4H2ToolsManager;
|
||||
class G4H3ToolsManager;
|
||||
class G4P1ToolsManager;
|
||||
class G4P2ToolsManager;
|
||||
class G4RootRNtupleManager;
|
||||
|
||||
class G4RootAnalysisReader : public G4VAnalysisReader
|
||||
{
|
||||
public:
|
||||
G4RootAnalysisReader(G4bool isMaster = true);
|
||||
virtual ~G4RootAnalysisReader();
|
||||
|
||||
// static methods
|
||||
static G4RootAnalysisReader* 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::rroot::ntuple* GetNtuple() const;
|
||||
tools::rroot::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 G4RootAnalysisReader* fgMasterInstance;
|
||||
static G4ThreadLocal G4RootAnalysisReader* fgInstance;
|
||||
|
||||
// methods
|
||||
//
|
||||
tools::rroot::buffer* GetBuffer(
|
||||
const G4String& fileName,
|
||||
const G4String& name,
|
||||
const G4String& inFunction);
|
||||
G4bool Reset();
|
||||
|
||||
// data members
|
||||
G4H1ToolsManager* fH1Manager;
|
||||
G4H2ToolsManager* fH2Manager;
|
||||
G4H3ToolsManager* fH3Manager;
|
||||
G4P1ToolsManager* fP1Manager;
|
||||
G4P2ToolsManager* fP2Manager;
|
||||
G4RootRNtupleManager* fNtupleManager;
|
||||
G4RootRFileManager* fFileManager;
|
||||
};
|
||||
|
||||
#include "G4RootAnalysisReader.icc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4RootAnalysisReader.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 "G4RootRNtupleManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::h1d* G4RootAnalysisReader::GetH1(G4int id, G4bool warn) const
|
||||
{
|
||||
return fH1Manager->GetH1(id, warn, false);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::h2d* G4RootAnalysisReader::GetH2(G4int id, G4bool warn) const
|
||||
{
|
||||
return fH2Manager->GetH2(id, warn, false);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::h3d* G4RootAnalysisReader::GetH3(G4int id, G4bool warn) const
|
||||
{
|
||||
return fH3Manager->GetH3(id, warn, false);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::p1d* G4RootAnalysisReader::GetP1(G4int id, G4bool warn) const
|
||||
{
|
||||
return fP1Manager->GetP1(id, warn, false);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::p2d* G4RootAnalysisReader::GetP2(G4int id, G4bool warn) const
|
||||
{
|
||||
return fP2Manager->GetP2(id, warn, false);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::rroot::ntuple* G4RootAnalysisReader::GetNtuple() const
|
||||
{
|
||||
return fNtupleManager->GetNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::rroot::ntuple* G4RootAnalysisReader::GetNtuple(G4int ntupleId) const
|
||||
{
|
||||
return fNtupleManager->GetNtuple(ntupleId);
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
// $Id: G4RootFileManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
// The manager for Root file operations.
|
||||
// The manager for Root output file operations.
|
||||
|
||||
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "G4VFileManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
class file;
|
||||
@@ -48,24 +50,26 @@ class G4RootFileManager : public G4VFileManager
|
||||
G4RootFileManager(const G4AnalysisManagerState& state);
|
||||
virtual ~G4RootFileManager();
|
||||
|
||||
// Methods to manipulate files
|
||||
// Methods to manipulate file
|
||||
virtual G4bool OpenFile(const G4String& fileName);
|
||||
virtual G4bool WriteFile();
|
||||
virtual G4bool CloseFile();
|
||||
|
||||
G4bool CreateHistoDirectory();
|
||||
G4bool CreateProfileDirectory();
|
||||
G4bool CreateNtupleDirectory();
|
||||
|
||||
// Get methods
|
||||
tools::wroot::file* GetFile() const;
|
||||
tools::wroot::directory* GetHistoDirectory() const;
|
||||
tools::wroot::directory* GetProfileDirectory() const;
|
||||
tools::wroot::directory* GetNtupleDirectory() const;
|
||||
|
||||
private:
|
||||
// data members
|
||||
//
|
||||
tools::wroot::file* fFile;
|
||||
tools::wroot::directory* fHistoDirectory;
|
||||
tools::wroot::directory* fProfileDirectory;
|
||||
tools::wroot::directory* fNtupleDirectory;
|
||||
};
|
||||
|
||||
@@ -77,6 +81,9 @@ inline tools::wroot::file* G4RootFileManager::GetFile() const
|
||||
inline tools::wroot::directory* G4RootFileManager::GetHistoDirectory() const
|
||||
{ return fHistoDirectory; }
|
||||
|
||||
inline tools::wroot::directory* G4RootFileManager::GetProfileDirectory() const
|
||||
{ return fProfileDirectory; }
|
||||
|
||||
inline tools::wroot::directory* G4RootFileManager::GetNtupleDirectory() const
|
||||
{ return fNtupleDirectory; }
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ struct G4RootNtupleDescription
|
||||
fNtupleBooking(0),
|
||||
fNtupleIColumnMap(),
|
||||
fNtupleFColumnMap(),
|
||||
fNtupleDColumnMap() {}
|
||||
fNtupleDColumnMap(),
|
||||
fNtupleSColumnMap() {}
|
||||
|
||||
~G4RootNtupleDescription()
|
||||
{
|
||||
@@ -60,6 +61,7 @@ struct G4RootNtupleDescription
|
||||
std::map<G4int, tools::wroot::ntuple::column<int>* > fNtupleIColumnMap;
|
||||
std::map<G4int, tools::wroot::ntuple::column<float>* > fNtupleFColumnMap;
|
||||
std::map<G4int, tools::wroot::ntuple::column<double>* > fNtupleDColumnMap;
|
||||
std::map<G4int, tools::wroot::ntuple::column_string* > fNtupleSColumnMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -71,20 +71,34 @@ class G4RootNtupleManager : public G4VNtupleManager
|
||||
tools::wroot::ntuple* GetNtuple() const;
|
||||
tools::wroot::ntuple* GetNtuple(G4int ntupleId) const;
|
||||
|
||||
// Iterators
|
||||
std::vector<tools::wroot::ntuple*>::iterator BeginNtuple();
|
||||
std::vector<tools::wroot::ntuple*>::iterator EndNtuple();
|
||||
std::vector<tools::wroot::ntuple*>::const_iterator BeginConstNtuple() const;
|
||||
std::vector<tools::wroot::ntuple*>::const_iterator EndConstNtuple() const;
|
||||
|
||||
// Functions independent from the output type
|
||||
//
|
||||
|
||||
// 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
|
||||
@@ -92,11 +106,14 @@ class G4RootNtupleManager : 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
|
||||
@@ -111,6 +128,8 @@ class G4RootNtupleManager : public G4VNtupleManager
|
||||
GetNtupleFColumn(G4int ntupleId, G4int columnId) const;
|
||||
tools::wroot::ntuple::column<double>*
|
||||
GetNtupleDColumn(G4int ntupleId, G4int columnId) const;
|
||||
tools::wroot::ntuple::column_string*
|
||||
GetNtupleSColumn(G4int ntupleId, G4int columnId) const;
|
||||
|
||||
virtual G4RootNtupleDescription* GetNtupleInFunction(G4int id,
|
||||
G4String function,
|
||||
@@ -120,15 +139,31 @@ class G4RootNtupleManager : public G4VNtupleManager
|
||||
// data members
|
||||
//
|
||||
tools::wroot::directory* fNtupleDirectory;
|
||||
std::vector<G4RootNtupleDescription*> fNtupleVector;
|
||||
std::vector<G4RootNtupleDescription*> fNtupleDescriptionVector;
|
||||
std::vector<tools::wroot::ntuple*> fNtupleVector;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void G4RootNtupleManager::SetNtupleDirectory(
|
||||
tools::wroot::directory* directory) {
|
||||
fNtupleDirectory = directory;
|
||||
}
|
||||
tools::wroot::directory* directory)
|
||||
{ fNtupleDirectory = directory; }
|
||||
|
||||
inline std::vector<tools::wroot::ntuple*>::iterator
|
||||
G4RootNtupleManager::BeginNtuple()
|
||||
{ return fNtupleVector.begin(); }
|
||||
|
||||
inline std::vector<tools::wroot::ntuple*>::iterator
|
||||
G4RootNtupleManager::EndNtuple()
|
||||
{ return fNtupleVector.end(); }
|
||||
|
||||
inline std::vector<tools::wroot::ntuple*>::const_iterator
|
||||
G4RootNtupleManager::BeginConstNtuple() const
|
||||
{ return fNtupleVector.begin(); }
|
||||
|
||||
inline std::vector<tools::wroot::ntuple*>::const_iterator
|
||||
G4RootNtupleManager::EndConstNtuple() const
|
||||
{ return fNtupleVector.end(); }
|
||||
|
||||
inline G4int G4RootNtupleManager::GetNofNtuples() const
|
||||
{ return fNtupleVector.size(); }
|
||||
|
||||
@@ -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: G4RootRFileManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
// The manager for Root file input operations.
|
||||
|
||||
// Author: Ivana Hrivnacova, 10/09/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4RootRFileManager_h
|
||||
#define G4RootRFileManager_h 1
|
||||
|
||||
#include "G4BaseFileManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace tools {
|
||||
namespace rroot {
|
||||
class file;
|
||||
//class directory;
|
||||
}
|
||||
}
|
||||
|
||||
class G4RootRFileManager : public G4BaseFileManager
|
||||
{
|
||||
public:
|
||||
G4RootRFileManager(const G4AnalysisManagerState& state);
|
||||
virtual ~G4RootRFileManager();
|
||||
|
||||
// Methods to manipulate input files
|
||||
virtual G4bool OpenRFile(const G4String& fileName,
|
||||
G4bool isPerThread);
|
||||
|
||||
// Get methods
|
||||
tools::rroot::file* GetRFile(const G4String& fileName,
|
||||
G4bool isPerThread) const;
|
||||
|
||||
private:
|
||||
// data members
|
||||
std::map<G4String, tools::rroot::file*> fRFiles;
|
||||
};
|
||||
|
||||
#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$
|
||||
|
||||
// Structure containing the information related to rroot ntuple
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 09/04/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4RootRNtupleDescription_h
|
||||
#define G4RootRNtupleDescription_h 1
|
||||
|
||||
#include "tools/rroot/ntuple"
|
||||
#include "tools/rroot/fac"
|
||||
#include "tools/rroot/tree"
|
||||
|
||||
namespace tools {
|
||||
class ntuple_binding;
|
||||
}
|
||||
|
||||
struct G4RootRNtupleDescription
|
||||
{
|
||||
G4RootRNtupleDescription(
|
||||
tools::rroot::ntuple* rntuple,
|
||||
tools::rroot::buffer* buffer,
|
||||
tools::rroot::fac* fac,
|
||||
tools::rroot::tree* tree)
|
||||
: fNtuple(rntuple),
|
||||
fNtupleBinding(new tools::ntuple_binding()),
|
||||
fBuffer(buffer),
|
||||
fFac(fac),
|
||||
fTree(tree),
|
||||
fIsInitialized(false) {}
|
||||
|
||||
~G4RootRNtupleDescription()
|
||||
{
|
||||
delete fNtupleBinding;
|
||||
delete fBuffer;
|
||||
delete fFac;
|
||||
delete fTree;
|
||||
// fNtuple is owned by the file CHECK
|
||||
}
|
||||
|
||||
tools::rroot::ntuple* fNtuple;
|
||||
tools::ntuple_binding* fNtupleBinding;
|
||||
tools::rroot::buffer* fBuffer;
|
||||
tools::rroot::fac* fFac;
|
||||
tools::rroot::tree* fTree;
|
||||
G4bool fIsInitialized;
|
||||
|
||||
private:
|
||||
// disabled (not implemented) copy constructor
|
||||
G4RootRNtupleDescription(const G4RootRNtupleDescription& rhs);
|
||||
// disabled (not implemented) assignement operator
|
||||
G4RootRNtupleDescription& operator=(G4RootRNtupleDescription& 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: G4RootRNtupleManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
// Manager class for Root read ntuples.
|
||||
// It implements functions specific to Root read ntuples.
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 09/04/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4RootRNtupleManager_h
|
||||
#define G4RootRNtupleManager_h 1
|
||||
|
||||
#include "G4VRNtupleManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/rroot/ntuple"
|
||||
|
||||
#include <vector>
|
||||
|
||||
struct G4RootRNtupleDescription;
|
||||
|
||||
class G4RootRNtupleManager : public G4VRNtupleManager
|
||||
{
|
||||
friend class G4RootAnalysisReader;
|
||||
|
||||
protected:
|
||||
G4RootRNtupleManager(const G4AnalysisManagerState& state);
|
||||
virtual ~G4RootRNtupleManager();
|
||||
|
||||
// Methods to manipulate ntuples
|
||||
G4bool IsEmpty() const;
|
||||
G4bool Reset();
|
||||
|
||||
// Access methods
|
||||
tools::rroot::ntuple* GetNtuple() const;
|
||||
tools::rroot::ntuple* GetNtuple(G4int ntupleId) const;
|
||||
|
||||
// Functions independent from the output type
|
||||
//
|
||||
// Methods to read ntuple from a file
|
||||
G4int SetNtuple(G4RootRNtupleDescription* 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
|
||||
G4RootRNtupleDescription* GetNtupleInFunction(G4int id,
|
||||
G4String function,
|
||||
G4bool warn = true) const;
|
||||
|
||||
// data members
|
||||
std::vector<G4RootRNtupleDescription*> fNtupleVector;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline G4int G4RootRNtupleManager::GetNofNtuples() const
|
||||
{ return fNtupleVector.size(); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: g4root_defs.hh 72292 2013-07-15 12:01:43Z ihrivnac $
|
||||
// $Id: g4root_defs.hh 83748 2014-09-12 12:13:37Z gcosmo $
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
@@ -32,15 +32,54 @@
|
||||
|
||||
#include "tools/histo/h1d"
|
||||
#include "tools/histo/h2d"
|
||||
#include "tools/histo/h3d"
|
||||
#include "tools/histo/p1d"
|
||||
#include "tools/histo/p2d"
|
||||
#include "tools/wroot/ntuple"
|
||||
#include "tools/rroot/ntuple"
|
||||
#include "G4RootAnalysisManager.hh"
|
||||
#include "G4RootAnalysisReader.hh"
|
||||
|
||||
namespace G4Root {
|
||||
|
||||
typedef tools::histo::h1d G4AnaH1;
|
||||
typedef tools::histo::h2d G4AnaH2;
|
||||
// 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::wroot::ntuple G4Ntuple;
|
||||
typedef std::vector<tools::wroot::ntuple*>::iterator G4NtupleIterator;
|
||||
typedef std::vector<tools::wroot::ntuple*>::const_iterator G4NtupleConstIterator;
|
||||
|
||||
// RNtuple types
|
||||
typedef tools::rroot::ntuple G4RNtuple;
|
||||
|
||||
// Managers
|
||||
typedef G4RootAnalysisManager G4AnalysisManager;
|
||||
typedef G4RootAnalysisReader G4AnalysisReader;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user