Files
geant4/source/digits_hits/utils/include/G4TScoreNtupleWriterMessenger.icc
T
2021-06-25 16:12:29 +02:00

84 lines
3.6 KiB
Plaintext

//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Author: Ivana Hrivnacova, 30/10/2018 (ivana@ipno.in2p3.fr)
#include "G4TScoreNtupleWriterMessenger.hh"
#include "G4TScoreNtupleWriter.hh"
#include "G4UImanager.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
//_____________________________________________________________________________
template <typename T>
G4TScoreNtupleWriterMessenger<T>::G4TScoreNtupleWriterMessenger(
G4TScoreNtupleWriter<T>* scoreNtupleWriter)
: G4UImessenger()
, fScoreNtupleWriter(scoreNtupleWriter)
, fWriterFileNameCmd(nullptr)
, fWriterVerboseCmd(nullptr)
{
fDirectory = new G4UIdirectory("/score/ntuple/");
fDirectory->SetGuidance("Interactive score ntuple writer commands.");
fWriterFileNameCmd =
new G4UIcmdWithAString("/score/ntuple/writerFileName", this);
fWriterFileNameCmd->SetGuidance("Set the ntuple writer output file name.");
fWriterFileNameCmd->SetParameterName("outputFileName", false);
fWriterFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fWriterVerboseCmd =
new G4UIcmdWithAnInteger("/score/ntuple/writerVerbose", this);
fWriterVerboseCmd->SetGuidance("Set the ntuple writer verbose level.");
fWriterVerboseCmd->SetParameterName("writerVerbose", false);
fWriterVerboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//_____________________________________________________________________________
template <typename T>
G4TScoreNtupleWriterMessenger<T>::~G4TScoreNtupleWriterMessenger()
{
delete fWriterFileNameCmd;
delete fWriterVerboseCmd;
delete fDirectory;
}
//_____________________________________________________________________________
template <typename T>
void G4TScoreNtupleWriterMessenger<T>::SetNewValue(G4UIcommand* command,
G4String newVal)
{
if(command == fWriterFileNameCmd)
{
fScoreNtupleWriter->SetFileName(newVal);
}
else if(command == fWriterVerboseCmd)
{
fScoreNtupleWriter->SetVerboseLevel(
fWriterVerboseCmd->GetNewIntValue(newVal));
}
}