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 | // |
---|
27 | // File name: RadmonPhysicsInfo.cc |
---|
28 | // Creation date: Nov 2005 |
---|
29 | // Main author: Riccardo Capra <capra@ge.infn.it> |
---|
30 | // |
---|
31 | // Id: $Id: RadmonPhysicsInfo.cc,v 1.3 2006/06/29 16:18:51 gunter Exp $ |
---|
32 | // Tag: $Name: $ |
---|
33 | // |
---|
34 | |
---|
35 | #include "RadmonPhysicsInfo.hh" |
---|
36 | #include "G4UnitsTable.hh" |
---|
37 | |
---|
38 | RadmonPhysicsInfo :: RadmonPhysicsInfo(const RadmonPhysicsInfo & copy) |
---|
39 | : |
---|
40 | minEnergy(copy.minEnergy), |
---|
41 | maxEnergy(copy.maxEnergy), |
---|
42 | name(copy.name), |
---|
43 | particle(copy.particle) |
---|
44 | { |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | RadmonPhysicsInfo & RadmonPhysicsInfo :: operator=(const RadmonPhysicsInfo & copy) |
---|
52 | { |
---|
53 | minEnergy=copy.minEnergy; |
---|
54 | maxEnergy=copy.maxEnergy; |
---|
55 | name=copy.name; |
---|
56 | particle=copy.particle; |
---|
57 | |
---|
58 | return (*this); |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | G4bool RadmonPhysicsInfo :: CollidesWith(const RadmonPhysicsInfo & other) const |
---|
66 | { |
---|
67 | if (name.empty() || particle==0 || minEnergy>maxEnergy || |
---|
68 | other.name.empty() || other.particle==0 || other.minEnergy>other.maxEnergy) |
---|
69 | return false; |
---|
70 | |
---|
71 | return (name==other.name && particle->GetParticleName()==other.particle->GetParticleName() && maxEnergy>=other.minEnergy && minEnergy<=other.maxEnergy); |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | std::ostream & operator<<(std::ostream & out, const RadmonPhysicsInfo & info) |
---|
79 | { |
---|
80 | if (info.GetProcessName().empty()) |
---|
81 | out << "UNDEFINED"; |
---|
82 | else |
---|
83 | out << info.GetProcessName(); |
---|
84 | |
---|
85 | if (info.GetParticleDefinition()==0) |
---|
86 | out << "(UNDEFINED)"; |
---|
87 | else |
---|
88 | out << info.GetParticleDefinition()->GetParticleName(); |
---|
89 | |
---|
90 | if (info.GetMinEnergy()>info.GetMaxEnergy()) |
---|
91 | out << " [UNDEFINED]"; |
---|
92 | else if (info.GetMinEnergy()==info.GetMaxEnergy()) |
---|
93 | { |
---|
94 | if (info.GetMinEnergy()==0.*eV) |
---|
95 | out << " [REST]"; |
---|
96 | else |
---|
97 | out << " [" << G4BestUnit(info.GetMinEnergy(), "Energy") << ']'; |
---|
98 | } |
---|
99 | else |
---|
100 | out << " [" << G4BestUnit(info.GetMinEnergy(), "Energy") << ", " << G4BestUnit(info.GetMaxEnergy(), "Energy") << ']'; |
---|
101 | |
---|
102 | return out; |
---|
103 | } |
---|
104 | |
---|