Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4HEPEvtParticle
0027 //
0028 // Class desccription:
0029 //
0030 // This class is exclusively used by G4HEPEvtInterface.
0031 // It represents one particle in /HEPEVT/ list.
0032 
0033 // Author: Makoto Asai, 1997
0034 // --------------------------------------------------------------------
0035 #ifndef G4HEPEvtParticle_hh
0036 #define G4HEPEvtParticle_hh 1
0037 
0038 #include "globals.hh"
0039 #include "evtdefs.hh"
0040 #include "G4Allocator.hh"
0041 #include "G4PrimaryParticle.hh"
0042 
0043 class G4HEPEvtParticle 
0044 {
0045   public:
0046 
0047     G4HEPEvtParticle() = default;
0048     G4HEPEvtParticle(G4PrimaryParticle* pp,
0049                      G4int isthep, G4int jdahep1, G4int jdahep2);
0050    ~G4HEPEvtParticle() = default;
0051 
0052     G4HEPEvtParticle & operator=(const G4HEPEvtParticle& right);
0053     G4bool operator==(const G4HEPEvtParticle &right) const;
0054     G4bool operator!=(const G4HEPEvtParticle &right) const;
0055 
0056     inline void *operator new(std::size_t);
0057     inline void operator delete(void* aStackedTrack);
0058 
0059     inline G4PrimaryParticle* GetTheParticle() { return theParticle; }
0060     inline void Done() { ISTHEP *= -1; }
0061     inline G4int GetISTHEP() { return ISTHEP; }
0062     inline G4int GetJDAHEP1() { return JDAHEP1; }
0063     inline G4int GetJDAHEP2() { return JDAHEP2; }
0064 
0065   private:
0066 
0067     G4PrimaryParticle* theParticle = nullptr; // not owned
0068     G4int ISTHEP = 1; // Status code of the entry
0069                       // Set to be 0 after generating links of
0070                       // G4PrimaryParticle object
0071     G4int JDAHEP1 = 1;
0072     G4int JDAHEP2 = 1;
0073 };
0074 
0075 extern G4EVENT_DLL G4Allocator<G4HEPEvtParticle>*& aHEPEvtParticleAllocator();
0076 
0077 inline void * G4HEPEvtParticle::operator new(std::size_t)
0078 {
0079   if (aHEPEvtParticleAllocator() == nullptr)
0080   {
0081     aHEPEvtParticleAllocator() = new G4Allocator<G4HEPEvtParticle>;
0082   }
0083   return (void *) aHEPEvtParticleAllocator()->MallocSingle();
0084 }
0085 
0086 inline void G4HEPEvtParticle::operator delete(void * aHEPEvtParticle)
0087 {
0088   aHEPEvtParticleAllocator()->FreeSingle((G4HEPEvtParticle *) aHEPEvtParticle);
0089 }
0090 
0091 #endif