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 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 /processes/hadronic/models/qmd/src/G4QMDSystem.cc (Version 11.3.0) and /processes/hadronic/models/qmd/src/G4QMDSystem.cc (Version 9.1.p1)


  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 // 081120 Add InsertParticipant Method by T. K << 
 27                                                << 
 28 #include "G4QMDSystem.hh"                          26 #include "G4QMDSystem.hh"
 29 #include <iomanip>                                 27 #include <iomanip>
 30                                                    28 
 31 G4QMDSystem::G4QMDSystem()                         29 G4QMDSystem::G4QMDSystem()
 32 {                                                  30 {
 33    participants.clear();                           31    participants.clear();
 34    numberOfCollision = 0;                          32    numberOfCollision = 0;
 35 }                                                  33 }
 36                                                    34 
 37                                                    35 
 38                                                    36 
 39 G4QMDSystem::~G4QMDSystem()                        37 G4QMDSystem::~G4QMDSystem()
 40 {                                                  38 {
 41    this->Clear();                                  39    this->Clear();
 42 }                                                  40 }
 43                                                    41 
 44                                                    42 
 45 // Insert nucleus to current system;               43 // Insert nucleus to current system;
 46 void G4QMDSystem::SetSystem ( G4QMDSystem* nuc     44 void G4QMDSystem::SetSystem ( G4QMDSystem* nucleus , G4ThreeVector dp , G4ThreeVector dr )
 47 {                                                  45 {
 48    std::vector< G4QMDParticipant* >::iterator      46    std::vector< G4QMDParticipant* >::iterator it; 
 49    for ( it = nucleus->participants.begin() ;      47    for ( it = nucleus->participants.begin() ; it != nucleus->participants.end() ; it++ ) 
 50    {                                               48    {
 51       G4ThreeVector r = (*it)->GetPosition() +     49       G4ThreeVector r = (*it)->GetPosition() + dr;
 52       (*it)->SetPosition ( r );                    50       (*it)->SetPosition ( r );
 53       G4ThreeVector p = (*it)->GetMomentum() +     51       G4ThreeVector p = (*it)->GetMomentum() + dp;
 54       (*it)->SetMomentum ( p );                    52       (*it)->SetMomentum ( p );
 55       this->SetParticipant( *it );                 53       this->SetParticipant( *it );
 56    }                                               54    }
 57 }                                                  55 }
 58                                                    56 
 59 void G4QMDSystem::SubtractSystem ( G4QMDSystem     57 void G4QMDSystem::SubtractSystem ( G4QMDSystem* nucleus )
 60 {                                                  58 {
 61                                                    59    
 62    for ( G4int i = 0 ; i < nucleus->GetTotalNu     60    for ( G4int i = 0 ; i < nucleus->GetTotalNumberOfParticipant() ; i++ )
 63    {                                               61    {
 64       participants.erase ( std::find ( partici     62       participants.erase ( std::find ( participants.begin() , participants.end() , nucleus->GetParticipant( i ) ) );
 65    }                                               63    }
 66 }                                                  64 }
 67                                                    65 
 68 void G4QMDSystem::Clear ()                         66 void G4QMDSystem::Clear ()
 69 {                                                  67 {
 70    for ( G4int i = 0 ; i < this->GetTotalNumbe     68    for ( G4int i = 0 ; i < this->GetTotalNumberOfParticipant() ; i++ )
 71    {                                               69    {
 72       delete participants[i];                      70       delete participants[i];
 73    }                                               71    }
 74    participants.clear();                           72    participants.clear();
 75 }                                                  73 }
 76                                                    74 
 77                                                    75 
 78                                                    76 
 79 void G4QMDSystem::ShowParticipants()               77 void G4QMDSystem::ShowParticipants()
 80 {                                                  78 {
 81    //store orginal precision                   << 
 82    std::ios::fmtflags oldform = G4cout.flags() << 
 83                                                << 
 84    G4ThreeVector p_sum( 0.0 );                     79    G4ThreeVector p_sum( 0.0 );
 85    std::vector< G4QMDParticipant* >::iterator      80    std::vector< G4QMDParticipant* >::iterator it; 
 86    G4cout << "Momentum and Position of each pa     81    G4cout << "Momentum and Position of each participant " << G4endl; 
 87    G4int i = 0;                                    82    G4int i = 0; 
 88    for ( it = participants.begin() ; it != par     83    for ( it = participants.begin() ; it != participants.end() ; it++ ) 
 89    {                                               84    { 
 90       G4cout << i                                  85       G4cout << i
 91              << " "                                86              << " " 
 92              << (*it)->GetDefinition()->GetPar     87              << (*it)->GetDefinition()->GetParticleName() 
 93              << " "                                88              << " " 
 94              << std::setprecision( 8 )             89              << std::setprecision( 8 )
 95              << (*it)->GetMomentum()               90              << (*it)->GetMomentum()
 96              << " "                                91              << " " 
 97              << (*it)->GetPosition()               92              << (*it)->GetPosition() 
 98              << G4endl;                            93              << G4endl;
 99       p_sum += (*it)->GetMomentum();               94       p_sum += (*it)->GetMomentum();
100       i++;                                         95       i++;
101    }                                               96    }
102    G4cout << "Sum upped Momentum and its mag " <<  97    G4cout << "Sum upped Momentum and mag " << p_sum << " " << p_sum.mag() << G4endl;
103                                                << 
104    //restore orginal precision                 << 
105    G4cout.flags( oldform );                    << 
106 }                                              << 
107                                                << 
108                                                << 
109                                                << 
110 void G4QMDSystem::InsertParticipant ( G4QMDPar << 
111 {                                              << 
112                                                << 
113    if ( (size_t) n > participants.size()+1 )   << 
114       G4cout << "G4QMDSystem::InsertParticipan << 
115                                                << 
116    std::vector< G4QMDParticipant* >::iterator  << 
117    it = participants.begin();                  << 
118                                                << 
119    for ( G4int i = 0; i < n ; i++ )            << 
120       it++;                                    << 
121                                                << 
122    participants.insert( it, particle );        << 
123 }                                                  98 }
124                                                    99