~ajdobbs/maus/scifi-efficiency-2

« back to all changes in this revision

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

MergeĀ inĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "BeamTools/BTMultipole.hh"
27
27
 
28
28
#include "Utils/Exception.hh"
29
 
#include "Interface/Squeak.hh"
 
29
#include "Utils/Squeak.hh"
30
30
 
31
31
const BTMultipole * BTMultipole::staticMultipole = NULL;
32
32
double              BTMultipole::staticDX        = 0.;
69
69
      if (curvature == "StraightEnds") _curvature = straightEnds;
70
70
      if (curvature == "Constant" || curvature == "") _curvature = constant;
71
71
      if (_width >= fabs(_rCurv))
72
 
        throw(MAUS::Exception(MAUS::Exception::nonRecoverable,
 
72
        throw(MAUS::Exceptions::Exception(MAUS::Exceptions::nonRecoverable,
73
73
              "Multipole with width > radius of curvature",
74
74
              "BTMultipole::BTMultipole"));
75
75
      if (_length > fabs(2*pi*_rCurv))
76
 
        throw(MAUS::Exception(MAUS::Exception::nonRecoverable,
 
76
        throw(MAUS::Exceptions::Exception(MAUS::Exceptions::nonRecoverable,
77
77
                     "Multipole with bending angle > 360 degrees",
78
78
                     "BTMultipole::BTMultipole"));
79
79
      _endRotation = CLHEP::HepRotation(CLHEP::Hep3Vector(0, 1, 0),
124
124
    case momentumBased:
125
125
      return TransformToRotatedMomentumBased(Point);
126
126
    default:
127
 
      throw(MAUS::Exception(MAUS::Exception::nonRecoverable, "Did not recognise curvature model",
 
127
      throw(MAUS::Exceptions::Exception(MAUS::Exceptions::nonRecoverable,
 
128
                   "Did not recognise curvature model",
128
129
                   "BTMultipole::TransformToRotated(const double*)"));
129
130
  }
130
131
}
199
200
      return _momentum/EMfield[1]/CLHEP::eplus/CLHEP::c_light;
200
201
    }
201
202
    default:
202
 
      throw(MAUS::Exception(MAUS::Exception::nonRecoverable, "Did not recognise curvature model",
 
203
      throw(MAUS::Exceptions::Exception(MAUS::Exceptions::nonRecoverable,
 
204
                   "Did not recognise curvature model",
203
205
                   "BTMultipole::RadiusOfCurvature(double)"));
204
206
  }
205
207
}
216
218
    case momentumBased:
217
219
      return TransformToRectangularMomentumBased(point, value);
218
220
    default:
219
 
      throw(MAUS::Exception(MAUS::Exception::nonRecoverable, "Did not recognise curvature model",
 
221
      throw(MAUS::Exceptions::Exception(MAUS::Exceptions::nonRecoverable,
 
222
                "Did not recognise curvature model",
220
223
                "BTMultipole::TransformToRectangular(const double*, double*)"));
221
224
  }
222
225
}
359
362
      int status =  gsl_odeiv_evolve_apply(evolve, control, stepper, &system,
360
363
                                           &s, sMax, &h, y);
361
364
      if (status != GSL_SUCCESS) {
362
 
        Print(Squeak::mout(Squeak::debug));
363
 
        throw(MAUS::Exception(MAUS::Exception::nonRecoverable,
 
365
        Print(MAUS::Squeak::mout(MAUS::Squeak::debug));
 
366
        throw(MAUS::Exceptions::Exception(MAUS::Exceptions::nonRecoverable,
364
367
                    "Error calculating reference trajectory",
365
368
                    "BTMultipole::SetupReferenceTrajectory()"));
366
369
      }
391
394
  int    step = 0;
392
395
  while (s < _length) {
393
396
    if (step > 10000) {
394
 
      Squeak::mout(Squeak::warning) << "Stepper stuck while calculating "
 
397
      MAUS::Squeak::mout(MAUS::Squeak::warning) << "Stepper stuck while calculating "
395
398
                                    << "BTMultipole Effective Length"
396
399
                                    << std::endl;
397
400
      return 0.;
399
402
    int status =  gsl_odeiv_evolve_apply(evolve, control, stepper, &system, &s,
400
403
                                         _length, &h, y);
401
404
    if (status != GSL_SUCCESS) {
402
 
      Print(Squeak::mout(Squeak::debug));
403
 
      throw(MAUS::Exception(MAUS::Exception::nonRecoverable, "Error integrating reference By",
 
405
      Print(MAUS::Squeak::mout(MAUS::Squeak::debug));
 
406
      throw(MAUS::Exceptions::Exception(MAUS::Exceptions::nonRecoverable,
 
407
                   "Error integrating reference By",
404
408
                   "BTMultipole::SetupMagnitude()"));
405
409
    }
406
410
    step++;