Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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 ([email protected])
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<G4UIcmdWithABool> fSetActivationCmd;
91 std::unique_ptr<G4UIcmdWithAnInteger> fVerboseCmd;
92 std::unique_ptr<G4UIcmdWithAnInteger> fCompressionCmd;
93 std::unique_ptr<G4UIcmdWithAString> fSetFileNameCmd;
94 std::unique_ptr<G4UIcmdWithAString> fSetHistoDirNameCmd;
95 std::unique_ptr<G4UIcmdWithAString> fSetNtupleDirNameCmd;
96};
97
98//_____________________________________________________________________________
99template <typename CMD>
100std::unique_ptr<CMD> G4AnalysisMessenger::CreateCommand(
101 G4String name, G4String guidance, G4String paremeterName, G4bool ommitable)
102{
103 G4String fullName = "/analysis/" + name;
104
105 auto command = std::make_unique<CMD>(fullName, this);
106 command->SetGuidance(guidance.c_str());
107 command->SetParameterName(paremeterName.c_str(), ommitable);
108 command->AvailableForStates(G4State_PreInit, G4State_Idle);
109
110 return command;
111}
112
113#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)