Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:36

0001 #pragma once
0002 
0003 #include <string>
0004 #include <cstring>
0005 #include <sstream>
0006 #include <iomanip>
0007 
0008 #include "geomdefs.hh"
0009 #include "G4ThreeVector.hh"
0010 
0011 struct sfmt
0012 {
0013     static std::string Format(double v, int w=10) ; 
0014     static std::string Format(const G4ThreeVector* v); 
0015 }; 
0016 
0017 
0018 inline std::string sfmt::Format(double v, int w)
0019 {
0020     std::stringstream ss ;    
0021     if( v == kInfinity ) 
0022     {   
0023         ss << std::setw(w) << "kInfinity" ; 
0024     }   
0025     else
0026     {   
0027         ss << std::setw(w) << std::fixed << std::setprecision(4) << v ; 
0028     }   
0029     std::string str = ss.str(); 
0030     return str ; 
0031 }
0032 
0033 inline std::string sfmt::Format(const G4ThreeVector* v)
0034 {
0035     std::stringstream ss ;    
0036     ss << *v ; 
0037     std::string str = ss.str(); 
0038     return str ; 
0039 }
0040 
0041