G4CollisionInitialState.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 // -----------------------------------------------------------------------------
00028 //      GEANT 4 class implementation file
00029 //
00030 //      History: first implementation, A. Feliciello, 30th June 1998
00031 // -----------------------------------------------------------------------------
00032 
00033 #include "G4CollisionInitialState.hh"
00034 #include "G4SystemOfUnits.hh"
00035 #include "G4BCAction.hh"
00036 // Class G4CollisionInitialState
00037 
00038 G4CollisionInitialState::G4CollisionInitialState() :
00039    theCollisionTime(DBL_MAX), thePrimary(0), theTarget(0), theFSGenerator(0)
00040 {
00041 }
00042 
00043 
00044 G4CollisionInitialState::G4CollisionInitialState(G4double time,
00045    G4KineticTrack * aPrimary, G4KineticTrack * aTarget)
00046 {
00047    theCollisionTime = time;
00048    thePrimary       = aPrimary;
00049    theTarget        = aTarget;
00050    theTs.clear();
00051    theFSGenerator = 0;
00052 }
00053 
00054 // +new interface post pion:
00055 G4CollisionInitialState::G4CollisionInitialState(G4double time,
00056    G4KineticTrack * aPrimary, const G4KineticTrackVector & aTarget,
00057    G4BCAction * aFSGenerator)
00058 {
00059    theCollisionTime = time;
00060    thePrimary       = aPrimary;
00061    theTarget = 0;
00062    for (size_t i=0; i<aTarget.size(); i++) theTs.push_back(aTarget[i]);
00063    theFSGenerator = aFSGenerator;
00064 }
00065 // -new interface post pion:
00066 
00067 
00068 G4CollisionInitialState::G4CollisionInitialState(const G4CollisionInitialState & right)
00069 {
00070      theCollisionTime = right.theCollisionTime;
00071      thePrimary       = right.thePrimary;
00072      theTarget        = right.theTarget;
00073      for (size_t i=0; i<right.theTs.size(); i++) theTs.push_back(right.theTs[i]);
00074      theFSGenerator   = right.theFSGenerator;
00075 }
00076 
00077 G4CollisionInitialState & G4CollisionInitialState::operator=(const G4CollisionInitialState& right)
00078 {
00079    if (this != &right)
00080    {
00081       theCollisionTime = right.theCollisionTime;
00082       thePrimary       = right.thePrimary;
00083       theTarget        = right.theTarget;
00084       for (size_t i=0; i<right.theTs.size(); i++)
00085           theTs.push_back(right.theTs[i]);
00086       theFSGenerator   = right.theFSGenerator;
00087    }
00088 
00089    return *this;
00090 }
00091 
00092 //#include <typeinfo>
00093 
00094   G4KineticTrackVector * G4CollisionInitialState::
00095   GetFinalState()
00096   {
00097 //    G4cerr << "what is the FS generator? "
00098 //           << typeid(*theFSGenerator).name()
00099 //         <<G4endl;
00100     return theFSGenerator->GetFinalState(thePrimary, theTs);
00101   }
00102 
00103 //#include <typeinfo>
00104 
00105 void G4CollisionInitialState::Print() const
00106 {
00107    G4int tgtPdg=theTarget ?
00108      theTarget->GetDefinition()->GetPDGEncoding() : 0;
00109    G4cout << "  collision " << this << " time: "
00110      << theCollisionTime/second << " proj: "
00111      << thePrimary << "/pdg=" << thePrimary->GetDefinition()->GetPDGEncoding()
00112      << " tgt: " << theTarget << "/pdg=" << tgtPdg
00113      << " Collision type: "<< typeid(*theFSGenerator).name();
00114 
00115 }
00116 
00117   /*
00118 std::ostream& G4CollisionInitialState::operator<<(std::ostream& out, const G4CollisionInitialState & collision)
00119 {
00120   G4int tgtPdg=collision.GetTarget() ?
00121     collision.GetTarget()->GetDefinition()->GetPDGEncoding() : 0;
00122   out << "  collision " << collision << " time: "
00123     << collision.GetCollisionTime()/second << " proj: "
00124     << collision.GetPrimary() << "/pdg=" << collision.GetPrimary()->GetDefinition()->GetPDGEncoding()
00125     << " tgt: " << collision.GetTarget() << "/pdg=" << tgtPdg
00126     << " Collision type: "<< typeid(*collision.GetGenerator()).name();
00127 
00128   return out;
00129 }
00130 */

Generated on Mon May 27 17:47:54 2013 for Geant4 by  doxygen 1.4.7