Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4AnalysisMessenger.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26
27// The messenger class for G4VAnalysisManager.
28// It implements commands:
29// - /analysis/closeFile
30// - /analysis/compression
31// - /analysis/list
32// - /analysis/openFile
33// - /analysis/reset
34// - /analysis/setActivation
35// - /analysis/setFileName
36// - /analysis/setHistoDirName
37// - /analysis/setNtupleDirName
38// - /analysis/verbose
39// - /analysis/write
40//
41// Author: Ivana Hrivnacova, 24/06/2013 (ivana@ipno.in2p3.fr)
42
43#ifndef G4AnalysisMessenger_h
44#define G4AnalysisMessenger_h 1
45
46#include "G4UImessenger.hh"
47#include "globals.hh"
48
49#include <memory>
50
53
54class G4UIdirectory;
59
61{
62 public:
63 explicit G4AnalysisMessenger(G4VAnalysisManager* manager);
66
67 // Methods
68 void SetNewValue(G4UIcommand* command, G4String value) final;
69
70 private:
71 template <typename CMD>
72 std::unique_ptr<CMD> CreateCommand(
73 G4String name, G4String guidance, G4String paremeterName,
74 G4bool ommitable = false);
75 std::unique_ptr<G4UIcmdWithoutParameter> CreateCommandWithoutParameter(
76 G4String name, G4String guidance);
77
78 // Data members
79 G4VAnalysisManager* fManager { nullptr }; ///< Associated class
80 std::unique_ptr<G4NtupleMessenger> fNtupleMessenger;
81
82 std::unique_ptr<G4UIdirectory> fAnalysisDir;
83 std::unique_ptr<G4UIcmdWithAString> fOpenFileCmd;
84 std::unique_ptr<G4UIcmdWithoutParameter> fWriteCmd;
85 std::unique_ptr<G4UIcmdWithoutParameter> fResetCmd;
86 // These command need to revert order of execution master-worker
87 // To be investigated
88 std::unique_ptr<G4UIcmdWithABool> fCloseFileCmd;
89 std::unique_ptr<G4UIcmdWithABool> fListCmd;
90 std::unique_ptr<G4UIcmdWithAString> fSetDefaultFileTypeCmd;
91 std::unique_ptr<G4UIcmdWithABool> fSetActivationCmd;
92 std::unique_ptr<G4UIcmdWithAnInteger> fVerboseCmd;
93 std::unique_ptr<G4UIcmdWithAnInteger> fCompressionCmd;
94 std::unique_ptr<G4UIcmdWithAString> fSetFileNameCmd;
95 std::unique_ptr<G4UIcmdWithAString> fSetHistoDirNameCmd;
96 std::unique_ptr<G4UIcmdWithAString> fSetNtupleDirNameCmd;
97};
98
99//_____________________________________________________________________________
100template <typename CMD>
101std::unique_ptr<CMD> G4AnalysisMessenger::CreateCommand(
102 G4String name, G4String guidance, G4String paremeterName, G4bool ommitable)
103{
104 G4String fullName = "/analysis/" + name;
105
106 auto command = std::make_unique<CMD>(fullName, this);
107 command->SetGuidance(guidance.c_str());
108 command->SetParameterName(paremeterName.c_str(), ommitable);
109 command->AvailableForStates(G4State_PreInit, G4State_Idle);
110
111 return command;
112}
113
114#endif
@ G4State_Idle
@ G4State_PreInit
bool G4bool
Definition G4Types.hh:86
G4AnalysisMessenger()=delete
~G4AnalysisMessenger() override
void SetNewValue(G4UIcommand *command, G4String value) final
const char * name(G4int ptype)