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/RE04Trajectory.hh
0027 /// \brief Definition of the RE04Trajectory class
0028 //
0029 //
0030 #ifndef RE04Trajectory_h
0031 #define RE04Trajectory_h 1
0032 
0033 #include "RE04TrajectoryPoint.hh"  // Include from 'tracking'
0034 
0035 #include "G4Allocator.hh"
0036 #include "G4ParticleDefinition.hh"  // Include from 'particle+matter'
0037 #include "G4Step.hh"
0038 #include "G4Track.hh"
0039 #include "G4VTrajectory.hh"
0040 #include "G4ios.hh"  // Include from 'system'
0041 #include "globals.hh"  // Include from 'global'
0042 
0043 #include <stdlib.h>  // Include from 'system'
0044 #include <vector>  // G4RWTValOrderedVector
0045 
0046 class G4Polyline;  // Forward declaration.
0047 
0048 typedef std::vector<G4VTrajectoryPoint*> TrajectoryPointContainer;
0049 
0050 //
0051 /// User trajectory class
0052 ///
0053 /// - new, delete and "==" operators are overwritten
0054 ///
0055 /// - get functions
0056 ///     G4int GetTrackID() const, G4int GetParentID() const,
0057 ///     G4String GetParticleName() const, G4double GetCharge() const,
0058 ///     G4int GetPDGEncoding() const, G4double GetInitialKineticEnergy() const
0059 ///     and G4ThreeVector GetInitialMomentum() const
0060 ///
0061 /// - void ShowTrajectory(std::ostream& os=G4cout) const
0062 ///     invokes the default implementation
0063 ///
0064 /// - void DrawTrajectory() const
0065 ///     invokes the default implementation
0066 ///
0067 /// - void AppendStep(const G4Step* aStep)
0068 ///     adds a user trajectory point object, RE04TrajectoryPoint
0069 ///
0070 /// - int GetPointEntries() const
0071 ///     returns the number of point entries
0072 ///
0073 /// - G4VTrajectoryPoint* GetPoint(G4int i) const
0074 ///     gets the i-th trajectory point
0075 ///
0076 /// - void MergeTrajectory(G4VTrajectory* secondTrajectory)
0077 ///     adds a trajectory to a TrajectoryPointContainer, fPositionRecord
0078 ///
0079 /// - G4ParticleDefinition* GetParticleDefinition()
0080 ///     get a particle definition from G4ParticleTable
0081 ///
0082 /// - const std::map<G4String,G4AttDef>* GetAttDefs() const
0083 ///    defines the track ID, the parent ID, the particle name, the charge,
0084 ///    the PDG encoding, the initial kinetic energy, the initial momentum,
0085 ///    the initial momentum magnitude and the number of points as attiributes
0086 ///
0087 /// - std::vector<G4AttValue>* CreateAttValues() const
0088 ///    sets and returns the attributes
0089 //
0090 ///////////////////
0091 class RE04Trajectory : public G4VTrajectory
0092 ///////////////////
0093 {
0094     //--------
0095   public:
0096     //--------
0097 
0098     // Constructor/Destrcutor
0099 
0100     RE04Trajectory();
0101 
0102     RE04Trajectory(const G4Track* aTrack);
0103     RE04Trajectory(RE04Trajectory&);
0104     virtual ~RE04Trajectory();
0105 
0106     // Operators
0107     inline void* operator new(size_t);
0108     inline void operator delete(void*);
0109     inline int operator==(const RE04Trajectory& right) const { return (this == &right); }
0110 
0111     // Get/Set functions
0112     inline virtual G4int GetTrackID() const { return fTrackID; }
0113     inline virtual G4int GetParentID() const { return fParentID; }
0114     inline virtual G4String GetParticleName() const { return fParticleName; }
0115     inline virtual G4double GetCharge() const { return fPDGCharge; }
0116     inline virtual G4int GetPDGEncoding() const { return fPDGEncoding; }
0117     inline virtual G4double GetInitialKineticEnergy() const { return fInitialKineticEnergy; }
0118     inline virtual G4ThreeVector GetInitialMomentum() const { return fInitialMomentum; }
0119 
0120     // Other member functions
0121     virtual void ShowTrajectory(std::ostream& os = G4cout) const;
0122     // virtual void DrawTrajectory() const;
0123     virtual void DrawTrajectory() const;
0124     virtual void AppendStep(const G4Step* aStep);
0125     virtual int GetPointEntries() const { return fPositionRecord->size(); }
0126     virtual G4VTrajectoryPoint* GetPoint(G4int i) const { return (*fPositionRecord)[i]; }
0127     virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
0128 
0129     G4ParticleDefinition* GetParticleDefinition();
0130 
0131     virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
0132     virtual std::vector<G4AttValue>* CreateAttValues() const;
0133 
0134     //---------
0135   private:
0136     //---------
0137 
0138     TrajectoryPointContainer* fPositionRecord;
0139     G4int fTrackID;
0140     G4int fParentID;
0141     G4int fPDGEncoding;
0142     G4double fPDGCharge;
0143     G4String fParticleName;
0144     G4double fInitialKineticEnergy;
0145     G4ThreeVector fInitialMomentum;
0146 };
0147 
0148 extern G4ThreadLocal G4Allocator<RE04Trajectory>* faTrajAllocator;
0149 
0150 inline void* RE04Trajectory::operator new(size_t)
0151 {
0152   if (!faTrajAllocator) faTrajAllocator = new G4Allocator<RE04Trajectory>;
0153   return (void*)faTrajAllocator->MallocSingle();
0154 }
0155 
0156 inline void RE04Trajectory::operator delete(void* aTrajectory)
0157 {
0158   faTrajAllocator->FreeSingle((RE04Trajectory*)aTrajectory);
0159 }
0160 
0161 #endif