G4VCollision.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 //
00027 // $Id: G4VCollision.cc,v 1.3 2006-06-29 20:41:49 gunter Exp $ //
00028 
00029 #include "globals.hh"
00030 #include "G4ios.hh"
00031 #include "G4VCollision.hh"
00032 #include "G4VCrossSectionSource.hh"
00033 #include "G4KineticTrack.hh"
00034 
00035 G4VCollision::G4VCollision()
00036 { }
00037 
00038 G4VCollision::~G4VCollision()
00039 {
00040 }
00041 
00042 
00043 G4bool G4VCollision::operator==(const G4VCollision &right) const
00044 {
00045         return (this == (G4VCollision *) &right);
00046 }
00047 
00048 
00049 G4bool G4VCollision::operator!=(const G4VCollision &right) const
00050 {
00051         return (this != (G4VCollision *) &right);
00052 }
00053 
00054 
00055 G4double G4VCollision::CrossSection(const G4KineticTrack& aTrk1, 
00056                 const G4KineticTrack& aTrk2) const
00057 {
00058         G4double sigma = 0.;
00059 
00060         const G4VCrossSectionSource* xSource = GetCrossSectionSource();
00061 
00062         if (xSource != 0)
00063         {
00064                 // There is a cross section for this Collision
00065                 sigma = xSource->CrossSection(aTrk1,aTrk2);
00066         }
00067         return sigma;
00068 }
00069 
00070 
00071 void G4VCollision::Print() const
00072 {
00073         G4String name = GetName();
00074 
00075         G4cout << "---- " << name << "---- Cross section" << G4endl;
00076 
00077         const G4VCrossSectionSource* xSource = GetCrossSectionSource();
00078         if (xSource) xSource->Print();
00079 
00080         G4int nComponents = 0;
00081         const G4CollisionVector* components = GetComponents();
00082         if (components)
00083         {
00084                 nComponents = components->size();
00085         }
00086         G4cout << "---- " << name << "---- has " << nComponents << " components" <<G4endl;
00087         G4int i = 0;
00088         G4CollisionVector::const_iterator iter;
00089         if (components)
00090         {
00091                 for (iter = components->begin(); iter != components->end(); ++iter)
00092                 {
00093                         G4cout << "---- " << name << " ---- Component " << i << G4endl;
00094                         ((*iter))->Print();
00095                         i++;
00096                 }
00097         }
00098 
00099 }
00100 
00101 
00102 void G4VCollision::Print(const G4KineticTrack& trk1, 
00103                 const G4KineticTrack& trk2) const
00104 {
00105         G4String name = GetName();
00106 
00107         if (IsInCharge(trk1,trk2))
00108         {
00109                 G4cout << "---- " << name << "is in charge ---- " << G4endl;
00110         }
00111         else
00112         {
00113                 G4cout << "---- " << name << "is not in charge ---- " << G4endl;
00114         }
00115 
00116         G4cout << "---- " << name << "---- Cross section" << G4endl;
00117 
00118         const G4VCrossSectionSource* xSource = GetCrossSectionSource();
00119         if (xSource) xSource->Print();
00120         G4cout << "Cross section = " << CrossSection(trk1,trk2) << G4endl;
00121 
00122         G4int nComponents = 0;
00123         const G4CollisionVector* components = GetComponents();
00124         if (components)
00125         {
00126                 nComponents = components->size();
00127         }
00128         G4cout << "---- " << name << "has " << nComponents << " components" <<G4endl;
00129 
00130         G4int i = 0;
00131         G4CollisionVector::const_iterator iter;
00132         if (components)
00133         {
00134                 for (iter = components->begin(); iter != components->end(); ++iter)
00135                 {
00136                         G4cout << "Component " << i << G4endl;
00137                         ((*iter))->Print();
00138                         i++;
00139                 }
00140         }
00141 }
00142 
00143 

Generated on Mon May 27 17:50:09 2013 for Geant4 by  doxygen 1.4.7