Back to home page

EIC code displayed by LXR

 
 

    


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

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 <DD4hep/InstanceCount.h>
0016 #include <DDG4/Geant4TrackingPreAction.h>
0017 
0018 // Geant4 include files
0019 #include <G4TrackingManager.hh>
0020 
0021 using namespace dd4hep::sim;
0022 
0023 /// Standard constructor
0024 Geant4TrackingPreAction::Geant4TrackingPreAction(Geant4Context* ctxt, const std::string& nam)
0025   : Geant4TrackingAction(ctxt, nam) {
0026   InstanceCount::increment(this);
0027 }
0028 
0029 /// Default destructor
0030 Geant4TrackingPreAction::~Geant4TrackingPreAction() {
0031   InstanceCount::decrement(this);
0032 }
0033 
0034 /// Begin-of-tracking callback
0035 void Geant4TrackingPreAction::begin(const G4Track* track) {
0036   // Is the track valid? Is tracking manager valid?
0037   // Does trajectory already exist?
0038   if (0 == track || 0 == trackMgr() || 0 != trackMgr()->GimmeTrajectory())
0039     return;
0040   trackMgr()->SetStoreTrajectory(true);
0041   // create GaussTrajectory and inform Tracking Manager
0042   G4VTrajectory* tr = context()->createTrajectory(track);
0043   trackMgr()->SetTrajectory(tr);
0044 }
0045 
0046 /// End-of-tracking callback
0047 void Geant4TrackingPreAction::end(const G4Track* /* track */) {
0048 }