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/Geant4StackingAction.h"
0016 
0017 /// Namespace for the AIDA detector description toolkit
0018 namespace dd4hep {
0019 
0020   /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
0021   namespace sim {
0022     
0023     /// Class to measure the energy of escaping tracks
0024     /** Class to measure the energy of escaping tracks of a detector using Geant 4
0025      * Measure escaping energy....
0026      *
0027      *  \author  M.Frank
0028      *  \version 1.0
0029      *  \ingroup DD4HEP_SIMULATION
0030      */
0031     class TestStackingAction : public Geant4StackingAction {
0032       std::size_t m_calls_newStage   { 0UL };
0033       std::size_t m_calls_prepare    { 0UL };
0034       std::size_t m_calls_classify   { 0UL };
0035     
0036     public:
0037       /// Standard constructor
0038       TestStackingAction(Geant4Context* context, const std::string& nam)
0039     : Geant4StackingAction(context, nam) 
0040       {
0041       }
0042       /// Default destructor
0043       virtual ~TestStackingAction()   {
0044     info("+++ Calls newStage: %ld prepare: %ld classifyNewTrack: %ld",
0045          m_calls_newStage, m_calls_prepare, m_calls_classify);
0046       }
0047       /// New-stage callback
0048       virtual void newStage(G4StackManager* stackManager)   override final  {
0049     info("+++ [%ld] Calling newStage. StackManager: %p", m_calls_newStage, (void*)stackManager);
0050     ++m_calls_newStage;
0051       }
0052       /// Preparation callback
0053       virtual void prepare(G4StackManager* stackManager)   override final   {
0054     info("+++ [%ld] Calling prepare. StackManager: %p", m_calls_prepare, (void*)stackManager);
0055     ++m_calls_prepare;
0056       }
0057       /// Return TrackClassification with enum G4ClassificationOfNewTrack or NoTrackClassification
0058       virtual TrackClassification 
0059       classifyNewTrack(G4StackManager* stackManager, const G4Track* track)   override final   {
0060     info("+++ [%ld] Calling classifyNewTrack. StackManager: %p Track: %p", 
0061          m_calls_classify, (void*)stackManager, (void*)track);
0062     ++m_calls_classify;
0063     return { fKill };
0064       }
0065     };
0066   }    // End namespace sim
0067 }      // End namespace dd4hep
0068 
0069 #include "DDG4/Factories.h"
0070 DECLARE_GEANT4ACTION_NS(dd4hep::sim,TestStackingAction)