Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4HarmonicPolMagField implementation << 27 // 23 // 28 // Author: V.Grichine, 03.02.1997 << 24 // $Id: G4HarmonicPolMagField.cc,v 1.5 2003/10/31 14:35:54 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-06-00-patch-01 $ >> 26 // 29 // ------------------------------------------- 27 // ------------------------------------------------------------------- 30 28 31 #include "G4HarmonicPolMagField.hh" 29 #include "G4HarmonicPolMagField.hh" 32 #include "globals.hh" 30 #include "globals.hh" 33 31 34 G4HarmonicPolMagField::G4HarmonicPolMagField() << 32 G4HarmonicPolMagField::G4HarmonicPolMagField() 35 << 36 G4HarmonicPolMagField* G4HarmonicPolMagField:: << 37 { 33 { 38 return new G4HarmonicPolMagField; << 39 } 34 } 40 35 41 // ------------------------------------------- << 36 ///////////////////////////////////////////////////////////////////////// 42 37 43 G4HarmonicPolMagField::~G4HarmonicPolMagField( << 38 G4HarmonicPolMagField::~G4HarmonicPolMagField() >> 39 { >> 40 } >> 41 >> 42 ///////////////////////////////////////////////////////////////////////// 44 43 45 // ------------------------------------------- << 46 44 47 void G4HarmonicPolMagField::GetFieldValue(cons << 45 void G4HarmonicPolMagField::GetFieldValue(const G4double yTrack[7], 48 << 46 G4double B[3] ) const 49 { 47 { >> 48 G4int i ; 50 G4double a = 1.00 ; // mm -> m 49 G4double a = 1.00 ; // mm -> m 51 G4double x = a*yTrack[0], y = a*yTrack[1], 50 G4double x = a*yTrack[0], y = a*yTrack[1], z = a*yTrack[2] ; 52 G4double x2 = x*x, y2 = y*y, z2 = z*z ; 51 G4double x2 = x*x, y2 = y*y, z2 = z*z ; 53 G4double x3 = x2*x, y3 = y2*y, z3 = z2*z ; 52 G4double x3 = x2*x, y3 = y2*y, z3 = z2*z ; 54 G4double xy = x*y, xz = x*z, yz = y*z, xyz 53 G4double xy = x*y, xz = x*z, yz = y*z, xyz = x*y*z ; 55 static G4ThreadLocal G4double << 54 static G4double 56 c[24] = { 55 c[24] = { 57 .010, .010, .010, 56 .010, .010, .010, // 3(0) 58 .0001, .0001, .0001, .0001, .0001 << 57 .0001, .0001, .0001, .0001, .0001, // 5(1) 59 .00001, .00001, .00001, .00001, . << 58 .00001, .00001, .00001, .00001, .00001, .00001, .00001, // 7(2) 60 .000001, .000001, .000001, .00000 << 59 .000001, .000001, .000001, .000001, .000001, .000001, 61 .0000001, .0000001, .0000001 << 60 .0000001, .0000001, .0000001 // 9(3) 62 } ; 61 } ; // total : 24 63 62 64 // for(auto i=0;i<24; ++i) << 63 // for(i=0;i<24;i++) 65 // { 64 // { 66 // c[i] = 1.0*c[i] ; 65 // c[i] = 1.0*c[i] ; 67 // } 66 // } 68 B[0] = c[1] 67 B[0] = c[1] 69 -2*c[3]*x + c[4]*z +c[6]*y -2*c[7]*x 68 -2*c[3]*x + c[4]*z +c[6]*y -2*c[7]*x 70 -6*c[8]*xz + c[9]*(z2-x2) -2*c[10]*x 69 -6*c[8]*xz + c[9]*(z2-x2) -2*c[10]*xy + c[11]*yz - 2*c[12]*xz 71 +c[13]*(y2-x2) - 6*c[14]*xy 70 +c[13]*(y2-x2) - 6*c[14]*xy 72 -4*c[15]*(3*x*z2-x3) +c[16]*(z3-3*x2 71 -4*c[15]*(3*x*z2-x3) +c[16]*(z3-3*x2*z) - 6*c[17]*xyz +c[18]*y*(z2-x2) 73 -2*c[19]*(x*z2+x*y2-2*x3/3) + c[20]* 72 -2*c[19]*(x*z2+x*y2-2*x3/3) + c[20]*z*(y2-x2) - 6*c[21]*xyz 74 +c[22]*(y3-3*x2*y) - 4*c[23]*(3*x*y2 73 +c[22]*(y3-3*x2*y) - 4*c[23]*(3*x*y2-x3) ; 75 74 76 B[1] = c[2] 75 B[1] = c[2] 77 +c[5]*z + c[6]*x + 2*c[7]*y 76 +c[5]*z + c[6]*x + 2*c[7]*y 78 +c[10]*(z2-x2) + c[11]*xz +2*c[12]*y 77 +c[10]*(z2-x2) + c[11]*xz +2*c[12]*yz +2*c[13]*xy + 3*c[14]*(y2-x2) 79 +c[17]*(z3-3*x2*z) + c[18]*(x*z2-x3/ << 78 +c[17]*(z3-3*x2*z) + c[18]*(x*z2-x3/3) +2*c[19]*y*(z2-x2) 80 +2*c[20]*xyz 79 +2*c[20]*xyz 81 +3*c[21]*z*(y2-x2) + c[22]*(3*x*y2-x 80 +3*c[21]*z*(y2-x2) + c[22]*(3*x*y2-x3) + 4*c[23]*(y3-3*x2*y) ; 82 81 83 B[2] = c[0] 82 B[2] = c[0] 84 +c[3]*z + c[4]*x + c[5]*y 83 +c[3]*z + c[4]*x + c[5]*y 85 +3*c[8]*(z2-x2) + 2*c[9]*xz + 2*c[10 84 +3*c[8]*(z2-x2) + 2*c[9]*xz + 2*c[10]*yz + c[11]*xy + c[12]*(y2-x2) 86 +4*c[15]*(z3-3*x2*z) + c[16]*(3*x*z2 85 +4*c[15]*(z3-3*x2*z) + c[16]*(3*x*z2-x3) + 3*c[17]*(y*z2-x2*y) 87 +2*c[18]*xyz 86 +2*c[18]*xyz 88 +2*c[19]*z*(y2-x2) + c[20]*(x*y2-x3/ 87 +2*c[19]*z*(y2-x2) + c[20]*(x*y2-x3/3) + c[21]*(y3-3*x2*y) ; 89 for(auto i=0; i<3 ; ++i) << 88 for(i=0;i<3;i++) 90 { 89 { 91 B[i] = 0.1*B[i] ; 90 B[i] = 0.1*B[i] ; 92 } 91 } 93 } 92 } 94 93 95 // ------------------------------------------- 94 // ----------------------------------------------------------------- 96 95