Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4XmlAnalysisManager.hh 74257 2013-10-02 14:24:55Z gcosmo $
|
||||
|
||||
// The main manager for Xml analysis.
|
||||
// It delegates most of functions to the object specific managers.
|
||||
|
||||
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4XmlAnalysisManager_h
|
||||
#define G4XmlAnalysisManager_h 1
|
||||
|
||||
#include "G4VAnalysisManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/histo/h1d"
|
||||
#include "tools/histo/h2d"
|
||||
#include "tools/waxml/ntuple"
|
||||
|
||||
|
||||
class G4XmlFileManager;
|
||||
class G4H1ToolsManager;
|
||||
class G4H2ToolsManager;
|
||||
class G4XmlNtupleManager;
|
||||
|
||||
class G4XmlAnalysisManager : public G4VAnalysisManager
|
||||
{
|
||||
public:
|
||||
G4XmlAnalysisManager(G4bool isMaster = true);
|
||||
~G4XmlAnalysisManager();
|
||||
|
||||
// static methods
|
||||
static G4XmlAnalysisManager* 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::waxml::ntuple* GetNtuple() const;
|
||||
tools::waxml::ntuple* GetNtuple(G4int ntupleId) const;
|
||||
|
||||
protected:
|
||||
// virtual methods from base class
|
||||
virtual G4bool OpenFileImpl(const G4String& fileName);
|
||||
virtual G4bool WriteImpl();
|
||||
virtual G4bool CloseFileImpl();
|
||||
|
||||
private:
|
||||
// static data members
|
||||
static G4XmlAnalysisManager* fgMasterInstance;
|
||||
static G4ThreadLocal G4XmlAnalysisManager* fgInstance;
|
||||
|
||||
// methods
|
||||
G4bool WriteH1();
|
||||
G4bool WriteH2();
|
||||
G4bool WriteNtuple();
|
||||
G4bool CloseNtupleFiles();
|
||||
G4bool Reset();
|
||||
|
||||
// data members
|
||||
G4H1ToolsManager* fH1Manager;
|
||||
G4H2ToolsManager* fH2Manager;
|
||||
G4XmlNtupleManager* fNtupleManager;
|
||||
G4XmlFileManager* fFileManager;
|
||||
|
||||
};
|
||||
|
||||
#include "G4XmlAnalysisManager.icc"
|
||||
|
||||
#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: G4XmlAnalysisManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
#include "G4H1ToolsManager.hh"
|
||||
#include "G4H2ToolsManager.hh"
|
||||
#include "G4XmlNtupleManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::h1d* G4XmlAnalysisManager::GetH1(G4int id, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
return fH1Manager->GetH1(id, warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::histo::h2d* G4XmlAnalysisManager::GetH2(G4int id, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
return fH2Manager->GetH2(id, warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::waxml::ntuple* G4XmlAnalysisManager::GetNtuple() const
|
||||
{
|
||||
return fNtupleManager->GetNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::waxml::ntuple* G4XmlAnalysisManager::GetNtuple(G4int ntupleId) const
|
||||
{
|
||||
return fNtupleManager->GetNtuple(ntupleId);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4XmlFileManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4XmlFileManager_h
|
||||
#define G4XmlFileManager_h 1
|
||||
|
||||
#include "G4VFileManager.hh"
|
||||
#include "G4XmlNtupleDescription.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
class G4AnalysisManagerState;
|
||||
|
||||
class G4XmlFileManager : public G4VFileManager
|
||||
{
|
||||
public:
|
||||
G4XmlFileManager(const G4AnalysisManagerState& state);
|
||||
~G4XmlFileManager();
|
||||
|
||||
// Methods to manipulate files
|
||||
virtual G4bool OpenFile(const G4String& fileName);
|
||||
virtual G4bool WriteFile();
|
||||
virtual G4bool CloseFile();
|
||||
|
||||
// Specific methods for files per objects
|
||||
G4bool CreateHnFile();
|
||||
G4bool CloseHnFile();
|
||||
G4bool CreateNtupleFile(G4XmlNtupleDescription* ntupleDescription);
|
||||
G4bool CloseNtupleFile(G4XmlNtupleDescription* ntupleDescription);
|
||||
|
||||
// Set methods
|
||||
void LockHistoDirectoryName();
|
||||
void LockNtupleDirectoryName();
|
||||
|
||||
// Get methods
|
||||
std::ofstream* GetHnFile() const;
|
||||
|
||||
private:
|
||||
// data members
|
||||
//
|
||||
std::ofstream* fHnFile;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void G4XmlFileManager::LockHistoDirectoryName()
|
||||
{ fLockHistoDirectoryName = true; }
|
||||
|
||||
inline void G4XmlFileManager::LockNtupleDirectoryName()
|
||||
{ fLockNtupleDirectoryName = true; }
|
||||
|
||||
inline std::ofstream* G4XmlFileManager::GetHnFile() const
|
||||
{ return fHnFile; }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 Xml ntuple
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 04/07/2012 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4XmlNtupleDescription_h
|
||||
#define G4XmlNtupleDescription_h 1
|
||||
|
||||
#include "tools/waxml/ntuple"
|
||||
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
|
||||
namespace tools {
|
||||
class ntuple_booking;
|
||||
}
|
||||
|
||||
struct G4XmlNtupleDescription
|
||||
{
|
||||
G4XmlNtupleDescription()
|
||||
: fFile(0),
|
||||
fNtuple(0),
|
||||
fNtupleBooking(0),
|
||||
fNtupleIColumnMap(),
|
||||
fNtupleFColumnMap(),
|
||||
fNtupleDColumnMap() {}
|
||||
|
||||
~G4XmlNtupleDescription()
|
||||
{ delete fFile;
|
||||
delete fNtuple;
|
||||
delete fNtupleBooking;
|
||||
}
|
||||
|
||||
std::ofstream* fFile;
|
||||
tools::waxml::ntuple* fNtuple;
|
||||
tools::ntuple_booking* fNtupleBooking;
|
||||
std::map<G4int, tools::waxml::ntuple::column<int>* > fNtupleIColumnMap;
|
||||
std::map<G4int, tools::waxml::ntuple::column<float>* > fNtupleFColumnMap;
|
||||
std::map<G4int, tools::waxml::ntuple::column<double>* > fNtupleDColumnMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4XmlNtupleManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
// Manager class for Xml ntuples
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4XmlNtupleManager_h
|
||||
#define G4XmlNtupleManager_h 1
|
||||
|
||||
#include "G4VNtupleManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/waxml/ntuple"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4XmlFileManager;
|
||||
struct G4XmlNtupleDescription;
|
||||
|
||||
class G4XmlNtupleManager : public G4VNtupleManager
|
||||
{
|
||||
friend class G4XmlAnalysisManager;
|
||||
|
||||
protected:
|
||||
G4XmlNtupleManager(const G4AnalysisManagerState& state);
|
||||
~G4XmlNtupleManager();
|
||||
|
||||
// Functions specific to the output type
|
||||
//
|
||||
|
||||
// Methods to manipulate ntuples
|
||||
void CreateNtuplesFromBooking();
|
||||
G4bool IsEmpty() const;
|
||||
G4bool Reset();
|
||||
|
||||
// Set methods
|
||||
void SetFileManager(G4XmlFileManager* fileManager);
|
||||
|
||||
// Access methods
|
||||
tools::waxml::ntuple* GetNtuple() const;
|
||||
tools::waxml::ntuple* GetNtuple(G4int ntupleId) const;
|
||||
|
||||
// Access to ntuple vector (needed for Write())
|
||||
const std::vector<G4XmlNtupleDescription*>& GetNtupleVector() 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);
|
||||
virtual G4int CreateNtupleFColumn(const G4String& name);
|
||||
virtual G4int CreateNtupleDColumn(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 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 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 AddNtupleRow(G4int ntupleId);
|
||||
|
||||
// Access methods
|
||||
virtual G4int GetNofNtuples() const;
|
||||
|
||||
private:
|
||||
// methods
|
||||
//
|
||||
tools::waxml::ntuple::column<int>*
|
||||
GetNtupleIColumn(G4int ntupleId, G4int columnId) const;
|
||||
tools::waxml::ntuple::column<float>*
|
||||
GetNtupleFColumn(G4int ntupleId, G4int columnId) const;
|
||||
tools::waxml::ntuple::column<double>*
|
||||
GetNtupleDColumn(G4int ntupleId, G4int columnId) const;
|
||||
|
||||
virtual G4XmlNtupleDescription* GetNtupleInFunction(G4int id,
|
||||
G4String function,
|
||||
G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
|
||||
// data members
|
||||
//
|
||||
G4XmlFileManager* fFileManager;
|
||||
std::vector<G4XmlNtupleDescription*> fNtupleVector;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void G4XmlNtupleManager::SetFileManager(G4XmlFileManager* fileManager)
|
||||
{ fFileManager = fileManager; }
|
||||
|
||||
inline G4int G4XmlNtupleManager::GetNofNtuples() const
|
||||
{ return fNtupleVector.size(); }
|
||||
|
||||
inline const std::vector<G4XmlNtupleDescription*>& G4XmlNtupleManager::GetNtupleVector() const
|
||||
{ return fNtupleVector; }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: g4xml.hh 72292 2013-07-15 12:01:43Z ihrivnac $
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef g4xml_h
|
||||
#define g4xml_h
|
||||
|
||||
#include "g4xml_defs.hh"
|
||||
|
||||
using namespace G4Xml;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: g4xml_defs.hh 72292 2013-07-15 12:01:43Z ihrivnac $
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef g4xml_defs_h
|
||||
#define g4xml_defs_h
|
||||
|
||||
#include "tools/histo/h1d"
|
||||
#include "tools/histo/h2d"
|
||||
#include "tools/waxml/ntuple"
|
||||
#include "G4XmlAnalysisManager.hh"
|
||||
|
||||
namespace G4Xml {
|
||||
|
||||
typedef tools::histo::h1d G4AnaH1;
|
||||
typedef tools::histo::h2d G4AnaH2;
|
||||
typedef tools::waxml::ntuple* G4Ntuple;
|
||||
|
||||
typedef G4XmlAnalysisManager G4AnalysisManager;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user