Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:04

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 // Author : Valentin Libioulle valentin.libioulle@usherbrooke.ca (3IT - GRAMS)
0027 //
0028 //---------------------------------------------------------------
0029 //
0030 // G4ScintillationTrackInformation
0031 //
0032 // Class Description:
0033 //
0034 // Concrete class of G4VUserTrackInformation used to store information
0035 // linked to the track generated in a scintillation process.
0036 //
0037 
0038 #ifndef G4SCINTILLATIONTRACKINFORMATION_H
0039 #define G4SCINTILLATIONTRACKINFORMATION_H
0040 
0041 #include "G4Allocator.hh"
0042 #include "G4VUserTrackInformation.hh"
0043 
0044 // Represents the scintillation type used to create the track (opticalphoton).
0045 enum G4ScintillationType
0046 {
0047   Fast,
0048   Medium,
0049   Slow
0050 };
0051 
0052 class G4ScintillationTrackInformation : public G4VUserTrackInformation
0053 {
0054  public:
0055   explicit G4ScintillationTrackInformation(
0056     const G4ScintillationType& aType = Slow);
0057   virtual ~G4ScintillationTrackInformation();
0058 
0059   // Required by G4VUserTrackInformation
0060   void* operator new(size_t);
0061   void operator delete(void* aScintillationTI);
0062 
0063   // Copy Constructor/instruction
0064   G4ScintillationTrackInformation(const G4ScintillationTrackInformation&);
0065   G4ScintillationTrackInformation& operator=(
0066     const G4ScintillationTrackInformation&);
0067 
0068   virtual void Print() const override;
0069 
0070   const G4ScintillationType& GetScintillationType() const
0071   {
0072     return scintillationType;
0073   }
0074 
0075   // Static class allowing to check if a G4VUserTrackInformation is a
0076   // G4ScintillationTrackInformation and cast it without changing the
0077   // pointer of the pointed data.
0078   static G4bool IsScintillationTrackInformation(
0079     const G4VUserTrackInformation* const);
0080   static G4ScintillationTrackInformation* Cast(
0081     const G4VUserTrackInformation* const);
0082 
0083  private:
0084   G4ScintillationType scintillationType;
0085   // String given to G4VUserTrackInformation to identify this concrete class
0086   static const G4String BaseType;
0087 };
0088 
0089 ///
0090 // Inline methods
0091 ///
0092 
0093 // Forward declaration for the Allocator
0094 class G4ScintillationTrackInformation;
0095 
0096 #if defined G4EM_ALLOC_EXPORT
0097 extern G4DLLEXPORT G4Allocator<G4ScintillationTrackInformation>*&
0098 aScintillationTIAllocator();
0099 #else
0100 extern G4DLLIMPORT G4Allocator<G4ScintillationTrackInformation>*&
0101 aScintillationTIAllocator();
0102 #endif
0103 
0104 inline void* G4ScintillationTrackInformation::operator new(size_t)
0105 {
0106   if(aScintillationTIAllocator() == nullptr)
0107   {
0108     aScintillationTIAllocator() =
0109       new G4Allocator<G4ScintillationTrackInformation>;
0110   }
0111   return (void*) aScintillationTIAllocator()->MallocSingle();
0112 }
0113 
0114 inline void G4ScintillationTrackInformation::operator delete(
0115   void* aScintillationTI)
0116 {
0117   aScintillationTIAllocator()->FreeSingle(
0118     (G4ScintillationTrackInformation*) aScintillationTI);
0119 }
0120 
0121 #endif  // G4SCINTILLATIONTRACKINFORMATION_H