Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:14

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 //
0027 // Author: Ivana Hrivnacova, 30/10/2018  (ivana@ipno.in2p3.fr)
0028 
0029 #include "G4TScoreNtupleWriterMessenger.hh"
0030 #include "G4TScoreNtupleWriter.hh"
0031 #include "G4UImanager.hh"
0032 #include "G4UIcmdWithAString.hh"
0033 #include "G4UIcmdWithAnInteger.hh"
0034 
0035 //_____________________________________________________________________________
0036 template <typename T>
0037 G4TScoreNtupleWriterMessenger<T>::G4TScoreNtupleWriterMessenger(
0038   G4TScoreNtupleWriter<T>* scoreNtupleWriter)
0039   : G4UImessenger()
0040   , fScoreNtupleWriter(scoreNtupleWriter)
0041   , fWriterFileNameCmd(nullptr)
0042   , fWriterVerboseCmd(nullptr)
0043 {
0044   fDirectory = new G4UIdirectory("/score/ntuple/");
0045   fDirectory->SetGuidance("Interactive score ntuple writer commands.");
0046 
0047   fWriterFileNameCmd =
0048     new G4UIcmdWithAString("/score/ntuple/writerFileName", this);
0049   fWriterFileNameCmd->SetGuidance("Set the ntuple writer output file name.");
0050   fWriterFileNameCmd->SetParameterName("outputFileName", false);
0051   fWriterFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0052 
0053   fWriterVerboseCmd =
0054     new G4UIcmdWithAnInteger("/score/ntuple/writerVerbose", this);
0055   fWriterVerboseCmd->SetGuidance("Set the  ntuple writer verbose level.");
0056   fWriterVerboseCmd->SetParameterName("writerVerbose", false);
0057   fWriterVerboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0058 }
0059 
0060 //_____________________________________________________________________________
0061 template <typename T>
0062 G4TScoreNtupleWriterMessenger<T>::~G4TScoreNtupleWriterMessenger()
0063 {
0064   delete fWriterFileNameCmd;
0065   delete fWriterVerboseCmd;
0066   delete fDirectory;
0067 }
0068 
0069 //_____________________________________________________________________________
0070 template <typename T>
0071 void G4TScoreNtupleWriterMessenger<T>::SetNewValue(G4UIcommand* command,
0072                                                    G4String newVal)
0073 {
0074   if(command == fWriterFileNameCmd)
0075   {
0076     fScoreNtupleWriter->SetFileName(newVal);
0077   }
0078   else if(command == fWriterVerboseCmd)
0079   {
0080     fScoreNtupleWriter->SetVerboseLevel(
0081       fWriterVerboseCmd->GetNewIntValue(newVal));
0082   }
0083 }