Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 07:50:51

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 /// \file RE04TrajectoryPoint.hh
0027 /// \brief Definition of the RE04TrajectoryPoint class
0028 
0029 #ifndef RE04TrajectoryPoint_h
0030 #define RE04TrajectoryPoint_h 1
0031 
0032 #include "G4Allocator.hh"
0033 #include "G4ThreeVector.hh"
0034 #include "G4VTrajectoryPoint.hh"
0035 #include "globals.hh"
0036 class G4Material;
0037 
0038 //
0039 /// Trajectory point class
0040 ///
0041 /// - new, delete and "==" operators are overwritten
0042 ///
0043 /// - const G4ThreeVector GetPosition() const
0044 ///    gets the position of this trajectory
0045 ///
0046 /// - const G4Material* GetMaterial() const
0047 ///    gets material that this trajectory has.
0048 ///
0049 /// - const std::map<G4String,G4AttDef>* GetAttDefs() const
0050 ///    defines the position and the material as attiributes
0051 ///
0052 /// - std::vector<G4AttValue>* CreateAttValues() const
0053 ///    sets and returns the attributes
0054 //
0055 ////////////////////////
0056 class RE04TrajectoryPoint : public G4VTrajectoryPoint
0057 ////////////////////////
0058 {
0059     //--------
0060   public:
0061     //--------
0062 
0063     // Constructor/Destructor
0064     RE04TrajectoryPoint();
0065     RE04TrajectoryPoint(G4ThreeVector pos, const G4Material* mat);
0066     RE04TrajectoryPoint(const RE04TrajectoryPoint& right);
0067     virtual ~RE04TrajectoryPoint();
0068 
0069     // Operators
0070     inline void* operator new(size_t);
0071     inline void operator delete(void* aTrajectoryPoint);
0072     inline G4bool operator==(const RE04TrajectoryPoint& right) const { return (this == &right); };
0073 
0074     // Get/Set functions
0075     inline virtual const G4ThreeVector GetPosition() const { return fPosition; };
0076     inline const G4Material* GetMaterial() const { return fpMaterial; };
0077 
0078     // Get method for HEPRep style attributes
0079     virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
0080     virtual std::vector<G4AttValue>* CreateAttValues() const;
0081 
0082     //---------
0083   private:
0084     //---------
0085 
0086     // Member data
0087     G4ThreeVector fPosition;
0088     const G4Material* fpMaterial;
0089 };
0090 
0091 extern G4ThreadLocal G4Allocator<RE04TrajectoryPoint>* faTrajPointAllocator;
0092 
0093 inline void* RE04TrajectoryPoint::operator new(size_t)
0094 {
0095   if (!faTrajPointAllocator) faTrajPointAllocator = new G4Allocator<RE04TrajectoryPoint>;
0096   return (void*)faTrajPointAllocator->MallocSingle();
0097 }
0098 
0099 inline void RE04TrajectoryPoint::operator delete(void* aTrajectoryPoint)
0100 {
0101   faTrajPointAllocator->FreeSingle((RE04TrajectoryPoint*)aTrajectoryPoint);
0102 }
0103 
0104 #endif