Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -200,6 +200,7 @@ G4AnalysisMessengerHelper::CreateSetBinsCommand(const G4String& axis,
parValBinScheme->SetGuidance(binSchemeGuidance);
parValBinScheme->SetDefaultValue("linear");
auto commandName = Update("/analysis/HNTYPE_/setUAXIS", axis);
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:"));
@@ -249,8 +250,13 @@ G4AnalysisMessengerHelper::CreateSetBinsCommand(const G4String& axis,
command->SetGuidance(Update("Set parameters for the NDIM_D LOBJECT of #id:"));
command->SetGuidance(
Update(" AXISvalMin; AXISvalMax; AXISunit; AXISfunction", axis));
command->SetParameter(parId);
command->SetParameter(parValMin);
command->SetParameter(parValMax);
command->SetParameter(parValUnit);
command->SetParameter(parValFcn);
command->AvailableForStates(G4State_PreInit, G4State_Idle);
return command;
}
@@ -116,6 +116,26 @@ G4String G4BaseFileManager::GetNtupleFileName(const G4String& ntupleName) const
return name;
}
//_____________________________________________________________________________
G4String G4BaseFileManager::GetNtupleFileName(G4int ntupleFileNumber) const
{
G4String name(fFileName);
// Take out file extension
auto extension = TakeOffExtension(name);
// Add _M followed by ntupleFileNumber
std::ostringstream os;
os << ntupleFileNumber;
name.append("_m");
name.append(os.str());
// Add (back if it was present) file extension
name.append(extension);
return name;
}
//_____________________________________________________________________________
G4String G4BaseFileManager::GetHnFileName(const G4String& hnType,
const G4String& hnName) const
@@ -83,7 +83,7 @@ G4HnInformation* G4HnManager::GetHnInformation(G4int id,
<< " does not exist.";
G4Exception(inFunction, "Analysis_W011", JustWarning, description);
}
return 0;
return nullptr;
}
return fHnVector[index];
}
@@ -94,7 +94,7 @@ G4HnDimensionInformation* G4HnManager::GetHnDimensionInformation(G4int id,
G4String functionName, G4bool warn) const
{
auto hnInformation = GetHnInformation(id, functionName, warn);
if ( ! hnInformation ) return 0;
if ( ! hnInformation ) return nullptr;
return hnInformation->GetHnDimensionInformation(dimension);
}
@@ -176,11 +176,11 @@ void G4P1Messenger::SetP1Cmd()
auto p1xValMax = new G4UIparameter("xvalMax", 'd', false);
p1xValMax->SetGuidance("Maximum x-value, expressed in unit");
auto p1xValUnit = new G4UIparameter("xvalUnit", 's', false);
auto p1xValUnit = new G4UIparameter("xvalUnit", 's', true);
p1xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
p1xValUnit->SetDefaultValue("none");
auto p1xValFcn = new G4UIparameter("xvalFcn", 's', false);
auto p1xValFcn = new G4UIparameter("xvalFcn", 's', true);
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";
@@ -197,17 +197,17 @@ void G4P1Messenger::SetP1Cmd()
p1xValBinScheme->SetGuidance(binSchemeGuidance);
p1xValBinScheme->SetDefaultValue("linear");
auto p1yValMin = new G4UIparameter("yvalMin", 'd', false);
auto p1yValMin = new G4UIparameter("yvalMin", 'd', true);
p1yValMin->SetGuidance("Minimum y-value, expressed in unit");
auto p1yValMax = new G4UIparameter("yvalMax", 'd', false);
auto p1yValMax = new G4UIparameter("yvalMax", 'd', true);
p1yValMax->SetGuidance("Maximum y-value, expressed in unit");
auto p1yValUnit = new G4UIparameter("yvalUnit", 's', true);
p1yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
p1yValUnit->SetDefaultValue("none");
auto p1yValFcn = new G4UIparameter("yvalFcn", 's', false);
auto p1yValFcn = new G4UIparameter("yvalFcn", 's', true);
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";
@@ -284,17 +284,26 @@ void G4P1Messenger::SetNewValue(G4UIcommand* command, G4String newValues)
xdata.fSbinScheme);
}
else if ( command == fSetP1XCmd.get() ) {
// Only save values
// Save values
auto counter = 0;
fXId = G4UIcommand::ConvertToInt(parameters[counter++]);
fHelper->GetBinData(fXData, parameters, counter);
// Set values
// (another set may follow if setY is also called)
auto xunit = GetUnitValue(fXData.fSunit);
fManager->SetP1(fXId,
fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
0., 0.,
fXData.fSunit, "none",
fXData.fSfcn, "none",
fXData.fSbinScheme);
}
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
fHelper->WarnAboutSetCommands();
return;
}
auto xunit = GetUnitValue(fXData.fSunit);
+27 -11
View File
@@ -63,7 +63,7 @@ G4P2Messenger::G4P2Messenger(G4VAnalysisManager* manager)
SetP2Cmd();
fSetP2XCmd = fHelper->CreateSetBinsCommand("x", this);
fSetP2YCmd = fHelper->CreateSetBinsCommand("y", this);
fSetP2YCmd = fHelper->CreateSetValuesCommand("z", this);
fSetP2ZCmd = fHelper->CreateSetValuesCommand("z", this);
fSetP2TitleCmd = fHelper->CreateSetTitleCommand(this);
fSetP2XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
@@ -209,11 +209,11 @@ void G4P2Messenger::SetP2Cmd()
auto p2xValMax = new G4UIparameter("xvalMax", 'd', false);
p2xValMax->SetGuidance("Maximum x-value, expressed in unit");
auto p2xValUnit = new G4UIparameter("xvalUnit", 's', false);
auto p2xValUnit = new G4UIparameter("xvalUnit", 's', true);
p2xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
p2xValUnit->SetDefaultValue("none");
auto p2xValFcn = new G4UIparameter("xvalFcn", 's', false);
auto p2xValFcn = new G4UIparameter("xvalFcn", 's', true);
p2xValFcn->SetParameterCandidates("log log10 exp none");
G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
p2xValFcn->SetGuidance(fcnxGuidance);
@@ -225,20 +225,20 @@ void G4P2Messenger::SetP2Cmd()
p2xValBinScheme->SetGuidance(binSchemeGuidance);
p2xValBinScheme->SetDefaultValue("linear");
auto p2yNbins = new G4UIparameter("nybins", 'i', false);
auto p2yNbins = new G4UIparameter("nybins", 'i', true);
p2yNbins->SetGuidance("Number of y-bins");
auto p2yValMin = new G4UIparameter("yvalMin", 'd', false);
auto p2yValMin = new G4UIparameter("yvalMin", 'd', true);
p2yValMin->SetGuidance("Minimum y-value, expressed in unit");
auto p2yValMax = new G4UIparameter("yvalMax", 'd', false);
auto p2yValMax = new G4UIparameter("yvalMax", 'd', true);
p2yValMax->SetGuidance("Maximum y-value, expressed in unit");
auto p2yValUnit = new G4UIparameter("yvalUnit", 's', true);
p2yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
p2yValUnit->SetDefaultValue("none");
auto p2yValFcn = new G4UIparameter("yvalFcn", 's', false);
auto p2yValFcn = new G4UIparameter("yvalFcn", 's', true);
p2yValFcn->SetParameterCandidates("log log10 exp none");
G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
p2yValFcn->SetGuidance(fcnyGuidance);
@@ -249,17 +249,17 @@ void G4P2Messenger::SetP2Cmd()
p2yValBinScheme->SetGuidance(binSchemeGuidance);
p2yValBinScheme->SetDefaultValue("linear");
auto p2zValMin = new G4UIparameter("zvalMin", 'd', false);
auto p2zValMin = new G4UIparameter("zvalMin", 'd', true);
p2zValMin->SetGuidance("Minimum z-value, expressed in unit");
auto p2zValMax = new G4UIparameter("zvalMax", 'd', false);
auto p2zValMax = new G4UIparameter("zvalMax", 'd', true);
p2zValMax->SetGuidance("Maximum z-value, expressed in unit");
auto p2zValUnit = new G4UIparameter("zvalUnit", 's', true);
p2zValUnit->SetGuidance("The unit applied to filled z-values and zvalMin0, zvalMax0");
p2zValUnit->SetDefaultValue("none");
auto p2zValFcn = new G4UIparameter("zvalFcn", 's', false);
auto p2zValFcn = new G4UIparameter("zvalFcn", 's', true);
p2zValFcn->SetParameterCandidates("log log10 exp none");
G4String fcnzGuidance = "The function applied to filled z-values (log, log10, exp, none).";
p2zValFcn->SetGuidance(fcnzGuidance);
@@ -356,10 +356,26 @@ void G4P2Messenger::SetNewValue(G4UIcommand* command, G4String newValues)
fHelper->GetBinData(fXData, parameters, counter);
}
else if ( command == fSetP2YCmd.get() ) {
// Only save values
// Save values
auto counter = 0;
fYId = G4UIcommand::ConvertToInt(parameters[counter++]);
// Check if setX command was called
if ( fXId == -1 || fXId != fYId ) {
fHelper->WarnAboutSetCommands();
return;
}
fHelper->GetBinData(fYData, parameters, counter);
// Set values
// (another set may follow if setZ is also called)
auto xunit = GetUnitValue(fXData.fSunit);
auto yunit = GetUnitValue(fYData.fSunit);
fManager->SetP2(fYId,
fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
fYData.fNbins, fYData.fVmin*yunit, fYData.fVmax*yunit,
0., 0.,
fXData.fSunit, fYData.fSunit, "none",
fXData.fSfcn, fYData.fSfcn, "none",
fXData.fSbinScheme, fYData.fSbinScheme);
}
else if ( command == fSetP2ZCmd.get() ) {
auto counter = 0;
@@ -65,7 +65,9 @@ G4VAnalysisManager::G4VAnalysisManager(const G4String& type, G4bool isMaster)
//_____________________________________________________________________________
G4VAnalysisManager::~G4VAnalysisManager()
{}
{
delete fVNtupleManager;
}
//
// protected methods
@@ -114,7 +116,8 @@ void G4VAnalysisManager::SetP2Manager(G4VP2Manager* p2Manager)
//_____________________________________________________________________________
void G4VAnalysisManager::SetNtupleManager(G4VNtupleManager* ntupleManager)
{
fVNtupleManager.reset(ntupleManager);
// fVNtupleManager.reset(ntupleManager);
fVNtupleManager = ntupleManager;
}
//_____________________________________________________________________________
@@ -542,7 +545,10 @@ G4int G4VAnalysisManager::CreateP1(const G4String& name, const G4String& title,
if ( ! CheckName(name, "P1") ) return kInvalidId;
if ( ! CheckNbins(nbins) ) return kInvalidId;
if ( ! CheckMinMax(xmin, xmax, xfcnName, xbinSchemeName) ) return kInvalidId;
if ( ! CheckMinMax(ymin, ymax) ) return kInvalidId;
if ( ymin != 0. || ymax != 0. ) {
// Do not check default values
if ( ! CheckMinMax(ymin, ymax) ) return kInvalidId;
}
return fVP1Manager->CreateP1(name, title, nbins, xmin, xmax, ymin, ymax,
xunitName, yunitName, xfcnName, yfcnName,
@@ -558,6 +564,10 @@ G4int G4VAnalysisManager::CreateP1(const G4String& name, const G4String& title,
{
if ( ! CheckName(name, "P1") ) return kInvalidId;
if ( ! CheckEdges(edges) ) return kInvalidId;
if ( ymin != 0. || ymax != 0. ) {
// Do not check default values
if ( ! CheckMinMax(ymin, ymax) ) return kInvalidId;
}
return fVP1Manager->CreateP1(name, title, edges, ymin, ymax,
xunitName, yunitName, xfcnName, yfcnName);
@@ -579,7 +589,10 @@ G4int G4VAnalysisManager::CreateP2(const G4String& name, const G4String& title,
if ( ! CheckNbins(nxbins) ) return kInvalidId;
if ( ! CheckMinMax(xmin, xmax, xfcnName, xbinSchemeName) ) return kInvalidId;
if ( ! CheckMinMax(ymin, ymax, yfcnName, xbinSchemeName) ) return kInvalidId;
if ( ! CheckMinMax(zmin, zmax) ) return kInvalidId;
if ( zmin != 0. || zmax != 0. ) {
// Do not check default values
if ( ! CheckMinMax(zmin, zmax) ) return kInvalidId;
}
return fVP2Manager->CreateP2(name, title,
nxbins, xmin, xmax, nybins, ymin, ymax,
@@ -602,6 +615,10 @@ G4int G4VAnalysisManager::CreateP2(const G4String& name, const G4String& title,
if ( ! CheckName(name, "P2") ) return kInvalidId;
if ( ! CheckEdges(xedges) ) return kInvalidId;
if ( ! CheckEdges(yedges) ) return kInvalidId;
if ( zmin != 0. || zmax != 0. ) {
// Do not check default values
if ( ! CheckMinMax(zmin, zmax) ) return kInvalidId;
}
return fVP2Manager->CreateP2(name, title, xedges, yedges, zmin, zmax,
xunitName, yunitName, zunitName,
@@ -618,6 +635,10 @@ G4bool G4VAnalysisManager::SetP1(G4int id,
{
if ( ! CheckNbins(nbins) ) return kInvalidId;
if ( ! CheckMinMax(xmin, xmax, xfcnName, xbinSchemeName) ) return kInvalidId;
if ( ymin != 0. || ymax != 0. ) {
// Do not check default values
if ( ! CheckMinMax(ymin, ymax) ) return kInvalidId;
}
return fVP1Manager->SetP1(id, nbins, xmin, xmax, ymin, ymax,
xunitName, yunitName, xfcnName, yfcnName,
@@ -632,6 +653,10 @@ G4bool G4VAnalysisManager::SetP1(G4int id,
const G4String& xfcnName, const G4String& yfcnName)
{
if ( ! CheckEdges(edges) ) return kInvalidId;
if ( ymin != 0. || ymax != 0. ) {
// Do not check default values
if ( ! CheckMinMax(ymin, ymax) ) return kInvalidId;
}
return fVP1Manager->SetP1(id, edges, ymin, ymax,
xunitName, yunitName, xfcnName, yfcnName);
@@ -653,6 +678,10 @@ G4bool G4VAnalysisManager::SetP2(G4int id,
if ( ! CheckNbins(nybins) ) return kInvalidId;
if ( ! CheckMinMax(xmin, xmax, xfcnName, xbinSchemeName) ) return kInvalidId;
if ( ! CheckMinMax(ymin, ymax, yfcnName, ybinSchemeName) ) return kInvalidId;
if ( zmin != 0. || zmax != 0. ) {
// Do not check default values
if ( ! CheckMinMax(zmin, zmax) ) return kInvalidId;
}
return fVP2Manager->SetP2(id, nxbins, xmin, xmax, nybins, ymin, ymax,
zmin, zmax,
@@ -675,6 +704,10 @@ G4bool G4VAnalysisManager::SetP2(G4int id,
{
if ( ! CheckEdges(xedges) ) return kInvalidId;
if ( ! CheckEdges(yedges) ) return kInvalidId;
if ( zmin != 0. || zmax != 0. ) {
// Do not check default values
if ( ! CheckMinMax(zmin, zmax) ) return kInvalidId;
}
return fVP2Manager->SetP2(id, xedges, yedges, zmin, zmax,
xunitName, yunitName, zunitName,