ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4AnalysisMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4AnalysisMessenger.cc
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 
29 #include "G4AnalysisMessenger.hh"
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"
39 #include "G4AnalysisUtilities.hh"
40 
41 #include "G4UIcmdWithABool.hh"
42 #include "G4UIcmdWithAnInteger.hh"
43 
44 using namespace G4Analysis;
45 
46 //_____________________________________________________________________________
48  : G4UImessenger(),
49  fManager(manager),
50  fFileMessenger(nullptr),
51  fH1Messenger(nullptr),
52  fH2Messenger(nullptr),
53  fH3Messenger(nullptr),
54  fP1Messenger(nullptr),
55  fP2Messenger(nullptr),
56  fNtupleMessenger(nullptr),
57  fH1HnMessenger(nullptr),
58  fH2HnMessenger(nullptr),
59  fH3HnMessenger(nullptr),
60  fP1HnMessenger(nullptr),
61  fP2HnMessenger(nullptr),
62  fAnalysisDir(nullptr),
63  fSetActivationCmd(nullptr),
64  fVerboseCmd(nullptr),
65  fCompressionCmd(nullptr)
66 {
67  fAnalysisDir = G4Analysis::make_unique<G4UIdirectory>("/analysis/");
68  fAnalysisDir->SetGuidance("analysis control");
69 
70  fSetActivationCmd = G4Analysis::make_unique<G4UIcmdWithABool>("/analysis/setActivation",this);
71  G4String guidance = "Set activation. \n";
72  guidance += "When this option is enabled, only the histograms marked as activated\n";
73  guidance += "are returned, filled or saved on file.\n";
74  guidance += "No warning is issued when Get or Fill is called on inactive histogram.";
75  fSetActivationCmd->SetGuidance(guidance);
76  fSetActivationCmd->SetParameterName("Activation",false);
77 
78  fVerboseCmd = G4Analysis::make_unique<G4UIcmdWithAnInteger>("/analysis/verbose",this);
79  fVerboseCmd->SetGuidance("Set verbose level");
80  fVerboseCmd->SetParameterName("VerboseLevel",false);
81  fVerboseCmd->SetRange("VerboseLevel>=0 && VerboseLevel<=4");
82 
83  fCompressionCmd = G4Analysis::make_unique<G4UIcmdWithAnInteger>("/analysis/compression",this);
84  fCompressionCmd->SetGuidance("Set compression level");
85  fCompressionCmd->SetParameterName("CompressionLevel",false);
86  fCompressionCmd->SetRange("CompressionLevel>=0 && CompressionLevel<=4");
87 
88  fFileMessenger = G4Analysis::make_unique<G4FileMessenger>(manager);
89  fH1Messenger = G4Analysis::make_unique<G4H1Messenger>(manager);
90  fH2Messenger = G4Analysis::make_unique<G4H2Messenger>(manager);
91  fH3Messenger = G4Analysis::make_unique<G4H3Messenger>(manager);
92  fP1Messenger = G4Analysis::make_unique<G4P1Messenger>(manager);
93  fP2Messenger = G4Analysis::make_unique<G4P2Messenger>(manager);
94  fNtupleMessenger = G4Analysis::make_unique<G4NtupleMessenger>(manager);
95 }
96 
97 //_____________________________________________________________________________
99 {}
100 
101 //
102 // public functions
103 //
104 
105 //_____________________________________________________________________________
107 {
108  fH1HnMessenger = G4Analysis::make_unique<G4HnMessenger>(h1HnManager);
109 }
110 
111 //_____________________________________________________________________________
113 {
114  fH2HnMessenger = G4Analysis::make_unique<G4HnMessenger>(h2HnManager);
115 }
116 
117 //_____________________________________________________________________________
119 {
120  fH3HnMessenger = G4Analysis::make_unique<G4HnMessenger>(h3HnManager);
121 }
122 
123 //_____________________________________________________________________________
125 {
126  fP1HnMessenger = G4Analysis::make_unique<G4HnMessenger>(p1HnManager);
127 }
128 
129 //_____________________________________________________________________________
131 {
132  fP2HnMessenger = G4Analysis::make_unique<G4HnMessenger>(p2HnManager);
133 }
134 
135 //_____________________________________________________________________________
137 {
138  if ( command == fSetActivationCmd.get() ) {
139  fManager->SetActivation(fSetActivationCmd->GetNewBoolValue(newValues));
140  }
141  else if ( command == fVerboseCmd.get() ) {
142  fManager->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValues));
143  }
144  else if ( command == fCompressionCmd.get() ) {
145  fManager->SetCompressionLevel(fCompressionCmd->GetNewIntValue(newValues));
146  }
147 }