G4InteractionCase.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 // $Id$
00027 //
00028 // 20100518  M. Kelsey -- Move code from Colliders' "bulletTargetSetter()"
00029 //              to setBulletTarget().
00030 
00031 #include "G4InteractionCase.hh"
00032 #include "G4InuclParticle.hh"
00033 #include "G4InuclElementaryParticle.hh"
00034 #include "G4InuclNuclei.hh"
00035 
00036 
00037 // Evaluate concrete types of input particles and assign bullet, target
00038 
00039 void G4InteractionCase::set(G4InuclParticle* part1, 
00040                             G4InuclParticle* part2) {
00041   clear();              // Reset everything in case of failure
00042 
00043   // See which one of the two (or both) is a nucleus
00044   G4InuclNuclei* nucl1 = dynamic_cast<G4InuclNuclei*>(part1);
00045   G4InuclNuclei* nucl2 = dynamic_cast<G4InuclNuclei*>(part2);
00046 
00047   G4InuclElementaryParticle* had1 = dynamic_cast<G4InuclElementaryParticle*>(part1);
00048   G4InuclElementaryParticle* had2 = dynamic_cast<G4InuclElementaryParticle*>(part2);
00049 
00050   if (nucl1 && nucl2) {         // Nuclear collision, lighter is projectile
00051     inter_case = -2;
00052     if (nucl2->getA() >= nucl1->getA()) {
00053       bullet = part1;
00054       target = part2;
00055     } else {
00056       bullet = part2;
00057       target = part1;
00058     } 
00059   } else if (nucl1 || nucl2) {  // Hadron on nucleus, hadron projectile
00060     inter_case = -1;
00061     if (nucl1 && had2) {
00062       bullet = part2;
00063       target = part1;
00064     } else {
00065       bullet = part1;
00066       target = part2;
00067     }
00068   } else if (had1 && had2) {    // Hadron-hadron interaction, order irrelevant
00069     inter_case = had1->type() * had2->type();
00070     bullet = part1;
00071     target = part2;
00072   }
00073 }

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