TVirtualMagField.h

Go to the documentation of this file.
00001 // @(#)root/geom:$Id: TVirtualMagField.h 27106 2009-01-09 07:55:28Z brun $
00002 
00003 /*************************************************************************
00004  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00009  *************************************************************************/
00010 
00011 #ifndef ROOT_TVirtualMagField
00012 #define ROOT_TVirtualMagField
00013 
00014 #ifndef ROOT_TNamed
00015 #include "TNamed.h"
00016 #endif
00017 
00018 ////////////////////////////////////////////////////////////////////////////
00019 //                                                                        //
00020 // TVirtualMagField - ABC for magnetic field. Derived classes must        //
00021 // implement the method: Field(const Double_t *x, Double_t *B)            //
00022 //                                                                        //
00023 ////////////////////////////////////////////////////////////////////////////
00024 
00025 class TVirtualMagField : public TNamed
00026 {
00027 public:
00028    TVirtualMagField()                 : TNamed() {}
00029    TVirtualMagField(const char *name) : TNamed(name,"") {}
00030    virtual ~TVirtualMagField();
00031    
00032    virtual void Field(const Double_t *x, Double_t *B) = 0;
00033    
00034    ClassDef(TVirtualMagField, 1)              // Abstract base field class
00035 };
00036 
00037 
00038 ////////////////////////////////////////////////////////////////////////////
00039 //                                                                        //
00040 // TGeoUniformMagField - Uniform magnetic field class.                       //
00041 //                                                                        //
00042 ////////////////////////////////////////////////////////////////////////////
00043 
00044 class TGeoUniformMagField : public TVirtualMagField
00045 {
00046 private:
00047    Double_t                fB[3]; // Magnetic field vector
00048 
00049 protected:
00050    TGeoUniformMagField(const TGeoUniformMagField&);
00051    TGeoUniformMagField& operator=(const TGeoUniformMagField&);
00052    
00053 public:
00054    TGeoUniformMagField();
00055    TGeoUniformMagField(Double_t Bx, Double_t By, Double_t Bz);
00056    virtual ~TGeoUniformMagField() {}
00057    
00058    void            Field(const Double_t * /*x*/, Double_t *B) {B[0]=fB[0]; B[1]=fB[1]; B[2]=fB[2];}
00059 
00060    const Double_t *GetFieldValue() const { return &fB[0]; }
00061    void            SetFieldValue(Double_t Bx, Double_t By, Double_t Bz) {fB[0]=Bx; fB[1]=By; fB[2]=Bz;}
00062    
00063    ClassDef(TGeoUniformMagField, 1)  // Uniform magnetic field        
00064 };
00065 
00066 #endif

Generated on Tue Jul 5 14:12:21 2011 for ROOT_528-00b_version by  doxygen 1.5.1