1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
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. * |
---|
10 | // * * |
---|
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. * |
---|
17 | // * * |
---|
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 | // ******************************************************************** |
---|
25 | // |
---|
26 | // $Id: G4InteractionCase.cc,v 1.2 2010/06/25 09:44:32 gunter Exp $ |
---|
27 | // GEANT4 tag: $Name: hadr-casc-V09-03-85 $ |
---|
28 | // |
---|
29 | // 20100518 M. Kelsey -- Move code from Colliders' "bulletTargetSetter()" |
---|
30 | // to setBulletTarget(). |
---|
31 | |
---|
32 | #include "G4InteractionCase.hh" |
---|
33 | #include "G4InuclParticle.hh" |
---|
34 | #include "G4InuclElementaryParticle.hh" |
---|
35 | #include "G4InuclNuclei.hh" |
---|
36 | |
---|
37 | |
---|
38 | // Evaluate concrete types of input particles and assign bullet, target |
---|
39 | |
---|
40 | void G4InteractionCase::set(G4InuclParticle* part1, |
---|
41 | G4InuclParticle* part2) { |
---|
42 | clear(); // Reset everything in case of failure |
---|
43 | |
---|
44 | // See which one of the two (or both) is a nucleus |
---|
45 | G4InuclNuclei* nucl1 = dynamic_cast<G4InuclNuclei*>(part1); |
---|
46 | G4InuclNuclei* nucl2 = dynamic_cast<G4InuclNuclei*>(part2); |
---|
47 | |
---|
48 | G4InuclElementaryParticle* had1 = dynamic_cast<G4InuclElementaryParticle*>(part1); |
---|
49 | G4InuclElementaryParticle* had2 = dynamic_cast<G4InuclElementaryParticle*>(part2); |
---|
50 | |
---|
51 | if (nucl1 && nucl2) { // Nuclear collision, lighter is projectile |
---|
52 | inter_case = -2; |
---|
53 | if (nucl2->getA() >= nucl1->getA()) { |
---|
54 | bullet = part1; |
---|
55 | target = part2; |
---|
56 | } else { |
---|
57 | bullet = part2; |
---|
58 | target = part1; |
---|
59 | } |
---|
60 | } else if (nucl1 || nucl2) { // Hadron on nucleus, hadron projectile |
---|
61 | inter_case = -1; |
---|
62 | if (nucl1 && had2) { |
---|
63 | bullet = part2; |
---|
64 | target = part1; |
---|
65 | } else { |
---|
66 | bullet = part1; |
---|
67 | target = part2; |
---|
68 | } |
---|
69 | } else if (had1 && had2) { // Hadron-hadron interaction, order irrelevant |
---|
70 | inter_case = had1->type() * had2->type(); |
---|
71 | bullet = part1; |
---|
72 | target = part2; |
---|
73 | } |
---|
74 | } |
---|