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 #ifndef EXAMPLES_DDG4_MYSENSDET_SRC_MYTRACKERHIT_H
0014 #define EXAMPLES_DDG4_MYSENSDET_SRC_MYTRACKERHIT_H
0015 
0016 /// Framework include files
0017 #include "DDG4/Geant4Data.h"
0018 #include "DDG4/Geant4Particle.h"
0019 
0020 namespace SomeExperiment {
0021 
0022   /// This is the hit definition.
0023   /** I took here the same definition of the default Geant4Tracker class,
0024    *  (see DDG4/Geant4Data.h)  but it could be anything else as well.
0025    *
0026    *  Please note:
0027    *  ============
0028    *  The MC truth handling as implemented in the Geant4ParticleHandler
0029    *  will not work with this class if the object(s) are saved with 
0030    *  the standard Geant4Output2ROOT event action. If the hit is 
0031    *  specialized, the output writing also must be specialized if
0032    *  MC truth handling should be supported.
0033    *  Otherwise it is sufficient to provide a ROOT dictionary as long as the
0034    *  base class dd4hep::sim::Geant4HitData is kept.
0035    *
0036    *  \author  M.Frank
0037    *  \version 1.0
0038    *  \ingroup DD4HEP_SIMULATION
0039    */
0040   class MyTrackerHit : public dd4hep::sim::Geant4Tracker::Hit   {
0041 
0042   public:
0043     dd4hep::Position prePos;
0044     dd4hep::Position postPos;
0045     double step_length;
0046 
0047   public:
0048     /// Default constructor
0049     MyTrackerHit() = default;
0050     /// Initializing constructor
0051     MyTrackerHit(int track_id, int pdg_id, double deposit, double time_stamp, double len,
0052          const dd4hep::Position& pos, const dd4hep::Direction& mom)
0053       : dd4hep::sim::Geant4Tracker::Hit(track_id,pdg_id,deposit,time_stamp, len, pos, mom) {}
0054     /// Default destructor
0055     virtual ~MyTrackerHit() = default;
0056     /// Assignment operator
0057     void copyFrom(const MyTrackerHit& c);
0058   };
0059 
0060   /// User data to be attached to the output MC particle
0061   /**
0062    *  \author  M.Frank
0063    *  \version 1.0
0064    *  \ingroup DD4HEP_SIMULATION
0065    */
0066   class ParticleUserData : public dd4hep::sim::ParticleExtension   {
0067   public:
0068     /// Some data item to be attached to the Geant4 particle object
0069     double absolute_momentum { 0e0 };
0070 
0071   public:
0072     using dd4hep::sim::ParticleExtension::ParticleExtension;
0073   };
0074   
0075   /// Helper to dump data file
0076   /**
0077    *  Usage:  
0078    *  $> root.exe
0079    *  ....
0080    *  root [0] gSystem->Load("libDDG4Plugins.so");
0081    *  root [1] gSystem->Load("libDDG4_MySensDet.so");
0082    *  root [2] SomeExperiment::Dump::dumpData(<num-ebents>,<file-name>);
0083    *
0084    */
0085   class Dump   {
0086   public:
0087     /// Standalone function to dump data from a root file
0088     static int dumpData(int num_evts, const char* file_name);
0089   };
0090 }
0091 
0092 // CINT configuration
0093 #if defined(__CINT__) || defined(__MAKECINT__) || defined(__CLING__) || defined(__ROOTCLING__)
0094 #pragma link off all globals;
0095 #pragma link off all classes;
0096 #pragma link off all functions;
0097 
0098 /// Define namespaces
0099 #pragma link C++ namespace dd4hep;
0100 #pragma link C++ namespace dd4hep::sim;
0101 #pragma link C++ namespace SomeExperiment;
0102 #pragma link C++ class     SomeExperiment::MyTrackerHit+;
0103 #pragma link C++ class     SomeExperiment::ParticleUserData+;
0104 #pragma link C++ class     SomeExperiment::Dump;
0105 
0106 #endif
0107 
0108 #endif // EXAMPLES_DDG4_MYSENSDET_SRC_MYTRACKERHIT_H