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 // 20100108 Michael Kelsey -- Use G4LorentzVector internally 00029 // 20100120 M. Kelsey -- BUG FIX: scm_momentum should be G4ThreeVector 00030 // 20100126 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly 00031 // 20100519 M. Kelsey -- Add interfaces to pass G4InuclParticles directly 00032 // 20100616 M. Kelsey -- Report bullet and target four-momenta when set 00033 // 20100915 M. Kelsey -- Move constructors to .cc file, add initializers 00034 // 20110602 M. Kelsey -- Drop some unnecessary kinematics intermediates 00035 00036 #ifndef G4LORENTZ_CONVERTOR_HH 00037 #define G4LORENTZ_CONVERTOR_HH 00038 00039 #include "globals.hh" 00040 #include "G4LorentzVector.hh" 00041 #include "G4ThreeVector.hh" 00042 00043 class G4InuclParticle; 00044 00045 class G4LorentzConvertor { 00046 public: 00047 G4LorentzConvertor(); 00048 00049 G4LorentzConvertor(const G4LorentzVector& bmom, G4double bmass, 00050 const G4LorentzVector& tmom, G4double tmass); 00051 00052 G4LorentzConvertor(const G4InuclParticle* bullet, 00053 const G4InuclParticle* target); 00054 00055 void setVerbose(G4int vb=0) { verboseLevel = vb; } 00056 00057 void setBullet(const G4InuclParticle* bullet); 00058 void setTarget(const G4InuclParticle* target); 00059 00060 void setBullet(const G4InuclParticle& bullet) { setBullet(&bullet); } 00061 void setTarget(const G4InuclParticle& target) { setTarget(&target); } 00062 00063 // Use correct four-vectors as input 00064 void setBullet(const G4LorentzVector& bmom) { 00065 bullet_mom = bmom; 00066 if (verboseLevel > 3) printBullet(); 00067 } 00068 00069 void setTarget(const G4LorentzVector& bmom) { 00070 target_mom = bmom; 00071 if (verboseLevel > 3) printTarget(); 00072 } 00073 00074 // These functions "repair" input 4-vectors using specified mass 00075 void setBullet(const G4LorentzVector& bmom, G4double bmass) { 00076 bullet_mom.setVectM(bmom.vect(), bmass); 00077 if (verboseLevel > 3) printBullet(); 00078 } 00079 00080 void setTarget(const G4LorentzVector& tmom, G4double tmass) { 00081 target_mom.setVectM(tmom.vect(), tmass); 00082 if (verboseLevel > 3) printTarget(); 00083 } 00084 00085 // Select reference frame for boosts, rotations, etc. 00086 void toTheCenterOfMass(); 00087 void toTheTargetRestFrame(); 00088 void fillKinematics(); // Common calculations after either of above 00089 00090 G4LorentzVector backToTheLab(const G4LorentzVector& mom) const; 00091 00092 // Four-vectors of bullet and target in last chosen reference frame 00093 const G4LorentzVector& getBullet() const { return bullet_mom; } 00094 const G4LorentzVector& getTarget() const { return target_mom; } 00095 00096 G4double getKinEnergyInTheTRS() const; 00097 G4double getTotalSCMEnergy() const { return ecm_tot; } 00098 G4double getSCMMomentum() const { return scm_momentum.rho(); } 00099 G4double getTRSMomentum() const; 00100 00101 G4LorentzVector rotate(const G4LorentzVector& mom) const; 00102 00103 G4LorentzVector rotate(const G4LorentzVector& mom1, 00104 const G4LorentzVector& mom) const; 00105 00106 G4bool reflectionNeeded() const; 00107 00108 G4bool trivial() const { return degenerated; } 00109 00110 // Reporting functions for diagnostics 00111 void printBullet() const; 00112 void printTarget() const; 00113 00114 private: 00115 static const G4double small; 00116 00117 G4int verboseLevel; 00118 G4LorentzVector bullet_mom; 00119 G4LorentzVector target_mom; 00120 00121 G4LorentzVector scm_momentum; // CM momentum relative to target/bullet 00122 G4ThreeVector scm_direction; // Unit vector to reduce repeated calcs 00123 00124 // Buffer variables for doing ::rotate() calculations 00125 G4ThreeVector velocity; 00126 G4double v2; 00127 G4double ecm_tot; 00128 G4double valong; 00129 G4bool degenerated; 00130 }; 00131 00132 #endif // G4LORENTZ_CONVERTOR_HH