G4INCLEventInfo.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // INCL++ intra-nuclear cascade model
00027 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
00028 // Davide Mancusi, CEA
00029 // Alain Boudard, CEA
00030 // Sylvie Leray, CEA
00031 // Joseph Cugnon, University of Liege
00032 //
00033 #define INCLXX_IN_GEANT4_MODE 1
00034 
00035 #include "globals.hh"
00036 
00046 #include "G4INCLEventInfo.hh"
00047 #include "G4INCLGlobals.hh"
00048 #include "G4INCLParticleTable.hh"
00049 #include <cmath>
00050 
00051 namespace G4INCL {
00052 
00053   Int_t EventInfo::eventNumber = 0;
00054 
00055 #ifdef INCL_INVERSE_KINEMATICS
00056   void EventInfo::fillInverseKinematics(const Double_t gamma) {
00057     const Double_t beta = std::sqrt(1.-1./(gamma*gamma));
00058     for(Int_t i=0; i<nParticles; ++i) {
00059       Double_t mass;
00060       if(A[i]>0) {
00061         mass = ParticleTable::getTableMass(A[i],Z[i]);
00062       } else if(origin[i]==-1) { // cascade particles with A=0, must be pions
00063         if(Z[i]==1)
00064           mass = ParticleTable::getTableParticleMass(PiPlus);
00065         else if(Z[i]==0)
00066           mass = ParticleTable::getTableParticleMass(PiZero);
00067         else
00068           mass = ParticleTable::getTableParticleMass(PiMinus);
00069       } else // gamma rays
00070         mass = 0.;
00071 
00072       const Double_t ETot = EKin[i] + mass;
00073       const Double_t ETotPrime = gamma*(ETot - beta*pz[i]);
00074       /* Using the invariant mass here avoids negative kinetic energies with
00075        * particles produced by the de-excitation models, which do not
00076        * necessarily use the same mass look-up tables as INCL.
00077        */
00078       Double_t invariantMass;
00079       if(A[i]>0 || origin[i]==-1) { // massive particles
00080         invariantMass = std::sqrt(ETot*ETot - px[i]*px[i] - py[i]*py[i] - pz[i]*pz[i]);
00081       } else { // gamma rays
00082         invariantMass = 0.;
00083       }
00084       EKinPrime[i] = ETotPrime - invariantMass;
00085       pzPrime[i] = -gamma*(pz[i] - beta*ETot);
00086       const Double_t pPrime = std::sqrt(px[i]*px[i] + py[i]*py[i] + pzPrime[i]*pzPrime[i]);
00087       const Double_t cosThetaPrime = pzPrime[i]/pPrime;
00088       if(cosThetaPrime>=1.)
00089         thetaPrime[i] = 0.;
00090       else if(cosThetaPrime<=-1.)
00091         thetaPrime[i] = 180.;
00092       else
00093         thetaPrime[i] = 180.*std::acos(cosThetaPrime)/Math::pi;
00094     }
00095   }
00096 #endif // INCL_INVERSE_KINEMATICS
00097 }
00098 

Generated on Mon May 27 17:48:35 2013 for Geant4 by  doxygen 1.4.7