Geant4-11
G4AnalysisMessenger.cc
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// Author: Ivana Hrivnacova, 24/06/2013 (ivana@ipno.in2p3.fr)
28
30#include "G4VAnalysisManager.hh"
31#include "G4FileMessenger.hh"
32#include "G4H1Messenger.hh"
33#include "G4H2Messenger.hh"
34#include "G4H3Messenger.hh"
35#include "G4P1Messenger.hh"
36#include "G4P2Messenger.hh"
37#include "G4NtupleMessenger.hh"
38#include "G4HnMessenger.hh"
40
41#include "G4UIcmdWithABool.hh"
43
44using namespace G4Analysis;
45
46//_____________________________________________________________________________
48 : G4UImessenger(),
49 fManager(manager)
50{
51 fAnalysisDir = std::make_unique<G4UIdirectory>("/analysis/");
52 fAnalysisDir->SetGuidance("analysis control");
53
54 fSetActivationCmd = std::make_unique<G4UIcmdWithABool>("/analysis/setActivation",this);
55 G4String guidance = "Set activation. \n";
56 guidance += "When this option is enabled, only the histograms marked as activated\n";
57 guidance += "are returned, filled or saved on file.\n";
58 guidance += "No warning is issued when Get or Fill is called on inactive histogram.";
59 fSetActivationCmd->SetGuidance(guidance);
60 fSetActivationCmd->SetParameterName("Activation",false);
61
62 fVerboseCmd = std::make_unique<G4UIcmdWithAnInteger>("/analysis/verbose",this);
63 fVerboseCmd->SetGuidance("Set verbose level");
64 fVerboseCmd->SetParameterName("VerboseLevel",false);
65 fVerboseCmd->SetRange("VerboseLevel>=0 && VerboseLevel<=4");
66
67 fCompressionCmd = std::make_unique<G4UIcmdWithAnInteger>("/analysis/compression",this);
68 fCompressionCmd->SetGuidance("Set compression level");
69 fCompressionCmd->SetParameterName("CompressionLevel",false);
70 fCompressionCmd->SetRange("CompressionLevel>=0 && CompressionLevel<=4");
71
72 fFileMessenger = std::make_unique<G4FileMessenger>(manager);
73 fH1Messenger = std::make_unique<G4H1Messenger>(manager);
74 fH2Messenger = std::make_unique<G4H2Messenger>(manager);
75 fH3Messenger = std::make_unique<G4H3Messenger>(manager);
76 fP1Messenger = std::make_unique<G4P1Messenger>(manager);
77 fP2Messenger = std::make_unique<G4P2Messenger>(manager);
78 fNtupleMessenger = std::make_unique<G4NtupleMessenger>(manager);
79}
80
81//_____________________________________________________________________________
83
84//
85// public functions
86//
87
88//_____________________________________________________________________________
90{
91 fH1HnMessenger = std::make_unique<G4HnMessenger>(h1HnManager);
92}
93
94//_____________________________________________________________________________
96{
97 fH2HnMessenger = std::make_unique<G4HnMessenger>(h2HnManager);
98}
99
100//_____________________________________________________________________________
102{
103 fH3HnMessenger = std::make_unique<G4HnMessenger>(h3HnManager);
104}
105
106//_____________________________________________________________________________
108{
109 fP1HnMessenger = std::make_unique<G4HnMessenger>(p1HnManager);
110}
111
112//_____________________________________________________________________________
114{
115 fP2HnMessenger = std::make_unique<G4HnMessenger>(p2HnManager);
116}
117
118//_____________________________________________________________________________
120{
121 if ( command == fSetActivationCmd.get() ) {
122 fManager->SetActivation(fSetActivationCmd->GetNewBoolValue(newValues));
123 }
124 else if ( command == fVerboseCmd.get() ) {
125 fManager->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValues));
126 }
127 else if ( command == fCompressionCmd.get() ) {
128 fManager->SetCompressionLevel(fCompressionCmd->GetNewIntValue(newValues));
129 }
130}
std::unique_ptr< G4HnMessenger > fP2HnMessenger
virtual ~G4AnalysisMessenger()
std::unique_ptr< G4HnMessenger > fP1HnMessenger
void SetP2HnManager(G4HnManager &p2HnManager)
G4AnalysisMessenger()=delete
void SetP1HnManager(G4HnManager &p1HnManager)
std::unique_ptr< G4UIcmdWithABool > fSetActivationCmd
std::unique_ptr< G4H3Messenger > fH3Messenger
std::unique_ptr< G4UIcmdWithAnInteger > fCompressionCmd
void SetH2HnManager(G4HnManager &h2HnManager)
std::unique_ptr< G4HnMessenger > fH2HnMessenger
std::unique_ptr< G4FileMessenger > fFileMessenger
void SetH3HnManager(G4HnManager &h3HnManager)
std::unique_ptr< G4UIcmdWithAnInteger > fVerboseCmd
G4VAnalysisManager * fManager
Associated class.
std::unique_ptr< G4H1Messenger > fH1Messenger
virtual void SetNewValue(G4UIcommand *command, G4String value) final
std::unique_ptr< G4H2Messenger > fH2Messenger
std::unique_ptr< G4NtupleMessenger > fNtupleMessenger
std::unique_ptr< G4P2Messenger > fP2Messenger
void SetH1HnManager(G4HnManager &h1HnManager)
std::unique_ptr< G4P1Messenger > fP1Messenger
std::unique_ptr< G4HnMessenger > fH3HnMessenger
std::unique_ptr< G4UIdirectory > fAnalysisDir
std::unique_ptr< G4HnMessenger > fH1HnMessenger
void SetActivation(G4bool activation)
void SetVerboseLevel(G4int verboseLevel)
void SetCompressionLevel(G4int level)