Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:24

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 histogram information management.
0028 // It implements commands in /analysis/h1 directory.
0029 //
0030 // Author: Ivana Hrivnacova, 18/06/2013  (ivana@ipno.in2p3.fr)
0031 
0032 #ifndef G4HnMessenger_h
0033 #define G4HnMessenger_h 1
0034 
0035 #include "G4UImessenger.hh"
0036 #include "globals.hh"
0037 
0038 #include <memory>
0039 
0040 class G4HnManager;
0041 class G4UIcommand;
0042 class G4UIcmdWithABool;
0043 class G4UIcmdWithAString;
0044 
0045 class G4HnMessenger : public G4UImessenger
0046 {
0047   public:
0048     explicit G4HnMessenger(G4HnManager& manager);
0049     G4HnMessenger() = delete;
0050     ~G4HnMessenger() override;
0051 
0052     // Methods
0053     void SetNewValue(G4UIcommand* command, G4String value) final;
0054 
0055   private:
0056     // Helper functions
0057     G4String GetObjectType() const;
0058     template <typename CMD>
0059     std::unique_ptr<CMD> CreateCommand(G4String name, G4String guidance);
0060     void AddIdParameter(G4UIcommand& command);
0061     void AddOptionParameter(G4UIcommand& command, G4String optionName);
0062 
0063     void SetHnAsciiCmd();
0064     void SetHnActivationCmd();
0065     void SetHnActivationToAllCmd();
0066     void SetHnPlottingCmd();
0067     void SetHnPlottingToAllCmd();
0068     void SetHnFileNameCmd();
0069     void SetHnFileNameToAllCmd();
0070     std::unique_ptr<G4UIcommand> CreateSetAxisLogCommand(unsigned int ibin);
0071 
0072     // constants
0073     static constexpr std::string_view fkClass { "G4HnMessenger" };
0074 
0075     // Data members
0076     G4HnManager& fManager; ///< Associated class
0077     G4String fHnType;
0078     unsigned int fHnDimension;
0079     std::unique_ptr<G4UIcommand>        fSetAsciiCmd;
0080     std::unique_ptr<G4UIcommand>        fSetActivationCmd;
0081     std::unique_ptr<G4UIcmdWithABool>   fSetActivationAllCmd;
0082     std::unique_ptr<G4UIcommand>        fSetPlottingCmd;
0083     std::unique_ptr<G4UIcmdWithABool>   fSetPlottingAllCmd;
0084     std::unique_ptr<G4UIcommand>        fSetFileNameCmd;
0085     std::unique_ptr<G4UIcmdWithAString> fSetFileNameAllCmd;
0086     std::vector<std::unique_ptr<G4UIcommand>> fSetAxisLogCmd;
0087 };
0088 
0089 //_____________________________________________________________________________
0090 template <typename CMD>
0091 std::unique_ptr<CMD> G4HnMessenger::CreateCommand(
0092   G4String name, G4String guidance)
0093 {
0094   G4String fullName = "/analysis/" + fHnType + "/" + name;
0095   G4String fullGuidance = guidance + GetObjectType();
0096 
0097   auto command = std::make_unique<CMD>(fullName, this);
0098   command->SetGuidance(fullGuidance);
0099   command->AvailableForStates(G4State_PreInit, G4State_Idle);
0100 
0101   return command;
0102 }
0103 
0104 #endif