Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:55

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
0015 #include "DDG4/Geant4Action.h"
0016 #include "DDG4/Geant4UIMessenger.h"
0017 
0018 /// Namespace for the AIDA detector description toolkit
0019 namespace dd4hep {
0020 
0021   /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
0022   namespace sim {
0023     
0024     /// Class to print message for debugging
0025     /** Class to print message for debugging
0026      *
0027      *  \author  M.Frank
0028      *  \version 1.0
0029      *  \ingroup DD4HEP_SIMULATION
0030      */
0031     class TestPrintAction : public Geant4Action {
0032       int num_calls { 0 };
0033       std::string param  { "Uninitalized" };
0034     public:
0035       /// Standard constructor
0036       TestPrintAction(Geant4Context* context, const std::string& nam)
0037     : Geant4Action(context, nam) 
0038       {
0039     declareProperty("param", param);
0040       }
0041       /// Default destructor
0042       virtual ~TestPrintAction()   {
0043       }
0044       /// Messenger callback
0045       void print_par()   {
0046     always("Parameter value at call %d is '%s'", ++num_calls, param.c_str());
0047       }
0048       /// Install command control messenger to write GDML file from command prompt.
0049       virtual void installCommandMessenger()  override {
0050     m_control->addCall("print_param", "Printing some increasing parameter",
0051                Callback(this).make(&TestPrintAction::print_par),0);
0052       }
0053     };
0054   }    // End namespace sim
0055 }      // End namespace dd4hep
0056 
0057 #include "DDG4/Factories.h"
0058 DECLARE_GEANT4ACTION_NS(dd4hep::sim,TestPrintAction)