#include <EDepSimPersistencyManager.hh>
Public Member Functions | |
PersistencyManager () | |
virtual | ~PersistencyManager () |
virtual G4bool | Store (const G4Event *anEvent) |
stores anEvent and the associated objects into database. More... | |
virtual G4bool | Store (const G4Run *aRun) |
virtual G4bool | Store (const G4VPhysicalVolume *aWorld) |
virtual G4bool | Retrieve (G4Event *&e) |
Retrieve information from a file. These are not implemented. More... | |
virtual G4bool | Retrieve (G4Run *&r) |
virtual G4bool | Retrieve (G4VPhysicalVolume *&w) |
const TG4Event & | GetEventSummary () |
const std::vector< TG4PrimaryVertex > & | GetPrimaries () const |
const std::vector< TG4Trajectory > & | GetTrajectories () const |
const TG4HitSegmentDetectors & | GetSegmentDetectors () const |
virtual G4bool | Open (G4String filename) |
virtual G4bool | Close (void) |
Make sure the output file is closed. More... | |
virtual G4String | GetFilename (void) const |
Return the output file name. More... | |
virtual void | SetLengthThreshold (G4double thresh) |
virtual G4double | GetLengthThreshold () const |
Get the threshold for length in a sensitive detector. More... | |
virtual void | SetGammaThreshold (G4double thresh) |
virtual G4double | GetGammaThreshold () const |
virtual void | SetNeutronThreshold (G4double thresh) |
virtual G4double | GetNeutronThreshold () const |
virtual void | SetTrajectoryPointAccuracy (double acc) |
virtual double | GetTrajectoryPointAccuracy (void) const |
virtual void | SetTrajectoryPointDeposit (double dep) |
virtual double | GetTrajectoryPointDeposit (void) const |
virtual void | SetSaveAllPrimaryTrajectories (bool val) |
virtual bool | GetSaveAllPrimaryTrajectories (void) const |
virtual void | AddTrajectoryBoundary (const G4String &boundary) |
virtual void | ClearTrajectoryBoundaries () |
void | SetDetectorPartition (int partition) |
Set the detector mask. More... | |
int | GetDetectorPartition () const |
Get the detector partition. More... | |
Protected Member Functions | |
void | SetFilename (G4String file) |
void | UpdateSummaries (const G4Event *event) |
Update the event summary fields. More... | |
Protected Attributes | |
TG4Event | fEventSummary |
A summary of the primary vertices in the event. More... | |
Private Types | |
typedef std::map< int, int > | TrackIdMap |
Private Member Functions | |
void | SummarizePrimaries (std::vector< TG4PrimaryVertex > &primaries, const G4PrimaryVertex *event) |
void | SummarizeTrajectories (std::vector< TG4Trajectory > &trajectories, const G4Event *event) |
Fill the trajectory container. More... | |
void | MarkTrajectories (const G4Event *event) |
Mark the G4 Trajectories that should be saved. More... | |
void | SummarizeSegmentDetectors (TG4HitSegmentDetectors &segmentDetectors, const G4Event *event) |
sensitive detector. More... | |
void | SummarizeHitSegments (std::vector< TG4HitSegment > &segments, G4VHitsCollection *hits) |
Fill a container of hit segments. More... | |
void | CopyHitContributors (std::vector< int > &dest, const std::vector< int > &src) |
void | CopyTrajectoryPoints (TG4Trajectory &traj, G4VTrajectory *g4Traj) |
double | FindTrajectoryAccuracy (G4VTrajectory *traj, int point1, int point2) |
int | SplitTrajectory (G4VTrajectory *traj, int point1, int point2) |
void | SelectTrajectoryPoints (std::vector< int > &selected, G4VTrajectory *g4Traj) |
bool | SaveTrajectoryBoundary (G4VTrajectory *g4Traj, G4StepStatus status, G4String currentVolume, G4String prevVolume) |
Private Attributes | |
TrackIdMap | fTrackIdMap |
G4String | fFilename |
The filename of the output file. More... | |
G4double | fLengthThreshold |
G4double | fGammaThreshold |
G4double | fNeutronThreshold |
The threshold momentum below which a neutron will be rejected. More... | |
double | fTrajectoryPointAccuracy |
double | fTrajectoryPointDeposit |
bool | fSaveAllPrimaryTrajectories |
std::vector< TPRegexp * > | fTrajectoryBoundaries |
int | fDetectorPartition |
The detector partition. More... | |
EDepSim::PersistencyMessenger * | fPersistencyMessenger |
Definition at line 44 of file EDepSimPersistencyManager.hh.
|
private |
The mapping between the internal G4 TrackID number and the external TrackId number. The G4 TrackID value is based on the order that the particle is placed onto the stack, not all TrackID value exist and the ordering in the vector is not monotonic. The external TrackId is the same as the location of the trajectory in the output array and can be used as an index so parent trajectories are "easy" to find. This is filled in SummarizeTrajectories, and used to remap TrackId in other methods.
Definition at line 274 of file EDepSimPersistencyManager.hh.
EDepSim::PersistencyManager::PersistencyManager | ( | ) |
Creates a root persistency manager. Through the "magic" of G4VPersistencyManager the ultimate base class, this declared to the G4 persistency management system. You can only have one active persistency class at any give moment.
Definition at line 45 of file EDepSimPersistencyManager.cc.
|
virtual |
Definition at line 55 of file EDepSimPersistencyManager.cc.
|
virtual |
Add a regular expression to define a volume boundary at which a trajectory point should be saved. The volume names are defined by the constructors which built the volume. Most of the names can be found by looking at the geant command list. The names are not the same as the root volume names.
Definition at line 94 of file EDepSimPersistencyManager.cc.
|
virtual |
Clear the list of volume boundaries which will cause a trajectory point to be saved.
Definition at line 99 of file EDepSimPersistencyManager.cc.
|
virtual |
Make sure the output file is closed.
Make sure the output file is closed. This is used to make sure that any information being summarized has been saved.
Reimplemented in EDepSim::RootPersistencyManager.
Definition at line 67 of file EDepSimPersistencyManager.cc.
|
private |
Fill the map of sensitive detectors which use hit segments as the Copy and map the contributing trajectories from the vector of contributors for the EDepSim::HitSegment into the vector of contributors for the TG4HitSegment.
Definition at line 537 of file EDepSimPersistencyManager.cc.
|
private |
Copy the trajectory points into the trajectory summary. This uses SelectTrajectoryPoints to pick out the points that should appear in the summary.
Definition at line 452 of file EDepSimPersistencyManager.cc.
|
private |
Find the maximum deviation of a trajectory point from the interpolated path between point 1 and point 2
Definition at line 573 of file EDepSimPersistencyManager.cc.
|
inline |
Get the detector partition.
Definition at line 194 of file EDepSimPersistencyManager.hh.
const TG4Event& EDepSim::PersistencyManager::GetEventSummary | ( | ) |
A public accessor to the summarized event. The primaries are summarized during by a call to UpdateSummaries. The EDepSim::PersistencyManager::Store(event) method is called from G4RunManager::AnalyzeEvent and will call the UpdateSummaries() method. Alternatively, the UpdateSummarize method can be called by a method of a derived class (e.g. in its Store method). The fEventSummary field is protected so derived classes can directly access it.
|
inlinevirtual |
Return the output file name.
Definition at line 98 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Get the momentum threshold required to save a gamma-ray as a trajectory. Gamma rays are rejected if the gamma-ray momentum is below either GetGammaThreshold() or GetMomentumThreshold().
Definition at line 119 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Get the threshold for length in a sensitive detector.
Definition at line 108 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Get the momentum threshold required to save a neutron as a trajectory.
Definition at line 129 of file EDepSimPersistencyManager.hh.
const std::vector<TG4PrimaryVertex>& EDepSim::PersistencyManager::GetPrimaries | ( | ) | const |
A public accessor to the summarized primaries. The primaries are summarized during by a call to UpdateSummaries. The EDepSim::PersistencyManager::Store(event) method is called from G4RunManager::AnalyzeEvent and will call the UpdateSummaries() method. Alternatively, the UpdateSummarize method can be called by a method of a derived class (e.g. in its Store method).
|
inlinevirtual |
Get the flag to save primary particle trajectories. If this flag is true, then the trajectories for primary particles are saved even if they don't ultimately cause an energy deposition in a sensitive detector. If this flag is false, the trajectories for primary particles are only saved if they, or one of their children, deposit energy in a sensitive detector.
Definition at line 175 of file EDepSimPersistencyManager.hh.
const TG4HitSegmentDetectors& EDepSim::PersistencyManager::GetSegmentDetectors | ( | ) | const |
A public accessor to the summarized hit segment detectors. See the documentation for the GetPrimaries() method.
const std::vector<TG4Trajectory>& EDepSim::PersistencyManager::GetTrajectories | ( | ) | const |
A public accessor to the summarized trajectories. See the documentation for the GetPrimaries() method.
|
inlinevirtual |
Get the required trajectory accuracy. Trajectory points are saved so that the interpolated position of a trajectory is never more than this distance from the unsaved points.
Definition at line 141 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Get the minimum energy deposition for which a trajectory point will be saved. This is the trajectory point process deposition (GetProcessDeposit()).
Definition at line 155 of file EDepSimPersistencyManager.hh.
|
private |
Mark the G4 Trajectories that should be saved.
Definition at line 324 of file EDepSimPersistencyManager.cc.
|
virtual |
Open the output (ie database) file. This is used by the persistency messenger to open files using the G4 macro language. It can be an empty method.
Reimplemented in EDepSim::RootPersistencyManager.
Definition at line 60 of file EDepSimPersistencyManager.cc.
|
inlinevirtual |
Retrieve information from a file. These are not implemented.
Reimplemented in EDepSim::RootPersistencyManager.
Definition at line 59 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Reimplemented in EDepSim::RootPersistencyManager.
Definition at line 60 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Reimplemented in EDepSim::RootPersistencyManager.
Definition at line 61 of file EDepSimPersistencyManager.hh.
|
private |
Return true if a trajectory point should be saved. The decision is based on the stepping status (must be fGeomBoundary), the current and the previous volume name (one must match a trajectory boundary regexp, the other must not).
Definition at line 108 of file EDepSimPersistencyManager.cc.
|
private |
Fill a vector with the indices of trajectory points that should be copied to the output file.
Definition at line 619 of file EDepSimPersistencyManager.cc.
|
inline |
Set the detector mask.
Definition at line 191 of file EDepSimPersistencyManager.hh.
|
inlineprotected |
Set the output filename. This can be used by the derived classes to inform the base class of the output file name.
Definition at line 199 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Set the momentum threshold required to save a gamma-ray as a trajectory.
Definition at line 112 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Set the threshold for length in a sensitive detector above which a trajectory will be saved. If a trajectory created this much track inside a sensitive detector, then it is saved.
Definition at line 103 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Set the momentum threshold required to save a neutron as a trajectory.
Definition at line 123 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Set the flag to save primary particle trajectories. If this flag is true, then the trajectories for primary particles are saved even if they don't ultimately cause an energy deposition in a sensitive detector. If this flag is false, the trajectories for primary particles are only saved if they, or one of their children, deposit energy in a sensitive detector.
Definition at line 165 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Get the required trajectory accuracy. Trajectory points are saved so that the interpolated position of a trajectory is never more than this distance from the unsaved points.
Definition at line 134 of file EDepSimPersistencyManager.hh.
|
inlinevirtual |
Get the minimum energy deposition for which a trajectory point will be saved. This is the trajectory point process deposition (GetProcessDeposit()).
Definition at line 148 of file EDepSimPersistencyManager.hh.
|
private |
Save another trajectory point between point 1 and point to optimize the trajectory accuracy.
Definition at line 595 of file EDepSimPersistencyManager.cc.
|
virtual |
stores anEvent and the associated objects into database.
Reimplemented in EDepSim::RootPersistencyManager.
Definition at line 73 of file EDepSimPersistencyManager.cc.
|
virtual |
Reimplemented in EDepSim::RootPersistencyManager.
Definition at line 79 of file EDepSimPersistencyManager.cc.
|
virtual |
Reimplemented in EDepSim::RootPersistencyManager.
Definition at line 87 of file EDepSimPersistencyManager.cc.
|
private |
Fill a container of hit segments.
Definition at line 510 of file EDepSimPersistencyManager.cc.
|
private |
Definition at line 158 of file EDepSimPersistencyManager.cc.
|
private |
sensitive detector.
Definition at line 486 of file EDepSimPersistencyManager.cc.
|
private |
Fill the trajectory container.
Rewrite the track ids so that they are consecutive.
Definition at line 224 of file EDepSimPersistencyManager.cc.
|
protected |
Update the event summary fields.
Definition at line 135 of file EDepSimPersistencyManager.cc.
|
private |
The detector partition.
Definition at line 311 of file EDepSimPersistencyManager.hh.
|
protected |
A summary of the primary vertices in the event.
Definition at line 207 of file EDepSimPersistencyManager.hh.
|
private |
The filename of the output file.
Definition at line 278 of file EDepSimPersistencyManager.hh.
|
private |
Threshold momentum above which gamma-ray trajectories are written. Gamma-rays are rejected if the momentum is less than either fGammaThreshold or fMomentumThreshold.
Definition at line 287 of file EDepSimPersistencyManager.hh.
|
private |
If a trajectory left this much track in a sensitive detector then it should be saved.
Definition at line 282 of file EDepSimPersistencyManager.hh.
|
private |
The threshold momentum below which a neutron will be rejected.
Definition at line 290 of file EDepSimPersistencyManager.hh.
|
private |
Definition at line 314 of file EDepSimPersistencyManager.hh.
|
private |
Flag to determine if all primary trajectories are saved, or only those that ultimately create energy in a sensitive detector. The primary particles are always saved.
Definition at line 304 of file EDepSimPersistencyManager.hh.
|
private |
Definition at line 275 of file EDepSimPersistencyManager.hh.
|
private |
A list of detectors for which trajectory points should be saved as particles enter and exit.
Definition at line 308 of file EDepSimPersistencyManager.hh.
|
private |
The maximum distance between the interpolated trajectory position and an unsaved trajectory point.
Definition at line 294 of file EDepSimPersistencyManager.hh.
|
private |
The minimum energy for the trajectory point process deposit (GetProcessDeposit()) to be saved. Points with less than this energy are not selected.
Definition at line 299 of file EDepSimPersistencyManager.hh.