Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MuonDecayChannel.cc
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 // $Id: G4MuonDecayChannel.cc 95906 2016-03-02 10:56:50Z gcosmo $
28 //
29 //
30 // ------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 // History: first implementation, based on object model of
34 // 30 May 1997 H.Kurashige
35 //
36 // - Fix bug in calculation of electron energy in DecayIt()
37 // 28 Feb 01 H.Kurashige
38 // - Adding V-A fluxes for neutrinos using a new algorithm, 2005
39 // M. Melissas ( melissas AT cppm.in2p3.fr)
40 // J. Brunner ( brunner AT cppm.in2p3.fr)
41 // ------------------------------------------------------------
42 
43 #include "G4ParticleDefinition.hh"
44 #include "G4PhysicalConstants.hh"
45 #include "G4SystemOfUnits.hh"
46 #include "G4DecayProducts.hh"
47 #include "G4VDecayChannel.hh"
48 #include "G4MuonDecayChannel.hh"
49 #include "Randomize.hh"
50 #include "G4LorentzVector.hh"
51 #include "G4LorentzRotation.hh"
52 #include "G4RotationMatrix.hh"
53 
56 {
57 }
58 
60  G4double theBR)
61  :G4VDecayChannel("Muon Decay",1)
62 {
63  // set names for daughter particles
64  if (theParentName == "mu+") {
65  SetBR(theBR);
66  SetParent("mu+");
68  SetDaughter(0, "e+");
69  SetDaughter(1, "nu_e");
70  SetDaughter(2, "anti_nu_mu");
71  } else if (theParentName == "mu-") {
72  SetBR(theBR);
73  SetParent("mu-");
75  SetDaughter(0, "e-");
76  SetDaughter(1, "anti_nu_e");
77  SetDaughter(2, "nu_mu");
78  } else {
79 #ifdef G4VERBOSE
80  if (GetVerboseLevel()>0) {
81  G4cout << "G4MuonDecayChannel:: constructor :";
82  G4cout << " parent particle is not muon but ";
83  G4cout << theParentName << G4endl;
84  }
85 #endif
86  }
87 }
88 
90  G4VDecayChannel(right)
91 {
92 }
93 
95 {
96 }
97 
99 {
100  if (this != &right) {
102  verboseLevel = right.verboseLevel;
103  rbranch = right.rbranch;
104 
105  // copy parent name
106  parent_name = new G4String(*right.parent_name);
107 
108  // clear daughters_name array
110 
111  // recreate array
113  if ( numberOfDaughters >0 ) {
116  //copy daughters name
117  for (G4int index=0; index < numberOfDaughters; index++) {
118  daughters_name[index] = new G4String(*right.daughters_name[index]);
119  }
120  }
121  }
122  return *this;
123 }
124 
126 {
127  // this version neglects muon polarization,and electron mass
128  // assumes the pure V-A coupling
129  // the Neutrinos are correctly V-A.
130 #ifdef G4VERBOSE
131  if (GetVerboseLevel()>1) G4cout << "G4MuonDecayChannel::DecayIt ";
132 #endif
133 
136 
137  // parent mass
138  G4double parentmass = G4MT_parent->GetPDGMass();
139  const int N_DAUGHTER=3;
140 
141  //daughters'mass
142  G4double daughtermass[N_DAUGHTER];
143  G4double sumofdaughtermass = 0.0;
144  for (G4int index=0; index<N_DAUGHTER; index++){
145  daughtermass[index] = G4MT_daughters[index]->GetPDGMass();
146  sumofdaughtermass += daughtermass[index];
147  }
148 
149  //create parent G4DynamicParticle at rest
150  G4ThreeVector dummy;
151  G4DynamicParticle * parentparticle = new G4DynamicParticle( G4MT_parent, dummy, 0.0);
152  //create G4Decayproducts
153  G4DecayProducts *products = new G4DecayProducts(*parentparticle);
154  delete parentparticle;
155 
156  // calculate daughter momentum
157  G4double daughtermomentum[N_DAUGHTER];
158  // calcurate electron energy
159  G4double xmax = (1.0+daughtermass[0]*daughtermass[0]/parentmass/parentmass);
160  G4double x;
161 
162  G4double Ee,Ene;
163 
164  G4double gam;
165  G4double EMax=parentmass/2-daughtermass[0];
166 
167  const size_t MAX_LOOP=1000;
168  //Generating Random Energy
169  for (size_t loop1=0; loop1 <MAX_LOOP; ++loop1){
170  Ee=G4UniformRand();
171  for (size_t loop2 =0; loop2<MAX_LOOP; ++loop2){
172  x=xmax*G4UniformRand();
173  gam=G4UniformRand();
174  if (gam <= x*(1.-x)) break;
175  x = xmax;
176  }
177  Ene=x;
178  if ( Ene >= (1.-Ee)) break;
179  Ene = 1.-Ee;
180  }
181  G4double Enm=(2.-Ee-Ene);
182 
183 
184  //initialisation of rotation parameters
185 
186  G4double costheta,sintheta,rphi,rtheta,rpsi;
187  costheta= 1.-2./Ee-2./Ene+2./Ene/Ee;
188  sintheta=std::sqrt(1.-costheta*costheta);
189 
190 
191  rphi=twopi*G4UniformRand()*rad;
192  rtheta=(std::acos(2.*G4UniformRand()-1.));
193  rpsi=twopi*G4UniformRand()*rad;
194 
195  G4RotationMatrix rot;
196  rot.set(rphi,rtheta,rpsi);
197 
198  //electron 0
199  daughtermomentum[0]=std::sqrt(Ee*Ee*EMax*EMax+2.0*Ee*EMax * daughtermass[0]);
200  G4ThreeVector direction0(0.0,0.0,1.0);
201 
202  direction0 *= rot;
203 
204  G4DynamicParticle * daughterparticle = new G4DynamicParticle ( G4MT_daughters[0], direction0 * daughtermomentum[0]);
205 
206  products->PushProducts(daughterparticle);
207 
208  //electronic neutrino 1
209 
210  daughtermomentum[1]=std::sqrt(Ene*Ene*EMax*EMax+2.0*Ene*EMax * daughtermass[1]);
211  G4ThreeVector direction1(sintheta,0.0,costheta);
212 
213  direction1 *= rot;
214 
215  G4DynamicParticle * daughterparticle1 = new G4DynamicParticle ( G4MT_daughters[1], direction1 * daughtermomentum[1]);
216  products->PushProducts(daughterparticle1);
217 
218  //muonnic neutrino 2
219 
220  daughtermomentum[2]=std::sqrt(Enm*Enm*EMax*EMax +2.0*Enm*EMax*daughtermass[2]);
221  G4ThreeVector direction2(-Ene/Enm*sintheta,0,-Ee/Enm-Ene/Enm*costheta);
222 
223  direction2 *= rot;
224 
225  G4DynamicParticle * daughterparticle2 = new G4DynamicParticle ( G4MT_daughters[2],
226  direction2 * daughtermomentum[2]);
227  products->PushProducts(daughterparticle2);
228 
229  // output message
230 #ifdef G4VERBOSE
231  if (GetVerboseLevel()>1) {
232  G4cout << "G4MuonDecayChannel::DecayIt ";
233  G4cout << " create decay products in rest frame " <<G4endl;
234  products->DumpInfo();
235  }
236 #endif
237  return products;
238 }
void CheckAndFillDaughters()
void SetBR(G4double value)
G4int PushProducts(G4DynamicParticle *aParticle)
G4ParticleDefinition * G4MT_parent
G4ParticleDefinition ** G4MT_daughters
tuple x
Definition: test.py:50
static constexpr double rad
Definition: G4SIunits.hh:149
int G4int
Definition: G4Types.hh:78
static constexpr double twopi
Definition: G4SIunits.hh:76
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
G4String kinematics_name
void DumpInfo() const
void SetNumberOfDaughters(G4int value)
G4String * parent_name
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
G4int GetVerboseLevel() const
G4double GetPDGMass() const
virtual G4DecayProducts * DecayIt(G4double)
void SetParent(const G4ParticleDefinition *particle_type)
void SetDaughter(G4int anIndex, const G4ParticleDefinition *particle_type)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4MuonDecayChannel & operator=(const G4MuonDecayChannel &)
G4String ** daughters_name