Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:38

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // 20100108  Michael Kelsey -- Use G4LorentzVector internally
0028 // 20100120  M. Kelsey -- BUG FIX:  scm_momentum should be G4ThreeVector
0029 // 20100126  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
0030 // 20100519  M. Kelsey -- Add interfaces to pass G4InuclParticles directly
0031 // 20100616  M. Kelsey -- Report bullet and target four-momenta when set
0032 // 20100915  M. Kelsey -- Move constructors to .cc file, add initializers
0033 // 20110602  M. Kelsey -- Drop some unnecessary kinematics intermediates
0034 
0035 #ifndef G4LORENTZ_CONVERTOR_HH
0036 #define G4LORENTZ_CONVERTOR_HH
0037 
0038 #include "globals.hh"
0039 #include "G4LorentzVector.hh"
0040 #include "G4ThreeVector.hh"
0041 
0042 class G4InuclParticle;
0043 
0044 class G4LorentzConvertor {
0045 public:
0046   G4LorentzConvertor();
0047 
0048   G4LorentzConvertor(const G4LorentzVector& bmom, G4double bmass, 
0049              const G4LorentzVector& tmom, G4double tmass);
0050 
0051   G4LorentzConvertor(const G4InuclParticle* bullet, 
0052              const G4InuclParticle* target);
0053 
0054   void setVerbose(G4int vb=0) { verboseLevel = vb; }
0055 
0056   void setBullet(const G4InuclParticle* bullet);
0057   void setTarget(const G4InuclParticle* target);
0058 
0059   void setBullet(const G4InuclParticle& bullet) { setBullet(&bullet); }
0060   void setTarget(const G4InuclParticle& target) { setTarget(&target); }
0061 
0062   // Use correct four-vectors as input
0063   void setBullet(const G4LorentzVector& bmom) {
0064     bullet_mom = bmom;
0065     if (verboseLevel > 3) printBullet();
0066   }
0067 
0068   void setTarget(const G4LorentzVector& bmom) {
0069     target_mom = bmom;
0070     if (verboseLevel > 3) printTarget();
0071   }
0072 
0073   // These functions "repair" input 4-vectors using specified mass
0074   void setBullet(const G4LorentzVector& bmom, G4double bmass) {
0075     bullet_mom.setVectM(bmom.vect(), bmass);
0076     if (verboseLevel > 3) printBullet();
0077   }
0078   
0079   void setTarget(const G4LorentzVector& tmom, G4double tmass) {
0080     target_mom.setVectM(tmom.vect(), tmass);
0081     if (verboseLevel > 3) printTarget();
0082   }
0083 
0084   // Select reference frame for boosts, rotations, etc.
0085   void toTheCenterOfMass();
0086   void toTheTargetRestFrame(); 
0087   void fillKinematics();    // Common calculations after either of above
0088 
0089   G4LorentzVector backToTheLab(const G4LorentzVector& mom) const;
0090 
0091   // Four-vectors of bullet and target in last chosen reference frame
0092   const G4LorentzVector& getBullet() const { return bullet_mom; }
0093   const G4LorentzVector& getTarget() const { return target_mom; }
0094  
0095   G4double getKinEnergyInTheTRS() const;
0096   G4double getTotalSCMEnergy() const { return ecm_tot; }
0097   G4double getSCMMomentum() const { return scm_momentum.rho(); }
0098   G4double getTRSMomentum() const;
0099 
0100   G4LorentzVector rotate(const G4LorentzVector& mom) const; 
0101 
0102   G4LorentzVector rotate(const G4LorentzVector& mom1,
0103              const G4LorentzVector& mom) const; 
0104 
0105   G4bool reflectionNeeded() const; 
0106 
0107   G4bool trivial() const { return degenerated; }
0108 
0109   // Reporting functions for diagnostics
0110   void printBullet() const;
0111   void printTarget() const;
0112 
0113 private: 
0114   static const G4double small;
0115 
0116   G4int verboseLevel;
0117   G4LorentzVector bullet_mom;
0118   G4LorentzVector target_mom;
0119 
0120   G4LorentzVector scm_momentum;     // CM momentum relative to target/bullet
0121   G4ThreeVector   scm_direction;    // Unit vector to reduce repeated calcs
0122 
0123   // Buffer variables for doing ::rotate() calculations
0124   G4ThreeVector velocity;
0125   G4double v2;
0126   G4double ecm_tot;
0127   G4double valong;
0128   G4bool degenerated;
0129 };        
0130 
0131 #endif // G4LORENTZ_CONVERTOR_HH