Skip to content

Commit

Permalink
macro field SetZOffset with /remoll/field/zoffset
Browse files Browse the repository at this point in the history
Value entered in meters since, again, no third token for units is
allowed.
  • Loading branch information
wdconinc committed Oct 2, 2019
1 parent 59046cf commit 96fd953
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/remollGlobalField.hh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class remollGlobalField : public G4MagneticField {

void AddNewField(G4String& name);

void SetZOffset(const G4String& name, G4double offset);
void SetFieldScale(const G4String& name, G4double scale);
void SetMagnetCurrent(const G4String& name, G4double current);

Expand Down
3 changes: 3 additions & 0 deletions macros/runexample.mac
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
/remoll/addfield map_directory/blockyHybrid_rm_3.0.txt
/remoll/addfield map_directory/blockyUpstream_rm_1.1.txt

/remoll/field/zoffset map_directory/blockyHybrid_rm_3.0.txt -5087.
/remoll/field/zoffset map_directory/blockyUpstream_rm_1.1.txt -5087.

#/remoll/field/scale map_directory/blockyHybrid_rm_3.0.txt 1.0
#/remoll/field/current map_directory/blockyHybrid_rm_3.0.txt 1000.0

Expand Down
10 changes: 10 additions & 0 deletions src/remollGlobalField.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ remollGlobalField::remollGlobalField()
fGlobalFieldMessenger->DeclareProperty("deltachord",fDeltaChord,"Set delta chord for the chord finder");
fGlobalFieldMessenger->DeclareProperty("deltaonestep",fDeltaOneStep,"Set delta one step for the field manager");
fGlobalFieldMessenger->DeclareProperty("deltaintersection",fMinStep,"Set delta intersection for the field manager");
fGlobalFieldMessenger->DeclareMethod("zoffset",&remollGlobalField::SetZOffset,"Set magnetic field z offset");
fGlobalFieldMessenger->DeclareMethod("scale",&remollGlobalField::SetFieldScale,"Scale magnetic field by factor");
fGlobalFieldMessenger->DeclareMethod("current",&remollGlobalField::SetMagnetCurrent,"Scale magnetic field by current");
fGlobalFieldMessenger->DeclareMethod("value",&remollGlobalField::PrintFieldValue,"Print the field value at a given point (in m)");
Expand Down Expand Up @@ -271,7 +272,16 @@ void remollGlobalField::GetFieldValue(const G4double p[], G4double *resB) const
}
}

void remollGlobalField::SetZOffset(const G4String& name, G4double offset)
{
remollMagneticField *field = GetFieldByName(name);
if (field) {
G4AutoLock lock(&remollGlobalFieldMutex);
field->SetZoffset(offset);
} else {
G4cerr << "WARNING " << __FILE__ << " line " << __LINE__
<< ": field " << name << " offset failed" << G4endl;
}
}

void remollGlobalField::SetFieldScale(const G4String& name, G4double scale)
Expand Down

0 comments on commit 96fd953

Please sign in to comment.