Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -88,8 +88,9 @@ class G4ScoringMessenger: public G4UImessenger
|
||||
//
|
||||
G4UIdirectory* meshCreateDir;
|
||||
G4UIcmdWithAString* meshBoxCreateCmd;
|
||||
G4UIcmdWithAString* meshCylinderCreateCmd;
|
||||
G4UIcmdWithAString* meshCylinderCreateCmd;
|
||||
// G4UIcmdWithAString* meshSphereCreateCmd;
|
||||
G4UIcommand* meshRWLogVolCreateCmd;
|
||||
//
|
||||
// Mesh commands
|
||||
G4UIdirectory* meshDir;
|
||||
@@ -111,7 +112,7 @@ class G4ScoringMessenger: public G4UImessenger
|
||||
G4UIcmdWithoutParameter* mTResetCmd;
|
||||
G4UIcmdWith3VectorAndUnit* mTXyzCmd;
|
||||
G4UIdirectory* mRotDir;
|
||||
G4UIcmdWithoutParameter* mRResetCmd;
|
||||
// G4UIcmdWithoutParameter* mRResetCmd;
|
||||
G4UIcmdWithADoubleAndUnit* mRotXCmd;
|
||||
G4UIcmdWithADoubleAndUnit* mRotYCmd;
|
||||
G4UIcmdWithADoubleAndUnit* mRotZCmd;
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef G4ScoringRealWorld_h
|
||||
#define G4ScoringRealWorld_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VScoringMesh.hh"
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
|
||||
class G4ScoringRealWorld : public G4VScoringMesh
|
||||
{
|
||||
public:
|
||||
G4ScoringRealWorld(G4String lvName);
|
||||
~G4ScoringRealWorld();
|
||||
|
||||
protected:
|
||||
// construct this mesh
|
||||
virtual void SetupGeometry(G4VPhysicalVolume* );
|
||||
|
||||
protected:
|
||||
G4String logVolName;
|
||||
|
||||
public:
|
||||
virtual void List() const;
|
||||
|
||||
public:
|
||||
//++++++++++ visualization method not yet implemented
|
||||
virtual void Draw(RunScore * /*map*/, G4VScoreColorMap* /*colorMap*/, G4int /*axflg=111*/)
|
||||
{;}
|
||||
virtual void DrawColumn(RunScore * /*map*/, G4VScoreColorMap* /*colorMap*/,
|
||||
G4int /*idxProj*/, G4int /*idxColumn*/)
|
||||
{;}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 30/10/2018 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4TScoreNtupleWriter_h
|
||||
#define G4TScoreNtupleWriter_h 1
|
||||
|
||||
#include "G4VScoreNtupleWriter.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Threading.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class G4HCofThisEvent;
|
||||
|
||||
template <typename T>
|
||||
class G4TScoreNtupleWriterMessenger;
|
||||
class G4HCofThisEvent;
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This class implements storing hits collections of G4THitsMap<G4double>
|
||||
// type vith Geant4 analysis tools.
|
||||
// In order to avoid introducing dependency on the analysis category,
|
||||
// the analysis manager type is defined via template.
|
||||
//
|
||||
// An ntuple with three columns is created for each primitive scorer:
|
||||
// int column - eventNumber
|
||||
// int column - copyNumber
|
||||
// double column - scored value
|
||||
|
||||
template <typename T>
|
||||
class G4TScoreNtupleWriter : public G4VScoreNtupleWriter
|
||||
{
|
||||
public:
|
||||
G4TScoreNtupleWriter();
|
||||
virtual ~G4TScoreNtupleWriter();
|
||||
|
||||
// methods
|
||||
virtual G4bool Book(G4HCofThisEvent* hce);
|
||||
virtual void OpenFile();
|
||||
virtual void Fill(G4HCofThisEvent* hce, G4int eventNumber);
|
||||
virtual void Write();
|
||||
|
||||
// set methods
|
||||
void SetFileName(const G4String& fileName);
|
||||
void SetVerboseLevel(G4int value);
|
||||
|
||||
// get methods
|
||||
G4String GetFileName() const { return fFileName; }
|
||||
G4int GetVerboseLevel() const { return fVerboseLevel; }
|
||||
|
||||
protected:
|
||||
// methods
|
||||
virtual G4VScoreNtupleWriter* CreateInstance() const;
|
||||
|
||||
private:
|
||||
// methods
|
||||
void CreateAnalysisManager();
|
||||
|
||||
// data members
|
||||
G4TScoreNtupleWriterMessenger<T>* fMessenger;
|
||||
std::vector<G4int> fHCIds;
|
||||
T* fAnalysisManager;
|
||||
G4String fFileName;
|
||||
G4int fVerboseLevel;
|
||||
G4bool fHasAnalysisManager;
|
||||
G4bool fHasAnalysisFile;
|
||||
G4bool fIsBooked;
|
||||
G4bool fIsInitialized;
|
||||
G4int fFirstNtupleId;
|
||||
};
|
||||
|
||||
#include "G4TScoreNtupleWriter.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,308 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 30/10/2018 (ivana@ipno.in2p3.fr)
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#include "G4TScoreNtupleWriterMessenger.hh"
|
||||
#include "G4THitsMap.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
//
|
||||
// ctor, dtor
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4TScoreNtupleWriter<T>::G4TScoreNtupleWriter()
|
||||
: G4VScoreNtupleWriter(),
|
||||
fMessenger(nullptr),
|
||||
fHCIds(),
|
||||
fAnalysisManager(nullptr),
|
||||
fFileName("scoring"),
|
||||
fVerboseLevel(1),
|
||||
fHasAnalysisManager(false),
|
||||
fHasAnalysisFile(false),
|
||||
fIsBooked(false),
|
||||
fIsInitialized(false),
|
||||
fFirstNtupleId(0)
|
||||
{
|
||||
if ( G4Threading::IsMasterThread() ) {
|
||||
fMessenger = new G4TScoreNtupleWriterMessenger<T>(this);
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4TScoreNtupleWriter<T>::~G4TScoreNtupleWriter()
|
||||
{
|
||||
if ( fHasAnalysisManager ) {
|
||||
delete fAnalysisManager;
|
||||
}
|
||||
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4TScoreNtupleWriter<T>::CreateAnalysisManager()
|
||||
{
|
||||
if ( fAnalysisManager ) return;
|
||||
|
||||
// create analysis manager
|
||||
if ( ! T::IsInstance() ) fHasAnalysisManager = true;
|
||||
fAnalysisManager = T::Instance();
|
||||
|
||||
fAnalysisManager->SetVerboseLevel(fVerboseLevel);
|
||||
}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4VScoreNtupleWriter* G4TScoreNtupleWriter<T>::CreateInstance() const
|
||||
{
|
||||
auto instance = new G4TScoreNtupleWriter();
|
||||
instance->SetFileName(fFileName);
|
||||
instance->SetVerboseLevel(fVerboseLevel);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4bool G4TScoreNtupleWriter<T>::Book(G4HCofThisEvent* hce)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- G4TScoreNtupleWriter<T>::Book" << G4endl;
|
||||
}
|
||||
#endif
|
||||
if ( ! hce) return false;
|
||||
|
||||
// book collection ID if DoubleHitsMap
|
||||
if (fHCIds.size() == 0) {
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- going to fill fHCIds " << G4endl;
|
||||
}
|
||||
#endif
|
||||
for (G4int i=0; i<hce->GetNumberOfCollections(); ++i) {
|
||||
auto hitsMap
|
||||
= dynamic_cast<G4THitsMap<G4double>*>(hce->GetHC(i));
|
||||
|
||||
if ( hitsMap ) {
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- adding hcID = " << i << G4endl;
|
||||
}
|
||||
#endif
|
||||
fHCIds.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create analysis manager
|
||||
if ( fHCIds.size() ) {
|
||||
CreateAnalysisManager();
|
||||
}
|
||||
|
||||
// Create ntuples (only once)
|
||||
if ( ! fIsInitialized ) {
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "-- going to create ntuples " << G4endl;
|
||||
}
|
||||
#endif
|
||||
auto first = true;
|
||||
for (auto id : fHCIds) {
|
||||
auto hitsMap
|
||||
= static_cast<G4THitsMap<G4double>*>(hce->GetHC(id));
|
||||
|
||||
// Create ntuple for this primitive
|
||||
G4String ntupleName(hitsMap->GetSDname());
|
||||
ntupleName.append("_");
|
||||
ntupleName.append(hitsMap->GetName());
|
||||
|
||||
G4int ntupleId
|
||||
= fAnalysisManager->CreateNtuple(ntupleName, ntupleName);
|
||||
if ( first ) {
|
||||
fFirstNtupleId = ntupleId;
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "-- set first ntuple Id " << fFirstNtupleId << G4endl;
|
||||
}
|
||||
#endif
|
||||
first = false;
|
||||
}
|
||||
|
||||
G4String colName(ntupleName);
|
||||
colName.append("_eventId");
|
||||
fAnalysisManager->CreateNtupleIColumn(colName);
|
||||
colName = ntupleName;
|
||||
colName.append("_cell");
|
||||
fAnalysisManager->CreateNtupleIColumn(colName);
|
||||
colName = ntupleName;
|
||||
colName.append("_score");
|
||||
fAnalysisManager->CreateNtupleDColumn(colName);
|
||||
fAnalysisManager->FinishNtuple();
|
||||
fIsBooked = true;
|
||||
}
|
||||
fIsInitialized = true;
|
||||
}
|
||||
|
||||
return fIsBooked;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4TScoreNtupleWriter<T>::OpenFile()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- G4TScoreNtupleWriter<T>::OpenFile" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( fAnalysisManager->IsOpenFile() ) return;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- G4TScoreNtupleWriter<T>::OpenFile executing" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( fAnalysisManager->GetFileName() == "" ) {
|
||||
fAnalysisManager->SetFileName(fFileName);
|
||||
}
|
||||
fAnalysisManager->OpenFile();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- G4TScoreNtupleWriter<T>::OpenFile isOpenFile: "
|
||||
<< fAnalysisManager->IsOpenFile() << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
fHasAnalysisFile = fAnalysisManager->IsOpenFile();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4TScoreNtupleWriter<T>::Fill(G4HCofThisEvent* hce, G4int eventNumber)
|
||||
{
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- start G4TScoreNtupleWriter<T>::Fill" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
auto counter = 0;
|
||||
for (auto id : fHCIds) {
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "in loop over fHCIds, counter " << counter << G4endl;
|
||||
}
|
||||
#endif
|
||||
auto hitsMap
|
||||
= static_cast<G4THitsMap<G4double>*>(hce->GetHC(id));
|
||||
|
||||
//G4cout << eventNumber << ".. go to fill ntuple " << counter + fFirstNtupleId << G4endl;
|
||||
|
||||
// fill hits in ntuple
|
||||
std::map<G4int, G4double*>::iterator it;
|
||||
for ( it = hitsMap->GetMap()->begin(); it != hitsMap->GetMap()->end(); it++ ) {
|
||||
fAnalysisManager->FillNtupleIColumn(counter + fFirstNtupleId, 0, eventNumber);
|
||||
fAnalysisManager->FillNtupleIColumn(counter + fFirstNtupleId, 1, it->first);
|
||||
fAnalysisManager->FillNtupleDColumn(counter + fFirstNtupleId, 2, *(it->second));
|
||||
fAnalysisManager->AddNtupleRow(counter + fFirstNtupleId);
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- done G4TScoreNtupleWriter<T>::Fill" << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4TScoreNtupleWriter<T>::Write()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- start G4TScoreNtupleWriter<T>::Write" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( fHasAnalysisFile ) {
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- G4TScoreNtupleWriter<T>::Write - has file" << G4endl;
|
||||
}
|
||||
#endif
|
||||
fAnalysisManager->Write();
|
||||
fAnalysisManager->CloseFile();
|
||||
fAnalysisManager->SetFileName("");
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- done G4TScoreNtupleWriter<T>::Write" << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4TScoreNtupleWriter<T>::SetVerboseLevel(G4int value)
|
||||
{
|
||||
fVerboseLevel = value;
|
||||
if ( fAnalysisManager ) {
|
||||
fAnalysisManager->SetVerboseLevel(value);
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4TScoreNtupleWriter<T>::SetFileName(const G4String& fileName)
|
||||
{
|
||||
fFileName = fileName;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 30/10/2018 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4TScoreNtupleWriterMessenger_h
|
||||
#define G4TScoreNtupleWriterMessenger_h 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
template <typename T>
|
||||
class G4TScoreNtupleWriter;
|
||||
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithAnInteger;
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a concrete class of G4UImessenger which handles the commands for
|
||||
// G4TScoreNtupleWriter. This class has the following commands:
|
||||
// /score/writerFileName filename
|
||||
// /score/writerVerbose value
|
||||
//
|
||||
|
||||
template <typename T>
|
||||
class G4TScoreNtupleWriterMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4TScoreNtupleWriterMessenger(G4TScoreNtupleWriter<T>* scoreNtupleWriter);
|
||||
~G4TScoreNtupleWriterMessenger();
|
||||
void SetNewValue(G4UIcommand * command,G4String newValues);
|
||||
|
||||
private:
|
||||
G4TScoreNtupleWriter<T>* fScoreNtupleWriter;
|
||||
G4UIdirectory* fDirectory;
|
||||
G4UIcmdWithAString* fWriterFileNameCmd;
|
||||
G4UIcmdWithAnInteger* fWriterVerboseCmd;
|
||||
};
|
||||
|
||||
#include "G4TScoreNtupleWriterMessenger.icc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 30/10/2018 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4TScoreNtupleWriterMessenger.hh"
|
||||
#include "G4TScoreNtupleWriter.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4TScoreNtupleWriterMessenger<T>::G4TScoreNtupleWriterMessenger(
|
||||
G4TScoreNtupleWriter<T>* scoreNtupleWriter)
|
||||
: G4UImessenger(),
|
||||
fScoreNtupleWriter(scoreNtupleWriter),
|
||||
fWriterFileNameCmd(nullptr),
|
||||
fWriterVerboseCmd(nullptr)
|
||||
{
|
||||
fDirectory = new G4UIdirectory("/score/ntuple/");
|
||||
fDirectory->SetGuidance("Interactive score ntuple writer commands.");
|
||||
|
||||
fWriterFileNameCmd = new G4UIcmdWithAString("/score/ntuple/writerFileName",this);
|
||||
fWriterFileNameCmd->SetGuidance( "Set the ntuple writer output file name.");
|
||||
fWriterFileNameCmd->SetParameterName("outputFileName",false);
|
||||
fWriterFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fWriterVerboseCmd = new G4UIcmdWithAnInteger("/score/ntuple/writerVerbose",this);
|
||||
fWriterVerboseCmd->SetGuidance("Set the ntuple writer verbose level.");
|
||||
fWriterVerboseCmd->SetParameterName("writerVerbose",false);
|
||||
fWriterVerboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4TScoreNtupleWriterMessenger<T>::~G4TScoreNtupleWriterMessenger()
|
||||
{
|
||||
delete fWriterFileNameCmd;
|
||||
delete fWriterVerboseCmd;
|
||||
delete fDirectory;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4TScoreNtupleWriterMessenger<T>::SetNewValue(G4UIcommand * command,G4String newVal)
|
||||
{
|
||||
if ( command==fWriterFileNameCmd ) {
|
||||
fScoreNtupleWriter->SetFileName(newVal);
|
||||
}
|
||||
else if ( command==fWriterVerboseCmd ) {
|
||||
fScoreNtupleWriter->SetVerboseLevel(fWriterVerboseCmd->GetNewIntValue(newVal));
|
||||
}
|
||||
}
|
||||
@@ -44,36 +44,41 @@ class G4ParallelWorldProcess;
|
||||
|
||||
#include <map>
|
||||
|
||||
enum MeshShape { boxMesh, cylinderMesh, sphereMesh , undefinedMesh = -1};
|
||||
typedef G4THitsMap< G4double > EventScore;
|
||||
typedef G4THitsMap< G4StatDouble > RunScore;
|
||||
typedef std::map< G4String, RunScore* > MeshScoreMap;
|
||||
// class description:
|
||||
//
|
||||
// This class represents a parallel world for interactive scoring purposes.
|
||||
// This class represents a multi-functional detector to be used by command-based scorer
|
||||
// For parallel world scorer, this class creates a parallel world mesh geometry
|
||||
//
|
||||
|
||||
class G4VScoringMesh
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum class MeshShape { box, cylinder, sphere, realWorldLogVol, undefined = -1};
|
||||
using EventScore = G4THitsMap< G4double >;
|
||||
using RunScore = G4THitsMap< G4StatDouble >;
|
||||
using MeshScoreMap = std::map< G4String, RunScore* >;
|
||||
|
||||
public:
|
||||
G4VScoringMesh(const G4String& wName);
|
||||
virtual ~G4VScoringMesh();
|
||||
|
||||
public: // with description
|
||||
public: // with description
|
||||
// a pure virtual function to construct this mesh geometry
|
||||
void Construct(G4VPhysicalVolume* fWorldPhys);
|
||||
|
||||
void WorkerConstruct(G4VPhysicalVolume* fWorldPhys);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual void SetupGeometry(G4VPhysicalVolume * fWorldPhys) = 0;
|
||||
|
||||
public: // with description
|
||||
public: // with description
|
||||
// list infomration of this mesh
|
||||
virtual void List() const;
|
||||
|
||||
public: // with description
|
||||
public: // with description
|
||||
// get the world name
|
||||
// If this ScoringMesh is for parallel world, it returns the name of the parallel world
|
||||
// If this ScoringMesh is for real world logical volume, it returns name of logical volume
|
||||
inline const G4String& GetWorldName() const
|
||||
{ return fWorldName; }
|
||||
// get whether this mesh is active or not
|
||||
@@ -104,6 +109,7 @@ class G4VScoringMesh
|
||||
// reset registered primitive scorers
|
||||
void ResetScore();
|
||||
|
||||
// Following set/get methods make sense only for parallel world scoring mesh
|
||||
// set size of this mesh
|
||||
void SetSize(G4double size[3]);
|
||||
// get size of this mesh
|
||||
@@ -123,6 +129,7 @@ class G4VScoringMesh
|
||||
if(fRotationMatrix) return *fRotationMatrix;
|
||||
else return G4RotationMatrix::IDENTITY;
|
||||
}
|
||||
|
||||
// set number of segments of this mesh
|
||||
void SetNumberOfSegments(G4int nSegment[3]);
|
||||
// get number of segments of this mesh
|
||||
@@ -218,6 +225,16 @@ public:
|
||||
fGeometryHasBeenDestroyed = true;
|
||||
fMeshElementLogical = nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
G4int copyNumberLevel;
|
||||
public:
|
||||
// Geometry hirarchy level (bottom = 0) to be used as the copy number
|
||||
// This is used only for real-world scorer
|
||||
inline void SetCopyNumberLevel(G4int val)
|
||||
{ copyNumberLevel = val; }
|
||||
inline G4int GetCopyNumberLevel() const
|
||||
{ return copyNumberLevel; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user