Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:44

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