Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4LorentzConvertor.hh
Go to the documentation of this file.
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// 20100108 Michael Kelsey -- Use G4LorentzVector internally
28// 20100120 M. Kelsey -- BUG FIX: scm_momentum should be G4ThreeVector
29// 20100126 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
30// 20100519 M. Kelsey -- Add interfaces to pass G4InuclParticles directly
31// 20100616 M. Kelsey -- Report bullet and target four-momenta when set
32// 20100915 M. Kelsey -- Move constructors to .cc file, add initializers
33// 20110602 M. Kelsey -- Drop some unnecessary kinematics intermediates
34
35#ifndef G4LORENTZ_CONVERTOR_HH
36#define G4LORENTZ_CONVERTOR_HH
37
38#include "globals.hh"
39#include "G4LorentzVector.hh"
40#include "G4ThreeVector.hh"
41
42class G4InuclParticle;
43
45public:
47
49 const G4LorentzVector& tmom, G4double tmass);
50
52 const G4InuclParticle* target);
53
54 void setVerbose(G4int vb=0) { verboseLevel = vb; }
55
56 void setBullet(const G4InuclParticle* bullet);
57 void setTarget(const G4InuclParticle* target);
58
59 void setBullet(const G4InuclParticle& bullet) { setBullet(&bullet); }
60 void setTarget(const G4InuclParticle& target) { setTarget(&target); }
61
62 // Use correct four-vectors as input
63 void setBullet(const G4LorentzVector& bmom) {
64 bullet_mom = bmom;
65 if (verboseLevel > 3) printBullet();
66 }
67
68 void setTarget(const G4LorentzVector& bmom) {
69 target_mom = bmom;
70 if (verboseLevel > 3) printTarget();
71 }
72
73 // These functions "repair" input 4-vectors using specified mass
74 void setBullet(const G4LorentzVector& bmom, G4double bmass) {
75 bullet_mom.setVectM(bmom.vect(), bmass);
76 if (verboseLevel > 3) printBullet();
77 }
78
79 void setTarget(const G4LorentzVector& tmom, G4double tmass) {
80 target_mom.setVectM(tmom.vect(), tmass);
81 if (verboseLevel > 3) printTarget();
82 }
83
84 // Select reference frame for boosts, rotations, etc.
85 void toTheCenterOfMass();
87 void fillKinematics(); // Common calculations after either of above
88
90
91 // Four-vectors of bullet and target in last chosen reference frame
92 const G4LorentzVector& getBullet() const { return bullet_mom; }
93 const G4LorentzVector& getTarget() const { return target_mom; }
94
96 G4double getTotalSCMEnergy() const { return ecm_tot; }
97 G4double getSCMMomentum() const { return scm_momentum.rho(); }
99
100 G4LorentzVector rotate(const G4LorentzVector& mom) const;
101
103 const G4LorentzVector& mom) const;
104
105 G4bool reflectionNeeded() const;
106
107 G4bool trivial() const { return degenerated; }
108
109 // Reporting functions for diagnostics
110 void printBullet() const;
111 void printTarget() const;
112
113private:
114 static const G4double small;
115
116 G4int verboseLevel;
117 G4LorentzVector bullet_mom;
118 G4LorentzVector target_mom;
119
120 G4LorentzVector scm_momentum; // CM momentum relative to target/bullet
121 G4ThreeVector scm_direction; // Unit vector to reduce repeated calcs
122
123 // Buffer variables for doing ::rotate() calculations
124 G4ThreeVector velocity;
125 G4double v2;
126 G4double ecm_tot;
127 G4double valong;
128 G4bool degenerated;
129};
130
131#endif // G4LORENTZ_CONVERTOR_HH
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void setVectM(const Hep3Vector &spatial, double mass)
Hep3Vector vect() const
G4double getTRSMomentum() const
void setBullet(const G4InuclParticle &bullet)
void setTarget(const G4LorentzVector &bmom)
void setTarget(const G4InuclParticle &target)
G4double getTotalSCMEnergy() const
const G4LorentzVector & getTarget() const
G4bool reflectionNeeded() const
void setVerbose(G4int vb=0)
void setBullet(const G4InuclParticle *bullet)
G4double getSCMMomentum() const
G4LorentzVector backToTheLab(const G4LorentzVector &mom) const
void setTarget(const G4LorentzVector &tmom, G4double tmass)
void setBullet(const G4LorentzVector &bmom)
G4LorentzVector rotate(const G4LorentzVector &mom) const
const G4LorentzVector & getBullet() const
void setBullet(const G4LorentzVector &bmom, G4double bmass)
G4double getKinEnergyInTheTRS() const
void setTarget(const G4InuclParticle *target)