Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:56:58

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4TScoreNtupleWriterMessenger inline methods
0027 //
0028 // Author: Ivana Hrivnacova, 30/10/2018
0029 // --------------------------------------------------------------------
0030 
0031 #include "G4TScoreNtupleWriterMessenger.hh"
0032 #include "G4TScoreNtupleWriter.hh"
0033 #include "G4UImanager.hh"
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIcmdWithAnInteger.hh"
0036 
0037 //_____________________________________________________________________________
0038 template <typename T>
0039 G4TScoreNtupleWriterMessenger<T>::G4TScoreNtupleWriterMessenger(
0040   G4TScoreNtupleWriter<T>* scoreNtupleWriter)
0041   : G4UImessenger()
0042   , fScoreNtupleWriter(scoreNtupleWriter)
0043   , fWriterFileNameCmd(nullptr)
0044   , fWriterVerboseCmd(nullptr)
0045 {
0046   fDirectory = new G4UIdirectory("/score/ntuple/");
0047   fDirectory->SetGuidance("Interactive score ntuple writer commands.");
0048 
0049   fWriterFileNameCmd =
0050     new G4UIcmdWithAString("/score/ntuple/writerFileName", this);
0051   fWriterFileNameCmd->SetGuidance("Set the ntuple writer output file name.");
0052   fWriterFileNameCmd->SetParameterName("outputFileName", false);
0053   fWriterFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0054 
0055   fWriterVerboseCmd =
0056     new G4UIcmdWithAnInteger("/score/ntuple/writerVerbose", this);
0057   fWriterVerboseCmd->SetGuidance("Set the  ntuple writer verbose level.");
0058   fWriterVerboseCmd->SetParameterName("writerVerbose", false);
0059   fWriterVerboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0060 }
0061 
0062 //_____________________________________________________________________________
0063 template <typename T>
0064 G4TScoreNtupleWriterMessenger<T>::~G4TScoreNtupleWriterMessenger()
0065 {
0066   delete fWriterFileNameCmd;
0067   delete fWriterVerboseCmd;
0068   delete fDirectory;
0069 }
0070 
0071 //_____________________________________________________________________________
0072 template <typename T>
0073 void G4TScoreNtupleWriterMessenger<T>::SetNewValue(G4UIcommand* command,
0074                                                    G4String newVal)
0075 {
0076   if(command == fWriterFileNameCmd)
0077   {
0078     fScoreNtupleWriter->SetFileName(newVal);
0079   }
0080   else if(command == fWriterVerboseCmd)
0081   {
0082     fScoreNtupleWriter->SetVerboseLevel(
0083       fWriterVerboseCmd->GetNewIntValue(newVal));
0084   }
0085 }