Set in MollerDetectorConstruction as the field manager. More...
#include <MollerGlobalMagnetField.hh>
Public Member Functions | |
MollerGlobalMagnetField () | |
~MollerGlobalMagnetField () | |
void | SetHybridMapFile (const G4String &) |
void | SetUpstreamMapFile (const G4String &) |
void | ReadMagneticField () |
void | GetFieldValue (const G4double Point[4], G4double *Bfield) const |
Private Attributes | |
MollerMagnetFieldMap * | fMagneticField_MainMagnet |
MollerMagnetFieldMap * | fMagneticField_MiniMagnet |
MollerGlobalMagnetFieldMessenger * | fieldMessenger |
G4double | BFieldScalingFactor_MainMagnet |
G4double | BFieldScalingFactor_MiniMagnet |
G4String | upstreamFilename |
G4String | hybridFilename |
Set in MollerDetectorConstruction as the field manager.
MollerGlobalMagnetField::MollerGlobalMagnetField() sets the field map names, initializes the grid after setting the min and max r, z, phi, and reads in the maps. MollerGlobalMagnetField::GetFieldValue() adds the field value for the hybrid and upstream toroids from MollerMagnetFieldMap::GetFieldValue (which does the interpolation) during tracking.
Definition at line 69 of file MollerGlobalMagnetField.hh.
MollerGlobalMagnetField::MollerGlobalMagnetField | ( | ) |
Definition at line 47 of file MollerGlobalMagnetField.cc.
References fieldMessenger, fMagneticField_MainMagnet, and fMagneticField_MiniMagnet.
00048 { 00049 00050 G4cout << G4endl << "###### Calling MollerGlobalMagnetField::MollerGlobalMagnetField() " << G4endl << G4endl; 00051 00052 fieldMessenger = new MollerGlobalMagnetFieldMessenger(this); 00053 00054 G4String fPath = "."; 00055 if (getenv("MOLLERGEANTDIR")) 00056 fPath = getenv("MOLLERGEANTDIR"); 00057 else 00058 G4cout << "You do not have MOLLERGEANTDIR defined in your environment!" << G4endl; 00059 00060 00061 fMagneticField_MainMagnet = NULL; 00062 fMagneticField_MiniMagnet = NULL; 00063 00064 }
MollerGlobalMagnetField::~MollerGlobalMagnetField | ( | ) |
Definition at line 147 of file MollerGlobalMagnetField.cc.
References fieldMessenger, fMagneticField_MainMagnet, and fMagneticField_MiniMagnet.
00148 { 00149 if (fMagneticField_MainMagnet) delete fMagneticField_MainMagnet; 00150 if (fMagneticField_MiniMagnet) delete fMagneticField_MiniMagnet; 00151 00152 delete fieldMessenger; 00153 }
void MollerGlobalMagnetField::GetFieldValue | ( | const G4double | Point[4], | |
G4double * | Bfield | |||
) | const |
Definition at line 156 of file MollerGlobalMagnetField.cc.
References BFieldScalingFactor_MainMagnet, BFieldScalingFactor_MiniMagnet, fMagneticField_MainMagnet, fMagneticField_MiniMagnet, and MollerMagnetFieldMap::GetFieldValue().
00157 { 00158 00159 G4double myLocalPointInMainMagnet[4]; 00160 G4double myLocalPointInMiniMagnet[4]; 00161 00162 G4double myLocalBfieldInMainMagnet[3]; 00163 G4double myLocalBfieldInMiniMagnet[3]; 00164 00165 //--------------------------------------------------------------- 00166 // translation from global Point[4] into local magnet coordinates 00167 //--------------------------------------------------------------- 00168 // 00169 // No translation needed because for now, map is created with actual z positions 00170 // If add command to move fields, would do it here. 00171 00172 myLocalPointInMainMagnet[0] = Point[0]; // x-pos 00173 myLocalPointInMainMagnet[1] = Point[1]; // y-pos 00174 myLocalPointInMainMagnet[2] = Point[2]; // z-pos 00175 myLocalPointInMainMagnet[3] = Point[3]; // time 00176 00177 myLocalPointInMiniMagnet[0] = Point[0]; // x-pos 00178 myLocalPointInMiniMagnet[1] = Point[1]; // y-pos 00179 myLocalPointInMiniMagnet[2] = Point[2]; // z-pos 00180 myLocalPointInMiniMagnet[3] = Point[3]; // time 00181 00182 00183 // G4cout << " X pos [cm] = " << Point[0]/cm << " ,Y pos [cm] = " << Point[1]/cm << " ,Z pos [cm] = " << Point[2]/cm << G4endl; 00184 00185 00186 if(fMagneticField_MiniMagnet && fMagneticField_MainMagnet){ 00187 fMagneticField_MiniMagnet->GetFieldValue( myLocalPointInMiniMagnet, myLocalBfieldInMiniMagnet ); 00188 fMagneticField_MainMagnet->GetFieldValue( myLocalPointInMainMagnet, myLocalBfieldInMainMagnet ); 00189 00190 Bfield[0] = myLocalBfieldInMainMagnet[0]*BFieldScalingFactor_MainMagnet + myLocalBfieldInMiniMagnet[0]*BFieldScalingFactor_MiniMagnet; 00191 Bfield[1] = myLocalBfieldInMainMagnet[1]*BFieldScalingFactor_MainMagnet + myLocalBfieldInMiniMagnet[1]*BFieldScalingFactor_MiniMagnet; 00192 Bfield[2] = myLocalBfieldInMainMagnet[2]*BFieldScalingFactor_MainMagnet + myLocalBfieldInMiniMagnet[2]*BFieldScalingFactor_MiniMagnet; 00193 // printf("%f %f %f %f %f %f %f %f %f %f %f %f\n",Point[0],Point[1],Point[2], 00194 // myLocalBfieldInMainMagnet[0]*100,myLocalBfieldInMiniMagnet[0]*100,Bfield[0]*100, 00195 // myLocalBfieldInMainMagnet[1]*100,myLocalBfieldInMiniMagnet[1]*100,Bfield[1]*100, 00196 // myLocalBfieldInMainMagnet[2]*100,myLocalBfieldInMiniMagnet[2]*100,Bfield[2]*100); 00197 } 00198 else if(fMagneticField_MainMagnet && !fMagneticField_MiniMagnet){ 00199 fMagneticField_MainMagnet->GetFieldValue( myLocalPointInMainMagnet, myLocalBfieldInMainMagnet ); 00200 00201 Bfield[0] = myLocalBfieldInMainMagnet[0]*BFieldScalingFactor_MainMagnet; 00202 Bfield[1] = myLocalBfieldInMainMagnet[1]*BFieldScalingFactor_MainMagnet; 00203 Bfield[2] = myLocalBfieldInMainMagnet[2]*BFieldScalingFactor_MainMagnet; 00204 } 00205 else if(!fMagneticField_MainMagnet && fMagneticField_MiniMagnet){ 00206 fMagneticField_MiniMagnet->GetFieldValue( myLocalPointInMiniMagnet, myLocalBfieldInMiniMagnet ); 00207 00208 Bfield[0] = myLocalBfieldInMiniMagnet[0]*BFieldScalingFactor_MiniMagnet; 00209 Bfield[1] = myLocalBfieldInMiniMagnet[1]*BFieldScalingFactor_MiniMagnet; 00210 Bfield[2] = myLocalBfieldInMiniMagnet[2]*BFieldScalingFactor_MiniMagnet; 00211 } 00212 else{ 00213 Bfield[0] = 0.0*kilogauss; 00214 Bfield[1] = 0.0*kilogauss; 00215 Bfield[2] = 0.0*kilogauss; 00216 } 00217 00218 // G4cout << "------------------------------------------------------------------------" << G4endl; 00219 // G4cout << " X pos [cm] = " << Point[0]/cm << " , with X BField [kG] = " << Bfield[0] << G4endl; 00220 // G4cout << " Y pos [cm] = " << Point[1]/cm << " , with Y BField [kG] = " << Bfield[1] << G4endl; 00221 // G4cout << " Z pos [cm] = " << Point[2]/cm << " , with Z BField [kG] = " << Bfield[2] << G4endl; 00222 00223 }
void MollerGlobalMagnetField::ReadMagneticField | ( | ) |
Definition at line 67 of file MollerGlobalMagnetField.cc.
References BFieldScalingFactor_MainMagnet, BFieldScalingFactor_MiniMagnet, fMagneticField_MainMagnet, fMagneticField_MiniMagnet, hybridFilename, MollerMagnetFieldMap::InitializeGrid(), MollerMagnetFieldMap::ReadFieldMap(), MollerMagnetFieldMap::SetFieldMap_PhiMax(), MollerMagnetFieldMap::SetFieldMap_PhiMin(), MollerMagnetFieldMap::SetFieldMap_PhiStepsize(), MollerMagnetFieldMap::SetFieldMap_RMax(), MollerMagnetFieldMap::SetFieldMap_RMin(), MollerMagnetFieldMap::SetFieldMap_RStepsize(), MollerMagnetFieldMap::SetFieldMap_ZMax(), MollerMagnetFieldMap::SetFieldMap_ZMin(), MollerMagnetFieldMap::SetFieldMap_ZStepsize(), and upstreamFilename.
Referenced by MollerDetectorConstruction::ReadGlobalMagneticField().
00068 { 00069 00070 G4String fPath = "."; 00071 if (getenv("MOLLERGEANTDIR")) 00072 fPath = getenv("MOLLERGEANTDIR"); 00073 else 00074 G4cout << "You do not have MOLLERGEANTDIR defined in your environment!" << G4endl; 00075 00076 G4String upstreamFieldMap = (fPath+"/map_directory/"+upstreamFilename+".txt"); 00077 G4String hybridFieldMap = (fPath+"/map_directory/"+hybridFilename+".txt"); 00078 00079 G4cout<<"Field maps:"<<G4endl; 00080 G4cout<<upstreamFieldMap<<G4endl; 00081 G4cout<<hybridFieldMap<<G4endl; 00082 00083 BFieldScalingFactor_MainMagnet = 1.0; // default is 1.0 here 00084 fMagneticField_MainMagnet = new MollerMagnetFieldMap(); 00085 00086 if(fMagneticField_MainMagnet){ 00087 00088 fMagneticField_MainMagnet->SetFieldMap_RMin(0.015*m); 00089 fMagneticField_MainMagnet->SetFieldMap_RMax(0.375*m); 00090 fMagneticField_MainMagnet->SetFieldMap_RStepsize(0.002*m); 00091 00092 fMagneticField_MainMagnet->SetFieldMap_ZMin(9.5*m); 00093 fMagneticField_MainMagnet->SetFieldMap_ZMax(17.0*m); 00094 fMagneticField_MainMagnet->SetFieldMap_ZStepsize(0.1*m); 00095 00096 fMagneticField_MainMagnet->SetFieldMap_PhiMin(-25*degree); 00097 fMagneticField_MainMagnet->SetFieldMap_PhiMax(25*degree); 00098 fMagneticField_MainMagnet->SetFieldMap_PhiStepsize(1*degree); 00099 00100 fMagneticField_MainMagnet->InitializeGrid(); 00101 00102 fMagneticField_MainMagnet->ReadFieldMap(hybridFieldMap); 00103 //fMagneticField_MainMagnet->PrintFieldCheck("magfieldcheck_back.txt"); 00104 } 00105 00106 //--------------------------------------------------------------- 00107 // configuration values of the upstream field map 00108 //--------------------------------------------------------------- 00109 00110 BFieldScalingFactor_MiniMagnet = 1.25; // default is 1.25 here 00111 fMagneticField_MiniMagnet = new MollerMagnetFieldMap(); 00112 00113 if(fMagneticField_MiniMagnet){ 00114 00115 fMagneticField_MiniMagnet->SetFieldMap_RMin(0.015*m); 00116 fMagneticField_MiniMagnet->SetFieldMap_RMax(0.375*m); 00117 fMagneticField_MiniMagnet->SetFieldMap_RStepsize(0.002*m); 00118 00119 fMagneticField_MiniMagnet->SetFieldMap_ZMin(6.0*m); 00120 fMagneticField_MiniMagnet->SetFieldMap_ZMax(8.0*m); 00121 fMagneticField_MiniMagnet->SetFieldMap_ZStepsize(0.1*m); 00122 00123 fMagneticField_MiniMagnet->SetFieldMap_PhiMin(-25*degree); 00124 fMagneticField_MiniMagnet->SetFieldMap_PhiMax(25*degree); 00125 fMagneticField_MiniMagnet->SetFieldMap_PhiStepsize(1*degree); 00126 00127 fMagneticField_MiniMagnet->InitializeGrid(); 00128 00129 fMagneticField_MiniMagnet->ReadFieldMap(upstreamFieldMap); 00130 00131 //fMagneticField_MiniMagnet->PrintGridCheck("maggridcheck_front.txt"); 00132 } 00133 00134 G4cout << G4endl << "###### Leaving MollerGlobalMagnetField::MollerGlobalMagnetField " << G4endl << G4endl; 00135 }
void MollerGlobalMagnetField::SetHybridMapFile | ( | const G4String & | nam | ) |
Definition at line 136 of file MollerGlobalMagnetField.cc.
References hybridFilename.
Referenced by MollerGlobalMagnetFieldMessenger::SetNewValue().
00137 { 00138 hybridFilename = nam; 00139 }
void MollerGlobalMagnetField::SetUpstreamMapFile | ( | const G4String & | nam | ) |
Definition at line 141 of file MollerGlobalMagnetField.cc.
References upstreamFilename.
Referenced by MollerGlobalMagnetFieldMessenger::SetNewValue().
00142 { 00143 upstreamFilename = nam; 00144 }
G4double MollerGlobalMagnetField::BFieldScalingFactor_MainMagnet [private] |
Definition at line 93 of file MollerGlobalMagnetField.hh.
Referenced by GetFieldValue(), and ReadMagneticField().
G4double MollerGlobalMagnetField::BFieldScalingFactor_MiniMagnet [private] |
Definition at line 94 of file MollerGlobalMagnetField.hh.
Referenced by GetFieldValue(), and ReadMagneticField().
Definition at line 91 of file MollerGlobalMagnetField.hh.
Referenced by MollerGlobalMagnetField(), and ~MollerGlobalMagnetField().
Definition at line 88 of file MollerGlobalMagnetField.hh.
Referenced by GetFieldValue(), MollerGlobalMagnetField(), ReadMagneticField(), and ~MollerGlobalMagnetField().
Definition at line 89 of file MollerGlobalMagnetField.hh.
Referenced by GetFieldValue(), MollerGlobalMagnetField(), ReadMagneticField(), and ~MollerGlobalMagnetField().
G4String MollerGlobalMagnetField::hybridFilename [private] |
Definition at line 97 of file MollerGlobalMagnetField.hh.
Referenced by ReadMagneticField(), and SetHybridMapFile().
G4String MollerGlobalMagnetField::upstreamFilename [private] |
Definition at line 96 of file MollerGlobalMagnetField.hh.
Referenced by ReadMagneticField(), and SetUpstreamMapFile().