2 // ********************************************************************
 
    3 // * License and Disclaimer                                           *
 
    5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
 
    6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
 
    7 // * conditions of the Geant4 Software License,  included in the file *
 
    8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
 
    9 // * include a list of copyright holders.                             *
 
   11 // * Neither the authors of this software system, nor their employing *
 
   12 // * institutes,nor the agencies providing financial support for this *
 
   13 // * work  make  any representation or  warranty, express or implied, *
 
   14 // * regarding  this  software system or assume any liability for its *
 
   15 // * use.  Please see the license in the file  LICENSE  and URL above *
 
   16 // * for the full disclaimer and the limitation of liability.         *
 
   18 // * This  code  implementation is the result of  the  scientific and *
 
   19 // * technical work of the GEANT4 collaboration.                      *
 
   20 // * By using,  copying,  modifying or  distributing the software (or *
 
   21 // * any work based  on the software)  you  agree  to acknowledge its *
 
   22 // * use  in  resulting  scientific  publications,  and indicate your *
 
   23 // * acceptance of all terms of the Geant4 Software license.          *
 
   24 // ********************************************************************
 
   27 //****************************************************************************************************************
 
   28 template<class ParticipantType>
 
   29 G4QGSModel<ParticipantType>::G4QGSModel() 
 
   31    G4VPartonStringModel::SetThisPointer(this);
 
   32    SetEnergyMomentumCheckLevels(2*CLHEP::perCent, 150*CLHEP::MeV);
 
   34 template<class ParticipantType>
 
   35 G4QGSModel<ParticipantType>::G4QGSModel(const G4QGSModel &right)
 
   37    G4VPartonStringModel::SetThisPointer(this);
 
   38    std::pair<G4double, G4double> levels=right.GetEnergyMomentumCheckLevels();
 
   39    SetEnergyMomentumCheckLevels(levels.first, levels.second);
 
   42 template<class ParticipantType>
 
   43 G4QGSModel<ParticipantType>& G4QGSModel<ParticipantType>::operator=(const G4QGSModel &right)
 
   47          G4VPartonStringModel::SetThisPointer(this);
 
   48          std::pair<G4double, G4double> levels=right.GetEnergyMomentumCheckLevels();
 
   49          SetEnergyMomentumCheckLevels(levels.first, levels.second);
 
   52 template<class ParticipantType>
 
   53 G4QGSModel<ParticipantType>::~G4QGSModel()
 
   57 template<class ParticipantType>
 
   58 void G4QGSModel<ParticipantType>::Init(const G4Nucleus & aNucleus, const G4DynamicParticle & aProjectile)
 
   60      // clean-up and consistency with design, HPW Feb 1999
 
   61     theParticipants.Init(aNucleus.GetA_asInt(),aNucleus.GetZ_asInt());
 
   62     theCurrentVelocity.setX(0);    
 
   63     theCurrentVelocity.setY(0); 
 
   65      // this is an approximation, neglecting the motion of nucleons in the nucleus & p,n mass differences. @@@
 
   66 //    G4double vz_old = aProjectile.Get4Momentum().pz()/
 
   67 //                  (aProjectile.Get4Momentum().e() + G4Proton::Proton()->GetPDGMass());
 
   69     if(std::abs(aProjectile.GetDefinition()->GetBaryonNumber()) !=0) 
 
   71       nCons = std::abs(aProjectile.GetDefinition()->GetBaryonNumber());
 
   73     G4double pz_per_projectile = aProjectile.Get4Momentum().pz()/nCons;
 
   74 //    G4double e_per_projectile = aProjectile.Get4Momentum().vect()*aProjectile.Get4Momentum().vect();
 
   75 //             e_per_projectile /=nCons*nCons;
 
   76 //      e_per_projectile += G4Proton::Proton()->GetPDGMass()*G4Proton::Proton()->GetPDGMass();
 
   77     G4double e_per_projectile = aProjectile.Get4Momentum()*aProjectile.Get4Momentum();
 
   78              e_per_projectile += aProjectile.Get4Momentum().vect()*aProjectile.Get4Momentum().vect();
 
   79              e_per_projectile /=nCons*nCons;
 
   80         e_per_projectile = std::sqrt(e_per_projectile);
 
   81         e_per_projectile += G4Proton::Proton()->GetPDGMass();
 
   82     G4double vz = pz_per_projectile/e_per_projectile;
 
   83 //--DEBUG--    G4cout << "IncomingMomentum - vz "<<aProjectile.Get4Momentum()<< ", " << vz <<G4endl;
 
   84     theCurrentVelocity.setZ(vz);
 
   85     theParticipants.DoLorentzBoost(-theCurrentVelocity); 
 
   86     G4LorentzVector Mom = aProjectile.Get4Momentum();
 
   87     Mom.boost(-theCurrentVelocity);
 
   88     G4ReactionProduct theProjectile;   
 
   89     theProjectile.SetDefinition(aProjectile.GetDefinition());
 
   90     theProjectile.SetTotalEnergy(Mom.e());
 
   91     theProjectile.SetMomentum(Mom.vect());
 
   92 //--DEBUG--    G4cout << "PreInteractionMomentum "<<Mom<<G4endl;
 
   93     theParticipants.BuildInteractions(theProjectile);
 
   94     theParticipants.GetWoundedNucleus()->DoLorentzBoost(theCurrentVelocity);
 
   97 template<class ParticipantType>
 
   98 G4ExcitedStringVector * G4QGSModel<ParticipantType>::GetStrings()
 
  100   // clean-up and consistancy with design, HPW Feb 1999
 
  101   // also fixing a memory leak, removing unnecessary caching, and 
 
  102   // streamlining of logic
 
  104   G4ExcitedStringVector* theStrings = new G4ExcitedStringVector;
 
  105   G4ExcitedString * aString;
 
  106   while( (aPair = theParticipants.GetNextPartonPair()) )  /* Loop checking, 26.10.2015, A.Ribon */
 
  108     if (aPair->GetCollisionType() == G4PartonPair::DIFFRACTIVE)
 
  110       aString = theDiffractiveStringBuilder.BuildString(aPair);
 
  111       // G4cout << "diffractive "<<aString->Get4Momentum()<<G4endl;
 
  115       aString = theSoftStringBuilder.BuildString(aPair);
 
  116       // G4cout << "soft "<<aString->Get4Momentum()<<G4endl;
 
  118 //--DEBUG-- G4cout << " QGSModel.icc::GetStrings() theCurrentVelocity " << theCurrentVelocity << G4endl;   
 
  119     aString->Boost(theCurrentVelocity);  
 
  120     theStrings->push_back(aString);
 
  123 //--DEBUG--  G4cout << G4endl;
 
  124 //  for(G4int i=0; i<theStrings->size(); i++)
 
  126 //   G4cout << "String = "<<theStrings->operator[](i)->Get4Momentum()<<G4endl;
 
  131 template<class ParticipantType>
 
  132 G4V3DNucleus* G4QGSModel<ParticipantType>::GetWoundedNucleus() const
 
  134   return theParticipants.GetWoundedNucleus();
 
  137 template<class ParticipantType>                      // Uzhi Nov. 2012
 
  138 G4V3DNucleus* G4QGSModel<ParticipantType>::GetProjectileNucleus() const
 
  143 template<class ParticipantType>
 
  144 void G4QGSModel<ParticipantType>::ModelDescription(std::ostream& outFile) const
 
  146   outFile << "The Quark-Gluon String (QGS) model simulates the interaction\n"
 
  147           << "of protons, neutrons, pions and kaons with nuclei in the\n"
 
  148           << "approximate energy range 20 GeV to 50 TeV. The model handles\n"
 
  149           << "the selection of collision partners, splitting of the nucleons\n"
 
  150           << "into quarks and di-quarks, the formation and excitation of\n"
 
  151           << "quark-gluon strings, string hadronization and diffractive dissociation.\n";
 
  153 //*********************************************************************************************************************