Changeset 4817


Ignore:
Timestamp:
08/31/04 10:21:26 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4815 r4817  
    1919
    2020                                                 -*-*- END OF LINE -*-*-
     21 2004/08/31: Thomas Bretz
     22
     23   * star.cc:
     24     - implemented batch- and quit-mode
     25
     26   * mastro/MAstroCatalog.h:
     27     - implemented default argument for magnitude in MVector3
     28       setters
     29
     30   * mbase/MDirIter.cc:
     31     - fixed a typo
     32
     33   * mfileio/MWriteRootFile.cc:
     34     - fixed a typo
     35
     36   * mimage/MHHillasSrc.[h,cc], mimage/MHillasSrc.[h,cc]:
     37     - added DCA and DCADelta as discussed with the ETH people
     38     - incrementes version number of MHillasSrc
     39     - changed return type of MHillasSrc::Calc from Bool_t to Int_t
     40
     41   * mpointing/MPointingPos.h:
     42     - added Getter for ZdA7Az in rad
     43
     44   * mpointing/MPointingPosCalc.cc:
     45     - fixed a bug which converted Ra/Dec wrongly to rad
     46
     47
     48
    2149 2004/08/30: Markus Gaug
    2250
     
    3260     - exchanged all arrays by MArray's
    3361
     62
     63
    3464 2004/08/30: Thomas Bretz
    35 
    3665
    3766   * showlog.cc, showplot.cc:
  • trunk/MagicSoft/Mars/mastro/MAstroCatalog.h

    r4521 r4817  
    3838    Double_t Magnitude() const { return -2.5*TMath::Log10(Mag()); }
    3939
    40     void SetRaDec(Double_t ra, Double_t dec, Double_t mag)
     40    void SetRaDec(Double_t ra, Double_t dec, Double_t mag=0)
    4141    {
    4242        fType = kIsRaDec;
     
    4444    }
    4545    void SetName(const TString &str) { fName = str.Strip(TString::kBoth); }
    46     void SetZdAz(Double_t zd, Double_t az, Double_t mag)
     46    void SetZdAz(Double_t zd, Double_t az, Double_t mag=0)
    4747    {
    4848        fType = kIsZdAz;
    4949        SetMagThetaPhi(pow(10, -mag/2.5), zd, az);
    5050    }
    51     void SetAltAz(Double_t alt, Double_t az, Double_t mag)
     51    void SetAltAz(Double_t alt, Double_t az, Double_t mag=0)
    5252    {
    5353        fType = kIsAltAz;
  • trunk/MagicSoft/Mars/mbase/MDirIter.cc

    r4722 r4817  
    9090Int_t MDirIter::AddDirectory(const char *d, const char *filter, Int_t recursive)
    9191{
    92     TString dir = d;
     92    TString dir(d);
    9393
    9494    // Sanity check
     
    142142            continue;
    143143
    144         // If entry is a directory add it with a lowere recursivity
     144        // If entry is a directory add it with a lower recursivity
    145145        if (IsDir(c)==0)
    146146            rc += AddDirectory(c, filter, recursive-1);
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r4698 r4817  
    417417            {
    418418                *fLog << warn << endl;
    419                 *fLog << "WARNING:   You are updating an existing branch.  For this" << endl;
    420                 *fLog << "     case file-splitting mode is not allowed... disabled!" << endl;
     419                *fLog << "WARNING: You are updating an existing branch. For this case" << endl;
     420                *fLog << "         file-splitting mode  is  not  allowed... disabled!" << endl;
    421421                *fLog << endl;
    422422                fSplitRule = "";
  • trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc

    r2438 r4817  
    7070    // connect all the histogram with the container fHist
    7171    //
    72     fAlpha = new TH1F("Alpha", "Alpha of Ellipse",            181, -90,  90);
    73     fDist  = new TH1F("Dist",  "Dist of Ellipse",             100,   0, 445);
    74     fCosDA = new TH1F("CosDA", "cos(Delta,Alpha) of Ellipse", 101,  -1,   1);
     72    fAlpha = new TH1F("Alpha", "Alpha of Ellipse",                181, -90,  90);
     73    fDist  = new TH1F("Dist",  "Dist of Ellipse",                 100,   0, 445);
     74    fCosDA = new TH1F("CosDA", "cos(Delta,Alpha) of Ellipse",     101,  -1,   1);
     75    fDCA   = new TH1F("DCA",   "Distance of closest aproach",     101,  -1,   1);
     76    fDCADelta  = new TH1F("DCADelta",  "Angle between shower and x-axis", 101,   0, 360);
    7577
    7678    fAlpha->SetDirectory(NULL);
    7779    fDist->SetDirectory(NULL);
    7880    fCosDA->SetDirectory(NULL);
     81    fDCA->SetDirectory(NULL);
     82    fDCADelta->SetDirectory(NULL);
    7983
    8084    fAlpha->SetXTitle("\\alpha [\\circ]");
    8185    fDist->SetXTitle("Dist [mm]");
    8286    fCosDA->SetXTitle("cos(\\delta,\\alpha)");
     87    fDCA->SetXTitle("DCA [\\circ]");
     88    fDCADelta->SetXTitle("DCADelta [0, 2\\pi]");
    8389
    8490    fAlpha->SetYTitle("Counts");
    8591    fDist->SetYTitle("Counts");
    8692    fCosDA->SetYTitle("Counts");
     93    fDCA->SetYTitle("Counts");
     94    fDCADelta->SetYTitle("Counts");
    8795}
    8896
     
    96104    delete fDist;
    97105    delete fCosDA;
     106    delete fDCA;
     107    delete fDCADelta;
    98108}
    99109
     
    121131    ApplyBinning(*plist, "Alpha",    fAlpha);
    122132    ApplyBinning(*plist, "Dist",     fDist);
     133    ApplyBinning(*plist, "DCA",      fDCA);
     134    ApplyBinning(*plist, "DCADelta",     fDCADelta);
    123135
    124136    return kTRUE;
     
    143155    fDist ->Fill(fUseMmScale ? h.GetDist() : fMm2Deg*h.GetDist(), w);
    144156    fCosDA->Fill(h.GetCosDeltaAlpha(), w);
     157    fDCA  ->Fill(fUseMmScale ? h.GetDCA() : fMm2Deg*h.GetDCA(), w);
     158    fDCADelta ->Fill(h.GetDCADelta(), w);
    145159
    146160    return kTRUE;
     
    186200    const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;
    187201    MH::ScaleAxis(fDist, scale);
     202    MH::ScaleAxis(fDCA,  scale);
    188203
    189204    fDist->SetXTitle(mmscale ? "Dist [mm]" : "Dist [\\circ]");
     205    fDCA->SetXTitle(mmscale ? "DCA [mm]" : "DCA [\\circ]");
    190206
    191207    fUseMmScale = mmscale;
     
    217233    fDist->Draw();
    218234
    219     delete pad->GetPad(3);
     235    pad->cd(3);
     236    gPad->SetBorderMode(0);
     237    fDCA->Draw();
    220238
    221239    pad->cd(4);
    222240    gPad->SetBorderMode(0);
    223     //gPad->SetLogy();
     241
     242    TVirtualPad *p = gPad;
     243    p->Divide(1,2);
     244    p->cd(1);
     245    gPad->SetBorderMode(0);
    224246    fCosDA->Draw();
     247
     248    p->cd(2);
     249    gPad->SetBorderMode(0);
     250    fDCADelta->Draw();
    225251
    226252    pad->Modified();
  • trunk/MagicSoft/Mars/mimage/MHHillasSrc.h

    r2416 r4817  
    1515    TH1F *fDist;      //->
    1616    TH1F *fCosDA;     //->
     17
     18    TH1F *fDCA;       //->
     19    TH1F *fDCADelta;  //->
    1720
    1821    Float_t fMm2Deg;
     
    3437    TH1F *GetHistDist()          { return fDist; }
    3538    TH1F *GetHistCosDeltaAlpha() { return fCosDA; }
     39    TH1F *GetHistDCA()           { return fDCA; }
     40    TH1F *GetHistDCADelta()      { return fDCADelta; }
    3641
    3742    void Draw(Option_t *opt=NULL);
  • trunk/MagicSoft/Mars/mimage/MHillasSrc.cc

    r4710 r4817  
    5757// Version 4:
    5858// ----------
    59 //
    6059// fHeadTail        removed
     60//
     61//
     62// Version 5:
     63// ----------
     64//  - added Float_t fDCA;      // [mm]   Distance to closest approach 'DCA'
     65//  - added Float_t fDCADelta; // [deg]  Angle of the shower axis with respect
     66//                                       to the x-axis [0,2pi]
    6167//
    6268/////////////////////////////////////////////////////////////////////////////
     
    9197    fAlpha         =  0;
    9298    fCosDeltaAlpha =  0;
     99
     100    fDCA           = -1;
     101    fDCADelta          =  0;
    93102}
    94103
     
    99108//  you call the Reset member function before.
    100109//
    101 Bool_t MHillasSrc::Calc(const MHillas &hillas)
    102 {
    103     const Double_t mx = hillas.GetMeanX();     // [mm]
    104     const Double_t my = hillas.GetMeanY();     // [mm]
    105 
    106     const Double_t sx = mx - fSrcPos->GetX();   // [mm]
    107     const Double_t sy = my - fSrcPos->GetY();   // [mm]
    108 
    109     const Double_t sd = hillas.GetSinDelta();  // [1]
    110     const Double_t cd = hillas.GetCosDelta();  // [1]
    111 
    112     //
    113     // Distance from source position to center of ellipse.
    114     // If the distance is 0 distance, Alpha is not specified.
    115     // The calculation has failed and returnes kFALSE.
    116     //
    117     const Double_t dist = sqrt(sx*sx + sy*sy);  // [mm]
    118     if (dist==0)
    119         return kFALSE;
    120 
    121     //
    122     // Calculate Alpha and Cosda = cos(d,a)
    123     // The sign of Cosda will be used for quantities containing
    124     // a head-tail information
    125     //
    126     // *OLD* const Double_t arg = (sy-tand*sx) / (dist*sqrt(tand*tand+1));
    127     // *OLD* fAlpha = asin(arg)*kRad2Deg;
    128     //
    129     const Double_t arg1 = cd*sy-sd*sx;          // [mm]
    130     const Double_t arg2 = cd*sx+sd*sy;          // [mm]
    131 
    132     //
    133     // Due to numerical uncertanties in the calculation of the
    134     // square root (dist) and arg1 it can happen (in less than 1e-5 cases)
    135     // that the absolute value of arg exceeds 1. Because this uncertainty
    136     // results in an Delta Alpha which is still less than 1e-3 we don't care
    137     // about this uncertainty in general and simply set values which exceed
    138     // to 1 saving its sign.
    139     //
    140     const Double_t arg = arg1/dist;
    141     fAlpha = TMath::Abs(arg)>1 ? TMath::Sign(90., arg) : asin(arg)*kRad2Deg;  // [deg]
    142 
    143     fCosDeltaAlpha = arg2/dist;                 // [1]
    144     fDist          = dist;                      // [mm]
    145 
    146     SetReadyToSave();
    147 
    148     return kTRUE;
    149 }
     110Int_t MHillasSrc::Calc(const MHillas &hillas)
     111{
     112     const Double_t mx = hillas.GetMeanX();     // [mm]
     113     const Double_t my = hillas.GetMeanY();     // [mm]
     114
     115     const Double_t sx = mx - fSrcPos->GetX();   // [mm]
     116     const Double_t sy = my - fSrcPos->GetY();   // [mm]
     117
     118     const Double_t sd = hillas.GetSinDelta();  // [1]
     119     const Double_t cd = hillas.GetCosDelta();  // [1]
     120
     121     //
     122     // Distance from source position to center of ellipse.
     123     // If the distance is 0 distance, Alpha is not specified.
     124     // The calculation has failed and returnes kFALSE.
     125     //
     126     const Double_t dist = TMath::Sqrt(sx*sx + sy*sy);  // [mm]
     127     if (dist==0)
     128         return 1;
     129
     130     //
     131     // Calculate Alpha and Cosda = cos(d,a)
     132     // The sign of Cosda will be used for quantities containing
     133     // a head-tail information
     134     //
     135     // *OLD* const Double_t arg = (sy-tand*sx) / (dist*sqrt(tand*tand+1));
     136     // *OLD* fAlpha = asin(arg)*kRad2Deg;
     137     //
     138     const Double_t arg2 = cd*sx + sd*sy;          // [mm]
     139     if (arg2==0)
     140         return 2;
     141
     142     const Double_t arg1 = cd*sy - sd*sx;          // [mm]
     143
     144     //
     145     // Due to numerical uncertanties in the calculation of the
     146     // square root (dist) and arg1 it can happen (in less than 1e-5 cases)
     147     // that the absolute value of arg exceeds 1. Because this uncertainty
     148     // results in an Delta Alpha which is still less than 1e-3 we don't care
     149     // about this uncertainty in general and simply set values which exceed
     150     // to 1 saving its sign.
     151     //
     152     const Double_t arg = arg1/dist;
     153     fAlpha = TMath::Abs(arg)>1 ? TMath::Sign(90., arg) : TMath::ASin(arg)*TMath::RadToDeg(); // [deg]
     154
     155     fCosDeltaAlpha = arg2/dist;                 // [1]
     156     fDist          = dist;                      // [mm]
     157
     158     // ----- Calculation of Distance to closest approach 'DCA' -----
     159
     160     // Components of DCA vector
     161     const Double_t fpd1 = sx - arg2*cd;         // [mm]
     162     const Double_t fpd2 = sy - arg2*sd;         // [mm]
     163
     164     // Determine the correct sign of the DCA (cross product of DCA vector and the
     165     // vector going from the intersection point of the DCA vector with the shower axis
     166     // to the COG)
     167     const Double_t sign = arg2*cd*fpd2 - arg2*sd*fpd1;
     168     fDCA  = TMath::Sign(TMath::Sqrt(fpd1*fpd1 + fpd2*fpd2), sign); // [mm]
     169
     170     // Calculate angle of the shower axis with respect to the x-axis
     171     fDCADelta = TMath::ACos((sx-fpd1)/TMath::Abs(arg2))*TMath::RadToDeg(); // [deg]
     172
     173     // Enlarge the interval of fDdca to [0, 2pi]
     174     if (sy < fpd2)
     175         fDCADelta = 360 - fDCADelta;
     176
     177     SetReadyToSave();
     178
     179     return 0;
     180}
    150181
    151182// --------------------------------------------------------------------------
     
    160191    *fLog << " - Alpha          [deg] = " << fAlpha << endl;
    161192    *fLog << " - CosDeltaAlpha        = " << fCosDeltaAlpha << endl;
     193    *fLog << " - DCA            [mm]  = " << fDCA << endl;
     194    *fLog << " - DCA delta      [deg] = " << fDCADelta*TMath::RadToDeg() << endl;
    162195}
    163196
     
    174207    *fLog << " - Alpha          [deg] = " << fAlpha << endl;
    175208    *fLog << " - CosDeltaAlpha        = " << fCosDeltaAlpha << endl;
     209    *fLog << " - DCA            [deg] = " << fDCA*geom.GetConvMm2Deg() << endl;
     210    *fLog << " - DCA delta      [deg] = " << fDCADelta*TMath::RadToDeg() << endl;
    176211}
    177212
     
    183218void MHillasSrc::Set(const TArrayF &arr)
    184219{
    185     if (arr.GetSize() != 3)
     220    if (arr.GetSize() != 5)
    186221        return;
    187222
     
    189224    fDist  = arr.At(1);         // [mm]   distance between src and center of ellipse
    190225    fCosDeltaAlpha = arr.At(2); // [1]    cosine of angle between d and a
    191 }
     226    fDCA = arr.At(3);           // [mm]
     227    fDCADelta = arr.At(4);      // [mm]
     228}
  • trunk/MagicSoft/Mars/mimage/MHillasSrc.h

    r4710 r4817  
    1717    Float_t fCosDeltaAlpha; // [1]    cosine of angle between d and a
    1818
     19    Float_t fDCA;           // [mm]   Distance to closest approach 'DCA'
     20    Float_t fDCADelta;      // [deg]  Angle of the shower axis with respect to the x-axis
     21
    1922public:
    2023    MHillasSrc(const char *name=NULL, const char *title=NULL);
     
    2831    Float_t GetDist()          const { return fDist; }
    2932    Float_t GetCosDeltaAlpha() const { return fCosDeltaAlpha; }
     33    Float_t GetDCA()           const { return fDCA; }
     34    Float_t GetDCADelta()      const { return fDCADelta; }
    3035
    3136    void Print(Option_t *opt=NULL) const;
    3237    void Print(const MGeomCam &geom) const;
    3338
    34     virtual Bool_t Calc(const MHillas &hillas);
     39    virtual Int_t Calc(const MHillas &hillas);
    3540
    3641    void Set(const TArrayF &arr);
    3742
    38     ClassDef(MHillasSrc, 4) // Container to hold source position dependant parameters
     43    ClassDef(MHillasSrc, 5) // Container to hold source position dependant parameters
    3944};
    4045
  • trunk/MagicSoft/Mars/mpointing/MPointingPos.h

    r4731 r4817  
    44#ifndef MARS_MParContainer
    55#include "MParContainer.h"
     6#endif
     7
     8// FIXME: Should not be here...
     9#ifndef MARS_MPointing
     10#include "MPointing.h"
    611#endif
    712
     
    3237    Double_t GetAz() const  { return fAz; }
    3338
     39    Double_t GetZdRad() const  { return fZd*TMath::DegToRad(); }
     40    Double_t GetAzRad() const  { return fAz*TMath::DegToRad(); }
     41
     42    ZdAz GetZdAz() const { return ZdAz(fZd, fAz); }
     43
    3444    Double_t GetRa() const  { return fRa; }
    3545    Double_t GetHa() const  { return fHa; }
  • trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.cc

    r3544 r4817  
    134134    case MRawRunHeader::kRTData:
    135135        fPosition->SetLocalPosition(fReport->GetNominalZd(), fReport->GetNominalAz());
    136         fPosition->SetSkyPosition(fReport->GetRa()*TMath::DegToRad()/15, fReport->GetDec()*TMath::DegToRad());
     136        fPosition->SetSkyPosition(fReport->GetRa()/**TMath::DegToRad()/15*/, fReport->GetDec()/**TMath::DegToRad()*/);
    137137        return kTRUE;
    138138
  • trunk/MagicSoft/Mars/star.cc

    r4756 r4817  
    4949    gLog << "   --debug-env               Debug setting resources from file" << endl << endl;
    5050    gLog << endl;
     51    gLog << " Output options:" << endl;
     52    gLog << "   -q                        Quit when job is finished" << endl;
    5153    gLog << "   -f                        Force overwrite of existing files" << endl;
    5254    gLog << "   -ff                       Force execution if not all files found" << endl;
     
    8789    const Bool_t  kDebugEnv   = arg.HasOnlyAndRemove("--debug-env");
    8890
     91    const Bool_t  kQuit       = arg.HasOnlyAndRemove("-q");
     92    const Bool_t  kBatch      = arg.HasOnlyAndRemove("-b");
    8993    const Bool_t  kOverwrite  = arg.HasOnlyAndRemove("-f");
    9094    const Bool_t  kForceExec  = arg.HasOnlyAndRemove("-ff");
    9195
    92     const TString kInpath     = arg.GetStringAndRemove("--in=", "");
     96    const TString kInpath     = arg.GetStringAndRemove("--ind=", "");
    9397    const TString kOutpath    = arg.GetStringAndRemove("--out=", ".");
    9498
     
    141145    //
    142146    MDirIter iter;
    143     seq.SetupDatRuns(iter, kInpath);
    144147
    145148    const Int_t n0 = seq.SetupDatRuns(iter, kInpath);
     
    179182
    180183    TApplication app("Star", &argc, argv);
    181     if (gROOT->IsBatch() || !gClient)
     184    if (!gROOT->IsBatch() && !gClient)
    182185    {
    183186        gLog << err << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
     
    219222    }
    220223
     224    if (kBatch || kQuit)
     225    {
     226        delete d;
     227        return 0;
     228    }
     229
    221230    // From now on each 'Close' means: Terminate the application
    222231    d->SetBit(MStatusDisplay::kExitLoopOnClose);
Note: See TracChangeset for help on using the changeset viewer.