Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:09:20

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 // G4LocatorChangeLogger
0027 //
0028 // Class description: 
0029 //
0030 // Aggregate the records of changes in an endpoint of a locator.
0031 // Its key use is in playing these back in case of a problem.
0032 
0033 // Author: John Apostolakis (CERN), 04 September 2019
0034 // --------------------------------------------------------------------
0035 #ifndef G4LOCATOR_CHANGE_LOGGER_HH
0036 #define G4LOCATOR_CHANGE_LOGGER_HH 1
0037 
0038 #include <vector>
0039 #include "G4LocatorChangeRecord.hh"
0040 #include "G4FieldTrack.hh"
0041 
0042 /**
0043  * @brief G4LocatorChangeLogger aggregates the records of changes in an
0044  * endpoint of a locator. Its key use is in playing these back in case of
0045  * a problem.
0046  */
0047 
0048 class G4LocatorChangeLogger : public std::vector<G4LocatorChangeRecord>
0049 {
0050   public:
0051 
0052     /**
0053      * Constructor.
0054      */
0055     G4LocatorChangeLogger( const std::string& name );
0056 
0057     /**
0058      * Move or add a record.
0059      */
0060     inline void AddRecord(       G4LocatorChangeRecord && chngRecord );
0061     inline void AddRecord( const G4LocatorChangeRecord &  chngRecord );
0062 
0063     /**
0064      * Create a new record with full information.
0065      */
0066     inline void AddRecord( G4LocatorChangeRecord::EChangeLocation codeLocation,
0067                            G4int iter, unsigned int count,
0068                            const G4FieldTrack& fieldTrack );
0069 
0070     /**
0071      * Streaming operator dumping record.
0072      */
0073     friend std::ostream& operator << ( std::ostream& os,
0074                          const G4LocatorChangeLogger& logR );
0075 
0076     /**
0077      * Streams object contents to an output stream.
0078      */
0079     std::ostream& StreamInfo(std::ostream& os) const;
0080 
0081     /**
0082      * Prints the changes in start, end points in columns. One event per row.
0083      */
0084     static std::ostream& ReportEndChanges ( std::ostream& os,
0085                                             const G4LocatorChangeLogger& startA,
0086                                             const G4LocatorChangeLogger& endB );
0087 
0088   private:
0089 
0090     const std::string fName;
0091 };
0092 
0093 // --------------------------------------------------------------------
0094 // Inline methods
0095 // --------------------------------------------------------------------
0096 
0097 void G4LocatorChangeLogger::
0098 AddRecord( G4LocatorChangeRecord::EChangeLocation codeLocation,
0099            G4int iter, unsigned int count,
0100            const G4FieldTrack &  fieldTrack )
0101 {
0102   push_back(G4LocatorChangeRecord(codeLocation, iter, count, fieldTrack));
0103 }
0104 
0105 inline   
0106 void G4LocatorChangeLogger::
0107 AddRecord( const G4LocatorChangeRecord& chngRecord )
0108 {
0109   push_back( chngRecord );
0110 }
0111 
0112 inline
0113 void G4LocatorChangeLogger::
0114 AddRecord( G4LocatorChangeRecord && chngRecord )
0115 {
0116   push_back( chngRecord );
0117 }
0118    
0119 #endif