Files
geant4/examples/extended/eventgenerator/HepMC/HepMCEx02/src/H02Field.cc
T
2016-06-09 11:11:55 +02:00

49 lines
2.1 KiB
C++

//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// ====================================================================
//
// H02Field.hh
// $Id: H02Field.cc,v 1.3 2004/12/03 15:52:39 gcosmo Exp $
//
// ====================================================================
#include "H02Field.hh"
////////////////////////////////////////////////////////////////////////////
void H02Field::GetFieldValue(const G4double Point[3], G4double* Bfield) const
////////////////////////////////////////////////////////////////////////////
{
const G4double Bz= 3.0*tesla;
const G4double rmax_sq = sqr(1.*m);
const G4double zmax = 1.*m;
Bfield[0]= 0.;
Bfield[1] = 0.;
if(std::abs(Point[2])<zmax && (sqr(Point[0])+sqr(Point[1]))<rmax_sq) {
Bfield[2]= Bz;
} else {
Bfield[2]= 0.;
}
}