Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-03 09:09:05

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 (CERN), 27 August 2019
0034 // --------------------------------------------------------------------
0035 #ifndef G4LOCATOR_CHANGE_RECORD_HH
0036 #define G4LOCATOR_CHANGE_RECORD_HH 1
0037 
0038 #include <vector>
0039 #include "G4FieldTrack.hh"
0040 
0041 /**
0042  * @brief G4LocatorChangeRecord records the changes in an endpoint of a locator.
0043  * Its key use is in playing these back in case of a problem.
0044  */
0045 
0046 class G4LocatorChangeRecord
0047 {
0048   public:
0049  
0050     enum EChangeLocation { kInvalidCL = 0, kUnknownCL = 1,                // 2
0051                            kInitialisingCL, kIntersectsAF, kIntersectsFB, // 3
0052                            kNoIntersectAForFB,  kRecalculatedB,           // 2
0053                            kInsertingMidPoint,  kRecalculatedBagn,        // 2
0054                            kLevelPop };  
0055  
0056     /**
0057      * Constructor.
0058      */
0059     G4LocatorChangeRecord( EChangeLocation codeLocation,
0060                            G4int iter,
0061                            unsigned int count,
0062                            const G4FieldTrack& fieldTrack );
0063 
0064     /**
0065      * Default copy and move constructors.
0066      */
0067     G4LocatorChangeRecord( const G4LocatorChangeRecord &  ) = default;
0068     G4LocatorChangeRecord(       G4LocatorChangeRecord && ) = default;
0069 
0070     // No set methods -> create a new record for each entry (more reliable)
0071 
0072     /**
0073      * Accessors.
0074      */
0075     inline EChangeLocation GetLocation() const { return fCodeLocation; }
0076     inline unsigned int   GetCount()     const { return fEventCount; }
0077     inline G4int          GetIteration() const { return fIteration; }
0078     inline G4double GetLength() const { return fFieldTrack.GetCurveLength(); }
0079    
0080     /**
0081      * Streaming operators, using StreamInfo().
0082      */
0083     friend std::ostream& operator<< ( std::ostream& os,
0084                          const G4LocatorChangeRecord& r );
0085     friend std::ostream& operator<< ( std::ostream& os,
0086                          const std::vector<G4LocatorChangeRecord> & vecR );
0087 
0088     /**
0089      * Streams object contents to an output stream.
0090      */
0091     std::ostream& StreamInfo(std::ostream& os) const;
0092 
0093     static std::ostream& ReportVector ( std::ostream& os,
0094                          const std::string & nameOfRecord, 
0095                          const std::vector<G4LocatorChangeRecord> & lcr );
0096    
0097     static std::ostream& ReportEndChanges ( std::ostream& os,
0098                          const std::vector<G4LocatorChangeRecord> & startA,
0099                          const std::vector<G4LocatorChangeRecord> & endB );
0100    
0101     static const char* GetNameChangeLocation( EChangeLocation );
0102    
0103   private:
0104 
0105     static const char* fNameChangeLocation[];
0106     EChangeLocation fCodeLocation = kInvalidCL;
0107     G4int        fIteration  = -1;
0108     unsigned int fEventCount = 0;
0109     G4FieldTrack fFieldTrack;
0110 };
0111 
0112 #endif