Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:53

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 // The messenger class for G4VAnalysisManager.
0028 // It implements commands:
0029 // - /analysis/closeFile
0030 // - /analysis/compression
0031 // - /analysis/list
0032 // - /analysis/openFile
0033 // - /analysis/reset
0034 // - /analysis/setActivation
0035 // - /analysis/setFileName
0036 // - /analysis/setHistoDirName
0037 // - /analysis/setNtupleDirName
0038 // - /analysis/verbose
0039 // - /analysis/write
0040 //
0041 // Author: Ivana Hrivnacova, 24/06/2013  (ivana@ipno.in2p3.fr)
0042 
0043 #ifndef G4AnalysisMessenger_h
0044 #define G4AnalysisMessenger_h 1
0045 
0046 #include "G4UImessenger.hh"
0047 #include "globals.hh"
0048 
0049 #include <memory>
0050 
0051 class G4VAnalysisManager;
0052 class G4NtupleMessenger;
0053 
0054 class G4UIdirectory;
0055 class G4UIcmdWithABool;
0056 class G4UIcmdWithAnInteger;
0057 class G4UIcmdWithAString;
0058 class G4UIcmdWithoutParameter;
0059 
0060 class G4AnalysisMessenger : public G4UImessenger
0061 {
0062   public:
0063     explicit G4AnalysisMessenger(G4VAnalysisManager* manager);
0064     G4AnalysisMessenger() = delete;
0065     ~G4AnalysisMessenger() override;
0066 
0067     // Methods
0068     void SetNewValue(G4UIcommand* command, G4String value) final;
0069 
0070   private:
0071     template <typename CMD>
0072     std::unique_ptr<CMD> CreateCommand(
0073       G4String name, G4String guidance, G4String paremeterName,
0074       G4bool ommitable = false);
0075     std::unique_ptr<G4UIcmdWithoutParameter> CreateCommandWithoutParameter(
0076       G4String name, G4String guidance);
0077 
0078     // Data members
0079     G4VAnalysisManager* fManager { nullptr }; ///< Associated class
0080     std::unique_ptr<G4NtupleMessenger>  fNtupleMessenger;
0081 
0082     std::unique_ptr<G4UIdirectory>         fAnalysisDir;
0083     std::unique_ptr<G4UIcmdWithAString>    fOpenFileCmd;
0084     std::unique_ptr<G4UIcmdWithoutParameter>  fWriteCmd;
0085     std::unique_ptr<G4UIcmdWithoutParameter>  fResetCmd;
0086          // These command need to revert order of execution master-worker
0087          // To be investigated
0088     std::unique_ptr<G4UIcmdWithABool>      fCloseFileCmd;
0089     std::unique_ptr<G4UIcmdWithABool>      fListCmd;
0090     std::unique_ptr<G4UIcmdWithAString>    fSetDefaultFileTypeCmd;
0091     std::unique_ptr<G4UIcmdWithABool>      fSetActivationCmd;
0092     std::unique_ptr<G4UIcmdWithAnInteger>  fVerboseCmd;
0093     std::unique_ptr<G4UIcmdWithAnInteger>  fCompressionCmd;
0094     std::unique_ptr<G4UIcmdWithAString>    fSetFileNameCmd;
0095     std::unique_ptr<G4UIcmdWithAString>    fSetHistoDirNameCmd;
0096     std::unique_ptr<G4UIcmdWithAString>    fSetNtupleDirNameCmd;
0097 };
0098 
0099 //_____________________________________________________________________________
0100 template <typename CMD>
0101 std::unique_ptr<CMD> G4AnalysisMessenger::CreateCommand(
0102   G4String name, G4String guidance, G4String paremeterName, G4bool ommitable)
0103 {
0104   G4String fullName = "/analysis/" + name;
0105 
0106   auto command = std::make_unique<CMD>(fullName, this);
0107   command->SetGuidance(guidance.c_str());
0108   command->SetParameterName(paremeterName.c_str(), ommitable);
0109   command->AvailableForStates(G4State_PreInit, G4State_Idle);
0110 
0111   return command;
0112 }
0113 
0114 #endif