Import Geant4 11.3.0 source tree
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedRichTrajectory
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This class is identical to G4RichTrajectory class, but uses the
|
||||
// singleton G4Allocator so that the master thread can safely
|
||||
// delete the object instantiated by worker threads in sub-event
|
||||
// parallel mode. This class object should be instantiated as
|
||||
// a clone of G4RichTrajectory object.
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4ClonedRichTrajectory_HH
|
||||
#define G4ClonedRichTrajectory_HH 1
|
||||
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ClonedRichTrajectoryPoint.hh" // Include from 'tracking'
|
||||
#include "G4ios.hh" // Include from 'system'
|
||||
#include "globals.hh" // Include from 'global'
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
#include <stdlib.h> // Include from 'system'
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4Polyline;
|
||||
class G4RichTrajectory;
|
||||
|
||||
class G4ClonedRichTrajectory : public G4VTrajectory
|
||||
{
|
||||
using G4TrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
|
||||
|
||||
public:
|
||||
// Constructors/destructor
|
||||
//
|
||||
G4ClonedRichTrajectory() = default;
|
||||
~G4ClonedRichTrajectory() override;
|
||||
G4ClonedRichTrajectory(const G4RichTrajectory&);
|
||||
G4ClonedRichTrajectory& operator=(const G4ClonedRichTrajectory&) = delete;
|
||||
|
||||
// Operators
|
||||
//
|
||||
G4bool operator==(const G4ClonedRichTrajectory& r) const { return (this == &r); }
|
||||
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
|
||||
// Get/Set functions
|
||||
|
||||
inline G4int GetTrackID() const override { return fTrackID; }
|
||||
inline G4int GetParentID() const override { return fParentID; }
|
||||
inline G4String GetParticleName() const override { return ParticleName; }
|
||||
inline G4double GetCharge() const override { return PDGCharge; }
|
||||
inline G4int GetPDGEncoding() const override { return PDGEncoding; }
|
||||
inline G4double GetInitialKineticEnergy() const { return initialKineticEnergy; }
|
||||
inline G4ThreeVector GetInitialMomentum() const override { return initialMomentum; }
|
||||
|
||||
// Other (virtual) member functions
|
||||
//
|
||||
void ShowTrajectory(std::ostream& os = G4cout) const override;
|
||||
void DrawTrajectory() const override;
|
||||
void AppendStep(const G4Step* aStep) override;
|
||||
void MergeTrajectory(G4VTrajectory* secondTrajectory) override;
|
||||
inline G4int GetPointEntries() const override;
|
||||
inline G4VTrajectoryPoint* GetPoint(G4int i) const override;
|
||||
|
||||
G4ParticleDefinition* GetParticleDefinition();
|
||||
|
||||
// Get methods for HepRep style attributes
|
||||
//
|
||||
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
|
||||
std::vector<G4AttValue>* CreateAttValues() const override;
|
||||
|
||||
private:
|
||||
//G4TrajectoryPointContainer* positionRecord = nullptr;
|
||||
G4int fTrackID = 0;
|
||||
G4int fParentID = 0;
|
||||
G4int PDGEncoding = 0;
|
||||
G4double PDGCharge = 0.0;
|
||||
G4String ParticleName = "dummy";
|
||||
G4double initialKineticEnergy = 0.0;
|
||||
G4ThreeVector initialMomentum;
|
||||
|
||||
// Extended information (only publicly accessible through AttValues)...
|
||||
//
|
||||
G4TrajectoryPointContainer* fpRichPointContainer = nullptr;
|
||||
G4TouchableHandle fpInitialVolume;
|
||||
G4TouchableHandle fpInitialNextVolume;
|
||||
const G4VProcess* fpCreatorProcess = nullptr;
|
||||
G4int fCreatorModelID = 0;
|
||||
G4TouchableHandle fpFinalVolume;
|
||||
G4TouchableHandle fpFinalNextVolume;
|
||||
const G4VProcess* fpEndingProcess = nullptr;
|
||||
G4double fFinalKineticEnergy = 0.0;
|
||||
};
|
||||
|
||||
extern G4TRACKING_DLL G4Allocator<G4ClonedRichTrajectory>*& aClonedRichTrajectoryAllocator();
|
||||
|
||||
inline void* G4ClonedRichTrajectory::operator new(size_t)
|
||||
{
|
||||
if (aClonedRichTrajectoryAllocator() == nullptr) {
|
||||
aClonedRichTrajectoryAllocator() = new G4Allocator<G4ClonedRichTrajectory>;
|
||||
}
|
||||
return (void*)aClonedRichTrajectoryAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4ClonedRichTrajectory::operator delete(void* aRichTrajectory)
|
||||
{
|
||||
aClonedRichTrajectoryAllocator()->FreeSingle((G4ClonedRichTrajectory*)aRichTrajectory);
|
||||
}
|
||||
|
||||
inline G4int G4ClonedRichTrajectory::GetPointEntries() const
|
||||
{
|
||||
return G4int(fpRichPointContainer->size());
|
||||
}
|
||||
|
||||
inline G4VTrajectoryPoint* G4ClonedRichTrajectory::GetPoint(G4int i) const
|
||||
{
|
||||
return (*fpRichPointContainer)[i];
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedRichTrajectoryPoint
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This class is identical to G4RichTrajectoryPoint class, but uses the
|
||||
// singleton G4Allocator so that the master thread can safely
|
||||
// delete the object instantiated by worker threads in sub-event
|
||||
// parallel mode.
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4ClonedRichTrajectoryPoint_HH
|
||||
#define G4ClonedRichTrajectoryPoint_HH 1
|
||||
|
||||
#include "G4StepStatus.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
#include "globals.hh" // Include from 'global'
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4Track;
|
||||
class G4Step;
|
||||
class G4VProcess;
|
||||
class G4RichTrajectoryPoint;
|
||||
|
||||
class G4ClonedRichTrajectoryPoint : public G4VTrajectoryPoint
|
||||
{
|
||||
public: // without description
|
||||
// Constructors/Destructor
|
||||
//
|
||||
G4ClonedRichTrajectoryPoint() = default;
|
||||
G4ClonedRichTrajectoryPoint(const G4Track*); // For first point.
|
||||
G4ClonedRichTrajectoryPoint(const G4Step*); // For subsequent points.
|
||||
G4ClonedRichTrajectoryPoint(const G4RichTrajectoryPoint& right);
|
||||
~G4ClonedRichTrajectoryPoint() override;
|
||||
|
||||
// Operators
|
||||
//
|
||||
G4ClonedRichTrajectoryPoint& operator=(const G4ClonedRichTrajectoryPoint&) = delete;
|
||||
inline G4bool operator==(const G4ClonedRichTrajectoryPoint& right) const;
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void* aRichTrajectoryPoint);
|
||||
|
||||
// Get/Set functions
|
||||
//
|
||||
|
||||
inline const G4ThreeVector GetPosition() const override { return fPosition; }
|
||||
|
||||
inline const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const override;
|
||||
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
|
||||
std::vector<G4AttValue>* CreateAttValues() const override;
|
||||
|
||||
private:
|
||||
G4ThreeVector fPosition{0., 0., 0.};
|
||||
|
||||
// Extended member data
|
||||
//
|
||||
std::vector<G4ThreeVector>* fpAuxiliaryPointVector = nullptr;
|
||||
G4double fTotEDep = 0.0;
|
||||
G4double fRemainingEnergy = 0.0;
|
||||
const G4VProcess* fpProcess = nullptr;
|
||||
G4StepStatus fPreStepPointStatus = fUndefined;
|
||||
G4StepStatus fPostStepPointStatus = fUndefined;
|
||||
G4double fPreStepPointGlobalTime = 0.0;
|
||||
G4double fPostStepPointGlobalTime = 0.0;
|
||||
G4TouchableHandle fpPreStepPointVolume;
|
||||
G4TouchableHandle fpPostStepPointVolume;
|
||||
G4double fPreStepPointWeight = 0.0;
|
||||
G4double fPostStepPointWeight = 0.0;
|
||||
};
|
||||
|
||||
extern G4TRACKING_DLL G4Allocator<G4ClonedRichTrajectoryPoint>*& aClonedRichTrajectoryPointAllocator();
|
||||
|
||||
inline void* G4ClonedRichTrajectoryPoint::operator new(size_t)
|
||||
{
|
||||
if (aClonedRichTrajectoryPointAllocator() == nullptr) {
|
||||
aClonedRichTrajectoryPointAllocator() = new G4Allocator<G4ClonedRichTrajectoryPoint>;
|
||||
}
|
||||
return (void*)aClonedRichTrajectoryPointAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4ClonedRichTrajectoryPoint::operator delete(void* aRichTrajectoryPoint)
|
||||
{
|
||||
aClonedRichTrajectoryPointAllocator()->FreeSingle((G4ClonedRichTrajectoryPoint*)aRichTrajectoryPoint);
|
||||
}
|
||||
|
||||
inline G4bool G4ClonedRichTrajectoryPoint::operator==(const G4ClonedRichTrajectoryPoint& r) const
|
||||
{
|
||||
return (this == &r);
|
||||
}
|
||||
|
||||
inline const std::vector<G4ThreeVector>* G4ClonedRichTrajectoryPoint::GetAuxiliaryPoints() const
|
||||
{
|
||||
return fpAuxiliaryPointVector;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedSmoothTrajectory
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This class is identical to G4SmoothTrajectory class, but uses the
|
||||
// singleton G4Allocator so that the master thread can safely
|
||||
// delete the object instantiated by worker threads in sub-event
|
||||
// parallel mode. This class object should be instantiated as
|
||||
// a clone of G4SmoothTrajectory object.
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4ClonedSmoothTrajectory_hh
|
||||
#define G4ClonedSmoothTrajectory_hh 1
|
||||
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
|
||||
#include "G4ClonedSmoothTrajectoryPoint.hh" // Include from 'tracking'
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4ios.hh" // Include from 'system'
|
||||
#include "globals.hh" // Include from 'global'
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
#include <stdlib.h> // Include from 'system'
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4Polyline;
|
||||
class G4SmoothTrajectory;
|
||||
|
||||
class G4ClonedSmoothTrajectory : public G4VTrajectory
|
||||
{
|
||||
using G4TrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
|
||||
|
||||
public:
|
||||
// Constructors/Destructor
|
||||
//
|
||||
G4ClonedSmoothTrajectory() = default;
|
||||
G4ClonedSmoothTrajectory(const G4SmoothTrajectory&);
|
||||
~G4ClonedSmoothTrajectory() override;
|
||||
|
||||
// Operators
|
||||
//
|
||||
inline G4bool operator==(const G4ClonedSmoothTrajectory& r) const;
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
|
||||
// Get/Set functions
|
||||
//
|
||||
inline G4int GetTrackID() const override { return fTrackID; }
|
||||
inline G4int GetParentID() const override { return fParentID; }
|
||||
inline G4String GetParticleName() const override { return ParticleName; }
|
||||
inline G4double GetCharge() const override { return PDGCharge; }
|
||||
inline G4int GetPDGEncoding() const override { return PDGEncoding; }
|
||||
inline G4double GetInitialKineticEnergy() const { return initialKineticEnergy; }
|
||||
inline G4ThreeVector GetInitialMomentum() const override { return initialMomentum; }
|
||||
|
||||
// Other member functions
|
||||
//
|
||||
void ShowTrajectory(std::ostream& os = G4cout) const override;
|
||||
void DrawTrajectory() const override;
|
||||
void AppendStep(const G4Step* aStep) override;
|
||||
G4int GetPointEntries() const override { return (G4int)positionRecord->size(); }
|
||||
G4VTrajectoryPoint* GetPoint(G4int i) const override { return (*positionRecord)[i]; }
|
||||
void MergeTrajectory(G4VTrajectory* secondTrajectory) override;
|
||||
|
||||
G4ParticleDefinition* GetParticleDefinition();
|
||||
|
||||
// Get method for HEPRep style attributes
|
||||
//
|
||||
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
|
||||
std::vector<G4AttValue>* CreateAttValues() const override;
|
||||
|
||||
private:
|
||||
G4TrajectoryPointContainer* positionRecord = nullptr;
|
||||
G4int fTrackID = 0;
|
||||
G4int fParentID = 0;
|
||||
G4int PDGEncoding = 0;
|
||||
G4double PDGCharge = 0.0;
|
||||
G4String ParticleName = "";
|
||||
G4double initialKineticEnergy = 0.0;
|
||||
G4ThreeVector initialMomentum;
|
||||
};
|
||||
|
||||
extern G4TRACKING_DLL G4Allocator<G4ClonedSmoothTrajectory>*& aClonedSmoothTrajectoryAllocator();
|
||||
|
||||
inline void* G4ClonedSmoothTrajectory::operator new(size_t)
|
||||
{
|
||||
if (aClonedSmoothTrajectoryAllocator() == nullptr) {
|
||||
aClonedSmoothTrajectoryAllocator() = new G4Allocator<G4ClonedSmoothTrajectory>;
|
||||
}
|
||||
return (void*)aClonedSmoothTrajectoryAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4ClonedSmoothTrajectory::operator delete(void* aTrajectory)
|
||||
{
|
||||
aClonedSmoothTrajectoryAllocator()->FreeSingle((G4ClonedSmoothTrajectory*)aTrajectory);
|
||||
}
|
||||
|
||||
inline G4bool G4ClonedSmoothTrajectory::operator==(const G4ClonedSmoothTrajectory& r) const
|
||||
{
|
||||
return (this == &r);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedSmoothTrajectoryPoint
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This class is identical to G4SmoothTrajectoryPoint class, but uses the
|
||||
// singleton G4Allocator so that the master thread can safely
|
||||
// delete the object instantiated by worker threads in sub-event
|
||||
// parallel mode.
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
#ifndef G4ClonedSmoothTrajectoryPoint_hh
|
||||
#define G4ClonedSmoothTrajectoryPoint_hh 1
|
||||
|
||||
#include "G4Allocator.hh" // Include from 'particle+matter'
|
||||
#include "G4ThreeVector.hh" // Include from 'geometry'
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
#include "G4Threading.hh"
|
||||
#include "globals.hh" // Include from 'global'
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
|
||||
class G4SmoothTrajectoryPoint;
|
||||
|
||||
class G4ClonedSmoothTrajectoryPoint : public G4VTrajectoryPoint
|
||||
{
|
||||
public:
|
||||
G4ClonedSmoothTrajectoryPoint() = default;
|
||||
G4ClonedSmoothTrajectoryPoint(G4ThreeVector pos, std::vector<G4ThreeVector>* auxiliaryPoints);
|
||||
G4ClonedSmoothTrajectoryPoint(const G4SmoothTrajectoryPoint& right);
|
||||
~G4ClonedSmoothTrajectoryPoint() override;
|
||||
|
||||
// Operators
|
||||
//
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void* aTrajectoryPoint);
|
||||
inline G4bool operator==(const G4ClonedSmoothTrajectoryPoint& right) const;
|
||||
|
||||
// Get/Set functions
|
||||
//
|
||||
inline const G4ThreeVector GetPosition() const override { return fPosition; }
|
||||
inline const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const override
|
||||
{
|
||||
return fAuxiliaryPointVector;
|
||||
}
|
||||
|
||||
// Get method for HEPRep style attributes
|
||||
//
|
||||
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
|
||||
std::vector<G4AttValue>* CreateAttValues() const override;
|
||||
|
||||
private:
|
||||
G4ThreeVector fPosition{0., 0., 0.};
|
||||
std::vector<G4ThreeVector>* fAuxiliaryPointVector = nullptr;
|
||||
};
|
||||
|
||||
extern G4TRACKING_DLL G4Allocator<G4ClonedSmoothTrajectoryPoint>*& aClonedSmoothTrajectoryPointAllocator();
|
||||
|
||||
inline void* G4ClonedSmoothTrajectoryPoint::operator new(size_t)
|
||||
{
|
||||
if (aClonedSmoothTrajectoryPointAllocator() == nullptr) {
|
||||
aClonedSmoothTrajectoryPointAllocator() = new G4Allocator<G4ClonedSmoothTrajectoryPoint>;
|
||||
}
|
||||
return (void*)aClonedSmoothTrajectoryPointAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4ClonedSmoothTrajectoryPoint::operator delete(void* aTrajectoryPoint)
|
||||
{
|
||||
aClonedSmoothTrajectoryPointAllocator()->FreeSingle((G4ClonedSmoothTrajectoryPoint*)aTrajectoryPoint);
|
||||
}
|
||||
|
||||
inline G4bool G4ClonedSmoothTrajectoryPoint::operator==(const G4ClonedSmoothTrajectoryPoint& r) const
|
||||
{
|
||||
return (this == &r);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,129 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedTrajectory
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This class is identical to G4Trajectory class, but uses the
|
||||
// singleton G4Allocator so that the master thread can safely
|
||||
// delete the object instantiated by worker threads in sub-event
|
||||
// parallel mode. This class object should be instantiated as
|
||||
// a clone of G4Trajectory object.
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
#ifndef G4ClonedTrajectory_hh
|
||||
#define G4ClonedTrajectory_hh 1
|
||||
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ClonedTrajectoryPoint.hh" // Include from 'tracking'
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4ios.hh" // Include from 'system'
|
||||
#include "globals.hh" // Include from 'global'
|
||||
#include "G4Threading.hh"
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
#include <stdlib.h> // Include from 'system'
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4Polyline;
|
||||
class G4Trajectory;
|
||||
|
||||
class G4ClonedTrajectory : public G4VTrajectory
|
||||
{
|
||||
using G4ClonedTrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
|
||||
|
||||
public:
|
||||
// Constructors/Destructor
|
||||
|
||||
G4ClonedTrajectory() = default;
|
||||
G4ClonedTrajectory(const G4Trajectory&);
|
||||
~G4ClonedTrajectory() override;
|
||||
|
||||
// Operators
|
||||
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
inline G4bool operator==(const G4ClonedTrajectory& r) const;
|
||||
|
||||
// Get/Set functions
|
||||
|
||||
inline G4int GetTrackID() const override { return fTrackID; }
|
||||
inline G4int GetParentID() const override { return fParentID; }
|
||||
inline G4String GetParticleName() const override { return ParticleName; }
|
||||
inline G4double GetCharge() const override { return PDGCharge; }
|
||||
inline G4int GetPDGEncoding() const override { return PDGEncoding; }
|
||||
inline G4double GetInitialKineticEnergy() const { return initialKineticEnergy; }
|
||||
inline G4ThreeVector GetInitialMomentum() const override { return initialMomentum; }
|
||||
|
||||
// Other member functions
|
||||
|
||||
void ShowTrajectory(std::ostream& os = G4cout) const override;
|
||||
void DrawTrajectory() const override;
|
||||
void AppendStep(const G4Step* aStep) override;
|
||||
G4int GetPointEntries() const override { return G4int(positionRecord->size()); }
|
||||
G4VTrajectoryPoint* GetPoint(G4int i) const override { return (*positionRecord)[i]; }
|
||||
void MergeTrajectory(G4VTrajectory* secondTrajectory) override;
|
||||
|
||||
G4ParticleDefinition* GetParticleDefinition();
|
||||
|
||||
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
|
||||
std::vector<G4AttValue>* CreateAttValues() const override;
|
||||
|
||||
private:
|
||||
G4ClonedTrajectoryPointContainer* positionRecord = nullptr;
|
||||
G4int fTrackID = 0;
|
||||
G4int fParentID = 0;
|
||||
G4int PDGEncoding = 0;
|
||||
G4double PDGCharge = 0.0;
|
||||
G4String ParticleName = "dummy";
|
||||
G4double initialKineticEnergy = 0.0;
|
||||
G4ThreeVector initialMomentum;
|
||||
};
|
||||
|
||||
extern G4TRACKING_DLL G4Allocator<G4ClonedTrajectory>*& aClonedTrajectoryAllocator();
|
||||
|
||||
inline void* G4ClonedTrajectory::operator new(size_t)
|
||||
{
|
||||
if (aClonedTrajectoryAllocator() == nullptr) {
|
||||
aClonedTrajectoryAllocator() = new G4Allocator<G4ClonedTrajectory>;
|
||||
}
|
||||
return (void*)aClonedTrajectoryAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4ClonedTrajectory::operator delete(void* aTrajectory)
|
||||
{
|
||||
aClonedTrajectoryAllocator()->FreeSingle((G4ClonedTrajectory*)aTrajectory);
|
||||
}
|
||||
|
||||
inline G4bool G4ClonedTrajectory::operator==(const G4ClonedTrajectory& r) const { return (this == &r); }
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,98 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ClonedTrajectoryPoint
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This class is identical to G4TrajectoryPoint class, but uses the
|
||||
// singleton G4Allocator so that the master thread can safely
|
||||
// delete the object instantiated by worker threads in sub-event
|
||||
// parallel mode.
|
||||
//
|
||||
// Makoto Asai (JLab) - Oct.2024
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
#ifndef G4ClonedTrajectoryPoint_hh
|
||||
#define G4ClonedTrajectoryPoint_hh 1
|
||||
|
||||
#include "G4Allocator.hh" // Include from 'particle+matter'
|
||||
#include "G4ThreeVector.hh" // Include from 'geometry'
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
#include "G4Threading.hh"
|
||||
#include "globals.hh" // Include from 'global'
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
|
||||
class G4TrajectoryPoint;
|
||||
|
||||
class G4ClonedTrajectoryPoint : public G4VTrajectoryPoint
|
||||
{
|
||||
public:
|
||||
// Constructors/Destructor
|
||||
|
||||
G4ClonedTrajectoryPoint() = default;
|
||||
G4ClonedTrajectoryPoint(const G4TrajectoryPoint& right);
|
||||
~G4ClonedTrajectoryPoint() override;
|
||||
|
||||
// Operators
|
||||
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void* aTrajectoryPoint);
|
||||
inline G4bool operator==(const G4ClonedTrajectoryPoint& right) const;
|
||||
|
||||
// Get/Set functions
|
||||
|
||||
inline const G4ThreeVector GetPosition() const override { return fPosition; }
|
||||
|
||||
// Get method for HEPRep style attributes
|
||||
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
|
||||
std::vector<G4AttValue>* CreateAttValues() const override;
|
||||
|
||||
private:
|
||||
G4ThreeVector fPosition{0., 0., 0.};
|
||||
};
|
||||
|
||||
extern G4TRACKING_DLL G4Allocator<G4ClonedTrajectoryPoint>*& aClonedTrajectoryPointAllocator();
|
||||
|
||||
inline void* G4ClonedTrajectoryPoint::operator new(size_t)
|
||||
{
|
||||
if (aClonedTrajectoryPointAllocator() == nullptr) {
|
||||
aClonedTrajectoryPointAllocator() = new G4Allocator<G4ClonedTrajectoryPoint>;
|
||||
}
|
||||
return (void*)aClonedTrajectoryPointAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4ClonedTrajectoryPoint::operator delete(void* aTrajectoryPoint)
|
||||
{
|
||||
aClonedTrajectoryPointAllocator()->FreeSingle((G4ClonedTrajectoryPoint*)aTrajectoryPoint);
|
||||
}
|
||||
|
||||
inline G4bool G4ClonedTrajectoryPoint::operator==(const G4ClonedTrajectoryPoint& right) const
|
||||
{
|
||||
return (this == &right);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -51,13 +51,27 @@
|
||||
#define G4RICHTRAJECTORY_HH
|
||||
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4RichTrajectoryPoint.hh" // Include from 'tracking'
|
||||
#include "G4ios.hh" // Include from 'system'
|
||||
#include "globals.hh" // Include from 'global'
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
#include <stdlib.h> // Include from 'system'
|
||||
|
||||
class G4RichTrajectory : public G4Trajectory
|
||||
#include <vector>
|
||||
|
||||
class G4Polyline;
|
||||
class G4ClonedRichTrajectory;
|
||||
|
||||
class G4RichTrajectory : public G4VTrajectory
|
||||
{
|
||||
using RichTrajectoryPointsContainer = std::vector<G4VTrajectoryPoint*>;
|
||||
using G4TrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
|
||||
|
||||
friend class G4ClonedRichTrajectory;
|
||||
|
||||
public:
|
||||
// Constructors/destructor
|
||||
@@ -75,6 +89,19 @@ class G4RichTrajectory : public G4Trajectory
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
|
||||
// cloning with the master thread allocator
|
||||
G4VTrajectory* CloneForMaster() const override;
|
||||
|
||||
// Get/Set functions
|
||||
|
||||
inline G4int GetTrackID() const override { return fTrackID; }
|
||||
inline G4int GetParentID() const override { return fParentID; }
|
||||
inline G4String GetParticleName() const override { return ParticleName; }
|
||||
inline G4double GetCharge() const override { return PDGCharge; }
|
||||
inline G4int GetPDGEncoding() const override { return PDGEncoding; }
|
||||
inline G4double GetInitialKineticEnergy() const { return initialKineticEnergy; }
|
||||
inline G4ThreeVector GetInitialMomentum() const override { return initialMomentum; }
|
||||
|
||||
// Other (virtual) member functions
|
||||
//
|
||||
void ShowTrajectory(std::ostream& os = G4cout) const override;
|
||||
@@ -84,15 +111,26 @@ class G4RichTrajectory : public G4Trajectory
|
||||
inline G4int GetPointEntries() const override;
|
||||
inline G4VTrajectoryPoint* GetPoint(G4int i) const override;
|
||||
|
||||
G4ParticleDefinition* GetParticleDefinition();
|
||||
|
||||
// Get methods for HepRep style attributes
|
||||
//
|
||||
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
|
||||
std::vector<G4AttValue>* CreateAttValues() const override;
|
||||
|
||||
private:
|
||||
G4TrajectoryPointContainer* positionRecord = nullptr;
|
||||
G4int fTrackID = 0;
|
||||
G4int fParentID = 0;
|
||||
G4int PDGEncoding = 0;
|
||||
G4double PDGCharge = 0.0;
|
||||
G4String ParticleName = "dummy";
|
||||
G4double initialKineticEnergy = 0.0;
|
||||
G4ThreeVector initialMomentum;
|
||||
|
||||
// Extended information (only publicly accessible through AttValues)...
|
||||
//
|
||||
RichTrajectoryPointsContainer* fpRichPointsContainer = nullptr;
|
||||
G4TrajectoryPointContainer* fpRichPointContainer = nullptr;
|
||||
G4TouchableHandle fpInitialVolume;
|
||||
G4TouchableHandle fpInitialNextVolume;
|
||||
const G4VProcess* fpCreatorProcess = nullptr;
|
||||
@@ -120,12 +158,12 @@ inline void G4RichTrajectory::operator delete(void* aRichTrajectory)
|
||||
|
||||
inline G4int G4RichTrajectory::GetPointEntries() const
|
||||
{
|
||||
return G4int(fpRichPointsContainer->size());
|
||||
return G4int(fpRichPointContainer->size());
|
||||
}
|
||||
|
||||
inline G4VTrajectoryPoint* G4RichTrajectory::GetPoint(G4int i) const
|
||||
{
|
||||
return (*fpRichPointsContainer)[i];
|
||||
return (*fpRichPointContainer)[i];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -54,7 +54,11 @@
|
||||
#include "G4StepStatus.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4TrajectoryPoint.hh"
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
#include "globals.hh" // Include from 'global'
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
class G4ClonedRichTrajectoryPoint;
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
|
||||
@@ -64,8 +68,11 @@ class G4Track;
|
||||
class G4Step;
|
||||
class G4VProcess;
|
||||
|
||||
class G4RichTrajectoryPoint : public G4TrajectoryPoint
|
||||
class G4RichTrajectoryPoint : public G4VTrajectoryPoint
|
||||
{
|
||||
|
||||
friend class G4ClonedRichTrajectoryPoint;
|
||||
|
||||
public: // without description
|
||||
// Constructors/Destructor
|
||||
//
|
||||
@@ -84,11 +91,16 @@ class G4RichTrajectoryPoint : public G4TrajectoryPoint
|
||||
|
||||
// Get/Set functions
|
||||
//
|
||||
|
||||
inline const G4ThreeVector GetPosition() const override { return fPosition; }
|
||||
|
||||
inline const std::vector<G4ThreeVector>* GetAuxiliaryPoints() const override;
|
||||
const std::map<G4String, G4AttDef>* GetAttDefs() const override;
|
||||
std::vector<G4AttValue>* CreateAttValues() const override;
|
||||
|
||||
private:
|
||||
G4ThreeVector fPosition{0., 0., 0.};
|
||||
|
||||
// Extended member data
|
||||
//
|
||||
std::vector<G4ThreeVector>* fpAuxiliaryPointVector = nullptr;
|
||||
|
||||
@@ -60,11 +60,14 @@
|
||||
#include <vector>
|
||||
|
||||
class G4Polyline;
|
||||
class G4ClonedSmoothTrajectory;
|
||||
|
||||
class G4SmoothTrajectory : public G4VTrajectory
|
||||
{
|
||||
using G4TrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
|
||||
|
||||
friend class G4ClonedSmoothTrajectory;
|
||||
|
||||
public:
|
||||
// Constructors/Destructor
|
||||
//
|
||||
@@ -80,6 +83,9 @@ class G4SmoothTrajectory : public G4VTrajectory
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
|
||||
// cloning with the master thread allocator
|
||||
G4VTrajectory* CloneForMaster() const override;
|
||||
|
||||
// Get/Set functions
|
||||
//
|
||||
inline G4int GetTrackID() const override { return fTrackID; }
|
||||
|
||||
@@ -45,8 +45,12 @@
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
|
||||
class G4ClonedSmoothTrajectoryPoint;
|
||||
|
||||
class G4SmoothTrajectoryPoint : public G4VTrajectoryPoint
|
||||
{
|
||||
friend class G4ClonedSmoothTrajectoryPoint;
|
||||
|
||||
public:
|
||||
G4SmoothTrajectoryPoint() = default;
|
||||
G4SmoothTrajectoryPoint(G4ThreeVector pos, std::vector<G4ThreeVector>* auxiliaryPoints);
|
||||
|
||||
@@ -135,8 +135,6 @@ inline G4Track* G4TrackingManager::GetTrack() const { return fpTrack; }
|
||||
|
||||
inline G4int G4TrackingManager::GetStoreTrajectory() const { return StoreTrajectory; }
|
||||
|
||||
inline void G4TrackingManager::SetStoreTrajectory(G4int value) { StoreTrajectory = value; }
|
||||
|
||||
inline G4SteppingManager* G4TrackingManager::GetSteppingManager() const
|
||||
{
|
||||
return fpSteppingManager;
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4ios.hh" // Include from 'system'
|
||||
#include "globals.hh" // Include from 'global'
|
||||
#include "G4Threading.hh"
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
#include <stdlib.h> // Include from 'system'
|
||||
@@ -58,11 +59,14 @@
|
||||
#include <vector>
|
||||
|
||||
class G4Polyline;
|
||||
class G4ClonedTrajectory;
|
||||
|
||||
class G4Trajectory : public G4VTrajectory
|
||||
{
|
||||
using G4TrajectoryPointContainer = std::vector<G4VTrajectoryPoint*>;
|
||||
|
||||
friend class G4ClonedTrajectory;
|
||||
|
||||
public:
|
||||
// Constructors/Destructor
|
||||
|
||||
@@ -77,6 +81,9 @@ class G4Trajectory : public G4VTrajectory
|
||||
inline void operator delete(void*);
|
||||
inline G4bool operator==(const G4Trajectory& r) const;
|
||||
|
||||
// cloning with the master thread allocator
|
||||
G4VTrajectory* CloneForMaster() const override;
|
||||
|
||||
// Get/Set functions
|
||||
|
||||
inline G4int GetTrackID() const override { return fTrackID; }
|
||||
@@ -107,7 +114,7 @@ class G4Trajectory : public G4VTrajectory
|
||||
G4int fParentID = 0;
|
||||
G4int PDGEncoding = 0;
|
||||
G4double PDGCharge = 0.0;
|
||||
G4String ParticleName = "";
|
||||
G4String ParticleName = "dummy";
|
||||
G4double initialKineticEnergy = 0.0;
|
||||
G4ThreeVector initialMomentum;
|
||||
};
|
||||
|
||||
@@ -43,9 +43,12 @@
|
||||
#include "globals.hh" // Include from 'global'
|
||||
|
||||
#include "trkgdefs.hh"
|
||||
class G4ClonedTrajectoryPoint;
|
||||
|
||||
class G4TrajectoryPoint : public G4VTrajectoryPoint
|
||||
{
|
||||
friend class G4ClonedTrajectoryPoint;
|
||||
|
||||
public:
|
||||
// Constructors/Destructor
|
||||
|
||||
|
||||
@@ -64,6 +64,11 @@ class G4VTrajectory
|
||||
// Equality operator
|
||||
G4bool operator==(const G4VTrajectory& right) const;
|
||||
|
||||
// Cloning with the master thread allocator
|
||||
// Each concrete class should implement its own method.
|
||||
// This method is used only in the sub-event parallel mode.
|
||||
virtual G4VTrajectory* CloneForMaster() const;
|
||||
|
||||
// Accessors
|
||||
virtual G4int GetTrackID() const = 0;
|
||||
virtual G4int GetParentID() const = 0;
|
||||
|
||||
Reference in New Issue
Block a user