Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:38

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, 04.09.19 - First version
0034 // --------------------------------------------------------------------
0035 #ifndef G4LOCATOR_CHANGE_LOGGER_HH
0036 #define G4LOCATOR_CHANGE_LOGGER_HH
0037 
0038 #include <vector>
0039 #include "G4LocatorChangeRecord.hh"
0040 #include "G4FieldTrack.hh"
0041 
0042 class G4LocatorChangeLogger : public std::vector<G4LocatorChangeRecord>
0043 {
0044   public:
0045 
0046     G4LocatorChangeLogger( const std::string& name ) : fName(name) {}
0047 
0048     void AddRecord(       G4LocatorChangeRecord && chngRecord );
0049     void AddRecord( const G4LocatorChangeRecord &  chngRecord );
0050 
0051     // Create a new record with full information
0052     inline
0053     void AddRecord( G4LocatorChangeRecord::EChangeLocation codeLocation,
0054                     G4int             iter,
0055                     unsigned int    count,
0056                     const G4FieldTrack &  fieldTrack );
0057 
0058     friend std::ostream& operator << ( std::ostream& os,
0059                          const G4LocatorChangeLogger& logR );
0060     std::ostream& StreamInfo(std::ostream& os) const;
0061 
0062     static std::ostream& ReportEndChanges ( std::ostream& os,
0063                                             const G4LocatorChangeLogger& startA,
0064                                             const G4LocatorChangeLogger& endB );
0065       // Print the changes in start, end points in columns
0066       // One event per row
0067 
0068   private:
0069 
0070     const std::string  fName;
0071 };
0072 
0073 // --------------
0074 // Inline methods
0075 // --------------
0076 
0077 void G4LocatorChangeLogger::
0078 AddRecord( G4LocatorChangeRecord::EChangeLocation codeLocation,
0079            G4int iter, unsigned int count,
0080            const G4FieldTrack &  fieldTrack )
0081 {
0082   this->push_back(G4LocatorChangeRecord(codeLocation, iter, count, fieldTrack));
0083 }
0084 
0085 inline   
0086 void G4LocatorChangeLogger::
0087 AddRecord( const G4LocatorChangeRecord& chngRecord )
0088 {
0089   this->push_back( chngRecord );
0090 }
0091 
0092 inline
0093 void G4LocatorChangeLogger::
0094 AddRecord( G4LocatorChangeRecord && chngRecord )
0095 {
0096   this->push_back( chngRecord );
0097 }
0098    
0099 #endif