Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4LocatorChangeLogger.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4LocatorChangeLogger
27//
28// Class description:
29//
30// Aggregate the records of changes in an endpoint of a locator.
31// Its key use is in playing these back in case of a problem.
32
33// Author: John Apostolakis (CERN), 04 September 2019
34// --------------------------------------------------------------------
35#ifndef G4LOCATOR_CHANGE_LOGGER_HH
36#define G4LOCATOR_CHANGE_LOGGER_HH 1
37
38#include <vector>
40#include "G4FieldTrack.hh"
41
42/**
43 * @brief G4LocatorChangeLogger aggregates the records of changes in an
44 * endpoint of a locator. Its key use is in playing these back in case of
45 * a problem.
46 */
47
48class G4LocatorChangeLogger : public std::vector<G4LocatorChangeRecord>
49{
50 public:
51
52 /**
53 * Constructor.
54 */
55 G4LocatorChangeLogger( const std::string& name );
56
57 /**
58 * Move or add a record.
59 */
60 inline void AddRecord( G4LocatorChangeRecord && chngRecord );
61 inline void AddRecord( const G4LocatorChangeRecord & chngRecord );
62
63 /**
64 * Create a new record with full information.
65 */
66 inline void AddRecord( G4LocatorChangeRecord::EChangeLocation codeLocation,
67 G4int iter, unsigned int count,
68 const G4FieldTrack& fieldTrack );
69
70 /**
71 * Streaming operator dumping record.
72 */
73 friend std::ostream& operator << ( std::ostream& os,
74 const G4LocatorChangeLogger& logR );
75
76 /**
77 * Streams object contents to an output stream.
78 */
79 std::ostream& StreamInfo(std::ostream& os) const;
80
81 /**
82 * Prints the changes in start, end points in columns. One event per row.
83 */
84 static std::ostream& ReportEndChanges ( std::ostream& os,
85 const G4LocatorChangeLogger& startA,
86 const G4LocatorChangeLogger& endB );
87
88 private:
89
90 const std::string fName;
91};
92
93// --------------------------------------------------------------------
94// Inline methods
95// --------------------------------------------------------------------
96
99 G4int iter, unsigned int count,
100 const G4FieldTrack & fieldTrack )
101{
102 push_back(G4LocatorChangeRecord(codeLocation, iter, count, fieldTrack));
103}
104
105inline
107AddRecord( const G4LocatorChangeRecord& chngRecord )
108{
109 push_back( chngRecord );
110}
111
112inline
114AddRecord( G4LocatorChangeRecord && chngRecord )
115{
116 push_back( chngRecord );
117}
118
119#endif
int G4int
Definition G4Types.hh:85
G4FieldTrack defines a data structure bringing together a magnetic track's state (position,...
std::ostream & StreamInfo(std::ostream &os) const
friend std::ostream & operator<<(std::ostream &os, const G4LocatorChangeLogger &logR)
G4LocatorChangeLogger(const std::string &name)
void AddRecord(G4LocatorChangeRecord &&chngRecord)
static std::ostream & ReportEndChanges(std::ostream &os, const G4LocatorChangeLogger &startA, const G4LocatorChangeLogger &endB)
G4LocatorChangeRecord records the changes in an endpoint of a locator. Its key use is in playing thes...