Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:52: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 // G4VTrajectoryPoint
0027 //
0028 // Class description:
0029 //
0030 // This class is the abstract base class representing the point
0031 // forming a trajectory. It includes information of a the point.
0032 
0033 // Contact:
0034 //   Questions and comments to this code should be sent to
0035 //     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
0036 //     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
0037 // --------------------------------------------------------------------
0038 #ifndef G4VTrajectoryPoint_hh
0039 #define G4VTrajectoryPoint_hh 1
0040 
0041 #include "G4ThreeVector.hh"
0042 #include "globals.hh"
0043 
0044 #include <map>
0045 #include <vector>
0046 #include <memory>
0047 
0048 class G4AttDef;
0049 class G4AttValue;
0050 
0051 class G4VTrajectoryPoint
0052 {
0053  public:
0054   // Constructor/Destructor
0055   G4VTrajectoryPoint() = default;
0056   virtual ~G4VTrajectoryPoint() = default;
0057 
0058   // Equality operator
0059   G4bool operator==(const G4VTrajectoryPoint& right) const { return (this == &right); }
0060 
0061   // Return point position
0062   virtual const G4ThreeVector GetPosition() const = 0;
0063 
0064   // Get method for a vector of auxiliary points.
0065   // If implemented by a derived class, returns a pointer to a list
0066   // of auxiliary points, e.g., intermediate points used during the
0067   // calculation of the step that can be used for drawing a smoother
0068   // trajectory. The user must test the validity of this pointer
0069   virtual const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const { return nullptr; }
0070 
0071   // Get method for HEPRep style attribute definitions.
0072   // If implemented by a derived class, returns a pointer to a map of
0073   // attribute definitions for the attribute values below. The user
0074   // must test the validity of this pointer. See G4Trajectory for an
0075   // example of a concrete implementation of this method
0076   virtual const std::map<G4String, G4AttDef>* GetAttDefs() const { return nullptr; }
0077 
0078   // Get method for HEPRep style attribute values.
0079   // If implemented by a derived class, returns a pointer to a list
0080   // of attribute values suitable, e.g., for picking. Each must
0081   // refer to an attribute definition in the above map; its name is
0082   // the key. The user must test the validity of this pointer (it
0083   // must be non-zero and conform to the G4AttDefs, which may be
0084   // checked with G4AttCheck) and delete the list after use. See
0085   // G4Trajectory for an example of a concrete implementation of this
0086   // method and G4VTrajectory::ShowTrajectory() for an example of its use.
0087   // The caller is expected to take ownership of the returned pointer
0088   // and delete it appropriately.
0089   virtual std::vector<G4AttValue>* CreateAttValues() const { return nullptr; }
0090 
0091   // Smart access function - creates on request and stores for future
0092   // access. An invalid shared pointer means "not available". Usage:
0093   //   const auto trajectoryPointAttValues = aTrajectoryPoint->GetAttValues();
0094   //   if (trajectoryPointAttValues) { ...
0095   // then use as a normal pointer, but do not delete - simply allow
0096   // to go out of scope.
0097   std::shared_ptr<std::vector<G4AttValue>> GetAttValues() const;
0098 
0099 protected:
0100   G4VTrajectoryPoint(const G4VTrajectoryPoint& right) = default;
0101   G4VTrajectoryPoint& operator=(const G4VTrajectoryPoint& right) = default;
0102   G4VTrajectoryPoint(G4VTrajectoryPoint&&) = default;
0103   G4VTrajectoryPoint& operator=(G4VTrajectoryPoint&&) = default;
0104 
0105 private:
0106   // Cached att values
0107   mutable std::shared_ptr<std::vector<G4AttValue>> fpAttValues;
0108 };
0109 
0110 #endif