~mbogomilov/maus/devel3

« back to all changes in this revision

Viewing changes to src/legacy/Optics/TransferMap.cc

  • Committer: Durga Rajaram
  • Date: 2013-11-19 02:09:06 UTC
  • mfrom: (659.1.77 rc)
  • Revision ID: durga@fnal.gov-20131119020906-t2vxx4h2yr0f09tj
Tags: MAUS-v0.7.4
MAUS-v0.7.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
296
296
double TransferMap::PhaseAdvance(int axis) const
297
297
{
298
298
        CLHEP::HepMatrix subMatrix = GetFirstOrderMap().sub(axis*2+1, axis*2+2, axis*2+1, axis*2+2);
299
 
        double    phaseAdvance = acos( (subMatrix[0][0] + subMatrix[1][1])/2. ) ;
 
299
  // TM given by
 
300
  // cos(\phi) + \alpha sin(\phi), \beta sin(\phi) / p
 
301
  // - \gamma sin(\phi),            cos(\phi) - \alpha sin(\phi)
 
302
  // we can get the phase advance quadrant by considering both sin(phi) and
 
303
  // cos(phi) and using atan2(phi)
 
304
  double n00 = (subMatrix[0][0]-subMatrix[1][1])/2.; // alpha sin(phi)
 
305
  double sin_phi = sqrt(-n00*n00 - subMatrix[0][1]*subMatrix[1][0]); // ((-alpha^2 + beta gamma) sin^2(phi) )^0.5
 
306
  double cos_phi = (subMatrix[0][0] + subMatrix[1][1])/2.; // cos(phi)
 
307
        double phaseAdvance = atan2(sin_phi, cos_phi);
300
308
        if(phaseAdvance != phaseAdvance) throw(Squeal(Squeal::recoverable, "Complex phase advance", "TransferMap::PhaseAdvance")); 
301
 
        return    phaseAdvance;
 
309
        return phaseAdvance;
302
310
}
303
311
 
304
312
MAUS::PolynomialMap* TransferMap::GetPolynomialMap() {