Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4MuonRadiativeDecayChannelWithSpin
0027 //
0028 // Class description:
0029 //
0030 // This class describes radiative muon decay kinematics, but
0031 // gives incorrect energy spectrum for neutrinos.
0032 // Samples Radiative Muon Decay.
0033 // References:
0034 // - TRIUMF/TWIST Technote TN-55:
0035 //   "Radiative muon decay" by P. Depommier and A. Vacheret
0036 // - Yoshitaka Kuno and Yasuhiro Okada
0037 //   "Muon Decays and Physics Beyond the Standard Model"
0038 //   Rev. Mod. Phys. 73, 151 (2001)
0039 
0040 // Author: P.Gumplinger - Triumf, 25 July 2007
0041 // Revision: D. Mingming - Center for HEP, Tsinghua Univ., 10 August 2011
0042 // --------------------------------------------------------------------
0043 #ifndef G4MuonRadiativeDecayChannelWithSpin_hh
0044 #define G4MuonRadiativeDecayChannelWithSpin_hh 1
0045 
0046 #include "G4ThreeVector.hh"
0047 #include "G4VDecayChannel.hh"
0048 #include "Randomize.hh"
0049 #include "globals.hh"
0050 
0051 #include <CLHEP/Units/PhysicalConstants.h>
0052 
0053 class G4MuonRadiativeDecayChannelWithSpin : public G4VDecayChannel
0054 {
0055   public:
0056     G4MuonRadiativeDecayChannelWithSpin(const G4String& theParentName, G4double theBR);
0057     ~G4MuonRadiativeDecayChannelWithSpin() override = default;
0058 
0059     G4DecayProducts* DecayIt(G4double) override;
0060 
0061   protected:
0062     // Copy constructor and assignment operator
0063     G4MuonRadiativeDecayChannelWithSpin(const G4MuonRadiativeDecayChannelWithSpin&) = default;
0064     G4MuonRadiativeDecayChannelWithSpin& operator=(const G4MuonRadiativeDecayChannelWithSpin&);
0065 
0066   private:
0067     G4MuonRadiativeDecayChannelWithSpin() = default;
0068 
0069     G4double fron(G4double Pmu, G4double x, G4double y, G4double cthetaE, G4double cthetaG,
0070                   G4double cthetaEG);
0071 
0072     // Generates random vectors, uniformly distributed over the surface
0073     // of a sphere of given radius
0074     void rn3dim(G4double& x, G4double& y, G4double& z, G4double xlong);
0075 
0076     G4double atan4(G4double x, G4double y);
0077 };
0078 
0079 // ------------------------
0080 // Inline methods
0081 // ------------------------
0082 
0083 inline void G4MuonRadiativeDecayChannelWithSpin::rn3dim(G4double& x, G4double& y, G4double& z,
0084                                                         G4double xlong)
0085 {
0086   G4double a = 0.;
0087   G4double b = 0.;
0088   G4double c = 0.;
0089   G4double r = 0.;
0090 
0091   do {
0092     a = G4UniformRand() - 0.5;
0093     b = G4UniformRand() - 0.5;
0094     c = G4UniformRand() - 0.5;
0095     r = a * a + b * b + c * c;
0096   } while (r > 0.25);  // Loop checking, 09.08.2015, K.Kurashige
0097 
0098   G4double rinv = xlong / (std::sqrt(r));
0099   x = a * rinv;
0100   y = b * rinv;
0101   z = c * rinv;
0102 
0103   return;
0104 }
0105 
0106 inline G4double G4MuonRadiativeDecayChannelWithSpin::atan4(G4double x, G4double y)
0107 {
0108   G4double phi = 0.;
0109 
0110   if (x == 0. && y > 0.) {
0111     phi = 0.5 * CLHEP::pi;
0112   }
0113   else if (x == 0. && y < 0.) {
0114     phi = 1.5 * CLHEP::pi;
0115   }
0116   else if (y == 0. && x > 0.) {
0117     phi = 0.;
0118   }
0119   else if (y == 0. && x < 0.) {
0120     phi = CLHEP::pi;
0121   }
0122   else if (x > 0.) {
0123     phi = std::atan(y / x);
0124   }
0125   else if (x < 0.) {
0126     phi = std::atan(y / x) + CLHEP::pi;
0127   }
0128 
0129   return phi;
0130 }
0131 
0132 #endif