Ignore:
Timestamp:
11/25/03 18:25:49 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/main/MBending.cc

    r2518 r2568  
    6161#include <fstream.h>
    6262#include <iomanip.h>
     63#include <TVector3.h>
    6364
    6465#include <TMinuit.h>
     
    6970
    7071#undef DEBUG
    71 #define DEBUG(txt) txt
    72 //#define DEBUG(txt)
     72//#define DEBUG(txt) txt
     73#define DEBUG(txt)
    7374
    7475const Int_t MBending::fNumPar=19;
     
    8384    fCoeff[ 1] = &fIe;      fName[ 1] = "IE";
    8485    fCoeff[ 2] = &fFlop;    fName[ 2] = "FLOP";
    85     fCoeff[ 3] = &fNpae;    fName[ 3] = "NPAE";
    86     fCoeff[ 4] = &fCa;      fName[ 4] = "CA";
    87     fCoeff[ 5] = &fAn;      fName[ 5] = "AN";
    88     fCoeff[ 6] = &fAw;      fName[ 6] = "AW";
     86    fCoeff[ 3] = &fAn;      fName[ 3] = "AN";
     87    fCoeff[ 4] = &fAw;      fName[ 4] = "AW";
     88    fCoeff[ 5] = &fNpae;    fName[ 5] = "NPAE";
     89    fCoeff[ 6] = &fCa;      fName[ 6] = "CA";
    8990    fCoeff[ 7] = &fTf;      fName[ 7] = "TF";
    9091    fCoeff[ 8] = &fTx;      fName[ 8] = "TX";
     
    103104    fDescr[ 1] =  "Index Error Zenith Distance";
    104105    fDescr[ 2] =  "Vertical Sag";
    105     fDescr[ 3] =  "Az-El Nonperpendicularity";
    106     fDescr[ 4] =  "Left-Right Collimation Error";
    107     fDescr[ 5] =  "Azimuth Axis Misalignment (N-S)";
    108     fDescr[ 6] =  "Azimuth Axis Misalignment (E-W)";
     106    fDescr[ 3] =  "Azimuth Axis Misalignment (N-S)";
     107    fDescr[ 4] =  "Azimuth Axis Misalignment (E-W)";
     108    fDescr[ 5] =  "Az-El Nonperpendicularity";
     109    fDescr[ 6] =  "Left-Right Collimation Error";
    109110    fDescr[ 7] =  "Tube fluxture (sin)";
    110111    fDescr[ 8] =  "Tube fluxture (tan)";
     
    291292
    292293    DEBUG(cout << setprecision(16));
    293     DEBUG(cout << "Bend8: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     294    DEBUG(cout << "Bend7: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    294295
    295296    const AltAz CRX(-fCrx*sin(p.Az()-p.Alt()),  fCrx*cos(p.Az()-p.Alt())/cos(p.Alt()));
     
    298299    p += CRY;
    299300
    300     DEBUG(cout << "Bend7: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     301    DEBUG(cout << "Bend6: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    301302
    302303    const AltAz NRX(fNrx*sin(p.Alt()), -fNrx);
     
    305306    p += NRY;
    306307
    307     DEBUG(cout << "Bend6: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     308    DEBUG(cout << "Bend5: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    308309
    309310    const AltAz CES(-fEces*sin(p.Alt()), -fAces*sin(p.Az()));
     
    312313    p += CEC;
    313314
    314     DEBUG(cout << "Bend5: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     315    DEBUG(cout << "Bend4: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    315316
    316317    const AltAz TX(Sign(fTx/tan(p.Alt()), p.Alt()), 0);
     
    319320    p += TF;
    320321
    321     DEBUG(cout << "Bend4: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    322 
     322
     323    DEBUG(cout << "Bend3: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     324
     325    /*
     326     //New Corrections for NPAE and CA:
     327     TVector3 v(1.,1.,1.); // Vector in cartesian coordinates
     328
     329     //Set Azimuth and Elevation
     330     v.SetPhi(p.Az());
     331     v.SetTheta(TMath::Pi()/2-p.Alt());
     332     //Rotation Vectors:
     333     TVector3 vNpae(             cos(p.Az()),              sin(p.Az()),             0);
     334     TVector3   vCa( -cos(p.Az())*cos(p.Alt()), -sin(p.Az())*cos(p.Alt()), sin(p.Alt()));
     335     //Rotate around the vectors vNpae and vCa
     336     v.Rotate(fNpae, vNpae);
     337     v.Rotate(fCa,     vCa);
     338
     339     p.Az(v.Phi());
     340     p.Alt(TMath::Pi()/2-v.Theta());
     341     */
     342
     343    //Old correction terms for Npae and Ca:
     344    const AltAz CA(0, -fCa/cos(p.Alt()));
     345    p += CA;
     346
     347    const AltAz NPAE(0, -fNpae*tan(p.Alt()));
     348    p += NPAE;
     349
     350    DEBUG(cout << "Bend2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     351
     352    // New Corrections for AW and AN:
     353    TVector3 v2(1.,1.,1.); // Vector in cartesian coordinates
     354    // Set Azimuth and Elevation
     355    v2.SetPhi(p.Az());
     356    v2.SetTheta(TMath::Pi()/2-p.Alt());
     357    // Rotate around the x- and y-axis
     358    v2.RotateX(fAw);
     359    v2.RotateY(fAn);
     360    // Get Azimuth and Elevation
     361    p.Az(v2.Phi());
     362    p.Alt(TMath::Pi()/2-v2.Theta());
     363
     364    /*
     365    // Old correction terms for An and Aw:
    323366    cout << fAw << " " << cos(p.Az()) << " " << tan(p.Alt()) << endl;
    324367    cout << fAw* cos(p.Az())*tan(p.Alt())*180/3.1415 << endl;
     
    328371    p += AW;
    329372    p += AN;
    330 
    331     DEBUG(cout << "Bend3: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    332 
    333     const AltAz CA(0, -fCa/cos(p.Alt()));
    334     p += CA;
    335 
    336     DEBUG(cout << "Bend2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    337 
    338     const AltAz NPAE(0, -fNpae*tan(p.Alt()));
    339     p += NPAE;
     373    */
     374
     375
     376
    340377
    341378    DEBUG(cout << "Bend1: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     
    381418    DEBUG(cout << "Back1: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    382419
     420    /*
     421     //Old correction terms for An and Aw:
     422     const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt()));
     423     const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt()));
     424     p -= AN;
     425     p -= AW;
     426     */
     427
     428    // New Corrections for AN and AW:
     429    TVector3 v(1.,1.,1.); // Vector in cartesian coordinates
     430    // Set Azimuth and Elevation
     431    v.SetPhi(p.Az());
     432    v.SetTheta(TMath::Pi()/2-p.Alt());
     433    // Rotate around the x- and y-axis
     434    v.RotateY(-fAn);
     435    v.RotateX(-fAw);
     436    // Get Azimuth and Elevation
     437    p.Az(v.Phi());
     438    p.Alt(TMath::Pi()/2-v.Theta());
     439
     440
     441    DEBUG(cout << "Back2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     442
     443    //Old Correction terms for Npae and Ca:
    383444    const AltAz NPAE(0, -fNpae*tan(p.Alt()));
    384445    p -= NPAE;
    385446
    386     DEBUG(cout << "Back2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    387 
    388447    const AltAz CA(0, -fCa/cos(p.Alt()));
    389448    p -= CA;
    390449
     450    /*
     451     //New Correction term for Npae and Ca:
     452     TVector3 v2(1.,1.,1.); // Vector in cartesian coordinates
     453     //Set Azimuth and Elevation
     454     v2.SetPhi(p.Az());
     455     v2.SetTheta(TMath::Pi()/2-p.Alt());
     456     //Rotation Vectors:
     457     TVector3 vNpae(             cos(p.Az()),              sin(p.Az()),             0);
     458     TVector3   vCa( -cos(p.Az())*cos(p.Alt()), -sin(p.Az())*cos(p.Alt()), sin(p.Alt()));
     459     //Rotate around the vectors vCa and vNpae
     460     v2.Rotate(-fCa,     vCa);
     461     v2.Rotate(-fNpae, vNpae);
     462
     463     p.Az(v2.Phi());
     464     p.Alt(TMath::Pi()/2-v2.Theta());
     465    */
     466
    391467    DEBUG(cout << "Back3: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    392 
    393     cout << fAw << " " << cos(p.Az()) << " " << tan(p.Alt()) << endl;
    394     cout << fAw* cos(p.Az())*tan(p.Alt())*180/3.1415 << endl;
    395 
    396     const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt()));
    397     const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt()));
    398     p -= AN;
    399     p -= AW;
    400 
    401     DEBUG(cout << "Back4: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    402468
    403469    const AltAz TF(Sign(fTf*cos(p.Alt()), p.Alt()), 0);
     
    406472    //p -= TX;
    407473
    408     DEBUG(cout << "Back5: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     474    DEBUG(cout << "Back4: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    409475
    410476    const AltAz CEC(-fEcec*cos(p.Alt()), -fAcec*cos(p.Az()));
     
    413479    p -= CES;
    414480
    415     DEBUG(cout << "Back6: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     481    DEBUG(cout << "Back5: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    416482
    417483    const AltAz NRY(fNry*cos(p.Alt()), -fNry*tan(p.Alt()));
     
    420486    p -= NRX;
    421487
    422     DEBUG(cout << "Back7: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     488    DEBUG(cout << "Back6: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    423489
    424490    const AltAz CRY(-fCry*cos(p.Az()-p.Alt()), -fCry*sin(p.Az()-p.Alt())/cos(p.Alt()));
     
    427493    p -= CRX;
    428494
    429     DEBUG(cout << "Back8: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     495    DEBUG(cout << "Back7: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    430496
    431497    return p;
Note: See TracChangeset for help on using the changeset viewer.