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 // G4LocatorChangeRecord 
0027 //
0028 // Class description: 
0029 //
0030 // Record the 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, 27.08.19 - First version
0034 // --------------------------------------------------------------------
0035 #ifndef G4LOCATOR_CHANGE_RECORD_HH
0036 #define G4LOCATOR_CHANGE_RECORD_HH
0037 
0038 #include <vector>
0039 #include "G4FieldTrack.hh"
0040 
0041 class G4LocatorChangeRecord
0042 {
0043   public:
0044  
0045     enum EChangeLocation { kInvalidCL = 0, kUnknownCL = 1,                // 2
0046                            kInitialisingCL, kIntersectsAF, kIntersectsFB, // 3
0047                            kNoIntersectAForFB,  kRecalculatedB,           // 2
0048                            kInsertingMidPoint,  kRecalculatedBagn,        // 2
0049                            kLevelPop };  
0050  
0051     static const char* fNameChangeLocation[];
0052     static const char* GetNameChangeLocation( EChangeLocation );
0053    
0054     G4LocatorChangeRecord( EChangeLocation codeLocation,
0055                            G4int iter,
0056                            unsigned int count,
0057                            const G4FieldTrack& fieldTrack )
0058         : fCodeLocation( codeLocation), fIteration(iter), fEventCount(count),
0059           fFieldTrack( fieldTrack ) {}
0060     G4LocatorChangeRecord( const G4LocatorChangeRecord &  ) = default;
0061     G4LocatorChangeRecord(       G4LocatorChangeRecord && ) = default;
0062 
0063     // No set methods -> create a new record for each entry (more reliable)
0064     // void SetLocation( EChangeLocation loc ) { fCodeLocation= loc; }
0065     // void SetLength( double len ) { fLength= len; }
0066     // void SetCount( int cnt ) {  fEventCount= cnt; }
0067     // void SetIteration( int iter ) {  fIteration= iter; }
0068 
0069     inline EChangeLocation GetLocation() const { return fCodeLocation; }
0070     inline unsigned int   GetCount()     const { return fEventCount; }
0071     inline G4int          GetIteration() const { return fIteration; }
0072     inline G4double GetLength() const { return fFieldTrack.GetCurveLength(); }
0073    
0074     friend std::ostream& operator<< ( std::ostream& os,
0075                          const G4LocatorChangeRecord& r );
0076       // Streaming operator, using StreamInfo().
0077 
0078     friend std::ostream& operator<< ( std::ostream& os,
0079                          const std::vector<G4LocatorChangeRecord> & vecR );
0080    
0081     std::ostream& StreamInfo(std::ostream& os) const;
0082 
0083     static std::ostream& ReportVector ( std::ostream& os,
0084                          const std::string & nameOfRecord, 
0085                          const std::vector<G4LocatorChangeRecord> & lcr );
0086    
0087     static std::ostream& ReportEndChanges ( std::ostream& os,
0088                          const std::vector<G4LocatorChangeRecord> & startA,
0089                          const std::vector<G4LocatorChangeRecord> & endB );
0090    
0091   private:
0092 
0093     EChangeLocation fCodeLocation = kInvalidCL;
0094     G4int        fIteration  = -1;
0095     unsigned int fEventCount = 0;
0096     G4FieldTrack fFieldTrack;
0097 };
0098 
0099 #endif