Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -39,6 +39,7 @@ G4AnalysisManagerState::G4AnalysisManagerState(
|
||||
fIsMaster(isMaster),
|
||||
fIsActivation(false),
|
||||
fVerboseLevel(0),
|
||||
fCompressionLevel(1),
|
||||
fVerboseL1(type,1),
|
||||
fVerboseL2(type,2),
|
||||
fVerboseL3(type,3),
|
||||
|
||||
@@ -35,34 +35,40 @@
|
||||
#include "G4H3Messenger.hh"
|
||||
#include "G4P1Messenger.hh"
|
||||
#include "G4P2Messenger.hh"
|
||||
#include "G4NtupleMessenger.hh"
|
||||
#include "G4HnMessenger.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4AnalysisMessenger::G4AnalysisMessenger(G4VAnalysisManager* manager)
|
||||
: G4UImessenger(),
|
||||
fManager(manager),
|
||||
fFileMessenger(0),
|
||||
fH1Messenger(0),
|
||||
fH2Messenger(0),
|
||||
fH3Messenger(0),
|
||||
fP1Messenger(0),
|
||||
fP2Messenger(0),
|
||||
fH1HnMessenger(0),
|
||||
fH2HnMessenger(0),
|
||||
fH3HnMessenger(0),
|
||||
fP1HnMessenger(0),
|
||||
fP2HnMessenger(0),
|
||||
fAnalysisDir(0),
|
||||
fSetActivationCmd(0),
|
||||
fVerboseCmd(0)
|
||||
fFileMessenger(nullptr),
|
||||
fH1Messenger(nullptr),
|
||||
fH2Messenger(nullptr),
|
||||
fH3Messenger(nullptr),
|
||||
fP1Messenger(nullptr),
|
||||
fP2Messenger(nullptr),
|
||||
fNtupleMessenger(nullptr),
|
||||
fH1HnMessenger(nullptr),
|
||||
fH2HnMessenger(nullptr),
|
||||
fH3HnMessenger(nullptr),
|
||||
fP1HnMessenger(nullptr),
|
||||
fP2HnMessenger(nullptr),
|
||||
fAnalysisDir(nullptr),
|
||||
fSetActivationCmd(nullptr),
|
||||
fVerboseCmd(nullptr),
|
||||
fCompressionCmd(nullptr)
|
||||
{
|
||||
fAnalysisDir = new G4UIdirectory("/analysis/");
|
||||
fAnalysisDir = G4Analysis::make_unique<G4UIdirectory>("/analysis/");
|
||||
fAnalysisDir->SetGuidance("analysis control");
|
||||
|
||||
fSetActivationCmd = new G4UIcmdWithABool("/analysis/setActivation",this);
|
||||
fSetActivationCmd = G4Analysis::make_unique<G4UIcmdWithABool>("/analysis/setActivation",this);
|
||||
G4String guidance = "Set activation. \n";
|
||||
guidance += "When this option is enabled, only the histograms marked as activated\n";
|
||||
guidance += "are returned, filled or saved on file.\n";
|
||||
@@ -70,79 +76,73 @@ G4AnalysisMessenger::G4AnalysisMessenger(G4VAnalysisManager* manager)
|
||||
fSetActivationCmd->SetGuidance(guidance);
|
||||
fSetActivationCmd->SetParameterName("Activation",false);
|
||||
|
||||
fVerboseCmd = new G4UIcmdWithAnInteger("/analysis/verbose",this);
|
||||
fVerboseCmd = G4Analysis::make_unique<G4UIcmdWithAnInteger>("/analysis/verbose",this);
|
||||
fVerboseCmd->SetGuidance("Set verbose level");
|
||||
fVerboseCmd->SetParameterName("VerboseLevel",false);
|
||||
fVerboseCmd->SetRange("VerboseLevel>=0 && VerboseLevel<=4");
|
||||
|
||||
fFileMessenger = new G4FileMessenger(manager);
|
||||
fH1Messenger = new G4H1Messenger(manager);
|
||||
fH2Messenger = new G4H2Messenger(manager);
|
||||
fH3Messenger = new G4H3Messenger(manager);
|
||||
fP1Messenger = new G4P1Messenger(manager);
|
||||
fP2Messenger = new G4P2Messenger(manager);
|
||||
fCompressionCmd = G4Analysis::make_unique<G4UIcmdWithAnInteger>("/analysis/compression",this);
|
||||
fCompressionCmd->SetGuidance("Set compression level");
|
||||
fCompressionCmd->SetParameterName("CompressionLevel",false);
|
||||
fCompressionCmd->SetRange("CompressionLevel>=0 && CompressionLevel<=4");
|
||||
|
||||
fFileMessenger = G4Analysis::make_unique<G4FileMessenger>(manager);
|
||||
fH1Messenger = G4Analysis::make_unique<G4H1Messenger>(manager);
|
||||
fH2Messenger = G4Analysis::make_unique<G4H2Messenger>(manager);
|
||||
fH3Messenger = G4Analysis::make_unique<G4H3Messenger>(manager);
|
||||
fP1Messenger = G4Analysis::make_unique<G4P1Messenger>(manager);
|
||||
fP2Messenger = G4Analysis::make_unique<G4P2Messenger>(manager);
|
||||
fNtupleMessenger = G4Analysis::make_unique<G4NtupleMessenger>(manager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4AnalysisMessenger::~G4AnalysisMessenger()
|
||||
{
|
||||
delete fSetActivationCmd;
|
||||
delete fVerboseCmd;
|
||||
delete fAnalysisDir;
|
||||
delete fFileMessenger;
|
||||
delete fH1Messenger;
|
||||
delete fH2Messenger;
|
||||
delete fH3Messenger;
|
||||
delete fP1Messenger;
|
||||
delete fP2Messenger;
|
||||
delete fH1HnMessenger;
|
||||
delete fH2HnMessenger;
|
||||
delete fH3HnMessenger;
|
||||
delete fP1HnMessenger;
|
||||
delete fP2HnMessenger;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessenger::SetH1HnManager(G4HnManager* h1HnManager)
|
||||
void G4AnalysisMessenger::SetH1HnManager(G4HnManager& h1HnManager)
|
||||
{
|
||||
fH1HnMessenger = new G4HnMessenger(h1HnManager);
|
||||
fH1HnMessenger = G4Analysis::make_unique<G4HnMessenger>(h1HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessenger::SetH2HnManager(G4HnManager* h2HnManager)
|
||||
void G4AnalysisMessenger::SetH2HnManager(G4HnManager& h2HnManager)
|
||||
{
|
||||
fH2HnMessenger = new G4HnMessenger(h2HnManager);
|
||||
fH2HnMessenger = G4Analysis::make_unique<G4HnMessenger>(h2HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessenger::SetH3HnManager(G4HnManager* h2HnManager)
|
||||
void G4AnalysisMessenger::SetH3HnManager(G4HnManager& h2HnManager)
|
||||
{
|
||||
fH2HnMessenger = new G4HnMessenger(h2HnManager);
|
||||
fH2HnMessenger = G4Analysis::make_unique<G4HnMessenger>(h2HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessenger::SetP1HnManager(G4HnManager* p1HnManager)
|
||||
void G4AnalysisMessenger::SetP1HnManager(G4HnManager& p1HnManager)
|
||||
{
|
||||
fP1HnMessenger = new G4HnMessenger(p1HnManager);
|
||||
fP1HnMessenger = G4Analysis::make_unique<G4HnMessenger>(p1HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessenger::SetP2HnManager(G4HnManager* p2HnManager)
|
||||
void G4AnalysisMessenger::SetP2HnManager(G4HnManager& p2HnManager)
|
||||
{
|
||||
fP2HnMessenger = new G4HnMessenger(p2HnManager);
|
||||
fP2HnMessenger = G4Analysis::make_unique<G4HnMessenger>(p2HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
{
|
||||
if ( command == fSetActivationCmd ) {
|
||||
if ( command == fSetActivationCmd.get() ) {
|
||||
fManager->SetActivation(fSetActivationCmd->GetNewBoolValue(newValues));
|
||||
}
|
||||
else if ( command == fVerboseCmd ) {
|
||||
else if ( command == fVerboseCmd.get() ) {
|
||||
fManager->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValues));
|
||||
}
|
||||
else if ( command == fCompressionCmd.get() ) {
|
||||
fManager->SetCompressionLevel(fCompressionCmd->GetNewIntValue(newValues));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
|
||||
// Author: Ivana Hrivnacova, 05/05/2015 (ivana@ipno.in2p3.fr)
|
||||
//
|
||||
// This messenger class is a generalization of the HistoMessenger class,
|
||||
// originally developed for the extended/electromagnetic examples
|
||||
// by Michel Maire (michel.maire@lapp.in2p3.fr)
|
||||
|
||||
#include "G4AnalysisMessengerHelper.hh"
|
||||
#include "G4VAnalysisManager.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4Tokenizer.hh"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
namespace {
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ObjectType(const G4String& hnType)
|
||||
{
|
||||
G4String first = hnType.substr(0,1);
|
||||
if (first == "h") {
|
||||
return "Histogram";
|
||||
} else if (first == "p") {
|
||||
return "Profile";
|
||||
} else {
|
||||
// other possibilitied not handled
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void Replace(std::string& str, const std::string& from, const std::string& to) {
|
||||
// Replace all occurences of from string
|
||||
if (from.empty()) return;
|
||||
size_t start_pos = 0;
|
||||
while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
|
||||
str.replace(start_pos, from.length(), to);
|
||||
start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4AnalysisMessengerHelper::G4AnalysisMessengerHelper(const G4String& hnType)
|
||||
: fHnType(hnType)
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4AnalysisMessengerHelper::~G4AnalysisMessengerHelper()
|
||||
{}
|
||||
|
||||
//
|
||||
// private functions
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String G4AnalysisMessengerHelper::Update(const G4String& str, const G4String& axis) const
|
||||
{
|
||||
G4String newStr(str);
|
||||
|
||||
// Hn, Pn
|
||||
G4String upperHnType(str);
|
||||
upperHnType.toUpper();
|
||||
Replace(newStr, "UHNTYPE_", upperHnType);
|
||||
|
||||
// hn, pn
|
||||
Replace(newStr, "HNTYPE_", fHnType);
|
||||
|
||||
// n = 1,2,3
|
||||
G4String second = fHnType.substr(1,1);
|
||||
Replace(newStr, "NDIM_", second);
|
||||
|
||||
// histogram, profile
|
||||
G4String lowerObjectType(ObjectType(fHnType));
|
||||
lowerObjectType.toLower();
|
||||
Replace(newStr, "LOBJECT", lowerObjectType);
|
||||
|
||||
// Histogram, Profile
|
||||
Replace(newStr, "OBJECT", ObjectType(fHnType));
|
||||
|
||||
// X, Y, Z
|
||||
G4String upperAxis(axis);
|
||||
upperAxis.toUpper();
|
||||
Replace(newStr, "UAXIS", upperAxis);
|
||||
|
||||
// x, y, z
|
||||
Replace(newStr, "AXIS", axis);
|
||||
|
||||
// return result
|
||||
return newStr;
|
||||
}
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
std::unique_ptr<G4UIdirectory>
|
||||
G4AnalysisMessengerHelper::CreateHnDirectory() const
|
||||
{
|
||||
std::unique_ptr<G4UIdirectory> directory(new G4UIdirectory(Update("/analysis/HNTYPE_/")));
|
||||
directory->SetGuidance(Update("NDIM_D LOBJECT control"));
|
||||
return directory;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
std::unique_ptr<G4UIcommand>
|
||||
G4AnalysisMessengerHelper::CreateSetTitleCommand(G4UImessenger* messenger) const
|
||||
{
|
||||
auto parId = new G4UIparameter("id", 'i', false);
|
||||
parId->SetGuidance(Update("OBJECT id"));
|
||||
parId->SetParameterRange("id>=0");
|
||||
|
||||
auto parTitle = new G4UIparameter("title", 's', true);
|
||||
parTitle->SetGuidance(Update("OBJECT title"));
|
||||
parTitle->SetDefaultValue("none");
|
||||
|
||||
std::unique_ptr<G4UIcommand> command(
|
||||
new G4UIcommand(Update("/analysis/HNTYPE_/setTitle"), messenger));
|
||||
command->SetGuidance(Update("Set title for the NDIM_D LOBJECT of given id"));
|
||||
command->SetParameter(parId);
|
||||
command->SetParameter(parTitle);
|
||||
command->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
std::unique_ptr<G4UIcommand>
|
||||
G4AnalysisMessengerHelper::CreateSetBinsCommand(const G4String& axis,
|
||||
G4UImessenger* messenger) const
|
||||
{
|
||||
auto parId = new G4UIparameter("id", 'i', false);
|
||||
parId->SetGuidance(Update( "OBJECT id"));
|
||||
parId->SetParameterRange("id>=0");
|
||||
|
||||
auto parNbins = new G4UIparameter("nbins", 'i', false);
|
||||
parNbins->SetGuidance("Number of bins");
|
||||
|
||||
auto parValMin = new G4UIparameter("valMin", 'd', false);
|
||||
parValMin->SetGuidance("Minimum value, expressed in unit");
|
||||
|
||||
auto parValMax = new G4UIparameter("valMax", 'd', false);
|
||||
parValMax->SetGuidance("Maximum value, expressed in unit");
|
||||
|
||||
auto parValUnit = new G4UIparameter("valUnit", 's', true);
|
||||
parValUnit->SetGuidance("The unit applied to filled values and valMin, valMax");
|
||||
parValUnit->SetDefaultValue("none");
|
||||
|
||||
auto parValFcn = new G4UIparameter("valFcn", 's', true);
|
||||
parValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnGuidance = "The function applied to filled values (log, log10, exp, none).\n";
|
||||
fcnGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
|
||||
fcnGuidance += "but none value should be used instead.";
|
||||
parValFcn->SetGuidance(fcnGuidance);
|
||||
parValFcn->SetDefaultValue("none");
|
||||
|
||||
auto parValBinScheme = new G4UIparameter("valBinScheme", 's', true);
|
||||
parValBinScheme->SetParameterCandidates("linear log");
|
||||
G4String binSchemeGuidance = "The binning scheme (linear, log).\n";
|
||||
binSchemeGuidance
|
||||
+= "Note that the unit and fcn parameters cannot be omitted in this case,\n";
|
||||
binSchemeGuidance += "but none value should be used instead.";
|
||||
parValBinScheme->SetGuidance(binSchemeGuidance);
|
||||
parValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
std::unique_ptr<G4UIcommand> command(
|
||||
new G4UIcommand(Update("/analysis/HNTYPE_/setUAXIS", axis), messenger));
|
||||
command->SetGuidance(Update("Set parameters for the NDIM_D LOBJECT of given id:"));
|
||||
command->SetGuidance(
|
||||
Update(" nAXISbins; AXISvalMin; AXISvalMax; AXISunit; AXISfunction; AXISbinScheme", axis));
|
||||
command->SetParameter(parId);
|
||||
command->SetParameter(parNbins);
|
||||
command->SetParameter(parValMin);
|
||||
command->SetParameter(parValMax);
|
||||
command->SetParameter(parValUnit);
|
||||
command->SetParameter(parValFcn);
|
||||
command->SetParameter(parValBinScheme);
|
||||
command->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
std::unique_ptr<G4UIcommand>
|
||||
G4AnalysisMessengerHelper::CreateSetValuesCommand(const G4String& axis,
|
||||
G4UImessenger* messenger) const
|
||||
{
|
||||
auto parId = new G4UIparameter("id", 'i', false);
|
||||
parId->SetGuidance(Update("OBJECT id"));
|
||||
parId->SetParameterRange("id>=0");
|
||||
|
||||
auto parValMin = new G4UIparameter("valMin", 'd', false);
|
||||
parValMin->SetGuidance(Update("Minimum AXIS-value expressed in unit", axis));
|
||||
|
||||
auto parValMax = new G4UIparameter("valMax", 'd', false);
|
||||
parValMax->SetGuidance(Update("Maximum AXIS-value expressed in unit", axis));
|
||||
|
||||
auto parValUnit = new G4UIparameter("valUnit", 's', true);
|
||||
parValUnit->SetGuidance("The unit applied to filled values and valMin, valMax");
|
||||
parValUnit->SetDefaultValue("none");
|
||||
|
||||
auto parValFcn = new G4UIparameter("valFcn", 's', true);
|
||||
parValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnGuidance = "The function applied to filled values (log, log10, exp, none).\n";
|
||||
fcnGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
|
||||
fcnGuidance += "but none value should be used instead.";
|
||||
parValFcn->SetGuidance(fcnGuidance);
|
||||
parValFcn->SetDefaultValue("none");
|
||||
|
||||
std::unique_ptr<G4UIcommand> command(
|
||||
new G4UIcommand(Update("/analysis/HNTYPE_/setUAXIS", axis), messenger));
|
||||
command->SetGuidance(Update("Set parameters for the NDIM_D LOBJECT of #id:"));
|
||||
command->SetGuidance(
|
||||
Update(" AXISvalMin; AXISvalMax; AXISunit; AXISfunction", axis));
|
||||
command->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
std::unique_ptr<G4UIcommand>
|
||||
G4AnalysisMessengerHelper::CreateSetAxisCommand(const G4String& axis,
|
||||
G4UImessenger* messenger) const
|
||||
{
|
||||
auto parId = new G4UIparameter("id", 'i', false);
|
||||
parId->SetGuidance(Update("OBJECT id"));
|
||||
parId->SetParameterRange("id>=0");
|
||||
|
||||
auto parAxis = new G4UIparameter("axis", 's', true);
|
||||
parAxis->SetGuidance(Update("Histogram AXIS-axis title", axis));
|
||||
parAxis->SetDefaultValue("none");
|
||||
|
||||
std::unique_ptr<G4UIcommand> command(
|
||||
new G4UIcommand(Update("/analysis/HNTYPE_/setUAXISaxis", axis), messenger));
|
||||
command->SetGuidance(Update("Set AXIS-axis title for the NDIM_D LOBJECT of given id", axis));
|
||||
command->SetParameter(parId);
|
||||
command->SetParameter(parAxis);
|
||||
command->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessengerHelper::GetBinData(BinData& data,
|
||||
std::vector<G4String>& parameters,
|
||||
G4int& counter) const
|
||||
{
|
||||
data.fNbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
data.fVmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
data.fVmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
data.fSunit = parameters[counter++];
|
||||
data.fSfcn = parameters[counter++];
|
||||
data.fSbinScheme = parameters[counter++];
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessengerHelper::GetValueData(ValueData& data,
|
||||
std::vector<G4String>& parameters,
|
||||
G4int& counter) const
|
||||
{
|
||||
data.fVmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
data.fVmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
data.fSunit = parameters[counter++];
|
||||
data.fSfcn = parameters[counter++];
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessengerHelper::WarnAboutParameters(G4UIcommand* command,
|
||||
G4int nofParameters) const
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Got wrong number of \"" << command->GetCommandName()
|
||||
<< "\" parameters: " << nofParameters
|
||||
<< " instead of " << command->GetParameterEntries()
|
||||
<< " expected" << G4endl;
|
||||
G4String methodName(Update("G4UHNTYPE_Messenger::SetNewValue"));
|
||||
G4Exception(methodName,
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4AnalysisMessengerHelper::WarnAboutSetCommands() const
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Command setX, setY, setZ must be called sucessively in this order. " << G4endl
|
||||
<< "Command was ignored." << G4endl;
|
||||
G4String methodName(Update("G4UHNTYPE_Messenger::SetNewValue"));
|
||||
G4Exception(methodName,
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace {
|
||||
G4bool GetToken(const G4String& line, G4String& token,
|
||||
std::string::size_type begIdx, std::string::size_type& endIdx)
|
||||
{
|
||||
while ( line[begIdx] == ' ') ++begIdx;
|
||||
while ( line[begIdx] == ' ') ++begIdx; // Loop checking, 23.06.2015, I. Hrivnacova
|
||||
if ( line[begIdx] == '"' ) {
|
||||
endIdx = line.find('"', begIdx+1);
|
||||
if ( endIdx == std::string::npos ) endIdx = line.length();
|
||||
@@ -78,7 +78,7 @@ G4bool CheckNbins(G4int nbins)
|
||||
G4bool CheckMinMax(G4double xmin, G4double xmax,
|
||||
const G4String& fcnName, const G4String& binSchemeName)
|
||||
{
|
||||
G4bool result = true;
|
||||
auto result = true;
|
||||
|
||||
if ( xmax <= xmin ) {
|
||||
G4ExceptionDescription description;
|
||||
@@ -101,7 +101,7 @@ G4bool CheckMinMax(G4double xmin, G4double xmax,
|
||||
result = false;
|
||||
}
|
||||
|
||||
if ( ( GetBinScheme(binSchemeName) == kLogBinScheme ||
|
||||
if ( ( GetBinScheme(binSchemeName) == G4BinScheme::kLog ||
|
||||
fcnName == "log" || fcnName == "log10" ) && ( xmin == 0 ) ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
@@ -185,7 +185,50 @@ void Tokenize(const G4String& line, std::vector<G4String>& tokens)
|
||||
}
|
||||
begIdx = endIdx + 1;
|
||||
}
|
||||
while ( endIdx != line.length() );
|
||||
while ( endIdx < line.length() ); // Loop checking, 23.06.2015, I. Hrivnacova
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4AnalysisOutput GetOutput(const G4String& outputName) {
|
||||
if ( outputName == "csv" ) { return G4AnalysisOutput::kCsv; }
|
||||
else if ( outputName == "root" ) { return G4AnalysisOutput::kRoot; }
|
||||
else if ( outputName == "xml" ) { return G4AnalysisOutput::kXml; }
|
||||
else if ( outputName == "none" ) { return G4AnalysisOutput::kNone; }
|
||||
else {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " \"" << outputName << "\" output type is not supported." << G4endl
|
||||
<< " " << "Root type will be used.";
|
||||
G4Exception("G4Analysis::GetOutputType",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return G4AnalysisOutput::kNone;
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String GetOutputName(G4AnalysisOutput output) {
|
||||
switch ( output ) {
|
||||
case G4AnalysisOutput::kCsv:
|
||||
return "csv";
|
||||
break;
|
||||
case G4AnalysisOutput::kRoot:
|
||||
return "root";
|
||||
break;
|
||||
case G4AnalysisOutput::kXml:
|
||||
return "xml";
|
||||
break;
|
||||
case G4AnalysisOutput::kNone:
|
||||
return "none";
|
||||
break;
|
||||
}
|
||||
// should never reach this line
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " \"" << static_cast<int>(output) << "\" is not handled." << G4endl
|
||||
<< " " << "none type will be used.";
|
||||
G4Exception("G4Analysis::GetOutputName",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return "none";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,13 +38,11 @@ G4BaseAnalysisManager::G4BaseAnalysisManager(
|
||||
: fState(state),
|
||||
fFirstId(0),
|
||||
fLockFirstId(false)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4BaseAnalysisManager::~G4BaseAnalysisManager()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// public methods
|
||||
|
||||
@@ -96,7 +96,7 @@ G4String G4BaseFileManager::GetNtupleFileName(const G4String& ntupleName) const
|
||||
G4String name(fFileName);
|
||||
|
||||
// Take out file extension
|
||||
G4String extension = TakeOffExtension(name);
|
||||
auto extension = TakeOffExtension(name);
|
||||
|
||||
// Add ntupleName
|
||||
name.append("_nt_");
|
||||
@@ -123,7 +123,7 @@ G4String G4BaseFileManager::GetHnFileName(const G4String& hnType,
|
||||
G4String name(fFileName);
|
||||
|
||||
// Take out file extension
|
||||
G4String extension = TakeOffExtension(name);
|
||||
auto extension = TakeOffExtension(name);
|
||||
|
||||
// Add _hnType_hnName
|
||||
name.append("_");
|
||||
@@ -137,6 +137,20 @@ G4String G4BaseFileManager::GetHnFileName(const G4String& hnType,
|
||||
return name;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String G4BaseFileManager::GetPlotFileName() const
|
||||
{
|
||||
G4String name(fFileName);
|
||||
|
||||
// Take out file extension
|
||||
auto extension = TakeOffExtension(name);
|
||||
|
||||
// Add .ps extension
|
||||
name.append(".ps");
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String G4BaseFileManager::GetFileType() const
|
||||
{
|
||||
|
||||
@@ -35,15 +35,15 @@ namespace G4Analysis
|
||||
//_____________________________________________________________________________
|
||||
G4BinScheme GetBinScheme(const G4String& binSchemeName)
|
||||
{
|
||||
G4BinScheme binScheme = kLinearBinScheme;
|
||||
G4BinScheme binScheme = G4BinScheme::kLinear;
|
||||
if ( binSchemeName != "linear" ) {
|
||||
if ( binSchemeName == "log" )
|
||||
binScheme = kLogBinScheme;
|
||||
binScheme = G4BinScheme::kLog;
|
||||
else {
|
||||
// There is no name associated with kUserBinScheme
|
||||
// There is no name associated with G4BinScheme::kUser
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " \"" << binScheme << "\" binning scheme is not supported." << G4endl
|
||||
<< " \"" << binSchemeName << "\" binning scheme is not supported." << G4endl
|
||||
<< " " << "Linear binning will be applied.";
|
||||
G4Exception("G4Analysis::GetBinScheme",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
@@ -60,29 +60,29 @@ void ComputeEdges(G4int nbins, G4double xmin, G4double xmax,
|
||||
// Compute edges from parameters
|
||||
|
||||
// Apply units
|
||||
G4double xumin = xmin/unit;
|
||||
G4double xumax = xmax/unit;
|
||||
auto xumin = xmin/unit;
|
||||
auto xumax = xmax/unit;
|
||||
|
||||
if ( binScheme == kLinearBinScheme ) {
|
||||
G4double dx = (fcn(xumax) - fcn(xumin) ) / nbins;
|
||||
G4double binValue = fcn(xumin);
|
||||
while ( G4int(edges.size()) <= nbins ) {
|
||||
if ( binScheme == G4BinScheme::kLinear ) {
|
||||
auto dx = (fcn(xumax) - fcn(xumin) ) / nbins;
|
||||
auto binValue = fcn(xumin);
|
||||
while ( G4int(edges.size()) <= nbins ) { // Loop checking, 23.06.2015, I. Hrivnacova
|
||||
edges.push_back(binValue);
|
||||
binValue += dx;
|
||||
}
|
||||
}
|
||||
else if ( binScheme == kLogBinScheme ) {
|
||||
else if ( binScheme == G4BinScheme::kLog ) {
|
||||
// do not apply fcn
|
||||
G4double dlog
|
||||
auto dlog
|
||||
= (std::log10(xumax) - std::log10(xumin))/ nbins;
|
||||
G4double dx = std::pow(10, dlog);
|
||||
G4double binValue = xumin;
|
||||
while ( G4int(edges.size()) <= nbins ) {
|
||||
auto dx = std::pow(10, dlog);
|
||||
auto binValue = xumin;
|
||||
while ( G4int(edges.size()) <= nbins ) { // Loop checking, 23.06.2015, I. Hrivnacova
|
||||
edges.push_back(binValue);
|
||||
binValue *= dx;
|
||||
}
|
||||
}
|
||||
else if ( binScheme == kUserBinScheme ) {
|
||||
else if ( binScheme == G4BinScheme::kUser ) {
|
||||
// This should never happen, but let's make sure about it
|
||||
// by issuing a warning
|
||||
G4ExceptionDescription description;
|
||||
@@ -100,9 +100,9 @@ void ComputeEdges(const std::vector<G4double>& edges,
|
||||
std::vector<G4double>& newBins)
|
||||
{
|
||||
// Apply function to defined edges
|
||||
std::vector<G4double>::const_iterator it;
|
||||
for (it = edges.begin(); it != edges.end(); it++ ) {
|
||||
newBins.push_back(fcn((*it)/unit));
|
||||
|
||||
for (auto element : edges) {
|
||||
newBins.push_back(fcn(element/unit));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,29 +29,32 @@
|
||||
|
||||
#include "G4FileMessenger.hh"
|
||||
#include "G4VAnalysisManager.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4FileMessenger::G4FileMessenger(G4VAnalysisManager* manager)
|
||||
: G4UImessenger(),
|
||||
fManager(manager),
|
||||
fSetFileNameCmd(0),
|
||||
fSetHistoDirNameCmd(0),
|
||||
fSetNtupleDirNameCmd(0)
|
||||
fSetFileNameCmd(nullptr),
|
||||
fSetHistoDirNameCmd(nullptr),
|
||||
fSetNtupleDirNameCmd(nullptr)
|
||||
{
|
||||
fSetFileNameCmd = new G4UIcmdWithAString("/analysis/setFileName",this);
|
||||
fSetFileNameCmd = G4Analysis::make_unique<G4UIcmdWithAString>("/analysis/setFileName",this);
|
||||
fSetFileNameCmd->SetGuidance("Set name for the histograms & ntuple file");
|
||||
fSetFileNameCmd->SetParameterName("Filename", false);
|
||||
fSetFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fSetHistoDirNameCmd = new G4UIcmdWithAString("/analysis/setHistoDirName",this);
|
||||
fSetHistoDirNameCmd = G4Analysis::make_unique<G4UIcmdWithAString>("/analysis/setHistoDirName",this);
|
||||
fSetHistoDirNameCmd->SetGuidance("Set name for the histograms directory");
|
||||
fSetHistoDirNameCmd->SetParameterName("HistoDirName", false);
|
||||
fSetHistoDirNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fSetNtupleDirNameCmd = new G4UIcmdWithAString("/analysis/setNtupleDirName",this);
|
||||
fSetNtupleDirNameCmd = G4Analysis::make_unique<G4UIcmdWithAString>("/analysis/setNtupleDirName",this);
|
||||
fSetNtupleDirNameCmd->SetGuidance("Set name for the ntuple directory");
|
||||
fSetNtupleDirNameCmd->SetParameterName("NtupleDirName", false);
|
||||
fSetNtupleDirNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
@@ -59,11 +62,7 @@ G4FileMessenger::G4FileMessenger(G4VAnalysisManager* manager)
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4FileMessenger::~G4FileMessenger()
|
||||
{
|
||||
delete fSetFileNameCmd;
|
||||
delete fSetHistoDirNameCmd;
|
||||
delete fSetNtupleDirNameCmd;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// public functions
|
||||
@@ -71,14 +70,14 @@ G4FileMessenger::~G4FileMessenger()
|
||||
//_____________________________________________________________________________
|
||||
void G4FileMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
{
|
||||
if ( command == fSetFileNameCmd ) {
|
||||
if ( command == fSetFileNameCmd.get() ) {
|
||||
G4cout << "Set file name: " << newValues << G4endl;
|
||||
fManager->SetFileName(newValues);
|
||||
}
|
||||
else if ( command == fSetHistoDirNameCmd ) {
|
||||
else if ( command == fSetHistoDirNameCmd.get() ) {
|
||||
fManager->SetHistoDirectoryName(newValues);
|
||||
}
|
||||
else if ( command == fSetNtupleDirNameCmd ) {
|
||||
else if ( command == fSetNtupleDirNameCmd.get() ) {
|
||||
fManager->SetNtupleDirectoryName(newValues);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "G4H1Messenger.hh"
|
||||
#include "G4VAnalysisManager.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "G4AnalysisMessengerHelper.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
@@ -45,53 +46,36 @@
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
namespace {
|
||||
|
||||
void Exception(G4UIcommand* command, G4int nofParameters)
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Got wrong number of \"" << command->GetCommandName()
|
||||
<< "\" parameters: " << nofParameters
|
||||
<< " instead of " << command->GetParameterEntries()
|
||||
<< " expected" << G4endl;
|
||||
G4Exception("G4H1Messenger::SetNewValue",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4H1Messenger::G4H1Messenger(G4VAnalysisManager* manager)
|
||||
: G4UImessenger(),
|
||||
fManager(manager),
|
||||
fH1Dir(0),
|
||||
fCreateH1Cmd(0),
|
||||
fSetH1Cmd(0),
|
||||
fSetH1TitleCmd(0),
|
||||
fSetH1XAxisCmd(0),
|
||||
fSetH1YAxisCmd(0)
|
||||
fHelper(nullptr),
|
||||
fDirectory(nullptr),
|
||||
fCreateH1Cmd(nullptr),
|
||||
fSetH1Cmd(nullptr),
|
||||
fSetH1TitleCmd(nullptr),
|
||||
fSetH1XAxisCmd(nullptr),
|
||||
fSetH1YAxisCmd(nullptr)
|
||||
{
|
||||
fH1Dir = new G4UIdirectory("/analysis/h1/");
|
||||
fH1Dir->SetGuidance("1D histograms control");
|
||||
fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>("h1");
|
||||
|
||||
fDirectory = fHelper->CreateHnDirectory();
|
||||
|
||||
CreateH1Cmd();
|
||||
|
||||
SetH1Cmd();
|
||||
SetH1TitleCmd();
|
||||
SetH1XAxisCmd();
|
||||
SetH1YAxisCmd();
|
||||
fSetH1XCmd = fHelper->CreateSetBinsCommand("x", this);
|
||||
|
||||
|
||||
fSetH1TitleCmd = fHelper->CreateSetTitleCommand(this);
|
||||
fSetH1XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
|
||||
fSetH1YAxisCmd = fHelper->CreateSetAxisCommand("y", this);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4H1Messenger::~G4H1Messenger()
|
||||
{
|
||||
delete fCreateH1Cmd;
|
||||
delete fSetH1Cmd;
|
||||
delete fSetH1TitleCmd;
|
||||
delete fSetH1XAxisCmd;
|
||||
delete fSetH1YAxisCmd;
|
||||
delete fH1Dir;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// private functions
|
||||
@@ -100,32 +84,32 @@ G4H1Messenger::~G4H1Messenger()
|
||||
//_____________________________________________________________________________
|
||||
void G4H1Messenger::CreateH1Cmd()
|
||||
{
|
||||
G4UIparameter* h1Name = new G4UIparameter("name", 's', false);
|
||||
auto h1Name = new G4UIparameter("name", 's', false);
|
||||
h1Name->SetGuidance("Histogram name (label)");
|
||||
|
||||
G4UIparameter* h1Title = new G4UIparameter("title", 's', false);
|
||||
auto h1Title = new G4UIparameter("title", 's', false);
|
||||
h1Title->SetGuidance("Histogram title");
|
||||
|
||||
G4UIparameter* h1Nbins0 = new G4UIparameter("nbins0", 'i', true);
|
||||
auto h1Nbins0 = new G4UIparameter("nbins0", 'i', true);
|
||||
h1Nbins0->SetGuidance("Number of bins (default = 100)");
|
||||
h1Nbins0->SetGuidance("Can be reset with /analysis/h1/set command");
|
||||
h1Nbins0->SetDefaultValue(100);
|
||||
|
||||
G4UIparameter* h1ValMin0 = new G4UIparameter("valMin0", 'd', true);
|
||||
auto h1ValMin0 = new G4UIparameter("valMin0", 'd', true);
|
||||
h1ValMin0->SetGuidance("Minimum value, expressed in unit (default = 0.)");
|
||||
h1ValMin0->SetGuidance("Can be reset with /analysis/h1/set command");
|
||||
h1ValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* h1ValMax0 = new G4UIparameter("valMax0", 'd', true);
|
||||
auto h1ValMax0 = new G4UIparameter("valMax0", 'd', true);
|
||||
h1ValMax0->SetGuidance("Maximum value, expressed in unit (default = 1.)");
|
||||
h1ValMax0->SetGuidance("Can be reset with /analysis/h1/set command");
|
||||
h1ValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* h1ValUnit0 = new G4UIparameter("valUnit0", 's', true);
|
||||
auto h1ValUnit0 = new G4UIparameter("valUnit0", 's', true);
|
||||
h1ValUnit0->SetGuidance("The unit applied to filled values and valMin0, valMax0");
|
||||
h1ValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h1ValFcn0 = new G4UIparameter("valFcn0", 's', true);
|
||||
auto h1ValFcn0 = new G4UIparameter("valFcn0", 's', true);
|
||||
G4String fcnGuidance = "The function applied to filled values (log, log10, exp).\n";
|
||||
fcnGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
|
||||
fcnGuidance += "but none value should be used instead.";
|
||||
@@ -133,7 +117,7 @@ void G4H1Messenger::CreateH1Cmd()
|
||||
h1ValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
h1ValFcn0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h1ValBinScheme0 = new G4UIparameter("valBinScheme0", 's', true);
|
||||
auto h1ValBinScheme0 = new G4UIparameter("valBinScheme0", 's', true);
|
||||
G4String binSchemeGuidance = "The binning scheme (linear, log).\n";
|
||||
h1ValBinScheme0->SetParameterCandidates("linear log");
|
||||
binSchemeGuidance
|
||||
@@ -142,7 +126,7 @@ void G4H1Messenger::CreateH1Cmd()
|
||||
h1ValBinScheme0->SetGuidance(binSchemeGuidance);
|
||||
h1ValBinScheme0->SetDefaultValue("linear");
|
||||
|
||||
fCreateH1Cmd = new G4UIcommand("/analysis/h1/create", this);
|
||||
fCreateH1Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/h1/create", this);
|
||||
fCreateH1Cmd->SetGuidance("Create 1D histogram");
|
||||
fCreateH1Cmd->SetParameter(h1Name);
|
||||
fCreateH1Cmd->SetParameter(h1Title);
|
||||
@@ -159,24 +143,24 @@ void G4H1Messenger::CreateH1Cmd()
|
||||
//_____________________________________________________________________________
|
||||
void G4H1Messenger::SetH1Cmd()
|
||||
{
|
||||
G4UIparameter* h1Id = new G4UIparameter("id", 'i', false);
|
||||
auto h1Id = new G4UIparameter("id", 'i', false);
|
||||
h1Id->SetGuidance("Histogram id");
|
||||
h1Id->SetParameterRange("id>=0");
|
||||
|
||||
G4UIparameter* h1Nbins = new G4UIparameter("nbins", 'i', false);
|
||||
auto h1Nbins = new G4UIparameter("nbins", 'i', false);
|
||||
h1Nbins->SetGuidance("Number of bins");
|
||||
|
||||
G4UIparameter* h1ValMin = new G4UIparameter("valMin", 'd', false);
|
||||
auto h1ValMin = new G4UIparameter("valMin", 'd', false);
|
||||
h1ValMin->SetGuidance("Minimum value, expressed in unit");
|
||||
|
||||
G4UIparameter* h1ValMax = new G4UIparameter("valMax", 'd', false);
|
||||
auto h1ValMax = new G4UIparameter("valMax", 'd', false);
|
||||
h1ValMax->SetGuidance("Maximum value, expressed in unit");
|
||||
|
||||
G4UIparameter* h1ValUnit = new G4UIparameter("valUnit", 's', true);
|
||||
auto h1ValUnit = new G4UIparameter("valUnit", 's', true);
|
||||
h1ValUnit->SetGuidance("The unit applied to filled values and valMin, valMax");
|
||||
h1ValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h1ValFcn = new G4UIparameter("valFcn", 's', true);
|
||||
auto h1ValFcn = new G4UIparameter("valFcn", 's', true);
|
||||
h1ValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnGuidance = "The function applied to filled values (log, log10, exp, none).\n";
|
||||
fcnGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
|
||||
@@ -184,7 +168,7 @@ void G4H1Messenger::SetH1Cmd()
|
||||
h1ValFcn->SetGuidance(fcnGuidance);
|
||||
h1ValFcn->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h1ValBinScheme = new G4UIparameter("valBinScheme", 's', true);
|
||||
auto h1ValBinScheme = new G4UIparameter("valBinScheme", 's', true);
|
||||
h1ValBinScheme->SetParameterCandidates("linear log");
|
||||
G4String binSchemeGuidance = "The binning scheme (linear, log).\n";
|
||||
binSchemeGuidance
|
||||
@@ -193,8 +177,8 @@ void G4H1Messenger::SetH1Cmd()
|
||||
h1ValBinScheme->SetGuidance(binSchemeGuidance);
|
||||
h1ValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
fSetH1Cmd = new G4UIcommand("/analysis/h1/set", this);
|
||||
fSetH1Cmd->SetGuidance("Set parameters for the 1D histogram of #Id :");
|
||||
fSetH1Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/h1/set", this);
|
||||
fSetH1Cmd->SetGuidance("Set parameters for the 1D histogram of given id:");
|
||||
fSetH1Cmd->SetGuidance(" nbins; valMin; valMax; unit; function; binScheme");
|
||||
fSetH1Cmd->SetParameter(h1Id);
|
||||
fSetH1Cmd->SetParameter(h1Nbins);
|
||||
@@ -206,60 +190,6 @@ void G4H1Messenger::SetH1Cmd()
|
||||
fSetH1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H1Messenger::SetH1TitleCmd()
|
||||
{
|
||||
G4UIparameter* h1Id = new G4UIparameter("idTitle", 'i', false);
|
||||
h1Id->SetGuidance("Histogram id");
|
||||
h1Id->SetParameterRange("idTitle>=0");
|
||||
|
||||
G4UIparameter* h1Title = new G4UIparameter("h1Title", 's', true);
|
||||
h1Title->SetGuidance("Histogram title");
|
||||
h1Title->SetDefaultValue("none");
|
||||
|
||||
fSetH1TitleCmd = new G4UIcommand("/analysis/h1/setTitle", this);
|
||||
fSetH1TitleCmd->SetGuidance("Set title for the 1D histogram of #Id");
|
||||
fSetH1TitleCmd->SetParameter(h1Id);
|
||||
fSetH1TitleCmd->SetParameter(h1Title);
|
||||
fSetH1TitleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H1Messenger::SetH1XAxisCmd()
|
||||
{
|
||||
G4UIparameter* h1Id = new G4UIparameter("idXaxis", 'i', false);
|
||||
h1Id->SetGuidance("Histogram id");
|
||||
h1Id->SetParameterRange("idXaxis>=0");
|
||||
|
||||
G4UIparameter* h1XAxis = new G4UIparameter("h1Xaxis", 's', true);
|
||||
h1XAxis->SetGuidance("Histogram x-axis title");
|
||||
h1XAxis->SetDefaultValue("none");
|
||||
|
||||
fSetH1XAxisCmd = new G4UIcommand("/analysis/h1/setXaxis", this);
|
||||
fSetH1XAxisCmd->SetGuidance("Set x-axis title for the 1D histogram of #Id");
|
||||
fSetH1XAxisCmd->SetParameter(h1Id);
|
||||
fSetH1XAxisCmd->SetParameter(h1XAxis);
|
||||
fSetH1XAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H1Messenger::SetH1YAxisCmd()
|
||||
{
|
||||
G4UIparameter* h1Id = new G4UIparameter("idYaxis", 'i', false);
|
||||
h1Id->SetGuidance("Histogram id");
|
||||
h1Id->SetParameterRange("idYaxis>=0");
|
||||
|
||||
G4UIparameter* h1YAxis = new G4UIparameter("h1Yaxis", 's', true);
|
||||
h1YAxis->SetGuidance("Histogram y-axis title");
|
||||
h1YAxis->SetDefaultValue("none");
|
||||
|
||||
fSetH1YAxisCmd = new G4UIcommand("/analysis/h1/setYaxis", this);
|
||||
fSetH1YAxisCmd->SetGuidance("Set y-axis title for the 1D histogram of #Id");
|
||||
fSetH1YAxisCmd->SetParameter(h1Id);
|
||||
fSetH1YAxisCmd->SetParameter(h1YAxis);
|
||||
fSetH1YAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
@@ -273,51 +203,57 @@ void G4H1Messenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
// check consistency
|
||||
if ( G4int(parameters.size()) != command->GetParameterEntries() ) {
|
||||
// Should never happen but let's check anyway for consistency
|
||||
Exception(command, parameters.size());
|
||||
fHelper->WarnAboutParameters(command, parameters.size());
|
||||
return;
|
||||
}
|
||||
|
||||
if ( command == fCreateH1Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4String name = parameters[counter++];
|
||||
G4String title = parameters[counter++];
|
||||
G4int nbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double vmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double vmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String sunit = parameters[counter++];
|
||||
G4String sfcn = parameters[counter++];
|
||||
G4String sbinScheme = parameters[counter++];
|
||||
G4double unit = GetUnitValue(sunit);
|
||||
fManager->CreateH1(name, title, nbins, vmin*unit, vmax*unit, sunit, sfcn, sbinScheme);
|
||||
if ( command == fCreateH1Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto name = parameters[counter++];
|
||||
auto title = parameters[counter++];
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto unit = GetUnitValue(xdata.fSunit);
|
||||
fManager->CreateH1(name, title,
|
||||
xdata.fNbins, xdata.fVmin*unit, xdata.fVmax*unit,
|
||||
xdata.fSunit, xdata.fSfcn, xdata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetH1Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4int nbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double vmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double vmax = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4String sunit = parameters[counter++];
|
||||
G4String sfcn = parameters[counter++];
|
||||
G4String sbinScheme = parameters[counter++];
|
||||
G4double unit = GetUnitValue(sunit);
|
||||
fManager->SetH1(id, nbins, vmin*unit, vmax*unit, sunit, sfcn, sbinScheme);
|
||||
else if ( command == fSetH1Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto unit = GetUnitValue(xdata.fSunit);
|
||||
fManager->SetH1(id,
|
||||
xdata.fNbins, xdata.fVmin*unit, xdata.fVmax*unit,
|
||||
xdata.fSunit, xdata.fSfcn, xdata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetH1TitleCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String title = parameters[counter++];
|
||||
else if ( command == fSetH1XCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto unit = GetUnitValue(xdata.fSunit);
|
||||
fManager->SetH1(id,
|
||||
xdata.fNbins, xdata.fVmin*unit, xdata.fVmax*unit,
|
||||
xdata.fSunit, xdata.fSfcn, xdata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetH1TitleCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto title = parameters[counter++];
|
||||
fManager->SetH1Title(id, title);
|
||||
}
|
||||
else if ( command == fSetH1XAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String xaxis = parameters[counter++];
|
||||
else if ( command == fSetH1XAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto xaxis = parameters[counter++];
|
||||
fManager->SetH1XAxisTitle(id, xaxis);
|
||||
}
|
||||
else if ( command == fSetH1YAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String yaxis = parameters[counter++];
|
||||
else if ( command == fSetH1YAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto yaxis = parameters[counter++];
|
||||
fManager->SetH1YAxisTitle(id, yaxis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,57 +39,41 @@
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
namespace {
|
||||
|
||||
void Exception(G4UIcommand* command, G4int nofParameters)
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Got wrong number of \"" << command->GetCommandName()
|
||||
<< "\" parameters: " << nofParameters
|
||||
<< " instead of " << command->GetParameterEntries()
|
||||
<< " expected" << G4endl;
|
||||
G4Exception("G4H2Messenger::SetNewValue",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4H2Messenger::G4H2Messenger(G4VAnalysisManager* manager)
|
||||
: G4UImessenger(),
|
||||
fManager(manager),
|
||||
fH2Dir(0),
|
||||
fCreateH2Cmd(0),
|
||||
fSetH2Cmd(0),
|
||||
fSetH2TitleCmd(0),
|
||||
fSetH2XAxisCmd(0),
|
||||
fSetH2YAxisCmd(0)
|
||||
fHelper(nullptr),
|
||||
fDirectory(nullptr),
|
||||
fCreateH2Cmd(nullptr),
|
||||
fSetH2Cmd(nullptr),
|
||||
fSetH2XCmd(nullptr),
|
||||
fSetH2YCmd(nullptr),
|
||||
fSetH2TitleCmd(nullptr),
|
||||
fSetH2XAxisCmd(nullptr),
|
||||
fSetH2YAxisCmd(nullptr),
|
||||
fXId(-1),
|
||||
fXData()
|
||||
{
|
||||
fH2Dir = new G4UIdirectory("/analysis/h2/");
|
||||
fH2Dir->SetGuidance("2D histograms control");
|
||||
fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>("h2");
|
||||
|
||||
fDirectory = fHelper->CreateHnDirectory();
|
||||
|
||||
CreateH2Cmd();
|
||||
|
||||
SetH2Cmd();
|
||||
fSetH2XCmd = fHelper->CreateSetBinsCommand("x", this);
|
||||
fSetH2YCmd = fHelper->CreateSetBinsCommand("y", this);
|
||||
|
||||
SetH2TitleCmd();
|
||||
SetH2XAxisCmd();
|
||||
SetH2YAxisCmd();
|
||||
SetH2ZAxisCmd();
|
||||
fSetH2TitleCmd = fHelper->CreateSetTitleCommand(this);
|
||||
fSetH2XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
|
||||
fSetH2YAxisCmd = fHelper->CreateSetAxisCommand("y", this);
|
||||
fSetH2ZAxisCmd = fHelper->CreateSetAxisCommand("z", this);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4H2Messenger::~G4H2Messenger()
|
||||
{
|
||||
delete fCreateH2Cmd;
|
||||
delete fSetH2Cmd;
|
||||
delete fSetH2TitleCmd;
|
||||
delete fSetH2XAxisCmd;
|
||||
delete fSetH2YAxisCmd;
|
||||
delete fSetH2ZAxisCmd;
|
||||
delete fH2Dir;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// private functions
|
||||
@@ -98,75 +82,75 @@ G4H2Messenger::~G4H2Messenger()
|
||||
//_____________________________________________________________________________
|
||||
void G4H2Messenger::CreateH2Cmd()
|
||||
{
|
||||
G4UIparameter* h2Name = new G4UIparameter("name", 's', false);
|
||||
auto h2Name = new G4UIparameter("name", 's', false);
|
||||
h2Name->SetGuidance("Histogram name (label)");
|
||||
|
||||
G4UIparameter* h2Title = new G4UIparameter("title", 's', false);
|
||||
auto h2Title = new G4UIparameter("title", 's', false);
|
||||
h2Title->SetGuidance("Histogram title");
|
||||
|
||||
G4UIparameter* h2xNbins0 = new G4UIparameter("xnbins0", 'i', true);
|
||||
auto h2xNbins0 = new G4UIparameter("xnbins0", 'i', true);
|
||||
h2xNbins0->SetGuidance("Number of x-bins (default = 100)");
|
||||
h2xNbins0->SetGuidance("Can be reset with /analysis/h2/set command");
|
||||
h2xNbins0->SetDefaultValue(100);
|
||||
|
||||
G4UIparameter* h2xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
|
||||
auto h2xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
|
||||
h2xValMin0->SetGuidance("Minimum x-value, expressed in unit (default = 0.)");
|
||||
h2xValMin0->SetGuidance("Can be reset with /analysis/h2/set command");
|
||||
h2xValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* h2xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
|
||||
auto h2xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
|
||||
h2xValMax0->SetGuidance("Maximum x-value, expressed in unit (default = 1.)");
|
||||
h2xValMax0->SetGuidance("Can be reset with /analysis/h2/set command");
|
||||
h2xValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* h2xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
|
||||
auto h2xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
|
||||
h2xValUnit0->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
|
||||
h2xValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h2xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
|
||||
auto h2xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
|
||||
G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
|
||||
h2xValFcn0->SetGuidance(fcnxGuidance);
|
||||
h2xValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
h2xValFcn0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h2xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
|
||||
auto h2xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
|
||||
G4String xbinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h2xValBinScheme0->SetParameterCandidates("linear log");
|
||||
h2xValBinScheme0->SetGuidance(xbinSchemeGuidance);
|
||||
h2xValBinScheme0->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* h2yNbins0 = new G4UIparameter("ynbins0", 'i', true);
|
||||
auto h2yNbins0 = new G4UIparameter("ynbins0", 'i', true);
|
||||
h2yNbins0->SetGuidance("Number of y-bins (default = 100)");
|
||||
h2yNbins0->SetGuidance("Can be reset with /analysis/h2/set command");
|
||||
h2yNbins0->SetDefaultValue(100);
|
||||
|
||||
G4UIparameter* h2yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
|
||||
auto h2yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
|
||||
h2yValMin0->SetGuidance("Minimum y-value, expressed in unit (default = 0.)");
|
||||
h2yValMin0->SetGuidance("Can be reset with /analysis/h2/set command");
|
||||
h2yValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* h2yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
|
||||
auto h2yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
|
||||
h2yValMax0->SetGuidance("Maximum y-value, expressed in unit (default = 1.)");
|
||||
h2yValMax0->SetGuidance("Can be reset with /analysis/h2/set command");
|
||||
h2yValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* h2yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
|
||||
auto h2yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
|
||||
h2yValUnit0->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
|
||||
h2yValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h2yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
|
||||
auto h2yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
|
||||
G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
|
||||
h2yValFcn0->SetGuidance(fcnyGuidance);
|
||||
h2yValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
h2yValFcn0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h2yValBinScheme0 = new G4UIparameter("yvalBinScheme0", 's', true);
|
||||
auto h2yValBinScheme0 = new G4UIparameter("yvalBinScheme0", 's', true);
|
||||
G4String ybinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h2yValBinScheme0->SetParameterCandidates("linear log");
|
||||
h2yValBinScheme0->SetGuidance(ybinSchemeGuidance);
|
||||
h2yValBinScheme0->SetDefaultValue("linear");
|
||||
|
||||
fCreateH2Cmd = new G4UIcommand("/analysis/h2/create", this);
|
||||
fCreateH2Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/h2/create", this);
|
||||
fCreateH2Cmd->SetGuidance("Create 2D histogram");
|
||||
fCreateH2Cmd->SetParameter(h2Name);
|
||||
fCreateH2Cmd->SetParameter(h2Title);
|
||||
@@ -189,62 +173,62 @@ void G4H2Messenger::CreateH2Cmd()
|
||||
//_____________________________________________________________________________
|
||||
void G4H2Messenger::SetH2Cmd()
|
||||
{
|
||||
G4UIparameter* h2Id = new G4UIparameter("id", 'i', false);
|
||||
auto h2Id = new G4UIparameter("id", 'i', false);
|
||||
h2Id->SetGuidance("Histogram id");
|
||||
h2Id->SetParameterRange("id>=0");
|
||||
|
||||
G4UIparameter* h2xNbins = new G4UIparameter("xnbins", 'i', false);
|
||||
auto h2xNbins = new G4UIparameter("xnbins", 'i', false);
|
||||
h2xNbins->SetGuidance("Number of x-bins");
|
||||
|
||||
G4UIparameter* h2xValMin = new G4UIparameter("xvalMin", 'd', false);
|
||||
auto h2xValMin = new G4UIparameter("xvalMin", 'd', false);
|
||||
h2xValMin->SetGuidance("Minimum x-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h2xValMax = new G4UIparameter("xvalMax", 'd', false);
|
||||
auto h2xValMax = new G4UIparameter("xvalMax", 'd', false);
|
||||
h2xValMax->SetGuidance("Maximum x-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h2xValUnit = new G4UIparameter("xvalUnit", 's', false);
|
||||
auto h2xValUnit = new G4UIparameter("xvalUnit", 's', false);
|
||||
h2xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin, xvalMax");
|
||||
h2xValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h2xValFcn = new G4UIparameter("xvalFcn", 's', false);
|
||||
auto h2xValFcn = new G4UIparameter("xvalFcn", 's', false);
|
||||
h2xValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
|
||||
h2xValFcn->SetGuidance(fcnxGuidance);
|
||||
h2xValFcn->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h2xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
|
||||
auto h2xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
|
||||
G4String xbinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h2xValBinScheme->SetParameterCandidates("linear log");
|
||||
h2xValBinScheme->SetGuidance(xbinSchemeGuidance);
|
||||
h2xValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* h2yNbins = new G4UIparameter("nybins", 'i', false);
|
||||
auto h2yNbins = new G4UIparameter("nybins", 'i', false);
|
||||
h2yNbins->SetGuidance("Number of y-bins");
|
||||
|
||||
G4UIparameter* h2yValMin = new G4UIparameter("yvalMin", 'd', false);
|
||||
auto h2yValMin = new G4UIparameter("yvalMin", 'd', false);
|
||||
h2yValMin->SetGuidance("Minimum y-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h2yValMax = new G4UIparameter("yvalMax", 'd', false);
|
||||
auto h2yValMax = new G4UIparameter("yvalMax", 'd', false);
|
||||
h2yValMax->SetGuidance("Maximum y-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h2yValUnit = new G4UIparameter("yvalUnit", 's', true);
|
||||
auto h2yValUnit = new G4UIparameter("yvalUnit", 's', true);
|
||||
h2yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin, yvalMax");
|
||||
h2yValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h2yValFcn = new G4UIparameter("yvalFcn", 's', false);
|
||||
auto h2yValFcn = new G4UIparameter("yvalFcn", 's', false);
|
||||
h2yValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
|
||||
h2yValFcn->SetGuidance(fcnyGuidance);
|
||||
h2yValFcn->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h2yValBinScheme = new G4UIparameter("yvalBinScheme", 's', true);
|
||||
auto h2yValBinScheme = new G4UIparameter("yvalBinScheme", 's', true);
|
||||
G4String ybinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h2yValBinScheme->SetParameterCandidates("linear log");
|
||||
h2yValBinScheme->SetGuidance(ybinSchemeGuidance);
|
||||
h2yValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
fSetH2Cmd = new G4UIcommand("/analysis/h2/set", this);
|
||||
fSetH2Cmd->SetGuidance("Set parameters for the 2D histogram of #Id :");
|
||||
fSetH2Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/h2/set", this);
|
||||
fSetH2Cmd->SetGuidance("Set parameters for the 2D histogram of given id:");
|
||||
fSetH2Cmd->SetGuidance(" nxbins; xvalMin; xvalMax; xunit; xfunction; xbinScheme");
|
||||
fSetH2Cmd->SetGuidance(" nybins; yvalMin; yvalMax; yunit; yfunction; ybinScheme");
|
||||
fSetH2Cmd->SetParameter(h2Id);
|
||||
@@ -263,77 +247,6 @@ void G4H2Messenger::SetH2Cmd()
|
||||
fSetH2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H2Messenger::SetH2TitleCmd()
|
||||
{
|
||||
G4UIparameter* h2Id = new G4UIparameter("idTitle", 'i', false);
|
||||
h2Id->SetGuidance("Histogram id");
|
||||
h2Id->SetParameterRange("idTitle>=0");
|
||||
|
||||
G4UIparameter* h2Title = new G4UIparameter("h2Title", 's', true);
|
||||
h2Title->SetGuidance("Histogram title");
|
||||
h2Title->SetDefaultValue("none");
|
||||
|
||||
fSetH2TitleCmd = new G4UIcommand("/analysis/h2/setTitle", this);
|
||||
fSetH2TitleCmd->SetGuidance("Set title for the 2D histogram of #Id");
|
||||
fSetH2TitleCmd->SetParameter(h2Id);
|
||||
fSetH2TitleCmd->SetParameter(h2Title);
|
||||
fSetH2TitleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H2Messenger::SetH2XAxisCmd()
|
||||
{
|
||||
G4UIparameter* h2Id = new G4UIparameter("idXaxis", 'i', false);
|
||||
h2Id->SetGuidance("Histogram id");
|
||||
h2Id->SetParameterRange("idXaxis>=0");
|
||||
|
||||
G4UIparameter* h2XAxis = new G4UIparameter("h2Xaxis", 's', true);
|
||||
h2XAxis->SetGuidance("Histogram x-axis title");
|
||||
h2XAxis->SetDefaultValue("none");
|
||||
|
||||
fSetH2XAxisCmd = new G4UIcommand("/analysis/h2/setXaxis", this);
|
||||
fSetH2XAxisCmd->SetGuidance("Set x-axis title for the 2D histogram of #Id");
|
||||
fSetH2XAxisCmd->SetParameter(h2Id);
|
||||
fSetH2XAxisCmd->SetParameter(h2XAxis);
|
||||
fSetH2XAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H2Messenger::SetH2YAxisCmd()
|
||||
{
|
||||
G4UIparameter* h2Id = new G4UIparameter("idYaxis", 'i', false);
|
||||
h2Id->SetGuidance("Histogram id");
|
||||
h2Id->SetParameterRange("idYaxis>=0");
|
||||
|
||||
G4UIparameter* h2YAxis = new G4UIparameter("h2Yaxis", 's', true);
|
||||
h2YAxis->SetGuidance("Histogram y-axis title");
|
||||
h2YAxis->SetDefaultValue("none");
|
||||
|
||||
fSetH2YAxisCmd = new G4UIcommand("/analysis/h2/setYaxis", this);
|
||||
fSetH2YAxisCmd->SetGuidance("Set y-axis title for the 2D histogram of #Id");
|
||||
fSetH2YAxisCmd->SetParameter(h2Id);
|
||||
fSetH2YAxisCmd->SetParameter(h2YAxis);
|
||||
fSetH2YAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H2Messenger::SetH2ZAxisCmd()
|
||||
{
|
||||
G4UIparameter* h2Id = new G4UIparameter("idYaxis", 'i', false);
|
||||
h2Id->SetGuidance("Histogram id");
|
||||
h2Id->SetParameterRange("idYaxis>=0");
|
||||
|
||||
G4UIparameter* h2YAxis = new G4UIparameter("h2Yaxis", 's', true);
|
||||
h2YAxis->SetGuidance("Histogram y-axis title");
|
||||
h2YAxis->SetDefaultValue("none");
|
||||
|
||||
fSetH2ZAxisCmd = new G4UIcommand("/analysis/h2/setYaxis", this);
|
||||
fSetH2ZAxisCmd->SetGuidance("Set y-axis title for the 2D histogram of #Id");
|
||||
fSetH2ZAxisCmd->SetParameter(h2Id);
|
||||
fSetH2ZAxisCmd->SetParameter(h2YAxis);
|
||||
fSetH2ZAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//
|
||||
// public functions
|
||||
@@ -348,77 +261,91 @@ void G4H2Messenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
// check consistency
|
||||
if ( G4int(parameters.size()) != command->GetParameterEntries() ) {
|
||||
// Should never happen but let's check anyway for consistency
|
||||
Exception(command, parameters.size());
|
||||
fHelper->WarnAboutParameters(command, parameters.size());
|
||||
return;
|
||||
}
|
||||
|
||||
if ( command == fCreateH2Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4String name = parameters[counter++];
|
||||
G4String title = parameters[counter++];
|
||||
G4int xnbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double xvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double xvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String xsunit = parameters[counter++];
|
||||
G4String xsfcn = parameters[counter++];
|
||||
G4String xsbinScheme = parameters[counter++];
|
||||
G4double xunit = GetUnitValue(xsunit);
|
||||
G4int ynbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double yvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double yvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String ysunit = parameters[counter++];
|
||||
G4String ysfcn = parameters[counter++];
|
||||
G4String ysbinScheme = parameters[counter++];
|
||||
G4double yunit = GetUnitValue(ysunit);
|
||||
if ( command == fCreateH2Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto name = parameters[counter++];
|
||||
auto title = parameters[counter++];
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto xunit = GetUnitValue(xdata.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData ydata;
|
||||
fHelper->GetBinData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
fManager->CreateH2(name, title,
|
||||
xnbins, xvmin*xunit, xvmax*xunit,
|
||||
ynbins, yvmin*yunit, yvmax*yunit,
|
||||
xsunit, ysunit, xsfcn, ysfcn, xsbinScheme, ysbinScheme);
|
||||
xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
|
||||
ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
xdata.fSunit, ydata.fSunit,
|
||||
xdata.fSfcn, ydata.fSfcn,
|
||||
xdata.fSbinScheme, ydata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetH2Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4int xnbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double xvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double xvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String xsunit = parameters[counter++];
|
||||
G4String xsfcn = parameters[counter++];
|
||||
G4String xsbinScheme = parameters[counter++];
|
||||
G4double xunit = GetUnitValue(xsunit);
|
||||
G4int ynbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double yvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double yvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String ysunit = parameters[counter++];
|
||||
G4String ysfcn = parameters[counter++];
|
||||
G4String ysbinScheme = parameters[counter++];
|
||||
G4double yunit = GetUnitValue(ysunit);
|
||||
else if ( command == fSetH2Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto xunit = GetUnitValue(xdata.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData ydata;
|
||||
fHelper->GetBinData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
fManager->SetH2(id,
|
||||
xnbins, xvmin*xunit, xvmax*xunit,
|
||||
ynbins, yvmin*yunit, yvmax*yunit,
|
||||
xsunit, ysunit, xsfcn, ysfcn, xsbinScheme, ysbinScheme);
|
||||
xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
|
||||
ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
xdata.fSunit, ydata.fSunit,
|
||||
xdata.fSfcn, ydata.fSfcn,
|
||||
xdata.fSbinScheme, ydata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetH2TitleCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String title = parameters[counter++];
|
||||
else if ( command == fSetH2XCmd.get() ) {
|
||||
// Only save values
|
||||
auto counter = 0;
|
||||
fXId = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
fHelper->GetBinData(fXData, parameters, counter);
|
||||
}
|
||||
else if ( command == fSetH2YCmd.get() ) {
|
||||
// Check if setX command was called
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
if ( fXId == -1 || fXId != id ) {
|
||||
fHelper->WarnAboutSetCommands();
|
||||
return;
|
||||
}
|
||||
auto xunit = GetUnitValue(fXData.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData ydata;
|
||||
fHelper->GetBinData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
fManager->SetH2(id,
|
||||
fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
|
||||
ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
fXData.fSunit, ydata.fSunit,
|
||||
fXData.fSfcn, ydata.fSfcn,
|
||||
fXData.fSbinScheme, ydata.fSbinScheme);
|
||||
fXId = -1;
|
||||
}
|
||||
else if ( command == fSetH2TitleCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto title = parameters[counter++];
|
||||
fManager->SetH2Title(id, title);
|
||||
}
|
||||
else if ( command == fSetH2XAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String xaxis = parameters[counter++];
|
||||
else if ( command == fSetH2XAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto xaxis = parameters[counter++];
|
||||
fManager->SetH2XAxisTitle(id, xaxis);
|
||||
}
|
||||
else if ( command == fSetH2YAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String yaxis = parameters[counter++];
|
||||
else if ( command == fSetH2YAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto yaxis = parameters[counter++];
|
||||
fManager->SetH2YAxisTitle(id, yaxis);
|
||||
}
|
||||
else if ( command == fSetH2ZAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String zaxis = parameters[counter++];
|
||||
else if ( command == fSetH2ZAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto zaxis = parameters[counter++];
|
||||
fManager->SetH2ZAxisTitle(id, zaxis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,57 +39,45 @@
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
namespace {
|
||||
|
||||
void Exception(G4UIcommand* command, G4int nofParameters)
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Got wrong number of \"" << command->GetCommandName()
|
||||
<< "\" parameters: " << nofParameters
|
||||
<< " instead of " << command->GetParameterEntries()
|
||||
<< " expected" << G4endl;
|
||||
G4Exception("G4H3Messenger::SetNewValue",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4H3Messenger::G4H3Messenger(G4VAnalysisManager* manager)
|
||||
: G4UImessenger(),
|
||||
fManager(manager),
|
||||
fH3Dir(0),
|
||||
fCreateH3Cmd(0),
|
||||
fSetH3Cmd(0),
|
||||
fSetH3TitleCmd(0),
|
||||
fSetH3XAxisCmd(0),
|
||||
fSetH3YAxisCmd(0)
|
||||
fHelper(nullptr),
|
||||
fDirectory(nullptr),
|
||||
fCreateH3Cmd(nullptr),
|
||||
fSetH3Cmd(nullptr),
|
||||
fSetH3XCmd(nullptr),
|
||||
fSetH3YCmd(nullptr),
|
||||
fSetH3ZCmd(nullptr),
|
||||
fSetH3TitleCmd(nullptr),
|
||||
fSetH3XAxisCmd(nullptr),
|
||||
fSetH3YAxisCmd(nullptr),
|
||||
fSetH3ZAxisCmd(nullptr),
|
||||
fXId(-1),
|
||||
fYId(-1),
|
||||
fXData(),
|
||||
fYData()
|
||||
{
|
||||
fH3Dir = new G4UIdirectory("/analysis/h3/");
|
||||
fH3Dir->SetGuidance("3D histograms control");
|
||||
fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>("h3");
|
||||
|
||||
fDirectory = fHelper->CreateHnDirectory();
|
||||
|
||||
CreateH3Cmd();
|
||||
|
||||
SetH3Cmd();
|
||||
fSetH3XCmd = fHelper->CreateSetBinsCommand("x", this);
|
||||
fSetH3YCmd = fHelper->CreateSetBinsCommand("y", this);
|
||||
|
||||
SetH3TitleCmd();
|
||||
SetH3XAxisCmd();
|
||||
SetH3YAxisCmd();
|
||||
SetH3ZAxisCmd();
|
||||
fSetH3TitleCmd = fHelper->CreateSetTitleCommand(this);
|
||||
fSetH3XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
|
||||
fSetH3YAxisCmd = fHelper->CreateSetAxisCommand("y", this);
|
||||
fSetH3ZAxisCmd = fHelper->CreateSetAxisCommand("z", this);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4H3Messenger::~G4H3Messenger()
|
||||
{
|
||||
delete fCreateH3Cmd;
|
||||
delete fSetH3Cmd;
|
||||
delete fSetH3TitleCmd;
|
||||
delete fSetH3XAxisCmd;
|
||||
delete fSetH3YAxisCmd;
|
||||
delete fSetH3ZAxisCmd;
|
||||
delete fH3Dir;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// private functions
|
||||
@@ -98,106 +86,106 @@ G4H3Messenger::~G4H3Messenger()
|
||||
//_____________________________________________________________________________
|
||||
void G4H3Messenger::CreateH3Cmd()
|
||||
{
|
||||
G4UIparameter* h3Name = new G4UIparameter("name", 's', false);
|
||||
auto h3Name = new G4UIparameter("name", 's', false);
|
||||
h3Name->SetGuidance("Histogram name (label)");
|
||||
|
||||
G4UIparameter* h3Title = new G4UIparameter("title", 's', false);
|
||||
auto h3Title = new G4UIparameter("title", 's', false);
|
||||
h3Title->SetGuidance("Histogram title");
|
||||
|
||||
G4UIparameter* h3xNbins0 = new G4UIparameter("xnbins0", 'i', true);
|
||||
auto h3xNbins0 = new G4UIparameter("xnbins0", 'i', true);
|
||||
h3xNbins0->SetGuidance("Number of x-bins (default = 100)");
|
||||
h3xNbins0->SetGuidance("Can be reset with /analysis/h3/set command");
|
||||
h3xNbins0->SetDefaultValue(100);
|
||||
|
||||
G4UIparameter* h3xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
|
||||
auto h3xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
|
||||
h3xValMin0->SetGuidance("Minimum x-value, expressed in unit (default = 0.)");
|
||||
h3xValMin0->SetGuidance("Can be reset with /analysis/h3/set command");
|
||||
h3xValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* h3xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
|
||||
auto h3xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
|
||||
h3xValMax0->SetGuidance("Maximum x-value, expressed in unit (default = 1.)");
|
||||
h3xValMax0->SetGuidance("Can be reset with /analysis/h3/set command");
|
||||
h3xValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* h3xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
|
||||
auto h3xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
|
||||
h3xValUnit0->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
|
||||
h3xValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
|
||||
auto h3xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
|
||||
G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
|
||||
h3xValFcn0->SetGuidance(fcnxGuidance);
|
||||
h3xValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
h3xValFcn0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
|
||||
auto h3xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
|
||||
G4String xbinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h3xValBinScheme0->SetParameterCandidates("linear log");
|
||||
h3xValBinScheme0->SetGuidance(xbinSchemeGuidance);
|
||||
h3xValBinScheme0->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* h3yNbins0 = new G4UIparameter("ynbins0", 'i', true);
|
||||
auto h3yNbins0 = new G4UIparameter("ynbins0", 'i', true);
|
||||
h3yNbins0->SetGuidance("Number of y-bins (default = 100)");
|
||||
h3yNbins0->SetGuidance("Can be reset with /analysis/h3/set command");
|
||||
h3yNbins0->SetDefaultValue(100);
|
||||
|
||||
G4UIparameter* h3yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
|
||||
auto h3yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
|
||||
h3yValMin0->SetGuidance("Minimum y-value, expressed in unit (default = 0.)");
|
||||
h3yValMin0->SetGuidance("Can be reset with /analysis/h3/set command");
|
||||
h3yValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* h3yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
|
||||
auto h3yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
|
||||
h3yValMax0->SetGuidance("Maximum y-value, expressed in unit (default = 1.)");
|
||||
h3yValMax0->SetGuidance("Can be reset with /analysis/h3/set command");
|
||||
h3yValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* h3yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
|
||||
auto h3yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
|
||||
h3yValUnit0->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
|
||||
h3yValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
|
||||
auto h3yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
|
||||
G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
|
||||
h3yValFcn0->SetGuidance(fcnyGuidance);
|
||||
h3yValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
h3yValFcn0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3yValBinScheme0 = new G4UIparameter("yvalBinScheme0", 's', true);
|
||||
auto h3yValBinScheme0 = new G4UIparameter("yvalBinScheme0", 's', true);
|
||||
G4String ybinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h3yValBinScheme0->SetParameterCandidates("linear log");
|
||||
h3yValBinScheme0->SetGuidance(ybinSchemeGuidance);
|
||||
h3yValBinScheme0->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* h3zNbins0 = new G4UIparameter("znbins0", 'i', true);
|
||||
auto h3zNbins0 = new G4UIparameter("znbins0", 'i', true);
|
||||
h3zNbins0->SetGuidance("Number of z-bins (default = 100)");
|
||||
h3zNbins0->SetGuidance("Can be reset with /analysis/h3/set command");
|
||||
h3zNbins0->SetDefaultValue(100);
|
||||
|
||||
G4UIparameter* h3zValMin0 = new G4UIparameter("zvalMin0", 'd', true);
|
||||
auto h3zValMin0 = new G4UIparameter("zvalMin0", 'd', true);
|
||||
h3zValMin0->SetGuidance("Minimum z-value, expressed in unit (default = 0.)");
|
||||
h3zValMin0->SetGuidance("Can be reset with /analysis/h3/set command");
|
||||
h3zValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* h3zValMax0 = new G4UIparameter("zvalMax0", 'd', true);
|
||||
auto h3zValMax0 = new G4UIparameter("zvalMax0", 'd', true);
|
||||
h3zValMax0->SetGuidance("Maximum z-value, expressed in unit (default = 1.)");
|
||||
h3zValMax0->SetGuidance("Can be reset with /analysis/h3/set command");
|
||||
h3zValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* h3zValUnit0 = new G4UIparameter("zvalUnit0", 's', true);
|
||||
auto h3zValUnit0 = new G4UIparameter("zvalUnit0", 's', true);
|
||||
h3zValUnit0->SetGuidance("The unit applied to filled z-values and zvalMin0, zvalMax0");
|
||||
h3zValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3zValFcn0 = new G4UIparameter("zvalFcn0", 's', true);
|
||||
auto h3zValFcn0 = new G4UIparameter("zvalFcn0", 's', true);
|
||||
G4String fcnzGuidance = "The function applied to filled z-values (log, log10, exp, none).";
|
||||
h3zValFcn0->SetGuidance(fcnzGuidance);
|
||||
h3zValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
h3zValFcn0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3zValBinScheme0 = new G4UIparameter("zvalBinScheme0", 's', true);
|
||||
auto h3zValBinScheme0 = new G4UIparameter("zvalBinScheme0", 's', true);
|
||||
G4String zbinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h3zValBinScheme0->SetParameterCandidates("linear log");
|
||||
h3zValBinScheme0->SetGuidance(zbinSchemeGuidance);
|
||||
h3zValBinScheme0->SetDefaultValue("linear");
|
||||
|
||||
fCreateH3Cmd = new G4UIcommand("/analysis/h3/create", this);
|
||||
fCreateH3Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/h3/create", this);
|
||||
fCreateH3Cmd->SetGuidance("Create 3D histogram");
|
||||
fCreateH3Cmd->SetParameter(h3Name);
|
||||
fCreateH3Cmd->SetParameter(h3Title);
|
||||
@@ -226,87 +214,87 @@ void G4H3Messenger::CreateH3Cmd()
|
||||
//_____________________________________________________________________________
|
||||
void G4H3Messenger::SetH3Cmd()
|
||||
{
|
||||
G4UIparameter* h3Id = new G4UIparameter("id", 'i', false);
|
||||
auto h3Id = new G4UIparameter("id", 'i', false);
|
||||
h3Id->SetGuidance("Histogram id");
|
||||
h3Id->SetParameterRange("id>=0");
|
||||
|
||||
G4UIparameter* h3xNbins = new G4UIparameter("xnbins", 'i', false);
|
||||
auto h3xNbins = new G4UIparameter("xnbins", 'i', false);
|
||||
h3xNbins->SetGuidance("Number of x-bins");
|
||||
|
||||
G4UIparameter* h3xValMin = new G4UIparameter("xvalMin", 'd', false);
|
||||
auto h3xValMin = new G4UIparameter("xvalMin", 'd', false);
|
||||
h3xValMin->SetGuidance("Minimum x-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h3xValMax = new G4UIparameter("xvalMax", 'd', false);
|
||||
auto h3xValMax = new G4UIparameter("xvalMax", 'd', false);
|
||||
h3xValMax->SetGuidance("Maximum x-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h3xValUnit = new G4UIparameter("xvalUnit", 's', false);
|
||||
auto h3xValUnit = new G4UIparameter("xvalUnit", 's', false);
|
||||
h3xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
|
||||
h3xValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3xValFcn = new G4UIparameter("xvalFcn", 's', false);
|
||||
auto h3xValFcn = new G4UIparameter("xvalFcn", 's', false);
|
||||
h3xValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
|
||||
h3xValFcn->SetGuidance(fcnxGuidance);
|
||||
h3xValFcn->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
|
||||
auto h3xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
|
||||
G4String xbinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h3xValBinScheme->SetParameterCandidates("linear log");
|
||||
h3xValBinScheme->SetGuidance(xbinSchemeGuidance);
|
||||
h3xValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* h3yNbins = new G4UIparameter("nybins", 'i', false);
|
||||
auto h3yNbins = new G4UIparameter("nybins", 'i', false);
|
||||
h3yNbins->SetGuidance("Number of y-bins");
|
||||
|
||||
G4UIparameter* h3yValMin = new G4UIparameter("yvalMin", 'd', false);
|
||||
auto h3yValMin = new G4UIparameter("yvalMin", 'd', false);
|
||||
h3yValMin->SetGuidance("Minimum y-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h3yValMax = new G4UIparameter("yvalMax", 'd', false);
|
||||
auto h3yValMax = new G4UIparameter("yvalMax", 'd', false);
|
||||
h3yValMax->SetGuidance("Maximum y-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h3yValUnit = new G4UIparameter("yvalUnit", 's', true);
|
||||
auto h3yValUnit = new G4UIparameter("yvalUnit", 's', true);
|
||||
h3yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
|
||||
h3yValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3yValFcn = new G4UIparameter("yvalFcn", 's', false);
|
||||
auto h3yValFcn = new G4UIparameter("yvalFcn", 's', false);
|
||||
h3yValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
|
||||
h3yValFcn->SetGuidance(fcnyGuidance);
|
||||
h3yValFcn->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3yValBinScheme = new G4UIparameter("yvalBinScheme", 's', true);
|
||||
auto h3yValBinScheme = new G4UIparameter("yvalBinScheme", 's', true);
|
||||
G4String ybinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h3yValBinScheme->SetParameterCandidates("linear log");
|
||||
h3yValBinScheme->SetGuidance(ybinSchemeGuidance);
|
||||
h3yValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* h3zNbins = new G4UIparameter("nzbins", 'i', false);
|
||||
auto h3zNbins = new G4UIparameter("nzbins", 'i', false);
|
||||
h3zNbins->SetGuidance("Number of z-bins");
|
||||
|
||||
G4UIparameter* h3zValMin = new G4UIparameter("zvalMin", 'd', false);
|
||||
auto h3zValMin = new G4UIparameter("zvalMin", 'd', false);
|
||||
h3zValMin->SetGuidance("Minimum z-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h3zValMax = new G4UIparameter("zvalMax", 'd', false);
|
||||
auto h3zValMax = new G4UIparameter("zvalMax", 'd', false);
|
||||
h3zValMax->SetGuidance("Maximum z-value, expressed in unit");
|
||||
|
||||
G4UIparameter* h3zValUnit = new G4UIparameter("zvalUnit", 's', true);
|
||||
auto h3zValUnit = new G4UIparameter("zvalUnit", 's', true);
|
||||
h3zValUnit->SetGuidance("The unit applied to filled z-values and zvalMin0, zvalMax0");
|
||||
h3zValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3zValFcn = new G4UIparameter("zvalFcn", 's', false);
|
||||
auto h3zValFcn = new G4UIparameter("zvalFcn", 's', false);
|
||||
h3zValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnzGuidance = "The function applied to filled z-values (log, log10, exp, none).";
|
||||
h3zValFcn->SetGuidance(fcnzGuidance);
|
||||
h3zValFcn->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* h3zValBinScheme = new G4UIparameter("zvalBinScheme", 's', true);
|
||||
auto h3zValBinScheme = new G4UIparameter("zvalBinScheme", 's', true);
|
||||
G4String zbinSchemeGuidance = "The binning scheme (linear, log).";
|
||||
h3zValBinScheme->SetParameterCandidates("linear log");
|
||||
h3zValBinScheme->SetGuidance(zbinSchemeGuidance);
|
||||
h3zValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
fSetH3Cmd = new G4UIcommand("/analysis/h3/set", this);
|
||||
fSetH3Cmd->SetGuidance("Set parameters for the 3D histogram of #Id :");
|
||||
fSetH3Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/h3/set", this);
|
||||
fSetH3Cmd->SetGuidance("Set parameters for the 3D histogram of given id:");
|
||||
fSetH3Cmd->SetGuidance(" nxbins; xvalMin; xvalMax; xunit; xfunction; xbinScheme");
|
||||
fSetH3Cmd->SetGuidance(" nybins; yvalMin; yvalMax; yunit; yfunction; ybinScheme");
|
||||
fSetH3Cmd->SetGuidance(" nzbins; zvalMin; zvalMax; zunit; zfunction; zbinScheme");
|
||||
@@ -332,77 +320,6 @@ void G4H3Messenger::SetH3Cmd()
|
||||
fSetH3Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H3Messenger::SetH3TitleCmd()
|
||||
{
|
||||
G4UIparameter* h3Id = new G4UIparameter("idTitle", 'i', false);
|
||||
h3Id->SetGuidance("Histogram id");
|
||||
h3Id->SetParameterRange("idTitle>=0");
|
||||
|
||||
G4UIparameter* h3Title = new G4UIparameter("h3Title", 's', true);
|
||||
h3Title->SetGuidance("Histogram title");
|
||||
h3Title->SetDefaultValue("none");
|
||||
|
||||
fSetH3TitleCmd = new G4UIcommand("/analysis/h3/setTitle", this);
|
||||
fSetH3TitleCmd->SetGuidance("Set title for the 3D histogram of #Id");
|
||||
fSetH3TitleCmd->SetParameter(h3Id);
|
||||
fSetH3TitleCmd->SetParameter(h3Title);
|
||||
fSetH3TitleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H3Messenger::SetH3XAxisCmd()
|
||||
{
|
||||
G4UIparameter* h3Id = new G4UIparameter("idXaxis", 'i', false);
|
||||
h3Id->SetGuidance("Histogram id");
|
||||
h3Id->SetParameterRange("idXaxis>=0");
|
||||
|
||||
G4UIparameter* h3XAxis = new G4UIparameter("h3Xaxis", 's', true);
|
||||
h3XAxis->SetGuidance("Histogram x-axis title");
|
||||
h3XAxis->SetDefaultValue("none");
|
||||
|
||||
fSetH3XAxisCmd = new G4UIcommand("/analysis/h3/setXaxis", this);
|
||||
fSetH3XAxisCmd->SetGuidance("Set x-axis title for the 3D histogram of #Id");
|
||||
fSetH3XAxisCmd->SetParameter(h3Id);
|
||||
fSetH3XAxisCmd->SetParameter(h3XAxis);
|
||||
fSetH3XAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H3Messenger::SetH3YAxisCmd()
|
||||
{
|
||||
G4UIparameter* h3Id = new G4UIparameter("idYaxis", 'i', false);
|
||||
h3Id->SetGuidance("Histogram id");
|
||||
h3Id->SetParameterRange("idYaxis>=0");
|
||||
|
||||
G4UIparameter* h3YAxis = new G4UIparameter("h3Yaxis", 's', true);
|
||||
h3YAxis->SetGuidance("Histogram y-axis title");
|
||||
h3YAxis->SetDefaultValue("none");
|
||||
|
||||
fSetH3YAxisCmd = new G4UIcommand("/analysis/h3/setYaxis", this);
|
||||
fSetH3YAxisCmd->SetGuidance("Set y-axis title for the 3D histogram of #Id");
|
||||
fSetH3YAxisCmd->SetParameter(h3Id);
|
||||
fSetH3YAxisCmd->SetParameter(h3YAxis);
|
||||
fSetH3YAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4H3Messenger::SetH3ZAxisCmd()
|
||||
{
|
||||
G4UIparameter* h3Id = new G4UIparameter("idYaxis", 'i', false);
|
||||
h3Id->SetGuidance("Histogram id");
|
||||
h3Id->SetParameterRange("idYaxis>=0");
|
||||
|
||||
G4UIparameter* h3YAxis = new G4UIparameter("h3Yaxis", 's', true);
|
||||
h3YAxis->SetGuidance("Histogram y-axis title");
|
||||
h3YAxis->SetDefaultValue("none");
|
||||
|
||||
fSetH3ZAxisCmd = new G4UIcommand("/analysis/h3/setZaxis", this);
|
||||
fSetH3ZAxisCmd->SetGuidance("Set y-axis title for the 3D histogram of #Id");
|
||||
fSetH3ZAxisCmd->SetParameter(h3Id);
|
||||
fSetH3ZAxisCmd->SetParameter(h3YAxis);
|
||||
fSetH3ZAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//
|
||||
// public functions
|
||||
@@ -417,95 +334,109 @@ void G4H3Messenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
// check consistency
|
||||
if ( G4int(parameters.size()) != command->GetParameterEntries() ) {
|
||||
// Should never happen but let's check anyway for consistency
|
||||
Exception(command, parameters.size());
|
||||
fHelper->WarnAboutParameters(command, parameters.size());
|
||||
return;
|
||||
}
|
||||
|
||||
if ( command == fCreateH3Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4String name = parameters[counter++];
|
||||
G4String title = parameters[counter++];
|
||||
G4int xnbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double xvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double xvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String xsunit = parameters[counter++];
|
||||
G4String xsfcn = parameters[counter++];
|
||||
G4String xsbinScheme = parameters[counter++];
|
||||
G4double xunit = GetUnitValue(xsunit);
|
||||
G4int ynbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double yvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double yvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String ysunit = parameters[counter++];
|
||||
G4String ysfcn = parameters[counter++];
|
||||
G4String ysbinScheme = parameters[counter++];
|
||||
G4double yunit = GetUnitValue(ysunit);
|
||||
G4int znbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double zvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double zvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String zsunit = parameters[counter++];
|
||||
G4String zsfcn = parameters[counter++];
|
||||
G4String zsbinScheme = parameters[counter++];
|
||||
G4double zunit = GetUnitValue(zsunit);
|
||||
if ( command == fCreateH3Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto name = parameters[counter++];
|
||||
auto title = parameters[counter++];
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto xunit = GetUnitValue(xdata.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData ydata;
|
||||
fHelper->GetBinData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData zdata;
|
||||
fHelper->GetBinData(zdata, parameters, counter);
|
||||
auto zunit = GetUnitValue(zdata.fSunit);
|
||||
fManager->CreateH3(name, title,
|
||||
xnbins, xvmin*xunit, xvmax*xunit,
|
||||
ynbins, yvmin*yunit, yvmax*yunit,
|
||||
znbins, zvmin*zunit, zvmax*zunit,
|
||||
xsunit, ysunit, zsunit, xsfcn, ysfcn, zsfcn,
|
||||
xsbinScheme, ysbinScheme, zsbinScheme);
|
||||
xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
|
||||
ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
zdata.fNbins, zdata.fVmin*zunit, zdata.fVmax*zunit,
|
||||
xdata.fSunit, ydata.fSunit, zdata.fSunit,
|
||||
xdata.fSfcn, ydata.fSfcn, zdata.fSfcn,
|
||||
xdata.fSbinScheme, ydata.fSbinScheme, zdata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetH3Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4int xnbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double xvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double xvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String xsunit = parameters[counter++];
|
||||
G4String xsfcn = parameters[counter++];
|
||||
G4String xsbinScheme = parameters[counter++];
|
||||
G4double xunit = GetUnitValue(xsunit);
|
||||
G4int ynbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double yvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double yvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String ysunit = parameters[counter++];
|
||||
G4String ysfcn = parameters[counter++];
|
||||
G4String ysbinScheme = parameters[counter++];
|
||||
G4double yunit = GetUnitValue(ysunit);
|
||||
G4int znbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double zvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double zvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String zsunit = parameters[counter++];
|
||||
G4String zsfcn = parameters[counter++];
|
||||
G4String zsbinScheme = parameters[counter++];
|
||||
G4double zunit = GetUnitValue(zsunit);
|
||||
else if ( command == fSetH3Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto xunit = GetUnitValue(xdata.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData ydata;
|
||||
fHelper->GetBinData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData zdata;
|
||||
fHelper->GetBinData(zdata, parameters, counter);
|
||||
auto zunit = GetUnitValue(zdata.fSunit);
|
||||
fManager->SetH3(id,
|
||||
xnbins, xvmin*xunit, xvmax*xunit,
|
||||
ynbins, yvmin*yunit, yvmax*yunit,
|
||||
znbins, zvmin*zunit, zvmax*zunit,
|
||||
xsunit, ysunit, zsunit, xsfcn, ysfcn, zsfcn,
|
||||
xsbinScheme, ysbinScheme, zsbinScheme);
|
||||
xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
|
||||
ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
zdata.fNbins, zdata.fVmin*zunit, zdata.fVmax*zunit,
|
||||
xdata.fSunit, ydata.fSunit, zdata.fSunit,
|
||||
xdata.fSfcn, ydata.fSfcn, zdata.fSfcn,
|
||||
xdata.fSbinScheme, ydata.fSbinScheme, zdata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetH3TitleCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String title = parameters[counter++];
|
||||
else if ( command == fSetH3XCmd.get() ) {
|
||||
// Only save values
|
||||
auto counter = 0;
|
||||
fXId = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
fHelper->GetBinData(fXData, parameters, counter);
|
||||
}
|
||||
else if ( command == fSetH3YCmd.get() ) {
|
||||
// Only save values
|
||||
auto counter = 0;
|
||||
fYId = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
fHelper->GetBinData(fYData, parameters, counter);
|
||||
}
|
||||
else if ( command == fSetH3ZCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
// Check if setX and setY command was called
|
||||
if ( fXId == -1 || fXId != id ||
|
||||
fYId == -1 || fYId != id ) {
|
||||
fHelper->WarnAboutSetCommands();
|
||||
return;
|
||||
}
|
||||
auto xunit = GetUnitValue(fXData.fSunit);
|
||||
auto yunit = GetUnitValue(fYData.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData zdata;
|
||||
fHelper->GetBinData(zdata, parameters, counter);
|
||||
auto zunit = GetUnitValue(zdata.fSunit);
|
||||
fManager->SetH3(id,
|
||||
fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
|
||||
fYData.fNbins, fYData.fVmin*yunit, fYData.fVmax*yunit,
|
||||
zdata.fNbins, zdata.fVmin*zunit, zdata.fVmax*zunit,
|
||||
fXData.fSunit, fYData.fSunit, zdata.fSunit,
|
||||
fXData.fSfcn, fYData.fSfcn, zdata.fSfcn,
|
||||
fXData.fSbinScheme, fYData.fSbinScheme, zdata.fSbinScheme);
|
||||
fXId = -1;
|
||||
fYId = -1;
|
||||
}
|
||||
else if ( command == fSetH3TitleCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto title = parameters[counter++];
|
||||
fManager->SetH3Title(id, title);
|
||||
}
|
||||
else if ( command == fSetH3XAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String xaxis = parameters[counter++];
|
||||
else if ( command == fSetH3XAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto xaxis = parameters[counter++];
|
||||
fManager->SetH3XAxisTitle(id, xaxis);
|
||||
}
|
||||
else if ( command == fSetH3YAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String yaxis = parameters[counter++];
|
||||
else if ( command == fSetH3YAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto yaxis = parameters[counter++];
|
||||
fManager->SetH3YAxisTitle(id, yaxis);
|
||||
}
|
||||
else if ( command == fSetH3ZAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String zaxis = parameters[counter++];
|
||||
else if ( command == fSetH3ZAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto zaxis = parameters[counter++];
|
||||
fManager->SetH3ZAxisTitle(id, zaxis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4HnManager.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4HnManager::G4HnManager(const G4String& hnType,
|
||||
@@ -36,6 +39,7 @@ G4HnManager::G4HnManager(const G4String& hnType,
|
||||
fHnType(hnType),
|
||||
fNofActiveObjects(0),
|
||||
fNofAsciiObjects(0),
|
||||
fNofPlottingObjects(0),
|
||||
fHnVector()
|
||||
{
|
||||
}
|
||||
@@ -43,10 +47,9 @@ G4HnManager::G4HnManager(const G4String& hnType,
|
||||
//_____________________________________________________________________________
|
||||
G4HnManager::~G4HnManager()
|
||||
{
|
||||
std::vector<G4HnInformation*>::iterator it;
|
||||
for (it = fHnVector.begin(); it != fHnVector.end(); it++ ) {
|
||||
delete (*it);
|
||||
}
|
||||
for ( auto hnInformation : fHnVector ) {
|
||||
delete hnInformation;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -54,69 +57,13 @@ G4HnManager::~G4HnManager()
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnManager::AddH1Information(const G4String& name,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName,
|
||||
G4double unit, G4Fcn fcn,
|
||||
G4BinScheme binScheme)
|
||||
G4HnInformation* G4HnManager::AddHnInformation(const G4String& name, G4int nofDimensions)
|
||||
{
|
||||
G4HnInformation* hnInformation = new G4HnInformation(name, 1);
|
||||
hnInformation
|
||||
->AddHnDimensionInformation(
|
||||
G4HnDimensionInformation(unitName, fcnName, unit, fcn, binScheme));
|
||||
|
||||
auto hnInformation = new G4HnInformation(name, nofDimensions);
|
||||
fHnVector.push_back(hnInformation);
|
||||
++fNofActiveObjects;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnManager::AddH2Information(const G4String& name,
|
||||
const G4String& xunitName,
|
||||
const G4String& yunitName,
|
||||
const G4String& xfcnName,
|
||||
const G4String& yfcnName,
|
||||
G4double xunit, G4double yunit,
|
||||
G4Fcn xfcn, G4Fcn yfcn,
|
||||
G4BinScheme xbinScheme, G4BinScheme ybinScheme)
|
||||
{
|
||||
G4HnInformation* hnInformation = new G4HnInformation(name, 2);
|
||||
hnInformation
|
||||
->AddHnDimensionInformation(
|
||||
G4HnDimensionInformation(xunitName, xfcnName, xunit, xfcn, xbinScheme));
|
||||
hnInformation
|
||||
->AddHnDimensionInformation(
|
||||
G4HnDimensionInformation(yunitName, yfcnName, yunit, yfcn, ybinScheme));
|
||||
|
||||
fHnVector.push_back(hnInformation);
|
||||
++fNofActiveObjects;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnManager::AddH3Information(const G4String& name,
|
||||
const G4String& xunitName,
|
||||
const G4String& yunitName,
|
||||
const G4String& zunitName,
|
||||
const G4String& xfcnName,
|
||||
const G4String& yfcnName,
|
||||
const G4String& zfcnName,
|
||||
G4double xunit, G4double yunit, G4double zunit,
|
||||
G4Fcn xfcn, G4Fcn yfcn, G4Fcn zfcn,
|
||||
G4BinScheme xbinScheme, G4BinScheme ybinScheme,
|
||||
G4BinScheme zbinScheme)
|
||||
{
|
||||
G4HnInformation* hnInformation = new G4HnInformation(name, 3);
|
||||
hnInformation
|
||||
->AddHnDimensionInformation(
|
||||
G4HnDimensionInformation(xunitName, xfcnName, xunit, xfcn, xbinScheme));
|
||||
hnInformation
|
||||
->AddHnDimensionInformation(
|
||||
G4HnDimensionInformation(yunitName, yfcnName, yunit, yfcn, ybinScheme));
|
||||
hnInformation
|
||||
->AddHnDimensionInformation(
|
||||
G4HnDimensionInformation(zunitName, zfcnName, zunit, zfcn, zbinScheme));
|
||||
|
||||
fHnVector.push_back(hnInformation);
|
||||
++fNofActiveObjects;
|
||||
return hnInformation;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -146,7 +93,7 @@ G4HnDimensionInformation* G4HnManager::GetHnDimensionInformation(G4int id,
|
||||
G4int dimension,
|
||||
G4String functionName, G4bool warn) const
|
||||
{
|
||||
G4HnInformation* hnInformation = GetHnInformation(id, functionName, warn);
|
||||
auto hnInformation = GetHnInformation(id, functionName, warn);
|
||||
if ( ! hnInformation ) return 0;
|
||||
|
||||
return hnInformation->GetHnDimensionInformation(dimension);
|
||||
@@ -164,12 +111,18 @@ G4bool G4HnManager::IsAscii() const
|
||||
return ( fNofAsciiObjects > 0 );
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4HnManager::IsPlotting() const
|
||||
{
|
||||
return ( fNofPlottingObjects > 0 );
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnManager::SetActivation(G4int id, G4bool activation)
|
||||
{
|
||||
// Set activation to a given object
|
||||
|
||||
G4HnInformation* info = GetHnInformation(id, "SetActivation");
|
||||
auto info = GetHnInformation(id, "SetActivation");
|
||||
|
||||
if ( ! info ) return;
|
||||
|
||||
@@ -189,9 +142,11 @@ void G4HnManager::SetActivation(G4bool activation)
|
||||
{
|
||||
// Set activation to all objects of the given type
|
||||
|
||||
std::vector<G4HnInformation*>::iterator it;
|
||||
for ( it = fHnVector.begin(); it != fHnVector.end(); it++ ) {
|
||||
G4HnInformation* info = *it;
|
||||
//std::vector<G4HnInformation*>::iterator it;
|
||||
//for ( it = fHnVector.begin(); it != fHnVector.end(); it++ ) {
|
||||
// G4HnInformation* info = *it;
|
||||
|
||||
for ( auto info : fHnVector ) {
|
||||
|
||||
// Do nothing if activation does not change
|
||||
if ( info->GetActivation() == activation ) continue;
|
||||
@@ -208,7 +163,7 @@ void G4HnManager::SetActivation(G4bool activation)
|
||||
//_____________________________________________________________________________
|
||||
void G4HnManager::SetAscii(G4int id, G4bool ascii)
|
||||
{
|
||||
G4HnInformation* info = GetHnInformation(id, "SetAscii");
|
||||
auto info = GetHnInformation(id, "SetAscii");
|
||||
|
||||
if ( ! info ) return;
|
||||
|
||||
@@ -223,10 +178,47 @@ void G4HnManager::SetAscii(G4int id, G4bool ascii)
|
||||
fNofAsciiObjects--;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnManager::SetPlotting(G4int id, G4bool plotting)
|
||||
{
|
||||
auto info = GetHnInformation(id, "SetPlotting");
|
||||
|
||||
if ( ! info ) return;
|
||||
|
||||
// Do nothing if ascii does not change
|
||||
if ( info->GetPlotting() == plotting ) return;
|
||||
|
||||
// Change Plotting and account it in fNofPlottingObjects
|
||||
info->SetPlotting(plotting);
|
||||
if ( plotting )
|
||||
fNofPlottingObjects++;
|
||||
else
|
||||
fNofPlottingObjects--;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnManager::SetPlotting(G4bool plotting)
|
||||
{
|
||||
// Set plotting to all objects of the given type
|
||||
|
||||
for ( auto info : fHnVector ) {
|
||||
|
||||
// Do nothing if plotting does not change
|
||||
if ( info->GetPlotting() == plotting ) continue;
|
||||
|
||||
// Change plotting and account it in fNofActiveObjects
|
||||
info->SetPlotting(plotting);
|
||||
if ( plotting )
|
||||
fNofPlottingObjects++;
|
||||
else
|
||||
fNofPlottingObjects--;
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String G4HnManager::GetName(G4int id) const
|
||||
{
|
||||
G4HnInformation* info = GetHnInformation(id, "GetName");
|
||||
auto info = GetHnInformation(id, "GetName");
|
||||
|
||||
if ( ! info ) return "";
|
||||
|
||||
@@ -236,8 +228,7 @@ G4String G4HnManager::GetName(G4int id) const
|
||||
//_____________________________________________________________________________
|
||||
G4double G4HnManager::GetXUnit(G4int id) const
|
||||
{
|
||||
G4HnDimensionInformation* info
|
||||
= GetHnDimensionInformation(id, G4HnInformation::kX, "GetXUnit");
|
||||
auto info = GetHnDimensionInformation(id, kX, "GetXUnit");
|
||||
|
||||
if ( ! info ) return 1.0;
|
||||
|
||||
@@ -247,8 +238,7 @@ G4double G4HnManager::GetXUnit(G4int id) const
|
||||
//_____________________________________________________________________________
|
||||
G4double G4HnManager::GetYUnit(G4int id) const
|
||||
{
|
||||
G4HnDimensionInformation* info
|
||||
= GetHnDimensionInformation(id, G4HnInformation::kY, "GetYUnit");
|
||||
auto info = GetHnDimensionInformation(id, kY, "GetYUnit");
|
||||
|
||||
if ( ! info ) return 1.0;
|
||||
|
||||
@@ -258,8 +248,7 @@ G4double G4HnManager::GetYUnit(G4int id) const
|
||||
//_____________________________________________________________________________
|
||||
G4double G4HnManager::GetZUnit(G4int id) const
|
||||
{
|
||||
G4HnDimensionInformation* info
|
||||
= GetHnDimensionInformation(id, G4HnInformation::kZ, "GetZUnit");
|
||||
auto info = GetHnDimensionInformation(id, kZ, "GetZUnit");
|
||||
|
||||
if ( ! info ) return 1.0;
|
||||
|
||||
@@ -269,7 +258,7 @@ G4double G4HnManager::GetZUnit(G4int id) const
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4HnManager::GetActivation(G4int id) const
|
||||
{
|
||||
G4HnInformation* info = GetHnInformation(id, "GetActivation");
|
||||
auto info = GetHnInformation(id, "GetActivation");
|
||||
|
||||
if ( ! info ) return true;
|
||||
|
||||
@@ -279,9 +268,19 @@ G4bool G4HnManager::GetActivation(G4int id) const
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4HnManager::GetAscii(G4int id) const
|
||||
{
|
||||
G4HnInformation* info = GetHnInformation(id, "GetAscii");
|
||||
auto info = GetHnInformation(id, "GetAscii");
|
||||
|
||||
if ( ! info ) return false;
|
||||
|
||||
return info->GetAscii();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4HnManager::GetPlotting(G4int id) const
|
||||
{
|
||||
auto info = GetHnInformation(id, "GetPlotting");
|
||||
|
||||
if ( ! info ) return false;
|
||||
|
||||
return info->GetPlotting();
|
||||
}
|
||||
|
||||
@@ -30,113 +30,74 @@
|
||||
#include "G4HnMessenger.hh"
|
||||
#include "G4HnManager.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "G4AnalysisMessengerHelper.hh"
|
||||
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
|
||||
void Exception(G4UIcommand* command, G4int nofParameters)
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Got wrong number of \"" << command->GetCommandName()
|
||||
<< "\" parameters: " << nofParameters
|
||||
<< " instead of " << command->GetParameterEntries()
|
||||
<< " expected" << G4endl;
|
||||
G4Exception("G4HnMessenger::SetNewValue",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4HnMessenger::G4HnMessenger(G4HnManager* manager)
|
||||
G4HnMessenger::G4HnMessenger(G4HnManager& manager)
|
||||
: G4UImessenger(),
|
||||
fManager(manager),
|
||||
fSetHnAsciiCmd(0),
|
||||
fSetHnActivationCmd(0),
|
||||
fSetHnActivationAllCmd(0)
|
||||
{
|
||||
|
||||
fHelper(nullptr),
|
||||
fSetHnAsciiCmd(nullptr),
|
||||
fSetHnActivationCmd(nullptr),
|
||||
fSetHnActivationAllCmd(nullptr),
|
||||
fSetHnPlottingCmd(nullptr),
|
||||
fSetHnPlottingAllCmd(nullptr)
|
||||
{
|
||||
G4String hnType = fManager.GetHnType();
|
||||
hnType.toLower();
|
||||
fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(hnType);
|
||||
|
||||
SetHnAsciiCmd();
|
||||
SetHnActivationCmd();
|
||||
SetHnActivationToAllCmd();
|
||||
SetHnPlottingCmd();
|
||||
SetHnPlottingToAllCmd();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4HnMessenger::~G4HnMessenger()
|
||||
{
|
||||
delete fSetHnAsciiCmd;
|
||||
delete fSetHnActivationCmd;
|
||||
delete fSetHnActivationAllCmd;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// private functions
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String G4HnMessenger::GetCmdDirectoryName() const
|
||||
{
|
||||
G4String hnType = fManager->GetHnType();
|
||||
hnType.toLower();
|
||||
G4String name("/analysis/");
|
||||
name.append(hnType);
|
||||
name.append("/");
|
||||
return name;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String G4HnMessenger::GetHnDescription() const
|
||||
{
|
||||
G4String hnDescription = fManager->GetHnType();
|
||||
hnDescription.erase(0);
|
||||
hnDescription.append("D");
|
||||
return hnDescription;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnMessenger::SetHnAsciiCmd()
|
||||
{
|
||||
G4String name = GetCmdDirectoryName();
|
||||
name.append("setAscii");
|
||||
fSetHnAsciiCmd = new G4UIcmdWithAnInteger(name, this);
|
||||
fSetHnAsciiCmd
|
||||
= G4Analysis::make_unique<G4UIcmdWithAnInteger>(fHelper->Update("/analysis/HNTYPE_/setAscii"), this);
|
||||
fSetHnAsciiCmd->SetGuidance(
|
||||
fHelper->Update("Print NDIM_D LOBJECT of given id on ascii file."));
|
||||
|
||||
G4String guidance("Print ");
|
||||
guidance.append(GetHnDescription());
|
||||
guidance.append(" histogram of #Id on ascii file.");
|
||||
|
||||
fSetHnAsciiCmd->SetGuidance(guidance);
|
||||
fSetHnAsciiCmd->SetParameterName("Id",false);
|
||||
fSetHnAsciiCmd->SetRange("Id>=0");
|
||||
fSetHnAsciiCmd->SetParameterName("id",false);
|
||||
fSetHnAsciiCmd->SetRange("id>=0");
|
||||
fSetHnAsciiCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnMessenger::SetHnActivationCmd()
|
||||
{
|
||||
G4UIparameter* hnId = new G4UIparameter("idActivation", 'i', false);
|
||||
hnId->SetGuidance("Histogram id");
|
||||
hnId->SetParameterRange("idActivation>=0");
|
||||
auto hnId = new G4UIparameter("id", 'i', false);
|
||||
hnId->SetGuidance(fHelper->Update("OBJECT id"));
|
||||
hnId->SetParameterRange("id>=0");
|
||||
|
||||
G4UIparameter* hnActivation = new G4UIparameter("hnActivation", 's', true);
|
||||
hnActivation->SetGuidance("Histogram activation");
|
||||
auto hnActivation = new G4UIparameter("hnActivation", 's', true);
|
||||
hnActivation->SetGuidance(fHelper->Update("OBJECT activation"));
|
||||
hnActivation->SetDefaultValue("none");
|
||||
|
||||
G4String name = GetCmdDirectoryName();
|
||||
name.append("setActivation");
|
||||
fSetHnActivationCmd = new G4UIcommand(name, this);
|
||||
|
||||
G4String guidance("Set activation for the ");
|
||||
guidance.append(GetHnDescription());
|
||||
guidance.append(" histogram of #Id");
|
||||
|
||||
fSetHnActivationCmd->SetGuidance(guidance);
|
||||
fSetHnActivationCmd
|
||||
= G4Analysis::make_unique<G4UIcommand>(fHelper->Update("/analysis/HNTYPE_/setActivation"), this);
|
||||
fSetHnActivationCmd->SetGuidance(
|
||||
fHelper->Update("Set activation for the NDIM_D LOBJECT of given id"));
|
||||
fSetHnActivationCmd->SetParameter(hnId);
|
||||
fSetHnActivationCmd->SetParameter(hnActivation);
|
||||
fSetHnActivationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
@@ -145,18 +106,43 @@ void G4HnMessenger::SetHnActivationCmd()
|
||||
//_____________________________________________________________________________
|
||||
void G4HnMessenger::SetHnActivationToAllCmd()
|
||||
{
|
||||
G4String name = GetCmdDirectoryName();
|
||||
name.append("setActivationToAll");
|
||||
fSetHnActivationAllCmd = new G4UIcmdWithABool(name, this);
|
||||
|
||||
G4String guidance("Set activation to all ");
|
||||
guidance.append(GetHnDescription());
|
||||
guidance.append(" histograms.");
|
||||
|
||||
fSetHnActivationAllCmd->SetGuidance(guidance);
|
||||
fSetHnActivationAllCmd
|
||||
= G4Analysis::make_unique<G4UIcmdWithABool>(fHelper->Update("/analysis/HNTYPE_/setActivationToAll"), this);
|
||||
fSetHnActivationAllCmd->SetGuidance(
|
||||
fHelper->Update("Set activation to all NDIM_D LOBJECTs"));
|
||||
fSetHnActivationAllCmd->SetParameterName("Activation",false);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnMessenger::SetHnPlottingCmd()
|
||||
{
|
||||
auto hnId = new G4UIparameter("id", 'i', false);
|
||||
hnId->SetGuidance(fHelper->Update("OBJECT id"));
|
||||
hnId->SetParameterRange("id>=0");
|
||||
|
||||
auto hnPlotting = new G4UIparameter("hnPlotting", 's', true);
|
||||
hnPlotting->SetGuidance(fHelper->Update("(In)Activate OBJECT plotting"));
|
||||
hnPlotting->SetDefaultValue("none");
|
||||
|
||||
fSetHnPlottingCmd
|
||||
= G4Analysis::make_unique<G4UIcommand>(fHelper->Update("/analysis/HNTYPE_/setPlotting"), this);
|
||||
fSetHnPlottingCmd->SetGuidance(
|
||||
fHelper->Update("(In)Activate batch plotting of the NDIM_D LOBJECT of given id"));
|
||||
fSetHnPlottingCmd->SetParameter(hnId);
|
||||
fSetHnPlottingCmd->SetParameter(hnPlotting);
|
||||
fSetHnPlottingCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4HnMessenger::SetHnPlottingToAllCmd()
|
||||
{
|
||||
fSetHnPlottingAllCmd
|
||||
= G4Analysis::make_unique<G4UIcmdWithABool>(fHelper->Update("/analysis/HNTYPE_/setPlottingToAll"), this);
|
||||
fSetHnPlottingAllCmd->SetGuidance(
|
||||
fHelper->Update("(In)Activate batch plotting of all NDIM_D LOBJECTs"));
|
||||
fSetHnPlottingAllCmd->SetParameterName("Plotting",false);
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
@@ -164,28 +150,48 @@ void G4HnMessenger::SetHnActivationToAllCmd()
|
||||
//_____________________________________________________________________________
|
||||
void G4HnMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
{
|
||||
if ( command == fSetHnAsciiCmd ) {
|
||||
G4int id = fSetHnAsciiCmd->GetNewIntValue(newValues);
|
||||
fManager->SetAscii(id, true);
|
||||
if ( command == fSetHnAsciiCmd.get() ) {
|
||||
auto id = fSetHnAsciiCmd->GetNewIntValue(newValues);
|
||||
fManager.SetAscii(id, true);
|
||||
}
|
||||
else if ( command == fSetHnActivationCmd ) {
|
||||
else if ( command == fSetHnActivationCmd.get() ) {
|
||||
// tokenize parameters in a vector
|
||||
std::vector<G4String> parameters;
|
||||
G4Analysis::Tokenize(newValues, parameters);
|
||||
// check consistency
|
||||
if ( G4int(parameters.size()) == command->GetParameterEntries() ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4bool activation = G4UIcommand::ConvertToBool(parameters[counter++]);
|
||||
fManager->SetActivation(id, activation);
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto activation = G4UIcommand::ConvertToBool(parameters[counter++]);
|
||||
fManager.SetActivation(id, activation);
|
||||
}
|
||||
else {
|
||||
// Should never happen but let's check anyway for consistency
|
||||
Exception(command, parameters.size());
|
||||
fHelper->WarnAboutParameters(command, parameters.size());
|
||||
}
|
||||
}
|
||||
else if ( command == fSetHnActivationAllCmd ) {
|
||||
G4bool activation = fSetHnActivationAllCmd->GetNewBoolValue(newValues);
|
||||
fManager->SetActivation(activation);
|
||||
else if ( command == fSetHnActivationAllCmd.get() ) {
|
||||
auto activation = fSetHnActivationAllCmd->GetNewBoolValue(newValues);
|
||||
fManager.SetActivation(activation);
|
||||
}
|
||||
else if ( command == fSetHnPlottingCmd.get() ) {
|
||||
// tokenize parameters in a vector
|
||||
std::vector<G4String> parameters;
|
||||
G4Analysis::Tokenize(newValues, parameters);
|
||||
// check consistency
|
||||
if ( G4int(parameters.size()) == command->GetParameterEntries() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto activation = G4UIcommand::ConvertToBool(parameters[counter++]);
|
||||
fManager.SetPlotting(id, activation);
|
||||
}
|
||||
else {
|
||||
// Should never happen but let's check anyway for consistency
|
||||
fHelper->WarnAboutParameters(command, parameters.size());
|
||||
}
|
||||
}
|
||||
else if ( command == fSetHnPlottingAllCmd.get() ) {
|
||||
auto activation = fSetHnPlottingAllCmd->GetNewBoolValue(newValues);
|
||||
fManager.SetPlotting(activation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
|
||||
// Author: Ivana Hrivnacova, 05/05/2015 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4NtupleMessenger.hh"
|
||||
#include "G4VAnalysisManager.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4NtupleMessenger::G4NtupleMessenger(G4VAnalysisManager* manager)
|
||||
: G4UImessenger(),
|
||||
fManager(manager),
|
||||
fSetActivationCmd(nullptr),
|
||||
fSetActivationAllCmd(nullptr)
|
||||
{
|
||||
|
||||
SetActivationCmd();
|
||||
SetActivationToAllCmd();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4NtupleMessenger::~G4NtupleMessenger()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4NtupleMessenger::SetActivationCmd()
|
||||
{
|
||||
auto ntupleId = new G4UIparameter("NtupleId", 'i', false);
|
||||
ntupleId->SetGuidance("Ntuple id");
|
||||
ntupleId->SetParameterRange("NtupleId>=0");
|
||||
|
||||
auto ntupleActivation = new G4UIparameter("NtupleActivation", 's', true);
|
||||
ntupleActivation->SetGuidance("Ntuple activation");
|
||||
ntupleActivation->SetDefaultValue("none");
|
||||
|
||||
fSetActivationCmd = G4Analysis::make_unique<G4UIcommand>("/analysis/ntuple/setActivation", this);
|
||||
G4String guidance("Set activation for the ntuple of given id");
|
||||
|
||||
fSetActivationCmd->SetGuidance(guidance);
|
||||
fSetActivationCmd->SetParameter(ntupleId);
|
||||
fSetActivationCmd->SetParameter(ntupleActivation);
|
||||
fSetActivationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4NtupleMessenger::SetActivationToAllCmd()
|
||||
{
|
||||
fSetActivationAllCmd
|
||||
= G4Analysis::make_unique<G4UIcmdWithABool>("/analysis/ntuple/setActivationToAll", this);
|
||||
G4String guidance("Set activation to all ntuples");
|
||||
fSetActivationAllCmd->SetGuidance(guidance);
|
||||
fSetActivationAllCmd->SetParameterName("AllNtupleActivation",false);
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4NtupleMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
{
|
||||
if ( command == fSetActivationCmd.get() ) {
|
||||
// tokenize parameters in a vector
|
||||
std::vector<G4String> parameters;
|
||||
G4Analysis::Tokenize(newValues, parameters);
|
||||
// check consistency
|
||||
if ( G4int(parameters.size()) == command->GetParameterEntries() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto activation = G4UIcommand::ConvertToBool(parameters[counter++]);
|
||||
fManager->SetNtupleActivation(id, activation);
|
||||
}
|
||||
else {
|
||||
// Should never happen but let's check anyway for consistency
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Got wrong number of \"" << command->GetCommandName()
|
||||
<< "\" parameters: " << parameters.size()
|
||||
<< " instead of " << command->GetParameterEntries()
|
||||
<< " expected" << G4endl;
|
||||
G4Exception("G4NtupleMessenger::SetNewValue",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
}
|
||||
else if ( command == fSetActivationAllCmd.get() ) {
|
||||
auto activation = fSetActivationAllCmd->GetNewBoolValue(newValues);
|
||||
fManager->SetNtupleActivation(activation);
|
||||
}
|
||||
}
|
||||
@@ -39,55 +39,37 @@
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
namespace {
|
||||
|
||||
void Exception(G4UIcommand* command, G4int nofParameters)
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Got wrong number of \"" << command->GetCommandName()
|
||||
<< "\" parameters: " << nofParameters
|
||||
<< " instead of " << command->GetParameterEntries()
|
||||
<< " expected" << G4endl;
|
||||
G4Exception("G4P1Messenger::SetNewValue",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4P1Messenger::G4P1Messenger(G4VAnalysisManager* manager)
|
||||
: G4UImessenger(),
|
||||
fManager(manager),
|
||||
fP1Dir(0),
|
||||
fCreateP1Cmd(0),
|
||||
fSetP1Cmd(0),
|
||||
fSetP1TitleCmd(0),
|
||||
fSetP1XAxisCmd(0),
|
||||
fSetP1YAxisCmd(0)
|
||||
fHelper(nullptr),
|
||||
fDirectory(nullptr),
|
||||
fCreateP1Cmd(nullptr),
|
||||
fSetP1Cmd(nullptr),
|
||||
fSetP1TitleCmd(nullptr),
|
||||
fSetP1XAxisCmd(nullptr),
|
||||
fSetP1YAxisCmd(nullptr),
|
||||
fXData()
|
||||
{
|
||||
fP1Dir = new G4UIdirectory("/analysis/p1/");
|
||||
fP1Dir->SetGuidance("1D profiles control");
|
||||
fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>("p1");
|
||||
|
||||
fDirectory = fHelper->CreateHnDirectory();
|
||||
|
||||
CreateP1Cmd();
|
||||
|
||||
SetP1Cmd();
|
||||
|
||||
SetP1TitleCmd();
|
||||
SetP1XAxisCmd();
|
||||
SetP1YAxisCmd();
|
||||
fSetP1XCmd = fHelper->CreateSetBinsCommand("x", this);
|
||||
fSetP1YCmd = fHelper->CreateSetValuesCommand("y", this);
|
||||
|
||||
fSetP1TitleCmd = fHelper->CreateSetTitleCommand(this);
|
||||
fSetP1XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
|
||||
fSetP1YAxisCmd = fHelper->CreateSetAxisCommand("y", this);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4P1Messenger::~G4P1Messenger()
|
||||
{
|
||||
delete fCreateP1Cmd;
|
||||
delete fSetP1Cmd;
|
||||
delete fSetP1TitleCmd;
|
||||
delete fSetP1XAxisCmd;
|
||||
delete fSetP1YAxisCmd;
|
||||
delete fP1Dir;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// private functions
|
||||
@@ -96,32 +78,32 @@ G4P1Messenger::~G4P1Messenger()
|
||||
//_____________________________________________________________________________
|
||||
void G4P1Messenger::CreateP1Cmd()
|
||||
{
|
||||
G4UIparameter* p1Name = new G4UIparameter("name", 's', false);
|
||||
auto p1Name = new G4UIparameter("name", 's', false);
|
||||
p1Name->SetGuidance("Profile name (label)");
|
||||
|
||||
G4UIparameter* p1Title = new G4UIparameter("title", 's', false);
|
||||
auto p1Title = new G4UIparameter("title", 's', false);
|
||||
p1Title->SetGuidance("Profile title");
|
||||
|
||||
G4UIparameter* p1xNbins0 = new G4UIparameter("xnbins0", 'i', true);
|
||||
auto p1xNbins0 = new G4UIparameter("xnbins0", 'i', true);
|
||||
p1xNbins0->SetGuidance("Number of x-bins (default = 100)");
|
||||
p1xNbins0->SetGuidance("Can be reset with /analysis/p1/set command");
|
||||
p1xNbins0->SetDefaultValue(100);
|
||||
|
||||
G4UIparameter* p1xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
|
||||
auto p1xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
|
||||
p1xValMin0->SetGuidance("Minimum x-value, expressed in unit (default = 0.)");
|
||||
p1xValMin0->SetGuidance("Can be reset with /analysis/p1/set command");
|
||||
p1xValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* p1xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
|
||||
auto p1xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
|
||||
p1xValMax0->SetGuidance("Maximum x-value, expressed in unit (default = 1.)");
|
||||
p1xValMax0->SetGuidance("Can be reset with /analysis/p1/set command");
|
||||
p1xValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* p1xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
|
||||
auto p1xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
|
||||
p1xValUnit0->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
|
||||
p1xValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p1xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
|
||||
auto p1xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
|
||||
G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).\n";
|
||||
fcnxGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
|
||||
fcnxGuidance += "but none value should be used insted.";
|
||||
@@ -129,7 +111,7 @@ void G4P1Messenger::CreateP1Cmd()
|
||||
p1xValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
p1xValFcn0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p1xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
|
||||
auto p1xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
|
||||
G4String binSchemeGuidance = "The binning scheme (linear, log).\n";
|
||||
p1xValBinScheme0->SetParameterCandidates("linear log");
|
||||
binSchemeGuidance
|
||||
@@ -138,21 +120,21 @@ void G4P1Messenger::CreateP1Cmd()
|
||||
p1xValBinScheme0->SetGuidance(binSchemeGuidance);
|
||||
p1xValBinScheme0->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* p1yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
|
||||
auto p1yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
|
||||
p1yValMin0->SetGuidance("Minimum y-value, expressed in unit (default = 0.)");
|
||||
p1yValMin0->SetGuidance("Can be reset with /analysis/p1/set command");
|
||||
p1yValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* p1yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
|
||||
auto p1yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
|
||||
p1yValMax0->SetGuidance("Maximum y-value, expressed in unit (default = 1.)");
|
||||
p1yValMax0->SetGuidance("Can be reset with /analysis/p1/set command");
|
||||
p1yValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* p1yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
|
||||
auto p1yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
|
||||
p1yValUnit0->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
|
||||
p1yValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p1yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
|
||||
auto p1yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
|
||||
G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).\n";
|
||||
fcnyGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
|
||||
fcnyGuidance += "but none value should be used insted.";
|
||||
@@ -160,7 +142,7 @@ void G4P1Messenger::CreateP1Cmd()
|
||||
p1yValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
p1yValFcn0->SetDefaultValue("none");
|
||||
|
||||
fCreateP1Cmd = new G4UIcommand("/analysis/p1/create", this);
|
||||
fCreateP1Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/p1/create", this);
|
||||
fCreateP1Cmd->SetGuidance("Create 1D profile");
|
||||
fCreateP1Cmd->SetParameter(p1Name);
|
||||
fCreateP1Cmd->SetParameter(p1Title);
|
||||
@@ -181,24 +163,24 @@ void G4P1Messenger::CreateP1Cmd()
|
||||
//_____________________________________________________________________________
|
||||
void G4P1Messenger::SetP1Cmd()
|
||||
{
|
||||
G4UIparameter* p1Id = new G4UIparameter("id", 'i', false);
|
||||
auto p1Id = new G4UIparameter("id", 'i', false);
|
||||
p1Id->SetGuidance("Profile id");
|
||||
p1Id->SetParameterRange("id>=0");
|
||||
|
||||
G4UIparameter* p1xNbins = new G4UIparameter("xnbins", 'i', false);
|
||||
auto p1xNbins = new G4UIparameter("xnbins", 'i', false);
|
||||
p1xNbins->SetGuidance("Number of x-bins");
|
||||
|
||||
G4UIparameter* p1xValMin = new G4UIparameter("xvalMin", 'd', false);
|
||||
auto p1xValMin = new G4UIparameter("xvalMin", 'd', false);
|
||||
p1xValMin->SetGuidance("Minimum x-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p1xValMax = new G4UIparameter("xvalMax", 'd', false);
|
||||
auto p1xValMax = new G4UIparameter("xvalMax", 'd', false);
|
||||
p1xValMax->SetGuidance("Maximum x-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p1xValUnit = new G4UIparameter("xvalUnit", 's', false);
|
||||
auto p1xValUnit = new G4UIparameter("xvalUnit", 's', false);
|
||||
p1xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
|
||||
p1xValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p1xValFcn = new G4UIparameter("xvalFcn", 's', false);
|
||||
auto p1xValFcn = new G4UIparameter("xvalFcn", 's', false);
|
||||
p1xValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).\n";
|
||||
fcnxGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
|
||||
@@ -206,7 +188,7 @@ void G4P1Messenger::SetP1Cmd()
|
||||
p1xValFcn->SetGuidance(fcnxGuidance);
|
||||
p1xValFcn->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p1xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
|
||||
auto p1xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
|
||||
G4String binSchemeGuidance = "The binning scheme (linear, log).\n";
|
||||
p1xValBinScheme->SetParameterCandidates("linear log");
|
||||
binSchemeGuidance
|
||||
@@ -215,17 +197,17 @@ void G4P1Messenger::SetP1Cmd()
|
||||
p1xValBinScheme->SetGuidance(binSchemeGuidance);
|
||||
p1xValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* p1yValMin = new G4UIparameter("yvalMin", 'd', false);
|
||||
auto p1yValMin = new G4UIparameter("yvalMin", 'd', false);
|
||||
p1yValMin->SetGuidance("Minimum y-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p1yValMax = new G4UIparameter("yvalMax", 'd', false);
|
||||
auto p1yValMax = new G4UIparameter("yvalMax", 'd', false);
|
||||
p1yValMax->SetGuidance("Maximum y-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p1yValUnit = new G4UIparameter("yvalUnit", 's', true);
|
||||
auto p1yValUnit = new G4UIparameter("yvalUnit", 's', true);
|
||||
p1yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
|
||||
p1yValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p1yValFcn = new G4UIparameter("yvalFcn", 's', false);
|
||||
auto p1yValFcn = new G4UIparameter("yvalFcn", 's', false);
|
||||
p1yValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).\n";
|
||||
fcnyGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
|
||||
@@ -233,8 +215,8 @@ void G4P1Messenger::SetP1Cmd()
|
||||
p1yValFcn->SetGuidance(fcnyGuidance);
|
||||
p1yValFcn->SetDefaultValue("none");
|
||||
|
||||
fSetP1Cmd = new G4UIcommand("/analysis/p1/set", this);
|
||||
fSetP1Cmd->SetGuidance("Set parameters for the 1D profile of #Id :");
|
||||
fSetP1Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/p1/set", this);
|
||||
fSetP1Cmd->SetGuidance("Set parameters for the 1D profile of given id:");
|
||||
fSetP1Cmd->SetGuidance(" nbins; xvalMin; xvalMax; xunit; xfunction; xbinScheme");
|
||||
fSetP1Cmd->SetGuidance(" yvalMin; yvalMax; yunit; yfunction");
|
||||
fSetP1Cmd->SetParameter(p1Id);
|
||||
@@ -251,60 +233,6 @@ void G4P1Messenger::SetP1Cmd()
|
||||
fSetP1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4P1Messenger::SetP1TitleCmd()
|
||||
{
|
||||
G4UIparameter* p1Id = new G4UIparameter("idTitle", 'i', false);
|
||||
p1Id->SetGuidance("Profile id");
|
||||
p1Id->SetParameterRange("idTitle>=0");
|
||||
|
||||
G4UIparameter* p1Title = new G4UIparameter("p1Title", 's', true);
|
||||
p1Title->SetGuidance("Profile title");
|
||||
p1Title->SetDefaultValue("none");
|
||||
|
||||
fSetP1TitleCmd = new G4UIcommand("/analysis/p1/setTitle", this);
|
||||
fSetP1TitleCmd->SetGuidance("Set title for the 1D profile of #Id");
|
||||
fSetP1TitleCmd->SetParameter(p1Id);
|
||||
fSetP1TitleCmd->SetParameter(p1Title);
|
||||
fSetP1TitleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4P1Messenger::SetP1XAxisCmd()
|
||||
{
|
||||
G4UIparameter* p1Id = new G4UIparameter("idXaxis", 'i', false);
|
||||
p1Id->SetGuidance("Profile id");
|
||||
p1Id->SetParameterRange("idXaxis>=0");
|
||||
|
||||
G4UIparameter* p1XAxis = new G4UIparameter("p1Xaxis", 's', true);
|
||||
p1XAxis->SetGuidance("Profile x-axis title");
|
||||
p1XAxis->SetDefaultValue("none");
|
||||
|
||||
fSetP1XAxisCmd = new G4UIcommand("/analysis/p1/setXaxis", this);
|
||||
fSetP1XAxisCmd->SetGuidance("Set x-axis title for the 1D profile of #Id");
|
||||
fSetP1XAxisCmd->SetParameter(p1Id);
|
||||
fSetP1XAxisCmd->SetParameter(p1XAxis);
|
||||
fSetP1XAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4P1Messenger::SetP1YAxisCmd()
|
||||
{
|
||||
G4UIparameter* p1Id = new G4UIparameter("idYaxis", 'i', false);
|
||||
p1Id->SetGuidance("Profile id");
|
||||
p1Id->SetParameterRange("idYaxis>=0");
|
||||
|
||||
G4UIparameter* p1YAxis = new G4UIparameter("p1Yaxis", 's', true);
|
||||
p1YAxis->SetGuidance("Profile y-axis title");
|
||||
p1YAxis->SetDefaultValue("none");
|
||||
|
||||
fSetP1YAxisCmd = new G4UIcommand("/analysis/p1/setYaxis", this);
|
||||
fSetP1YAxisCmd->SetGuidance("Set y-axis title for the 1D profile of #Id");
|
||||
fSetP1YAxisCmd->SetParameter(p1Id);
|
||||
fSetP1YAxisCmd->SetParameter(p1YAxis);
|
||||
fSetP1YAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
@@ -318,67 +246,85 @@ void G4P1Messenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
// check consistency
|
||||
if ( G4int(parameters.size()) != command->GetParameterEntries() ) {
|
||||
// Should never happen but let's check anyway for consistency
|
||||
Exception(command, parameters.size());
|
||||
fHelper->WarnAboutParameters(command, parameters.size());
|
||||
return;
|
||||
}
|
||||
|
||||
if ( command == fCreateP1Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4String name = parameters[counter++];
|
||||
G4String title = parameters[counter++];
|
||||
G4int xnbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double xvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double xvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String xsunit = parameters[counter++];
|
||||
G4String xsfcn = parameters[counter++];
|
||||
G4String xsbinScheme = parameters[counter++];
|
||||
G4double xunit = GetUnitValue(xsunit);
|
||||
G4double yvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double yvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String ysunit = parameters[counter++];
|
||||
G4String ysfcn = parameters[counter++];
|
||||
G4double yunit = GetUnitValue(ysunit);
|
||||
if ( command == fCreateP1Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto name = parameters[counter++];
|
||||
auto title = parameters[counter++];
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto xunit = GetUnitValue(xdata.fSunit);
|
||||
G4AnalysisMessengerHelper::ValueData ydata;
|
||||
fHelper->GetValueData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
fManager->CreateP1(name, title,
|
||||
xnbins, xvmin*xunit, xvmax*xunit,
|
||||
yvmin*yunit, yvmax*yunit,
|
||||
xsunit, ysunit, xsfcn, ysfcn, xsbinScheme);
|
||||
xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
|
||||
ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
xdata.fSunit, ydata.fSunit,
|
||||
xdata.fSfcn, ydata.fSfcn,
|
||||
xdata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetP1Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4int xnbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double xvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double xvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String xsunit = parameters[counter++];
|
||||
G4String xsfcn = parameters[counter++];
|
||||
G4String xsbinScheme = parameters[counter++];
|
||||
G4double xunit = GetUnitValue(xsunit);
|
||||
G4double yvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double yvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String ysunit = parameters[counter++];
|
||||
G4String ysfcn = parameters[counter++];
|
||||
G4double yunit = GetUnitValue(ysunit);
|
||||
else if ( command == fSetP1Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto xunit = GetUnitValue(xdata.fSunit);
|
||||
G4AnalysisMessengerHelper::ValueData ydata;
|
||||
fHelper->GetValueData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
fManager->SetP1(id,
|
||||
xnbins, xvmin*xunit, xvmax*xunit,
|
||||
yvmin*yunit, yvmax*yunit,
|
||||
xsunit, ysunit, xsfcn, ysfcn, xsbinScheme);
|
||||
xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
|
||||
ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
xdata.fSunit, ydata.fSunit,
|
||||
xdata.fSfcn, ydata.fSfcn,
|
||||
xdata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetP1TitleCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String title = parameters[counter++];
|
||||
else if ( command == fSetP1XCmd.get() ) {
|
||||
// Only save values
|
||||
auto counter = 0;
|
||||
fXId = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
fHelper->GetBinData(fXData, parameters, counter);
|
||||
}
|
||||
else if ( command == fSetP1YCmd.get() ) {
|
||||
// Check if setX command was called
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
if ( fXId == -1 || fXId != id ) {
|
||||
// add exception
|
||||
return;
|
||||
}
|
||||
auto xunit = GetUnitValue(fXData.fSunit);
|
||||
G4AnalysisMessengerHelper::ValueData ydata;
|
||||
fHelper->GetValueData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
fManager->SetP1(id,
|
||||
fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
|
||||
ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
fXData.fSunit, ydata.fSunit,
|
||||
fXData.fSfcn, ydata.fSfcn,
|
||||
fXData.fSbinScheme);
|
||||
fXId = -1;
|
||||
}
|
||||
else if ( command == fSetP1TitleCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto title = parameters[counter++];
|
||||
fManager->SetP1Title(id, title);
|
||||
}
|
||||
else if ( command == fSetP1XAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String xaxis = parameters[counter++];
|
||||
else if ( command == fSetP1XAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto xaxis = parameters[counter++];
|
||||
fManager->SetP1XAxisTitle(id, xaxis);
|
||||
}
|
||||
else if ( command == fSetP1YAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String yaxis = parameters[counter++];
|
||||
else if ( command == fSetP1YAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto yaxis = parameters[counter++];
|
||||
fManager->SetP1YAxisTitle(id, yaxis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,57 +39,41 @@
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
namespace {
|
||||
|
||||
void Exception(G4UIcommand* command, G4int nofParameters)
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Got wrong number of \"" << command->GetCommandName()
|
||||
<< "\" parameters: " << nofParameters
|
||||
<< " instead of " << command->GetParameterEntries()
|
||||
<< " expected" << G4endl;
|
||||
G4Exception("G4P2Messenger::SetNewValue",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4P2Messenger::G4P2Messenger(G4VAnalysisManager* manager)
|
||||
: G4UImessenger(),
|
||||
fManager(manager),
|
||||
fP2Dir(0),
|
||||
fCreateP2Cmd(0),
|
||||
fSetP2Cmd(0),
|
||||
fSetP2TitleCmd(0),
|
||||
fSetP2XAxisCmd(0),
|
||||
fSetP2YAxisCmd(0)
|
||||
fHelper(nullptr),
|
||||
fDirectory(nullptr),
|
||||
fCreateP2Cmd(nullptr),
|
||||
fSetP2Cmd(nullptr),
|
||||
fSetP2XCmd(nullptr),
|
||||
fSetP2YCmd(nullptr),
|
||||
fSetP2ZCmd(nullptr),
|
||||
fSetP2TitleCmd(nullptr),
|
||||
fSetP2XAxisCmd(nullptr),
|
||||
fSetP2YAxisCmd(nullptr)
|
||||
{
|
||||
fP2Dir = new G4UIdirectory("/analysis/p2/");
|
||||
fP2Dir->SetGuidance("2D profiles control");
|
||||
fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>("p2");
|
||||
|
||||
fDirectory = fHelper->CreateHnDirectory();
|
||||
|
||||
CreateP2Cmd();
|
||||
|
||||
SetP2Cmd();
|
||||
|
||||
SetP2TitleCmd();
|
||||
SetP2XAxisCmd();
|
||||
SetP2YAxisCmd();
|
||||
SetP2ZAxisCmd();
|
||||
fSetP2XCmd = fHelper->CreateSetBinsCommand("x", this);
|
||||
fSetP2YCmd = fHelper->CreateSetBinsCommand("y", this);
|
||||
fSetP2YCmd = fHelper->CreateSetValuesCommand("z", this);
|
||||
|
||||
fSetP2TitleCmd = fHelper->CreateSetTitleCommand(this);
|
||||
fSetP2XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
|
||||
fSetP2YAxisCmd = fHelper->CreateSetAxisCommand("y", this);
|
||||
fSetP2ZAxisCmd = fHelper->CreateSetAxisCommand("z", this);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4P2Messenger::~G4P2Messenger()
|
||||
{
|
||||
delete fCreateP2Cmd;
|
||||
delete fSetP2Cmd;
|
||||
delete fSetP2TitleCmd;
|
||||
delete fSetP2XAxisCmd;
|
||||
delete fSetP2YAxisCmd;
|
||||
delete fSetP2ZAxisCmd;
|
||||
delete fP2Dir;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// private functions
|
||||
@@ -98,94 +82,94 @@ G4P2Messenger::~G4P2Messenger()
|
||||
//_____________________________________________________________________________
|
||||
void G4P2Messenger::CreateP2Cmd()
|
||||
{
|
||||
G4UIparameter* p2Name = new G4UIparameter("name", 's', false);
|
||||
auto p2Name = new G4UIparameter("name", 's', false);
|
||||
p2Name->SetGuidance("Profile name (label)");
|
||||
|
||||
G4UIparameter* p2Title = new G4UIparameter("title", 's', false);
|
||||
auto p2Title = new G4UIparameter("title", 's', false);
|
||||
p2Title->SetGuidance("Profile title");
|
||||
|
||||
G4UIparameter* p2xNbins0 = new G4UIparameter("xnbins0", 'i', true);
|
||||
auto p2xNbins0 = new G4UIparameter("xnbins0", 'i', true);
|
||||
p2xNbins0->SetGuidance("Number of x-bins (default = 100)");
|
||||
p2xNbins0->SetGuidance("Can be reset with /analysis/p2/set command");
|
||||
p2xNbins0->SetDefaultValue(100);
|
||||
|
||||
G4UIparameter* p2xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
|
||||
auto p2xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
|
||||
p2xValMin0->SetGuidance("Minimum x-value, expressed in unit (default = 0.)");
|
||||
p2xValMin0->SetGuidance("Can be reset with /analysis/p2/set command");
|
||||
p2xValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* p2xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
|
||||
auto p2xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
|
||||
p2xValMax0->SetGuidance("Maximum x-value, expressed in unit (default = 1.)");
|
||||
p2xValMax0->SetGuidance("Can be reset with /analysis/p2/set command");
|
||||
p2xValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* p2xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
|
||||
auto p2xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
|
||||
p2xValUnit0->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
|
||||
p2xValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
|
||||
auto p2xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
|
||||
G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
|
||||
p2xValFcn0->SetGuidance(fcnxGuidance);
|
||||
p2xValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
p2xValFcn0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
|
||||
auto p2xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
|
||||
G4String binSchemeGuidance = "The binning scheme (linear, log).";
|
||||
p2xValBinScheme0->SetParameterCandidates("linear log");
|
||||
p2xValBinScheme0->SetGuidance(binSchemeGuidance);
|
||||
p2xValBinScheme0->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* p2yNbins0 = new G4UIparameter("ynbins0", 'i', true);
|
||||
auto p2yNbins0 = new G4UIparameter("ynbins0", 'i', true);
|
||||
p2yNbins0->SetGuidance("Number of y-bins (default = 100)");
|
||||
p2yNbins0->SetGuidance("Can be reset with /analysis/p2/set command");
|
||||
p2yNbins0->SetDefaultValue(100);
|
||||
|
||||
G4UIparameter* p2yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
|
||||
auto p2yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
|
||||
p2yValMin0->SetGuidance("Minimum y-value, expressed in unit (default = 0.)");
|
||||
p2yValMin0->SetGuidance("Can be reset with /analysis/p2/set command");
|
||||
p2yValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* p2yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
|
||||
auto p2yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
|
||||
p2yValMax0->SetGuidance("Maximum y-value, expressed in unit (default = 1.)");
|
||||
p2yValMax0->SetGuidance("Can be reset with /analysis/p2/set command");
|
||||
p2yValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* p2yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
|
||||
auto p2yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
|
||||
p2yValUnit0->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
|
||||
p2yValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
|
||||
auto p2yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
|
||||
G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
|
||||
p2yValFcn0->SetGuidance(fcnyGuidance);
|
||||
p2yValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
p2yValFcn0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2yValBinScheme0 = new G4UIparameter("yvalBinScheme0", 's', true);
|
||||
auto p2yValBinScheme0 = new G4UIparameter("yvalBinScheme0", 's', true);
|
||||
p2yValBinScheme0->SetParameterCandidates("linear log");
|
||||
p2yValBinScheme0->SetGuidance(binSchemeGuidance);
|
||||
p2yValBinScheme0->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* p2zValMin0 = new G4UIparameter("zvalMin0", 'd', true);
|
||||
auto p2zValMin0 = new G4UIparameter("zvalMin0", 'd', true);
|
||||
p2zValMin0->SetGuidance("Minimum z-value, expressed in unit (default = 0.)");
|
||||
p2zValMin0->SetGuidance("Can be reset with /analysis/p2/set command");
|
||||
p2zValMin0->SetDefaultValue(0.);
|
||||
|
||||
G4UIparameter* p2zValMax0 = new G4UIparameter("zvalMax0", 'd', true);
|
||||
auto p2zValMax0 = new G4UIparameter("zvalMax0", 'd', true);
|
||||
p2zValMax0->SetGuidance("Maximum z-value, expressed in unit (default = 1.)");
|
||||
p2zValMax0->SetGuidance("Can be reset with /analysis/p2/set command");
|
||||
p2zValMax0->SetDefaultValue(1.);
|
||||
|
||||
G4UIparameter* p2zValUnit0 = new G4UIparameter("zvalUnit0", 's', true);
|
||||
auto p2zValUnit0 = new G4UIparameter("zvalUnit0", 's', true);
|
||||
p2zValUnit0->SetGuidance("The unit applied to filled z-values and zvalMin0, zvalMax0");
|
||||
p2zValUnit0->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2zValFcn0 = new G4UIparameter("zvalFcn0", 's', true);
|
||||
auto p2zValFcn0 = new G4UIparameter("zvalFcn0", 's', true);
|
||||
G4String fcnzGuidance = "The function applied to filled z-values (log, log10, exp, none).";
|
||||
p2zValFcn0->SetGuidance(fcnzGuidance);
|
||||
p2zValFcn0->SetParameterCandidates("log log10 exp none");
|
||||
p2zValFcn0->SetDefaultValue("none");
|
||||
|
||||
fCreateP2Cmd = new G4UIcommand("/analysis/p2/create", this);
|
||||
fCreateP2Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/p2/create", this);
|
||||
fCreateP2Cmd->SetGuidance("Create 2D profile");
|
||||
fCreateP2Cmd->SetParameter(p2Name);
|
||||
fCreateP2Cmd->SetParameter(p2Title);
|
||||
@@ -212,77 +196,77 @@ void G4P2Messenger::CreateP2Cmd()
|
||||
//_____________________________________________________________________________
|
||||
void G4P2Messenger::SetP2Cmd()
|
||||
{
|
||||
G4UIparameter* p2Id = new G4UIparameter("id", 'i', false);
|
||||
auto p2Id = new G4UIparameter("id", 'i', false);
|
||||
p2Id->SetGuidance("Profile id");
|
||||
p2Id->SetParameterRange("id>=0");
|
||||
|
||||
G4UIparameter* p2xNbins = new G4UIparameter("xnbins", 'i', false);
|
||||
auto p2xNbins = new G4UIparameter("xnbins", 'i', false);
|
||||
p2xNbins->SetGuidance("Number of x-bins");
|
||||
|
||||
G4UIparameter* p2xValMin = new G4UIparameter("xvalMin", 'd', false);
|
||||
auto p2xValMin = new G4UIparameter("xvalMin", 'd', false);
|
||||
p2xValMin->SetGuidance("Minimum x-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p2xValMax = new G4UIparameter("xvalMax", 'd', false);
|
||||
auto p2xValMax = new G4UIparameter("xvalMax", 'd', false);
|
||||
p2xValMax->SetGuidance("Maximum x-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p2xValUnit = new G4UIparameter("xvalUnit", 's', false);
|
||||
auto p2xValUnit = new G4UIparameter("xvalUnit", 's', false);
|
||||
p2xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
|
||||
p2xValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2xValFcn = new G4UIparameter("xvalFcn", 's', false);
|
||||
auto p2xValFcn = new G4UIparameter("xvalFcn", 's', false);
|
||||
p2xValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
|
||||
p2xValFcn->SetGuidance(fcnxGuidance);
|
||||
p2xValFcn->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
|
||||
auto p2xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
|
||||
G4String binSchemeGuidance = "The binning scheme (linear, log).";
|
||||
p2xValBinScheme->SetParameterCandidates("linear log");
|
||||
p2xValBinScheme->SetGuidance(binSchemeGuidance);
|
||||
p2xValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* p2yNbins = new G4UIparameter("nybins", 'i', false);
|
||||
auto p2yNbins = new G4UIparameter("nybins", 'i', false);
|
||||
p2yNbins->SetGuidance("Number of y-bins");
|
||||
|
||||
G4UIparameter* p2yValMin = new G4UIparameter("yvalMin", 'd', false);
|
||||
auto p2yValMin = new G4UIparameter("yvalMin", 'd', false);
|
||||
p2yValMin->SetGuidance("Minimum y-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p2yValMax = new G4UIparameter("yvalMax", 'd', false);
|
||||
auto p2yValMax = new G4UIparameter("yvalMax", 'd', false);
|
||||
p2yValMax->SetGuidance("Maximum y-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p2yValUnit = new G4UIparameter("yvalUnit", 's', true);
|
||||
auto p2yValUnit = new G4UIparameter("yvalUnit", 's', true);
|
||||
p2yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
|
||||
p2yValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2yValFcn = new G4UIparameter("yvalFcn", 's', false);
|
||||
auto p2yValFcn = new G4UIparameter("yvalFcn", 's', false);
|
||||
p2yValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
|
||||
p2yValFcn->SetGuidance(fcnyGuidance);
|
||||
p2yValFcn->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2yValBinScheme = new G4UIparameter("yvalBinScheme", 's', true);
|
||||
auto p2yValBinScheme = new G4UIparameter("yvalBinScheme", 's', true);
|
||||
p2yValBinScheme->SetParameterCandidates("linear log");
|
||||
p2yValBinScheme->SetGuidance(binSchemeGuidance);
|
||||
p2yValBinScheme->SetDefaultValue("linear");
|
||||
|
||||
G4UIparameter* p2zValMin = new G4UIparameter("zvalMin", 'd', false);
|
||||
auto p2zValMin = new G4UIparameter("zvalMin", 'd', false);
|
||||
p2zValMin->SetGuidance("Minimum z-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p2zValMax = new G4UIparameter("zvalMax", 'd', false);
|
||||
auto p2zValMax = new G4UIparameter("zvalMax", 'd', false);
|
||||
p2zValMax->SetGuidance("Maximum z-value, expressed in unit");
|
||||
|
||||
G4UIparameter* p2zValUnit = new G4UIparameter("zvalUnit", 's', true);
|
||||
auto p2zValUnit = new G4UIparameter("zvalUnit", 's', true);
|
||||
p2zValUnit->SetGuidance("The unit applied to filled z-values and zvalMin0, zvalMax0");
|
||||
p2zValUnit->SetDefaultValue("none");
|
||||
|
||||
G4UIparameter* p2zValFcn = new G4UIparameter("zvalFcn", 's', false);
|
||||
auto p2zValFcn = new G4UIparameter("zvalFcn", 's', false);
|
||||
p2zValFcn->SetParameterCandidates("log log10 exp none");
|
||||
G4String fcnzGuidance = "The function applied to filled z-values (log, log10, exp, none).";
|
||||
p2zValFcn->SetGuidance(fcnzGuidance);
|
||||
p2zValFcn->SetDefaultValue("none");
|
||||
|
||||
fSetP2Cmd = new G4UIcommand("/analysis/p2/set", this);
|
||||
fSetP2Cmd->SetGuidance("Set parameters for the 2D profile of #Id :");
|
||||
fSetP2Cmd = G4Analysis::make_unique<G4UIcommand>("/analysis/p2/set", this);
|
||||
fSetP2Cmd->SetGuidance("Set parameters for the 2D profile of given id:");
|
||||
fSetP2Cmd->SetGuidance(" nxbins; xvalMin; xvalMax; xunit; xbinScheme");
|
||||
fSetP2Cmd->SetGuidance(" nybins; yvalMin; yvalMax; yunit; ybinScheme");
|
||||
fSetP2Cmd->SetGuidance(" zvalMin; zvalMax; zunit; zfunction");
|
||||
@@ -306,76 +290,6 @@ void G4P2Messenger::SetP2Cmd()
|
||||
fSetP2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4P2Messenger::SetP2TitleCmd()
|
||||
{
|
||||
G4UIparameter* p2Id = new G4UIparameter("idTitle", 'i', false);
|
||||
p2Id->SetGuidance("Profile id");
|
||||
p2Id->SetParameterRange("idTitle>=0");
|
||||
|
||||
G4UIparameter* p2Title = new G4UIparameter("p2Title", 's', true);
|
||||
p2Title->SetGuidance("Profile title");
|
||||
p2Title->SetDefaultValue("none");
|
||||
|
||||
fSetP2TitleCmd = new G4UIcommand("/analysis/p2/setTitle", this);
|
||||
fSetP2TitleCmd->SetGuidance("Set title for the 2D profile of #Id");
|
||||
fSetP2TitleCmd->SetParameter(p2Id);
|
||||
fSetP2TitleCmd->SetParameter(p2Title);
|
||||
fSetP2TitleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4P2Messenger::SetP2XAxisCmd()
|
||||
{
|
||||
G4UIparameter* p2Id = new G4UIparameter("idXaxis", 'i', false);
|
||||
p2Id->SetGuidance("Profile id");
|
||||
p2Id->SetParameterRange("idXaxis>=0");
|
||||
|
||||
G4UIparameter* p2XAxis = new G4UIparameter("p2Xaxis", 's', true);
|
||||
p2XAxis->SetGuidance("Profile x-axis title");
|
||||
p2XAxis->SetDefaultValue("none");
|
||||
|
||||
fSetP2XAxisCmd = new G4UIcommand("/analysis/p2/setXaxis", this);
|
||||
fSetP2XAxisCmd->SetGuidance("Set x-axis title for the 2D profile of #Id");
|
||||
fSetP2XAxisCmd->SetParameter(p2Id);
|
||||
fSetP2XAxisCmd->SetParameter(p2XAxis);
|
||||
fSetP2XAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4P2Messenger::SetP2YAxisCmd()
|
||||
{
|
||||
G4UIparameter* p2Id = new G4UIparameter("idYaxis", 'i', false);
|
||||
p2Id->SetGuidance("Profile id");
|
||||
p2Id->SetParameterRange("idYaxis>=0");
|
||||
|
||||
G4UIparameter* p2YAxis = new G4UIparameter("p2Yaxis", 's', true);
|
||||
p2YAxis->SetGuidance("Profile y-axis title");
|
||||
p2YAxis->SetDefaultValue("none");
|
||||
|
||||
fSetP2YAxisCmd = new G4UIcommand("/analysis/p2/setYaxis", this);
|
||||
fSetP2YAxisCmd->SetGuidance("Set y-axis title for the 2D profile of #Id");
|
||||
fSetP2YAxisCmd->SetParameter(p2Id);
|
||||
fSetP2YAxisCmd->SetParameter(p2YAxis);
|
||||
fSetP2YAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4P2Messenger::SetP2ZAxisCmd()
|
||||
{
|
||||
G4UIparameter* p2Id = new G4UIparameter("idZaxis", 'i', false);
|
||||
p2Id->SetGuidance("Profile id");
|
||||
p2Id->SetParameterRange("idZaxis>=0");
|
||||
|
||||
G4UIparameter* p2ZAxis = new G4UIparameter("p2Zaxis", 's', true);
|
||||
p2ZAxis->SetGuidance("Profile z-axis title");
|
||||
p2ZAxis->SetDefaultValue("none");
|
||||
|
||||
fSetP2ZAxisCmd = new G4UIcommand("/analysis/p2/setZaxis", this);
|
||||
fSetP2ZAxisCmd->SetParameter(p2Id);
|
||||
fSetP2ZAxisCmd->SetParameter(p2ZAxis);
|
||||
fSetP2ZAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//
|
||||
// public functions
|
||||
@@ -390,91 +304,109 @@ void G4P2Messenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
// check consistency
|
||||
if ( G4int(parameters.size()) != command->GetParameterEntries() ) {
|
||||
// Should never happen but let's check anyway for consistency
|
||||
Exception(command, parameters.size());
|
||||
fHelper->WarnAboutParameters(command, parameters.size());
|
||||
return;
|
||||
}
|
||||
|
||||
if ( command == fCreateP2Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4String name = parameters[counter++];
|
||||
G4String title = parameters[counter++];
|
||||
G4int xnbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double xvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double xvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String xsunit = parameters[counter++];
|
||||
G4String xsfcn = parameters[counter++];
|
||||
G4String xsbinScheme = parameters[counter++];
|
||||
G4double xunit = GetUnitValue(xsunit);
|
||||
G4int ynbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double yvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double yvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String ysunit = parameters[counter++];
|
||||
G4String ysfcn = parameters[counter++];
|
||||
G4String ysbinScheme = parameters[counter++];
|
||||
G4double yunit = GetUnitValue(ysunit);
|
||||
G4double zvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double zvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String zsunit = parameters[counter++];
|
||||
G4String zsfcn = parameters[counter++];
|
||||
G4double zunit = GetUnitValue(zsunit);
|
||||
if ( command == fCreateP2Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto name = parameters[counter++];
|
||||
auto title = parameters[counter++];
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto xunit = GetUnitValue(xdata.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData ydata;
|
||||
fHelper->GetBinData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
G4AnalysisMessengerHelper::ValueData zdata;
|
||||
fHelper->GetValueData(zdata, parameters, counter);
|
||||
auto zunit = GetUnitValue(zdata.fSunit);
|
||||
fManager->CreateP2(name, title,
|
||||
xnbins, xvmin*xunit, xvmax*xunit,
|
||||
ynbins, yvmin*yunit, yvmax*yunit,
|
||||
zvmin*zunit, zvmax*zunit,
|
||||
xsunit, ysunit, zsunit, xsfcn, ysfcn, zsfcn,
|
||||
xsbinScheme, ysbinScheme);
|
||||
xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
|
||||
ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
zdata.fVmin*zunit, zdata.fVmax*zunit,
|
||||
xdata.fSunit, ydata.fSunit, zdata.fSunit,
|
||||
xdata.fSfcn, ydata.fSfcn, zdata.fSfcn,
|
||||
xdata.fSbinScheme, ydata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetP2Cmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4int xnbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double xvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double xvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String xsunit = parameters[counter++];
|
||||
G4String xsfcn = parameters[counter++];
|
||||
G4String xsbinScheme = parameters[counter++];
|
||||
G4double xunit = GetUnitValue(xsunit);
|
||||
G4int ynbins = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4double yvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double yvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String ysunit = parameters[counter++];
|
||||
G4String ysfcn = parameters[counter++];
|
||||
G4String ysbinScheme = parameters[counter++];
|
||||
G4double yunit = GetUnitValue(ysunit);
|
||||
G4double zvmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
|
||||
G4double zvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
|
||||
G4String zsunit = parameters[counter++];
|
||||
G4String zsfcn = parameters[counter++];
|
||||
G4double zunit = GetUnitValue(zsunit);
|
||||
else if ( command == fSetP2Cmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4AnalysisMessengerHelper::BinData xdata;
|
||||
fHelper->GetBinData(xdata, parameters, counter);
|
||||
auto xunit = GetUnitValue(xdata.fSunit);
|
||||
G4AnalysisMessengerHelper::BinData ydata;
|
||||
fHelper->GetBinData(ydata, parameters, counter);
|
||||
auto yunit = GetUnitValue(ydata.fSunit);
|
||||
G4AnalysisMessengerHelper::ValueData zdata;
|
||||
fHelper->GetValueData(zdata, parameters, counter);
|
||||
auto zunit = GetUnitValue(zdata.fSunit);
|
||||
fManager->SetP2(id,
|
||||
xnbins, xvmin*xunit, xvmax*xunit,
|
||||
ynbins, yvmin*yunit, yvmax*yunit,
|
||||
zvmin*zunit, zvmax*zunit,
|
||||
xsunit, ysunit, zsunit, xsfcn, ysfcn, zsfcn,
|
||||
xsbinScheme, ysbinScheme);
|
||||
xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
|
||||
ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
|
||||
zdata.fVmin*zunit, zdata.fVmax*zunit,
|
||||
xdata.fSunit, ydata.fSunit, zdata.fSunit,
|
||||
xdata.fSfcn, ydata.fSfcn, zdata.fSfcn,
|
||||
xdata.fSbinScheme, ydata.fSbinScheme);
|
||||
}
|
||||
else if ( command == fSetP2TitleCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String title = parameters[counter++];
|
||||
else if ( command == fSetP2XCmd.get() ) {
|
||||
// Only save values
|
||||
auto counter = 0;
|
||||
fXId = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
fHelper->GetBinData(fXData, parameters, counter);
|
||||
}
|
||||
else if ( command == fSetP2YCmd.get() ) {
|
||||
// Only save values
|
||||
auto counter = 0;
|
||||
fYId = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
fHelper->GetBinData(fYData, parameters, counter);
|
||||
}
|
||||
else if ( command == fSetP2ZCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
// Check if setX and setY command was called
|
||||
if ( fXId == -1 || fXId != id ||
|
||||
fYId == -1 || fYId != id ) {
|
||||
fHelper->WarnAboutSetCommands();
|
||||
return;
|
||||
}
|
||||
auto xunit = GetUnitValue(fXData.fSunit);
|
||||
auto yunit = GetUnitValue(fYData.fSunit);
|
||||
G4AnalysisMessengerHelper::ValueData zdata;
|
||||
fHelper->GetValueData(zdata, parameters, counter);
|
||||
auto zunit = GetUnitValue(zdata.fSunit);
|
||||
fManager->SetP2(id,
|
||||
fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
|
||||
fYData.fNbins, fYData.fVmin*yunit, fYData.fVmax*yunit,
|
||||
zdata.fVmin*zunit, zdata.fVmax*zunit,
|
||||
fXData.fSunit, fYData.fSunit, zdata.fSunit,
|
||||
fXData.fSfcn, fYData.fSfcn, zdata.fSfcn,
|
||||
fXData.fSbinScheme, fYData.fSbinScheme);
|
||||
fXId = -1;
|
||||
fYId = -1;
|
||||
}
|
||||
else if ( command == fSetP2TitleCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto title = parameters[counter++];
|
||||
fManager->SetP2Title(id, title);
|
||||
}
|
||||
else if ( command == fSetP2XAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String xaxis = parameters[counter++];
|
||||
else if ( command == fSetP2XAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto xaxis = parameters[counter++];
|
||||
fManager->SetP2XAxisTitle(id, xaxis);
|
||||
}
|
||||
else if ( command == fSetP2YAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String yaxis = parameters[counter++];
|
||||
else if ( command == fSetP2YAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto yaxis = parameters[counter++];
|
||||
fManager->SetP2YAxisTitle(id, yaxis);
|
||||
}
|
||||
else if ( command == fSetP2ZAxisCmd ) {
|
||||
G4int counter = 0;
|
||||
G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
G4String zaxis = parameters[counter++];
|
||||
else if ( command == fSetP2ZAxisCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto zaxis = parameters[counter++];
|
||||
fManager->SetP2ZAxisTitle(id, zaxis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4PlotManager.cc 85314 2014-10-27 14:33:08Z ihrivnac $
|
||||
|
||||
// Author: Ivana Hrivnacova, 02/06/2015 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4HnInformation.hh"
|
||||
#include "G4PlotManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#if defined(TOOLS_USE_FREETYPE)
|
||||
#include <tools/sg/text_freetype>
|
||||
#include <tools/xml/xml_style>
|
||||
#include <tools/xml/wrap_viewplot_style>
|
||||
//inlib/xml/viewplot.style file embeded in an inline function.
|
||||
|
||||
namespace {
|
||||
|
||||
// from g4tools/test/viewplot.cpp
|
||||
//_____________________________________________________________________________
|
||||
void HD_style(tools::sg::plots& a_plots,float a_line_width) {
|
||||
std::vector<tools::sg::plotter*> plotters;
|
||||
a_plots.plotters(plotters);
|
||||
tools_vforcit(tools::sg::plotter*,plotters,it) {
|
||||
tools::sg::plotter* _plotter = *it;
|
||||
_plotter->bins_style(0).line_width = a_line_width;
|
||||
_plotter->inner_frame_style().line_width = a_line_width;
|
||||
_plotter->grid_style().line_width = a_line_width;
|
||||
_plotter->x_axis().line_style().width = a_line_width;
|
||||
_plotter->x_axis().ticks_style().width = a_line_width;
|
||||
_plotter->y_axis().line_style().width = a_line_width;
|
||||
_plotter->y_axis().ticks_style().width = a_line_width;
|
||||
_plotter->z_axis().line_style().width = a_line_width;
|
||||
_plotter->z_axis().ticks_style().width = a_line_width;
|
||||
|
||||
// needed if font is hershey :
|
||||
_plotter->title_style().line_width = a_line_width;
|
||||
_plotter->infos_style().line_width = a_line_width;
|
||||
_plotter->title_box_style().line_width = a_line_width;
|
||||
|
||||
_plotter->x_axis().labels_style().line_width = a_line_width;
|
||||
_plotter->x_axis().mag_style().line_width = a_line_width;
|
||||
_plotter->x_axis().title_style().line_width = a_line_width;
|
||||
|
||||
_plotter->y_axis().labels_style().line_width = a_line_width;
|
||||
_plotter->y_axis().mag_style().line_width = a_line_width;
|
||||
_plotter->y_axis().title_style().line_width = a_line_width;
|
||||
|
||||
_plotter->z_axis().labels_style().line_width = a_line_width;
|
||||
_plotter->z_axis().mag_style().line_width = a_line_width;
|
||||
_plotter->z_axis().title_style().line_width = a_line_width;
|
||||
}
|
||||
}
|
||||
|
||||
// from g4tools/test/viewplot.cpp
|
||||
//_____________________________________________________________________________
|
||||
void regions_style(tools::sg::plots& a_plots,float a_plotter_scale = 1) {
|
||||
// Rescale some plotter parameters (for example margins) according to the number of regions.
|
||||
// We assume that these parameters had been set previously according to one plot per page.
|
||||
// Then this function must be applied after all the styles had been applied (because
|
||||
// a plotting style may set these parameters).
|
||||
|
||||
float ww_wc = a_plots.width;
|
||||
float wh_wc = a_plots.height;
|
||||
float rw_wc = ww_wc/a_plots.cols;
|
||||
float rh_wc = wh_wc/a_plots.rows;
|
||||
|
||||
float cooking = 1.2f; //if increased the data area is diminished.
|
||||
|
||||
float wfac = (rw_wc/ww_wc)*cooking;
|
||||
float hfac = (rh_wc/wh_wc)*cooking;
|
||||
|
||||
float label_cooking = 1.6f; //if increased the labels are bigger.
|
||||
|
||||
if((a_plots.cols.value()>=4)&&(a_plots.cols.value()>a_plots.rows.value())) label_cooking = 0.9f;
|
||||
|
||||
float title_cooking = 1.1f; //extra title cooking.
|
||||
|
||||
a_plots.plotter_scale = a_plotter_scale;
|
||||
|
||||
std::vector<tools::sg::plotter*> plotters;
|
||||
a_plots.plotters(plotters);
|
||||
tools_vforcit(tools::sg::plotter*,plotters,it) {
|
||||
tools::sg::plotter* _plotter = *it;
|
||||
|
||||
_plotter->left_margin = _plotter->left_margin * wfac;
|
||||
_plotter->right_margin = _plotter->right_margin * wfac;
|
||||
_plotter->bottom_margin = _plotter->bottom_margin * hfac;
|
||||
_plotter->top_margin = _plotter->top_margin * hfac;
|
||||
|
||||
_plotter->x_axis().tick_length = _plotter->x_axis().tick_length * wfac;
|
||||
_plotter->y_axis().tick_length = _plotter->y_axis().tick_length * hfac;
|
||||
|
||||
_plotter->title_to_axis = _plotter->title_to_axis * hfac;
|
||||
_plotter->title_height = _plotter->title_height * hfac * title_cooking;
|
||||
|
||||
_plotter->x_axis().label_height = _plotter->x_axis().label_height * hfac * label_cooking;
|
||||
_plotter->y_axis().label_height = _plotter->y_axis().label_height * hfac * label_cooking;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// from g4tools/test/viewplot.cpp
|
||||
//_____________________________________________________________________________
|
||||
bool load_embeded_styles(tools::xml::styles& a_styles) {
|
||||
std::string ss;
|
||||
unsigned int linen;
|
||||
const char** lines = viewplot_style(linen);
|
||||
for(unsigned int index=0;index<linen;index++) {
|
||||
std::string s = lines[index];
|
||||
tools::replace(s,"@@double_quote@@","\"");
|
||||
tools::replace(s,"@@back_slash@@","\\");
|
||||
ss += s + "\n";
|
||||
}
|
||||
return tools::xml::load_style_string(a_styles,ss);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// static data
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4PlotParameters G4PlotManager::fgPlotParameters;
|
||||
|
||||
//
|
||||
// ctors, dtor
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4PlotManager::G4PlotManager(const G4AnalysisManagerState& state)
|
||||
: fState(state),
|
||||
fViewer(nullptr),
|
||||
fFileName()
|
||||
{
|
||||
#if defined(TOOLS_USE_FREETYPE)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// plotting, high resolution with freetype fonts and by using styles : //////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL1() )
|
||||
G4cout << "... using high resolution with Freetype fonts" << G4endl;
|
||||
#endif
|
||||
//Have vertical A4 :
|
||||
// unsigned int ww = 2000; //to have better antialising on freetype fonts.
|
||||
// float A4 = 29.7f/21.0f;
|
||||
// unsigned int wh = (unsigned int)(float(ww)*A4*0.80);
|
||||
static tools::sg::text_freetype ttf;
|
||||
fViewer.reset(new tools::viewplot(G4cout, ttf,
|
||||
fgPlotParameters.GetColumns(),
|
||||
fgPlotParameters.GetRows(),
|
||||
fgPlotParameters.GetWidth(),
|
||||
fgPlotParameters.GetHeight()));
|
||||
fViewer->plots().view_border = false;
|
||||
load_embeded_styles(fViewer->styles());
|
||||
fViewer->styles().add_colormap("default",tools::sg::style_default_colormap());
|
||||
fViewer->styles().add_colormap("ROOT",tools::sg::style_ROOT_colormap());
|
||||
#else
|
||||
// cretae a viewer with default parameters
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL1() )
|
||||
G4cout << "... using low resolution with Hershey fonts" << G4endl;
|
||||
#endif
|
||||
fViewer.reset(new tools::viewplot(G4cout,
|
||||
fgPlotParameters.GetColumns(),
|
||||
fgPlotParameters.GetRows(),
|
||||
fgPlotParameters.GetWidth(),
|
||||
fgPlotParameters.GetHeight()));
|
||||
fViewer->plots().view_border = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4PlotManager::~G4PlotManager()
|
||||
{}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4PlotManager::WritePage()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("write a page in", "plot file", fFileName);
|
||||
#endif
|
||||
|
||||
#if defined(TOOLS_USE_FREETYPE)
|
||||
HD_style(fViewer->plots(), 5);
|
||||
regions_style(fViewer->plots(), fgPlotParameters.GetScale());
|
||||
#endif
|
||||
|
||||
G4bool result = fViewer->write_page();
|
||||
if ( ! result ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "Cannot write a page in the plot file " << fFileName;
|
||||
G4Exception("G4PlotManager::WritePage()",
|
||||
"Analysis_W022", JustWarning, description);
|
||||
}
|
||||
|
||||
// clear viewers plots
|
||||
fViewer->plots().init_sg();
|
||||
//it will recreate the sg::plotters and then reset the styles on new ones.
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL3() )
|
||||
fState.GetVerboseL3()->Message("write a page in", "plot file", fFileName);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4PlotManager::OpenFile(const G4String& fileName)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("open", "plot file", fileName);
|
||||
#endif
|
||||
|
||||
// Keep filename for logging
|
||||
fFileName = fileName;
|
||||
|
||||
G4bool result = fViewer->open_file(fileName);
|
||||
if ( ! result ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "Cannot open plot file " << fileName;
|
||||
G4Exception("G4PlotManager::OpenFile()",
|
||||
"Analysis_W001", JustWarning, description);
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL1() )
|
||||
fState.GetVerboseL1()->Message("open", "plot file", fileName);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4PlotManager::CloseFile()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("close", "plot file", fFileName);
|
||||
#endif
|
||||
|
||||
G4bool result = fViewer->close_file();
|
||||
if ( ! result ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "Cannot close the plot file.";
|
||||
G4Exception("G4PlotManager::CloseFile()",
|
||||
"Analysis_W021", JustWarning, description);
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL1() )
|
||||
fState.GetVerboseL1()->Message("close", "plot file", fFileName);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
|
||||
// Author: Ivana Hrivnacova, 21/10/2015 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4PlotMessenger.hh"
|
||||
#include "G4PlotParameters.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "G4AnalysisMessengerHelper.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
//#include "G4Tokenizer.hh"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4PlotMessenger::G4PlotMessenger(G4PlotParameters* plotParameters)
|
||||
: G4UImessenger(),
|
||||
fPlotParameters(plotParameters),
|
||||
fHelper(nullptr),
|
||||
fDirectory(nullptr),
|
||||
fSetLayoutCmd(nullptr),
|
||||
fSetDimensionsCmd(nullptr),
|
||||
fSetStyleCmd(nullptr)
|
||||
{
|
||||
fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>("plot");
|
||||
|
||||
fDirectory = fHelper->CreateHnDirectory();
|
||||
|
||||
SetStyleCmd();
|
||||
SetLayoutCmd();
|
||||
SetDimensionsCmd();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4PlotMessenger::~G4PlotMessenger()
|
||||
{}
|
||||
|
||||
//
|
||||
// private functions
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4PlotMessenger::SetStyleCmd()
|
||||
{
|
||||
fSetStyleCmd = G4Analysis::make_unique<G4UIcmdWithAString>("/analysis/plot/setStyle",this);
|
||||
#if defined(TOOLS_USE_FREETYPE)
|
||||
fSetStyleCmd->SetGuidance("Set plotting style from: ");
|
||||
fSetStyleCmd->SetGuidance(" ROOT_default: ROOT style with high resolution fonts");
|
||||
fSetStyleCmd->SetGuidance(" hippodraw: hippodraw style with high resolution fonts");
|
||||
fSetStyleCmd->SetGuidance(" inlib_default: PAW style with low resolution fonts");
|
||||
fSetStyleCmd->SetParameterName("Style", false);
|
||||
#else
|
||||
fSetStyleCmd->SetGuidance("Only one plotting style is available in low resolution: ");
|
||||
fSetStyleCmd->SetGuidance(" inlib_default: PAW style with low resolution fonts");
|
||||
fSetStyleCmd->SetParameterName("Style", false);
|
||||
fSetStyleCmd->SetCandidates("inlib_default");
|
||||
#endif
|
||||
fSetStyleCmd->SetCandidates(fPlotParameters->GetAvailableStyles());
|
||||
fSetStyleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4PlotMessenger::SetLayoutCmd()
|
||||
{
|
||||
auto columns = new G4UIparameter("columns", 'i', false);
|
||||
columns->SetGuidance("The number of columns in the page layout.");
|
||||
G4String range = "columns>=1 && columns<=";
|
||||
std::ostringstream osMaxColumns;
|
||||
osMaxColumns << fPlotParameters->GetMaxColumns();
|
||||
range.append(osMaxColumns.str());
|
||||
columns->SetParameterRange(range);
|
||||
|
||||
auto rows = new G4UIparameter("rows", 'i', false);
|
||||
rows->SetGuidance("The number of rows in the page layout.");
|
||||
range = "rows>=1 && rows<=";
|
||||
std::ostringstream osMaxRows;
|
||||
osMaxRows << fPlotParameters->GetMaxRows();
|
||||
range.append(osMaxRows.str());
|
||||
rows->SetParameterRange(range);
|
||||
|
||||
fSetLayoutCmd = G4Analysis::make_unique<G4UIcommand>("/analysis/plot/setLayout", this);
|
||||
// Guidance text:
|
||||
// Set page layout (number of columns and rows per page).
|
||||
// Suported layouts:
|
||||
// columns = 1 .. maxValueAllowed
|
||||
// rows = 1 .. maxValueAllowed, and >= columns
|
||||
fSetLayoutCmd->SetGuidance("Set page layout (number of columns and rows per page).");
|
||||
fSetLayoutCmd->SetGuidance(" Suported layouts: ");
|
||||
G4String guidance = " columns = 1 .. ";
|
||||
guidance.append(osMaxColumns.str());
|
||||
fSetLayoutCmd->SetGuidance(guidance);
|
||||
guidance = " rows = 1 .. ";
|
||||
guidance.append(osMaxRows.str());
|
||||
guidance.append(" and >= columns");
|
||||
fSetLayoutCmd->SetGuidance(guidance);
|
||||
fSetLayoutCmd->SetParameter(columns);
|
||||
fSetLayoutCmd->SetParameter(rows);
|
||||
fSetLayoutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4PlotMessenger::SetDimensionsCmd()
|
||||
{
|
||||
auto width = new G4UIparameter("width", 'i', false);
|
||||
width->SetGuidance("The page width.");
|
||||
|
||||
auto height = new G4UIparameter("height", 'i', false);
|
||||
height->SetGuidance("The page height.");
|
||||
|
||||
fSetDimensionsCmd = G4Analysis::make_unique<G4UIcommand>("/analysis/plot/setDimensions", this);
|
||||
fSetDimensionsCmd->SetGuidance("Set the plotter window size (width and height) in pixels.");
|
||||
fSetDimensionsCmd->SetParameter(width);
|
||||
fSetDimensionsCmd->SetParameter(height);
|
||||
fSetDimensionsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4PlotMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
{
|
||||
// tokenize parameters in a vector
|
||||
std::vector<G4String> parameters;
|
||||
G4Analysis::Tokenize(newValues, parameters);
|
||||
// check consistency
|
||||
if ( G4int(parameters.size()) != command->GetParameterEntries() ) {
|
||||
// Should never happen but let's check anyway for consistency
|
||||
fHelper->WarnAboutParameters(command, parameters.size());
|
||||
return;
|
||||
}
|
||||
|
||||
if ( command == fSetLayoutCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto columns = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto rows = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
fPlotParameters->SetLayout(columns, rows);
|
||||
}
|
||||
else if ( command == fSetDimensionsCmd.get() ) {
|
||||
auto counter = 0;
|
||||
auto width = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
auto height = G4UIcommand::ConvertToInt(parameters[counter++]);
|
||||
fPlotParameters->SetDimensions(width, height);
|
||||
}
|
||||
#if defined(TOOLS_USE_FREETYPE)
|
||||
else if ( command == fSetStyleCmd.get() ) {
|
||||
fPlotParameters->SetStyle(newValues);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
|
||||
// Author: Ivana Hrivnacova, 21/10/2015 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4PlotParameters.hh"
|
||||
#include "G4PlotMessenger.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4PlotParameters::G4PlotParameters()
|
||||
: fMessenger(nullptr),
|
||||
fDefaultColumns(1),
|
||||
fDefaultRows (2),
|
||||
#if defined(TOOLS_USE_FREETYPE)
|
||||
//Have vertical A4 :
|
||||
fDefaultWidth(2000),
|
||||
fDefaultHeight((G4int)(29.7f/21.0f*fDefaultWidth)),
|
||||
fDefaultStyle("ROOT_default"),
|
||||
fDefaultScale(0.9f),
|
||||
fMaxColumns(3),
|
||||
fMaxRows (5),
|
||||
fAvailableStyles("ROOT_default hippodrow inlib_default"),
|
||||
#else
|
||||
fDefaultWidth (700),
|
||||
fDefaultHeight((G4int)(29.7f/21.0f*fDefaultWidth)),
|
||||
fDefaultStyle("inlib_default"),
|
||||
fDefaultScale(0.9f),
|
||||
fMaxColumns(2),
|
||||
fMaxRows (3),
|
||||
fAvailableStyles("inlib_default"),
|
||||
#endif
|
||||
fColumns(fDefaultColumns),
|
||||
fRows(fDefaultRows),
|
||||
fWidth(fDefaultWidth),
|
||||
fHeight(fDefaultHeight),
|
||||
fScale(fDefaultScale),
|
||||
fStyle(fDefaultStyle)
|
||||
{
|
||||
fMessenger = G4Analysis::make_unique<G4PlotMessenger>(this);
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4PlotParameters::SetLayout(G4int columns, G4int rows)
|
||||
{
|
||||
if ( columns > rows ||
|
||||
columns < 1 || columns > fMaxColumns ||
|
||||
rows < 1 || rows > fMaxRows ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Layout: " << columns << " x " << rows << " was ignored." << G4endl
|
||||
<< "Suported layouts: " << G4endl
|
||||
<< " columns <= rows" << G4endl
|
||||
<< " columns = 1 .. " << fMaxColumns << G4endl
|
||||
<< " rows = 1 .. " << fMaxRows << G4endl;
|
||||
G4Exception("G4PlotParameters::SetLayout",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return;
|
||||
}
|
||||
fColumns = columns;
|
||||
fRows = rows;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4PlotParameters::SetDimensions(G4int width, G4int height)
|
||||
{
|
||||
fWidth = width;
|
||||
fHeight = height;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4PlotParameters::SetStyle(const G4String& style)
|
||||
{
|
||||
// Set style and update scale according to the style selected
|
||||
|
||||
if ( fAvailableStyles.find(style) == std::string::npos ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Style: " << style << " was ignored." << G4endl
|
||||
<< "Supported styles: " << fAvailableStyles << G4endl;
|
||||
G4Exception("G4PlotParameters::SetLayout",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return;
|
||||
}
|
||||
|
||||
fStyle = style;
|
||||
|
||||
if ( fStyle == "ROOT_default" ) {
|
||||
fScale = fDefaultScale;
|
||||
} else {
|
||||
fScale = 1.f;
|
||||
}
|
||||
}
|
||||
@@ -46,88 +46,79 @@ using namespace G4Analysis;
|
||||
//_____________________________________________________________________________
|
||||
G4VAnalysisManager::G4VAnalysisManager(const G4String& type, G4bool isMaster)
|
||||
: fState(type, isMaster),
|
||||
fMessenger(0),
|
||||
fH1HnManager(0),
|
||||
fH2HnManager(0),
|
||||
fH3HnManager(0),
|
||||
fP1HnManager(0),
|
||||
fP2HnManager(0),
|
||||
fVH1Manager(0),
|
||||
fVH2Manager(0),
|
||||
fVH3Manager(0),
|
||||
fVP1Manager(0),
|
||||
fVP2Manager(0),
|
||||
fVNtupleManager(0),
|
||||
fVFileManager(0)
|
||||
fVFileManager(nullptr),
|
||||
fMessenger(G4Analysis::make_unique<G4AnalysisMessenger>(this)),
|
||||
fH1HnManager(nullptr),
|
||||
fH2HnManager(nullptr),
|
||||
fH3HnManager(nullptr),
|
||||
fP1HnManager(nullptr),
|
||||
fP2HnManager(nullptr),
|
||||
fVH1Manager(nullptr),
|
||||
fVH2Manager(nullptr),
|
||||
fVH3Manager(nullptr),
|
||||
fVP1Manager(nullptr),
|
||||
fVP2Manager(nullptr),
|
||||
fVNtupleManager(nullptr)
|
||||
{
|
||||
fMessenger = new G4AnalysisMessenger(this);
|
||||
//fMessenger = G4Analysis::make_unique<G4AnalysisMessenger>(this);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VAnalysisManager::~G4VAnalysisManager()
|
||||
{
|
||||
delete fMessenger;
|
||||
delete fVH1Manager;
|
||||
delete fVH2Manager;
|
||||
delete fVH3Manager;
|
||||
delete fVP1Manager;
|
||||
delete fVP2Manager;
|
||||
delete fVNtupleManager;
|
||||
delete fVFileManager;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
//
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetH1Manager(G4VH1Manager* h1Manager)
|
||||
{
|
||||
fVH1Manager = h1Manager;
|
||||
fH1HnManager = h1Manager->fHnManager;
|
||||
fMessenger->SetH1HnManager(fH1HnManager);
|
||||
fVH1Manager.reset(h1Manager);
|
||||
fH1HnManager = h1Manager->GetHnManager();
|
||||
fMessenger->SetH1HnManager(*fH1HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetH2Manager(G4VH2Manager* h2Manager)
|
||||
{
|
||||
fVH2Manager = h2Manager;
|
||||
fH2HnManager = h2Manager->fHnManager;
|
||||
fMessenger->SetH2HnManager(fH2HnManager);
|
||||
fVH2Manager.reset(h2Manager);
|
||||
fH2HnManager = h2Manager->GetHnManager();
|
||||
fMessenger->SetH2HnManager(*fH2HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetH3Manager(G4VH3Manager* h3Manager)
|
||||
{
|
||||
fVH3Manager = h3Manager;
|
||||
fH3HnManager = h3Manager->fHnManager;
|
||||
fMessenger->SetH3HnManager(fH3HnManager);
|
||||
fVH3Manager.reset(h3Manager);
|
||||
fH3HnManager = h3Manager->GetHnManager();
|
||||
fMessenger->SetH3HnManager(*fH3HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetP1Manager(G4VP1Manager* p1Manager)
|
||||
{
|
||||
fVP1Manager = p1Manager;
|
||||
fP1HnManager = p1Manager->fHnManager;
|
||||
fMessenger->SetP1HnManager(fP1HnManager);
|
||||
fVP1Manager.reset(p1Manager);
|
||||
fP1HnManager = p1Manager->GetHnManager();
|
||||
fMessenger->SetP1HnManager(*fP1HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetP2Manager(G4VP2Manager* p2Manager)
|
||||
{
|
||||
fVP2Manager = p2Manager;
|
||||
fP2HnManager = p2Manager->fHnManager;
|
||||
fMessenger->SetP2HnManager(fP2HnManager);
|
||||
fVP2Manager.reset(p2Manager);
|
||||
fP2HnManager = p2Manager->GetHnManager();
|
||||
fMessenger->SetP2HnManager(*fP2HnManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetNtupleManager(G4VNtupleManager* ntupleManager)
|
||||
{
|
||||
fVNtupleManager = ntupleManager;
|
||||
fVNtupleManager.reset(ntupleManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetFileManager(G4VFileManager* fileManager)
|
||||
void G4VAnalysisManager::SetFileManager(std::shared_ptr<G4VFileManager> fileManager)
|
||||
{
|
||||
fVFileManager = fileManager;
|
||||
}
|
||||
@@ -209,7 +200,17 @@ G4bool G4VAnalysisManager::OpenFile(const G4String& fileName)
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::Write()
|
||||
{
|
||||
return WriteImpl();
|
||||
G4bool finalResult = true;
|
||||
|
||||
G4bool result = WriteImpl();
|
||||
finalResult = finalResult && result;
|
||||
|
||||
if ( IsPlotting() ) {
|
||||
result = PlotImpl();
|
||||
finalResult = finalResult && result;
|
||||
}
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -218,6 +219,24 @@ G4bool G4VAnalysisManager::CloseFile()
|
||||
return CloseFileImpl();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::Merge(tools::histo::hmpi* hmpi)
|
||||
{
|
||||
return MergeImpl(hmpi);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::Plot()
|
||||
{
|
||||
return PlotImpl();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::IsOpenFile() const
|
||||
{
|
||||
return IsOpenFileImpl();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::SetFileName(const G4String& fileName)
|
||||
{
|
||||
@@ -236,6 +255,12 @@ G4bool G4VAnalysisManager::SetNtupleDirectoryName(const G4String& dirName)
|
||||
return fVFileManager->SetNtupleDirectoryName(dirName);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetCompressionLevel(G4int level)
|
||||
{
|
||||
fState.SetCompressionLevel(level);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String G4VAnalysisManager::GetFileName() const
|
||||
{
|
||||
@@ -254,6 +279,12 @@ G4String G4VAnalysisManager::GetNtupleDirectoryName() const
|
||||
return fVFileManager->GetNtupleDirectoryName();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisManager::GetCompressionLevel() const
|
||||
{
|
||||
return fState.GetCompressionLevel();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisManager::CreateH1(const G4String& name, const G4String& title,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
@@ -829,40 +860,19 @@ G4bool G4VAnalysisManager::SetFirstHistoId(G4int firstId)
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::SetFirstH1Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVH1Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fH1HnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fH1HnManager->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::SetFirstH2Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVH2Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fH2HnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fH2HnManager->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::SetFirstH3Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVH3Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fH3HnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fH3HnManager->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -882,27 +892,13 @@ G4bool G4VAnalysisManager::SetFirstProfileId(G4int firstId)
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::SetFirstP1Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVP1Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fP1HnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fP1HnManager->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::SetFirstP2Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVP2Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fP2HnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fP2HnManager->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -934,16 +930,35 @@ G4bool G4VAnalysisManager::IsActive() const
|
||||
// an activated object.
|
||||
|
||||
return fState.GetIsActivation() &&
|
||||
( fH1HnManager->IsActive() || fH2HnManager->IsActive() );
|
||||
( fH1HnManager->IsActive() ||
|
||||
fH2HnManager->IsActive() ||
|
||||
fH3HnManager->IsActive() ||
|
||||
fP1HnManager->IsActive() ||
|
||||
fP2HnManager->IsActive() );
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::IsAscii() const
|
||||
{
|
||||
// Return true any of managers has an object with activated ASCII option.
|
||||
|
||||
return ( fH1HnManager->IsAscii() || fH2HnManager->IsAscii() );
|
||||
return ( fH1HnManager->IsAscii() ||
|
||||
fH2HnManager->IsAscii() ||
|
||||
fH3HnManager->IsAscii() ||
|
||||
fP1HnManager->IsAscii() ||
|
||||
fP2HnManager->IsAscii() );
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisManager::IsPlotting() const
|
||||
{
|
||||
// Return true any of managers has an object with activated plotting option.
|
||||
|
||||
return ( fH1HnManager->IsPlotting() ||
|
||||
fH2HnManager->IsPlotting() ||
|
||||
fH3HnManager->IsPlotting() ||
|
||||
fP1HnManager->IsPlotting() ||
|
||||
fP2HnManager->IsPlotting() );
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -951,7 +966,7 @@ G4int G4VAnalysisManager::GetFirstH1Id() const
|
||||
{
|
||||
// Return first H1 id
|
||||
|
||||
return fVH1Manager->GetFirstId();
|
||||
return fH1HnManager->GetFirstId();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -959,7 +974,7 @@ G4int G4VAnalysisManager::GetFirstH2Id() const
|
||||
{
|
||||
// Return first H2 id
|
||||
|
||||
return fVH2Manager->GetFirstId();
|
||||
return fH2HnManager->GetFirstId();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -967,7 +982,7 @@ G4int G4VAnalysisManager::GetFirstH3Id() const
|
||||
{
|
||||
// Return first H3 id
|
||||
|
||||
return fVH3Manager->GetFirstId();
|
||||
return fH3HnManager->GetFirstId();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -975,7 +990,7 @@ G4int G4VAnalysisManager::GetFirstP1Id() const
|
||||
{
|
||||
// Return first P1 id
|
||||
|
||||
return fVP1Manager->GetFirstId();
|
||||
return fP1HnManager->GetFirstId();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -983,7 +998,7 @@ G4int G4VAnalysisManager::GetFirstP2Id() const
|
||||
{
|
||||
// Return first P2 id
|
||||
|
||||
return fVP2Manager->GetFirstId();
|
||||
return fP2HnManager->GetFirstId();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -1062,6 +1077,12 @@ void G4VAnalysisManager::SetH1Ascii(G4int id, G4bool ascii)
|
||||
fH1HnManager->SetAscii(id, ascii);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetH1Plotting(G4int id, G4bool plotting)
|
||||
{
|
||||
fH1HnManager->SetPlotting(id, plotting);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetH2Activation(G4int id, G4bool activation)
|
||||
{
|
||||
@@ -1082,6 +1103,12 @@ void G4VAnalysisManager::SetH2Activation(G4bool activation)
|
||||
void G4VAnalysisManager::SetH2Ascii(G4int id, G4bool ascii)
|
||||
{
|
||||
fH2HnManager->SetAscii(id, ascii);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetH2Plotting(G4int id, G4bool plotting)
|
||||
{
|
||||
fH2HnManager->SetPlotting(id, plotting);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -1104,7 +1131,13 @@ void G4VAnalysisManager::SetH3Activation(G4bool activation)
|
||||
void G4VAnalysisManager::SetH3Ascii(G4int id, G4bool ascii)
|
||||
{
|
||||
fH3HnManager->SetAscii(id, ascii);
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetH3Plotting(G4int id, G4bool plotting)
|
||||
{
|
||||
fH3HnManager->SetPlotting(id, plotting);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetP1Activation(G4int id, G4bool activation)
|
||||
@@ -1126,7 +1159,13 @@ void G4VAnalysisManager::SetP1Activation(G4bool activation)
|
||||
void G4VAnalysisManager::SetP1Ascii(G4int id, G4bool ascii)
|
||||
{
|
||||
fP1HnManager->SetAscii(id, ascii);
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetP1Plotting(G4int id, G4bool plotting)
|
||||
{
|
||||
fP1HnManager->SetPlotting(id, plotting);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetP2Activation(G4int id, G4bool activation)
|
||||
@@ -1148,6 +1187,28 @@ void G4VAnalysisManager::SetP2Activation(G4bool activation)
|
||||
void G4VAnalysisManager::SetP2Ascii(G4int id, G4bool ascii)
|
||||
{
|
||||
fP2HnManager->SetAscii(id, ascii);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetP2Plotting(G4int id, G4bool plotting)
|
||||
{
|
||||
fP2HnManager->SetPlotting(id, plotting);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetNtupleActivation(G4int id, G4bool activation)
|
||||
{
|
||||
// Set activation to a given P2 object
|
||||
|
||||
fVNtupleManager->SetActivation(id, activation);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisManager::SetNtupleActivation(G4bool activation)
|
||||
{
|
||||
// Set activation to all P2 objects
|
||||
|
||||
fVNtupleManager->SetActivation(activation);
|
||||
}
|
||||
|
||||
// Access methods in .icc
|
||||
|
||||
@@ -45,26 +45,18 @@ using namespace G4Analysis;
|
||||
//_____________________________________________________________________________
|
||||
G4VAnalysisReader::G4VAnalysisReader(const G4String& type, G4bool isMaster)
|
||||
: fState(type, isMaster),
|
||||
fVH1Manager(0),
|
||||
fVH2Manager(0),
|
||||
fVH3Manager(0),
|
||||
fVP1Manager(0),
|
||||
fVP2Manager(0),
|
||||
fVNtupleManager(0),
|
||||
fFileManager(0)
|
||||
fVH1Manager(nullptr),
|
||||
fVH2Manager(nullptr),
|
||||
fVH3Manager(nullptr),
|
||||
fVP1Manager(nullptr),
|
||||
fVP2Manager(nullptr),
|
||||
fVNtupleManager(nullptr),
|
||||
fFileManager(nullptr)
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VAnalysisReader::~G4VAnalysisReader()
|
||||
{
|
||||
delete fVH1Manager;
|
||||
delete fVH2Manager;
|
||||
delete fVH3Manager;
|
||||
delete fVP1Manager;
|
||||
delete fVP2Manager;
|
||||
delete fVNtupleManager;
|
||||
delete fFileManager;
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
@@ -73,43 +65,43 @@ G4VAnalysisReader::~G4VAnalysisReader()
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisReader::SetH1Manager(G4VH1Manager* h1Manager)
|
||||
{
|
||||
fVH1Manager = h1Manager;
|
||||
fVH1Manager.reset(h1Manager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisReader::SetH2Manager(G4VH2Manager* h2Manager)
|
||||
{
|
||||
fVH2Manager = h2Manager;
|
||||
fVH2Manager.reset(h2Manager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisReader::SetH3Manager(G4VH3Manager* h3Manager)
|
||||
{
|
||||
fVH3Manager = h3Manager;
|
||||
fVH3Manager.reset(h3Manager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisReader::SetP1Manager(G4VP1Manager* p1Manager)
|
||||
{
|
||||
fVP1Manager = p1Manager;
|
||||
fVP1Manager.reset(p1Manager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisReader::SetP2Manager(G4VP2Manager* p2Manager)
|
||||
{
|
||||
fVP2Manager = p2Manager;
|
||||
fVP2Manager.reset(p2Manager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisReader::SetNtupleManager(G4VRNtupleManager* ntupleManager)
|
||||
{
|
||||
fVNtupleManager = ntupleManager;
|
||||
fVNtupleManager.reset(ntupleManager);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4VAnalysisReader::SetFileManager(G4BaseFileManager* fileManager)
|
||||
{
|
||||
fFileManager = fileManager;
|
||||
fFileManager.reset(fileManager);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -248,40 +240,19 @@ G4bool G4VAnalysisReader::SetFirstHistoId(G4int firstId)
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisReader::SetFirstH1Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVH1Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fVH1Manager->fHnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fVH1Manager->GetHnManager()->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisReader::SetFirstH2Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVH2Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fVH2Manager->fHnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fVH2Manager->GetHnManager()->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisReader::SetFirstH3Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVH3Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fVH3Manager->fHnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fVH3Manager->GetHnManager()->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -301,27 +272,13 @@ G4bool G4VAnalysisReader::SetFirstProfileId(G4int firstId)
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisReader::SetFirstP1Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVP1Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fVP1Manager->fHnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fVP1Manager->GetHnManager()->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VAnalysisReader::SetFirstP2Id(G4int firstId)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fVP2Manager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
result = fVP2Manager->fHnManager->SetFirstId(firstId);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
return finalResult;
|
||||
return fVP2Manager->GetHnManager()->SetFirstId(firstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
@@ -471,31 +428,31 @@ G4bool G4VAnalysisReader::GetNtupleRow(G4int ntupleId)
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::GetNofH1s() const
|
||||
{
|
||||
return fVH1Manager->fHnManager->GetNofHns();
|
||||
return fVH1Manager->GetHnManager()->GetNofHns();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::GetNofH2s() const
|
||||
{
|
||||
return fVH2Manager->fHnManager->GetNofHns();
|
||||
return fVH2Manager->GetHnManager()->GetNofHns();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::GetNofH3s() const
|
||||
{
|
||||
return fVH3Manager->fHnManager->GetNofHns();
|
||||
return fVH3Manager->GetHnManager()->GetNofHns();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::GetNofP1s() const
|
||||
{
|
||||
return fVP1Manager->fHnManager->GetNofHns();
|
||||
return fVP1Manager->GetHnManager()->GetNofHns();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int G4VAnalysisReader::GetNofP2s() const
|
||||
{
|
||||
return fVP2Manager->fHnManager->GetNofHns();
|
||||
return fVP2Manager->GetHnManager()->GetNofHns();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
@@ -35,20 +35,17 @@
|
||||
//_____________________________________________________________________________
|
||||
G4VFileManager::G4VFileManager(const G4AnalysisManagerState& state)
|
||||
: G4BaseFileManager(state),
|
||||
fIsOpenFile(false),
|
||||
fHistoDirectoryName(""),
|
||||
fProfileDirectoryName(""),
|
||||
fNtupleDirectoryName(""),
|
||||
fLockFileName(false),
|
||||
fLockHistoDirectoryName(false),
|
||||
fLockProfileDirectoryName(false),
|
||||
fLockNtupleDirectoryName(false)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VFileManager::~G4VFileManager()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
// public methods
|
||||
@@ -85,22 +82,6 @@ G4bool G4VFileManager::SetHistoDirectoryName(const G4String& dirName)
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VFileManager::SetProfileDirectoryName(const G4String& dirName)
|
||||
{
|
||||
if ( fLockProfileDirectoryName ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Cannot set Profile directory name as its value was already used.";
|
||||
G4Exception("G4VFileManager::SetProfileDirectoryName()",
|
||||
"Analysis_W012", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
fProfileDirectoryName = dirName;
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool G4VFileManager::SetNtupleDirectoryName(const G4String& dirName)
|
||||
{
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VH1Manager.cc 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4VH1Manager.hh"
|
||||
#include "G4HnManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VH1Manager::G4VH1Manager(const G4AnalysisManagerState& state)
|
||||
: G4BaseAnalysisManager(state),
|
||||
fHnManager(0)
|
||||
{
|
||||
fHnManager = new G4HnManager("H1", state);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VH1Manager::~G4VH1Manager()
|
||||
{
|
||||
delete fHnManager;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VH2Manager.cc 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4VH2Manager.hh"
|
||||
#include "G4HnManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VH2Manager::G4VH2Manager(const G4AnalysisManagerState& state)
|
||||
: G4BaseAnalysisManager(state),
|
||||
fHnManager(0)
|
||||
{
|
||||
fHnManager = new G4HnManager("H2", state);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VH2Manager::~G4VH2Manager()
|
||||
{
|
||||
delete fHnManager;
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
|
||||
// Author: Ivana Hrivnacova, 24/07/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4VH3Manager.hh"
|
||||
#include "G4HnManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VH3Manager::G4VH3Manager(const G4AnalysisManagerState& state)
|
||||
: G4BaseAnalysisManager(state),
|
||||
fHnManager(0)
|
||||
{
|
||||
fHnManager = new G4HnManager("H3", state);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VH3Manager::~G4VH3Manager()
|
||||
{
|
||||
delete fHnManager;
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
|
||||
// Author: Ivana Hrivnacova, 24/07/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4VP1Manager.hh"
|
||||
#include "G4HnManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VP1Manager::G4VP1Manager(const G4AnalysisManagerState& state)
|
||||
: G4BaseAnalysisManager(state),
|
||||
fHnManager(0)
|
||||
{
|
||||
fHnManager = new G4HnManager("P1", state);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VP1Manager::~G4VP1Manager()
|
||||
{
|
||||
delete fHnManager;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
|
||||
// Author: Ivana Hrivnacova, 24/07/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4VP2Manager.hh"
|
||||
#include "G4HnManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VP2Manager::G4VP2Manager(const G4AnalysisManagerState& state)
|
||||
: G4BaseAnalysisManager(state),
|
||||
fHnManager(0)
|
||||
{
|
||||
fHnManager = new G4HnManager("P2", state);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VP2Manager::~G4VP2Manager()
|
||||
{
|
||||
delete fHnManager;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user