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 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/geometry/vecGeomNavigation/src/VG01SteppingVerboseWithDir.cc (Version 11.3.0) and /examples/extended/geometry/vecGeomNavigation/src/VG01SteppingVerboseWithDir.cc (Version 11.2.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // s                                           <<  26 //s
 27 /// \file VG01SteppingVerboseWithDir.cc            27 /// \file VG01SteppingVerboseWithDir.cc
 28 /// \brief Implementation of the VG01SteppingV     28 /// \brief Implementation of the VG01SteppingVerboseWithDir class
 29                                                    29 
 30 // Author : J. Apostolakis,  (EP/SFT CERN)  20     30 // Author : J. Apostolakis,  (EP/SFT CERN)  2019-21
 31 //                                                 31 //
 32 //  Refines the existing G4SteppingVerbose, ad     32 //  Refines the existing G4SteppingVerbose, adding:
 33 //   - direction of particle                       33 //   - direction of particle
 34 //   - safety (at step's start point)              34 //   - safety (at step's start point)
 35                                                    35 
 36 #include "VG01SteppingVerboseWithDir.hh"           36 #include "VG01SteppingVerboseWithDir.hh"
 37                                                << 
 38 #include "G4SteppingManager.hh"                    37 #include "G4SteppingManager.hh"
                                                   >>  38 
 39 #include "G4UnitsTable.hh"                         39 #include "G4UnitsTable.hh"
 40                                                    40 
 41 //....oooOO0OOooo........oooOO0OOooo........oo     41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 42                                                    42 
 43 VG01SteppingVerboseWithDir::VG01SteppingVerbos <<  43 VG01SteppingVerboseWithDir::VG01SteppingVerboseWithDir()
                                                   >>  44   : G4SteppingVerbose()
                                                   >>  45 {}
 44                                                    46 
 45 //....oooOO0OOooo........oooOO0OOooo........oo     47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 46                                                    48 
 47 VG01SteppingVerboseWithDir::~VG01SteppingVerbo <<  49 VG01SteppingVerboseWithDir::~VG01SteppingVerboseWithDir()
                                                   >>  50 {}
 48                                                    51 
 49 //....oooOO0OOooo........oooOO0OOooo........oo     52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 50                                                    53 
 51 void VG01SteppingVerboseWithDir::Banner()          54 void VG01SteppingVerboseWithDir::Banner()
 52 {                                                  55 {
 53   G4cout << G4endl;                            <<  56       G4cout << G4endl;
 54   G4cout << std::setw(5) << "Step#"            <<  57       G4cout << std::setw( 5) << "Step#"     << " "
 55          << " " << std::setw(9) << "X (mm)"    <<  58              << std::setw( 9) << "X (mm)"          << " "
 56          << " " << std::setw(9) << "Y (mm)"    <<  59              << std::setw( 9) << "Y (mm)"          << " "
 57          << " " << std::setw(9) << "Z (mm)"    <<  60              << std::setw( 9) << "Z (mm)"          << " "
 58          << " " << std::setw(11) << "Ek (MeV)" <<  61              << std::setw(11) << "Ek (MeV)"     << " "
 59          << " " << std::setw(8) << "dE (MeV)"  <<  62              << std::setw( 8) << "dE (MeV)"     << " "
 60          << " " << std::setw(7) << "Step(mm)"  <<  63              << std::setw( 7) << "Step(mm)"   << " "
 61          << " " << std::setw(12) << "Track(mm) <<  64              << std::setw(12) << "Track(mm)"   << " "
 62          << " " << std::setw(7) << "Safety(mm) <<  65              << std::setw( 7) << "Safety(mm)" << " | "
 63          << " | " << std::setw(11) << " Dir.x  <<  66              << std::setw(11) << " Dir.x " << " "
 64          << " " << std::setw(11) << " Dir.y "  <<  67              << std::setw(11) << " Dir.y " << " "
 65          << " " << std::setw(11) << " Dir.z "  <<  68              << std::setw(11) << " Dir.z " << " | "
 66          << " | " << std::setw(15) << "Materia <<  69              << std::setw(15) << "Material"
 67          << "NextVolu" << G4endl;              <<  70              << std::setw(14) << "Process"
                                                   >>  71              << std::setw(15) << "NextVolu"
                                                   >>  72              << G4endl;
 68 }                                                  73 }
 69                                                    74 
 70 //....oooOO0OOooo........oooOO0OOooo........oo     75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 71                                                    76 
 72 void VG01SteppingVerboseWithDir::StepInfo()        77 void VG01SteppingVerboseWithDir::StepInfo()
 73 {                                                  78 {
 74   CopyState();                                     79   CopyState();
 75                                                <<  80   
 76   G4int prec = G4cout.precision(6);                81   G4int prec = G4cout.precision(6);
 77                                                <<  82   
 78   if (verboseLevel >= 1) {                     <<  83   if( verboseLevel >= 1 ){
 79     if (verboseLevel >= 4) VerboseTrack();     <<  84     if( verboseLevel >= 4 ) VerboseTrack();
 80     if (verboseLevel >= 3) {                   <<  85     if( verboseLevel >= 3 ){ Banner(); }
 81       Banner();                                <<  86 
 82     }                                          <<  87     G4cout << std::setw( 5)<<fTrack->GetCurrentStepNumber() << " "
 83                                                <<  88            << std::setw( 9)<<fTrack->GetPosition().x() / CLHEP::mm << " "
 84     G4cout << std::setw(5) << fTrack->GetCurre <<  89            << std::setw( 9)<<fTrack->GetPosition().y() / CLHEP::mm << " "
 85            << fTrack->GetPosition().x() / CLHE <<  90            << std::setw( 9)<<fTrack->GetPosition().z() / CLHEP::mm << " " // << " Ek  = "
 86            << fTrack->GetPosition().y() / CLHE <<  91            << std::setw(11)<<fTrack->GetKineticEnergy() / CLHEP::MeV << " ";
 87            << fTrack->GetPosition().z() / CLHE << 
 88            << std::setw(11) << fTrack->GetKine << 
 89     G4cout.precision(3);                           92     G4cout.precision(3);
 90     G4cout << std::setw(8) << fStep->GetTotalE <<  93     G4cout << std::setw( 8)<<fStep->GetTotalEnergyDeposit() / CLHEP::MeV << " "
 91            << fStep->GetStepLength() / CLHEP:: <<  94            << std::setw( 7)<<fStep->GetStepLength() / CLHEP::mm << " ";
 92     G4cout.precision(6);                       <<  95     G4cout.precision(6);       
 93     G4cout << std::setw(12) << fTrack->GetTrac <<  96     G4cout << std::setw(12)<<fTrack->GetTrackLength() / CLHEP::mm << " ";
 94                                                <<  97     
 95     G4cout.precision(5);                           98     G4cout.precision(5);
 96     G4StepPoint* preStepPt = fTrack->GetStep() <<  99     G4StepPoint* preStepPt= fTrack->GetStep()->GetPreStepPoint();
 97     if (preStepPt != nullptr) {                << 100     if( preStepPt != nullptr ) {
 98       G4double safety = preStepPt->GetSafety() << 101        G4double safety = preStepPt->GetSafety();
 99       G4cout << std::setw(8) << ((safety > 1.0 << 102        G4cout  << std::setw( 8) << ( (safety > 1.0e-9) ? safety : 0.0 ) << " ";
100     }                                          << 103     } else {
101     else {                                     << 104        G4cout  << std::setw( 8) << "-0.0_(N/A)" << " ";
102       G4cout << std::setw(8) << "-0.0_(N/A)"   << 
103              << " ";                           << 
104     }                                             105     }
105                                                   106 
106     G4cout << "| ";                            << 
107     G4cout << std::setw(11) << fTrack->GetMome << 
108            << fTrack->GetMomentumDirection().y << 
109            << fTrack->GetMomentumDirection().z << 
110                                                   107 
                                                   >> 108     G4cout << "| ";
                                                   >> 109     G4cout << std::setw(11)<<fTrack->GetMomentumDirection().x() << " "
                                                   >> 110            << std::setw(11)<<fTrack->GetMomentumDirection().y() << " "
                                                   >> 111            << std::setw(11)<<fTrack->GetMomentumDirection().z() << " | ";
                                                   >> 112     
111     G4cout << std::setw(15) << fTrack->GetMate    113     G4cout << std::setw(15) << fTrack->GetMaterial()->GetName() << " ";
112     G4VProcess const* pds = fStep->GetPostStep << 114     G4VProcess const* pds= fStep->GetPostStepPoint()->GetProcessDefinedStep();
113     G4cout << std::setw(14) << ((pds != nullpt << 115     G4cout << std::setw(14) << ( ( pds != nullptr) ? pds->GetProcessName() :
114            << " ";                             << 116                                                      G4String( "User Limit") ) <<  " ";
115     // if( fStepStatus != fWorldBoundary){     << 117     // if( fStepStatus != fWorldBoundary){     
116     if (fTrack->GetNextVolume() != nullptr) {  << 118     if( fTrack->GetNextVolume() != nullptr ) { 
117       G4cout << std::setw(10) << fTrack->GetNe << 119        G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName();
118       G4cout << std::setw(4) << fTrack->GetNex << 120        G4cout << std::setw( 4) << fTrack->GetNextVolume()->GetCopyNo();
119     }                                          << 121     } else {
120     else {                                     << 
121       G4cout << std::setw(10) << "OutOfWorld";    122       G4cout << std::setw(10) << "OutOfWorld";
122     }                                             123     }
123                                                << 124     
124     G4cout << " ";                                125     G4cout << " ";
125                                                << 126     
126     G4cout << G4endl;                             127     G4cout << G4endl;
127                                                << 128     
128     if (verboseLevel == 2) {                   << 129     if( verboseLevel == 2 ){
129       G4int tN2ndariesTot = fN2ndariesAtRestDo << 130       G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
130       if (tN2ndariesTot > 0) {                 << 131                             fN2ndariesAlongStepDoIt +
                                                   >> 132                             fN2ndariesPostStepDoIt;
                                                   >> 133       if(tN2ndariesTot>0){
131         G4cout << "    :----- List of 2ndaries    134         G4cout << "    :----- List of 2ndaries - "
132                << "#SpawnInStep=" << std::setw << 135                << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot 
133                << fN2ndariesAtRestDoIt << ",Al << 136                << "(Rest="  << std::setw(2) << fN2ndariesAtRestDoIt
134                << ",Post=" << std::setw(2) <<  << 137                << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
135                << "#SpawnTotal=" << std::setw( << 138                << ",Post="  << std::setw(2) << fN2ndariesPostStepDoIt
                                                   >> 139                << "), "
                                                   >> 140                << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
                                                   >> 141                << " ---------------"
136                << G4endl;                         142                << G4endl;
137                                                << 143         
138         for (size_t lp1 = (*fSecondary).size() << 144         for(size_t lp1=(*fSecondary).size()-tN2ndariesTot; 
139           G4cout << "    : " << std::setw(8) < << 145             lp1<(*fSecondary).size(); lp1++){
140                  << " " << std::setw(8) << (*f << 146           G4cout << "    : "
141                  << std::setw(8) << (*fSeconda << 147                  << std::setw(8)
142                  << std::setw(8) << (*fSeconda << 148                  << (*fSecondary)[lp1]->GetPosition().x() / CLHEP::mm << " "
143                  << std::setw(10) << (*fSecond << 149                  << std::setw(8)
                                                   >> 150                  << (*fSecondary)[lp1]->GetPosition().y() / CLHEP::mm << " "
                                                   >> 151                  << std::setw(8)
                                                   >> 152                  << (*fSecondary)[lp1]->GetPosition().z() / CLHEP::mm << " "
                                                   >> 153                  << std::setw(8)
                                                   >> 154                  << (*fSecondary)[lp1]->GetKineticEnergy() / CLHEP::MeV << " "
                                                   >> 155                  << std::setw(10)
                                                   >> 156                  << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << " ";
144           G4cout << G4endl;                       157           G4cout << G4endl;
145         }                                         158         }
146                                                << 159               
147         G4cout << "    :----------------------    160         G4cout << "    :-----------------------------"
148                << "---------------------------    161                << "----------------------------------"
149                << "-- EndOf2ndaries Info ----- << 162                << "-- EndOf2ndaries Info ---------------"
                                                   >> 163                << G4endl;
150       }                                           164       }
151     }                                             165     }
                                                   >> 166     
152   }                                               167   }
153   G4cout.precision(prec);                         168   G4cout.precision(prec);
154   // G4cout<< "exit VG01SteppingVerboseWithDir    169   // G4cout<< "exit VG01SteppingVerboseWithDir::StepInfo   " <<G4endl;
155 }                                                 170 }
156                                                   171 
157 //....oooOO0OOooo........oooOO0OOooo........oo    172 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
158                                                   173 
159 void VG01SteppingVerboseWithDir::TrackingStart    174 void VG01SteppingVerboseWithDir::TrackingStarted()
160 {                                                 175 {
161   CopyState();                                    176   CopyState();
162   G4int prec = G4cout.precision(6);               177   G4int prec = G4cout.precision(6);
163   if (verboseLevel > 0) {                      << 178   if( verboseLevel > 0 ){
164     Banner();                                  << 179 
                                                   >> 180     Banner();  
165                                                   181 
166     G4cout << std::setw(5) << fTrack->GetCurre << 182     G4cout << std::setw( 5)<<fTrack->GetCurrentStepNumber() << " "
167            << fTrack->GetPosition().x() / CLHE << 183            << std::setw( 9)<<fTrack->GetPosition().x() / CLHEP::mm << " "
168            << fTrack->GetPosition().y() / CLHE << 184            << std::setw( 9)<<fTrack->GetPosition().y() / CLHEP::mm << " "
169            << fTrack->GetPosition().z() / CLHE << 185            << std::setw( 9)<<fTrack->GetPosition().z() / CLHEP::mm << " "  // << " E_0 = "
170            << std::setw(11) << fTrack->GetKine << 186            << std::setw(11)<<fTrack->GetKineticEnergy() / CLHEP::MeV << " ";
171     // << " ( = " << std::setw(8) << G4BestUni << 187            // << " ( = " << std::setw(8) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy") << " ) "
172     G4cout.precision(3);                          188     G4cout.precision(3);
173     G4cout << std::setw(8) << fStep->GetTotalE << 189     G4cout << std::setw( 8) << fStep->GetTotalEnergyDeposit() / CLHEP::MeV << " "
174            << fStep->GetStepLength() / CLHEP:: << 190            << std::setw( 7) << fStep->GetStepLength() / CLHEP::mm << " ";
175     G4cout.precision(6);                          191     G4cout.precision(6);
176     G4cout << std::setw(12) << fTrack->GetTrac    192     G4cout << std::setw(12) << fTrack->GetTrackLength() / CLHEP::mm << " ";
177                                                   193 
178     G4Step const* step = fTrack->GetStep();    << 194     G4Step const* step= fTrack->GetStep();
179     G4StepPoint const* preStepPt = nullptr;    << 195     G4StepPoint const * preStepPt= nullptr;
180     if (step != nullptr) preStepPt = fTrack->G << 196     if( step != nullptr )
181     if (preStepPt != nullptr) {                << 197        preStepPt =fTrack->GetStep()->GetPreStepPoint();
182       G4double safety = preStepPt->GetSafety() << 198     if( preStepPt != nullptr ) {
183       G4cout << std::setw(8) << ((safety > 1.0 << 199        G4double safety = preStepPt->GetSafety();
184     }                                          << 200        G4cout  << std::setw( 8) << ( (safety > 1.0e-9) ? safety : 0.0 ) << " ";
185     else {                                     << 201     } else {
186       G4cout << std::setw(8) << "N/A"          << 202        G4cout  << std::setw( 8) << "N/A" << " ";
187              << " ";                           << 
188     }                                             203     }
189     G4cout << "| ";                               204     G4cout << "| ";
190     G4cout << std::setw(11) << fTrack->GetMome << 205     G4cout << std::setw(11) << fTrack->GetMomentumDirection().x() << " "
191            << fTrack->GetMomentumDirection().y << 206            << std::setw(11) << fTrack->GetMomentumDirection().y() << " "
192            << fTrack->GetMomentumDirection().z << 207            << std::setw(11) << fTrack->GetMomentumDirection().z() << " | ";
193                                                   208 
194     // Material and volume name                   209     // Material and volume name
195     if (fTrack->GetVolume()) {                 << 210     if(fTrack->GetVolume()){
196       G4Material* material = fTrack->GetVolume    211       G4Material* material = fTrack->GetVolume()->GetLogicalVolume()->GetMaterial();
197       if (material != nullptr) {               << 212       if( material != nullptr  ){
198         G4cout << std::setw(15) << material->G << 213          G4cout << std::setw(15) << material->GetName() << " ";
199       }                                           214       }
200       else {                                      215       else {
201         G4cout << std::setw(15) << "No-Materia << 216          G4cout << std::setw(15) << "No-Material" << " ";
202                << " ";                         << 
203       }                                           217       }
204       G4cout << std::setw(14) << "initStep"    << 218       G4cout << std::setw(14) << "initStep" << " ";
205              << " ";                           << 
206       G4cout << std::setw(10) << fTrack->GetVo    219       G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
207       G4cout << std::setw(4) << fTrack->GetVol << 220       G4cout << std::setw( 4) << fTrack->GetVolume()->GetCopyNo() << " (initial Volume)";
208     }                                          << 221 
209     else {                                     << 222     } else {
210       G4cout << std::setw(10) << "No-Material" << 223       G4cout << std::setw(10) << "No-Material" << " ";
211              << " ";                           << 224       G4cout << std::setw(14) << "initStep" << " ";
212       G4cout << std::setw(14) << "initStep"    << 225       G4cout << std::setw(10) << "OutOfWorld" << " ";
213              << " ";                           << 
214       G4cout << std::setw(10) << "OutOfWorld"  << 
215              << " ";                           << 
216     }                                             226     }
217     // fTrack->GetMaterial() fails at track st    227     // fTrack->GetMaterial() fails at track start !!!!
218     G4cout << G4endl;                          << 228     G4cout << G4endl;      
219   }                                               229   }
220   G4cout.precision(prec);                         230   G4cout.precision(prec);
221 }                                                 231 }
222                                                   232