~christopher-hunt08/maus/maus_integrated_kalman

« back to all changes in this revision

Viewing changes to src/legacy/BeamTools/BTFieldConstructor.cc

  • Committer: Christopher Hunt
  • Date: 2015-06-18 14:48:59 UTC
  • mfrom: (697.69.1 merge)
  • mto: (697.69.2 merge_hunt)
  • mto: This revision was merged to the branch mainline in revision 708.
  • Revision ID: christopher.hunt08@imperial.ac.uk-20150618144859-rki5ma1lv8722w41
Merged in latest trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
        double length=(theModule->propertyDoubleThis("Length"));
219
219
        double thickness=(theModule->propertyDoubleThis("Thickness"));
220
220
        double innerRadius=(theModule->propertyDoubleThis("InnerRadius"));
221
 
        double currentDensity=(theModule->propertyDoubleThis("CurrentDensity"));
 
221
  double currentDensity = 0.;
 
222
  if (theModule->propertyExistsThis("CurrentDensity", "double")) {
 
223
        currentDensity = theModule->propertyDoubleThis("CurrentDensity");
 
224
  } else if (theModule->propertyExistsThis("Current", "double") &&
 
225
             theModule->propertyExistsThis("NumberOfTurns", "int")) {
 
226
      double current = theModule->propertyDoubleThis("Current");
 
227
      current *= theModule->propertyIntThis("NumberOfTurns");
 
228
      currentDensity = current/length/thickness;
 
229
  } else {
 
230
      throw(MAUS::Exception(MAUS::Exception::recoverable,
 
231
            "Either (Current and NumberOfTurns) or CurrentDensity should be defined in module "+theModule->name(),
 
232
            "BTFieldConstructor::GetSolenoid"));
 
233
  }
222
234
        if(solenoidMode == "Analytic")
223
235
        {
224
236
                newSolenoid->SetIsAnalytic(true);