--- PamVMC/include/PamVMCFieldMgr.h 2009/02/19 16:50:36 1.1 +++ PamVMC/include/PamVMCFieldMgr.h 2010/09/15 07:05:42 1.6 @@ -1,6 +1,7 @@ #ifndef PAMVMCFIELDMGR_H #define PAMVMCFIELDMGR_H #include +#include #include "TString.h" @@ -12,12 +13,17 @@ #define ZSPEBP 2.97 //cm #define HORMG 22.57 //cm -#ifdef PAMFIELD +//#ifdef PAMFIELD #include "TrkParams.h" -#endif - -class PamVMCFieldMgr: public TObject { +//#endif +#if ROOT_VERSION_CODE >= 333572 + #include + class PamVMCFieldMgr: public TVirtualMagField +#else + class PamVMCFieldMgr: public TObject +#endif +{ private: static PamVMCFieldMgr * fm; @@ -44,46 +50,47 @@ #endif } - void Field(const Double_t* x, Double_t* b) const { - + void Field(const Double_t* x, Double_t* B) { #ifdef PAMFIELD float xm[3]={x[0],x[1],x[2]-ZCAL-CALS3-ZSPEBP-HORMG}; - b[0] = TrkParams::GetBX((float *)xm)*10; - b[1] = TrkParams::GetBY((float *)xm)*10; - b[2] = TrkParams::GetBZ((float *)xm)*10; + B[0] = TrkParams::GetBX((float *)xm)*10; + B[1] = TrkParams::GetBY((float *)xm)*10; + B[2] = TrkParams::GetBZ((float *)xm)*10; #else if(x) { - for (Int_t i=0; i<3; i++) b[i] = 0.0; + for (Int_t i=0; i<3; i++) B[i] = 0.0; } else { - b[0]=b[1]=b[2]=0.0; + B[0]=B[1]=B[2]=0.0; } #endif } - void Field(const Float_t* x, Float_t* b) const { + void Field(const Float_t* x, Float_t* b) { -#ifdef PAMFIELD - float xm[3]={x[0],x[1],x[2]-ZCAL-CALS3-ZSPEBP-HORMG}; - b[0] = TrkParams::GetBX((float *)xm)*10; - b[1] = TrkParams::GetBY((float *)xm)*10; - b[2] = TrkParams::GetBZ((float *)xm)*10; - -#else - if(x) { - for (Int_t i=0; i<3; i++) b[i] = 0.0; - } else { - b[0]=b[1]=b[2]=0.0; - } -#endif - +#ifdef PAMFIELD + float xm[3]={x[0],x[1],x[2]-ZCAL-CALS3-ZSPEBP-HORMG}; + + b[0] = TrkParams::GetBX((float *)xm)*10; + b[1] = TrkParams::GetBY((float *)xm)*10; + b[2] = TrkParams::GetBZ((float *)xm)*10; + +#else + if(x) { + for (Int_t i=0; i<3; i++) b[i] = 0.0; + } else { + b[0]=b[1]=b[2]=0.0; + } +#endif + } + }; #endif