Changeset 8337


Ignore:
Timestamp:
02/28/07 13:34:10 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8336 r8337  
    1919                                                 -*-*- END OF LINE -*-*-
    2020
     21 2007/02/28 Thomas Bretz
     22
     23  * macros/tutorials/mirrordelay.C:
     24     - fixed the formula for the spherical mirror
     25     - fixed the calculation of the time-delay
     26
     27   * mastro/MObservatory.[h,cc]:
     28     - added constructors and functions to set the observatory location
     29       manually
     30
     31   * mbase/MTime.[h,cc]:
     32     - added constructor to construct MTime by date
     33     - added AsDouble for new root streamers (allowing to view MTime in
     34       a TBrowser)
     35     - added GetRootDatime to return TDatime object
     36
     37   * mcalib/MCalibrateData.cc:
     38     - added more meaningful output in case a conversion factor exceeds a limit
     39
     40
     41
    2142 2007/02/26 Daniela Dorner
    2243
  • trunk/MagicSoft/Mars/macros/tutorials/mirrordelay.C

    r8322 r8337  
    2525void mirrordelay()
    2626{
    27     TF1 fpar("Parab",  "[0]*x*x");
    28     TF1 fsph("Sphere", "-sqrt([0]*[0] - x*x)+[0]");
     27    TF1 fpar("Parab",  "x*x/(4*[0])");
     28    TF1 fsph("Sphere", "-sqrt(4*[0]*[0] - x*x) + 2*[0]");
    2929
    3030    Double_t F = 4.92; // Fokallaenge = 1/4a
    3131    Double_t D = 4.5;  // Mirror Diameter
    3232    Double_t x = 1.85; // incident point for photon
    33 
     33                                     
    3434    fsph.SetRange(-D*0.55, D*0.55);
    3535    fpar.SetRange(-D*0.55, D*0.55);
    3636
    37     fpar.SetParameter(0, 1./(4*F));
     37    fpar.SetParameter(0, F);
    3838    fsph.SetParameter(0, F);
    3939
     
    7979    TLegend leg(0.40, 0.6, 0.60, 0.85);//, "NDC");
    8080
    81     TF1 fdel("Diff", "(Sphere-Parab+TMath::Hypot(x-0, Parab-[0])-[0])/3e8*1e9");
    82     fdel.SetRange(-D*0.55, D*0.55);
    83     fdel.SetLineWidth(2);
    84 
    8581    for (int i=-2; i<3; i++)
    8682    {
     83        // Make sure to set the parameters BEFORE reusing the function!
     84        fsph.SetParameter(0, F+i*0.10*F);
     85        fpar.SetParameter(0, F+i*0.10*F);
    8786
     87        TF1 fdel1("Diff1", "Sphere-Parab");
     88        TF1 fdel2("Diff2", "TMath::Hypot(x-0, Parab-[0])-TMath::Hypot(x-0, Sphere-[0])");
     89        fdel2.SetParameter(0, F+i*0.10*F);
     90
     91        TF1 fdel("Diff", "(Diff1+Diff2)/3e8*1e9");
     92        fdel.SetRange(-D*0.55, D*0.55);
     93        fdel.SetLineWidth(2);
    8894        fdel.SetParameter(0, F+i*0.10*F);
     95
    8996        fdel.SetLineColor(kBlack+(abs(i)==2?3:abs(i)));
    9097        if (i<0)
     
    98105
    99106        f->GetXaxis()->SetTitle("x [m]");
    100         f->GetYaxis()->SetTitle("Delay \\Delta t [ns]");
     107        f->GetYaxis()->SetTitle("Delay  \\Delta t [ns]");
    101108        f->GetXaxis()->CenterTitle();
    102109
  • trunk/MagicSoft/Mars/mastro/MObservatory.cc

    r8324 r8337  
    5353}
    5454
     55// --------------------------------------------------------------------------
     56//
     57// Default constructor sets name and title of instace.
     58// Default location is kMagic1
     59//
    5560MObservatory::MObservatory(const char *name, const char *title)
    5661{
     
    6065}
    6166
     67// --------------------------------------------------------------------------
     68//
     69// For example "MObservator(MObservatory::kMagic1)"
     70//
    6271MObservatory::MObservatory(LocationName_t key, const char *name, const char *title)
    6372{
     
    6574
    6675    SetLocation(key);
     76}
     77
     78// --------------------------------------------------------------------------
     79//
     80// Calls SetLocation
     81//
     82MObservatory::MObservatory(Double_t lon, Double_t lat, const char *name)
     83{
     84    Init();
     85
     86    SetLocation(lon, lat, 0, name);
     87}
     88
     89// --------------------------------------------------------------------------
     90//
     91// Calls SetLocation
     92//
     93MObservatory::MObservatory(Double_t lon, Double_t lat, Double_t h, const char *name)
     94{
     95    Init();
     96
     97    SetLocation(lon, lat, h, name);
    6798}
    6899
     
    106137}
    107138
     139// --------------------------------------------------------------------------
     140//
     141// Longitude/Latitude [rad]
     142// Height             [m]
     143//
     144void MObservatory::SetLocation(Double_t lon, Double_t lat, Double_t h, const char *name)
     145{
     146    fLongitude = lon;
     147    fLatitude  = lat;
     148    fHeight    = h;
     149
     150    fSinLatitude = TMath::Sin(fLatitude);
     151    fCosLatitude = TMath::Cos(fLatitude);
     152
     153    if (name)
     154        fObservatoryName = name;
     155}
     156
    108157void MObservatory::Print(Option_t *) const
    109158{
  • trunk/MagicSoft/Mars/mastro/MObservatory.h

    r8066 r8337  
    3232    Double_t fHeight;                //! [m] height of observatory
    3333
    34     void Init(const char *name, const char *title);
     34    void Init(const char *name=NULL, const char *title=NULL);
    3535
    3636public:
    3737    MObservatory(const char *name=NULL, const char *title=NULL);
    3838    MObservatory(LocationName_t key, const char *name=NULL, const char *title=NULL);
     39    MObservatory(Double_t lon, Double_t lat, const char *name="<n/a>");
     40    MObservatory(Double_t lon, Double_t lat, Double_t h, const char *name="<n/a>");
    3941
    4042    void Copy(TObject &obj) const
     
    5052
    5153    void SetLocation(LocationName_t name);
     54    void SetLocation(Double_t lon, Double_t lat, Double_t h=0, const char *name=NULL);
    5255
    5356    void Print(Option_t *o=0) const;
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r7550 r8337  
    108108// --------------------------------------------------------------------------
    109109//
     110// Constructor. Calls Set(y, m, d, h, min, s, ms, ns).
     111// To check validity test for (*this)==MTime()
     112//
     113MTime::MTime(UShort_t y, Byte_t m, Byte_t d, Byte_t h, Byte_t min, Byte_t s, UShort_t ms, UInt_t ns)
     114{
     115    Set(y, m, d, h, min, s, ms, ns);
     116}
     117
     118// --------------------------------------------------------------------------
     119//
    110120// Return date as year(y), month(m), day(d)
    111121//
     
    218228{
    219229    return (ULong_t)((GetMjd()-49718)*kDay);
     230}
     231
     232// --------------------------------------------------------------------------
     233//
     234// Return a time which is expressed in seconds since 01/01/1970 0:00h
     235// This is compatible with root's definition used in the constructor of
     236// TDatime.
     237//
     238TDatime MTime::GetRootDatime() const
     239{
     240    return TDatime((UInt_t)((GetMjd()-40587)*kDay/1000));
    220241}
    221242
  • trunk/MagicSoft/Mars/mbase/MTime.h

    r8066 r8337  
    6464    }
    6565    MTime(Double_t mjd);
     66    MTime(UShort_t y, Byte_t m, Byte_t d, Byte_t h=13, Byte_t min=0, Byte_t s=0, UShort_t ms=0, UInt_t ns=0);
    6667    MTime(const MTime& t) : MParContainer(), fMjd(t.fMjd), fTime(t.fTime), fNanoSec(t.fNanoSec)
    6768    {
    6869        Init(NULL, NULL);
    6970    }
     71
     72    //static Int_t Hour() { return 3600; }
     73    //static Int_t Day()  { return 3600;*24 }
    7074
    7175    void operator=(const MTime &t)
     
    108112    void     GetDateOfSunrise(UShort_t &y, Byte_t &m, Byte_t &d) const;
    109113    TTime    GetRootTime() const;
     114    TDatime  GetRootDatime() const;
    110115    Double_t GetAxisTime() const;
    111116    Double_t GetMoonPhase() const;
     
    143148    operator double() const;   //[s]
    144149    double operator()() const; //[s]
     150
     151    Double_t    AsDouble() const    { return GetMjd(); }
     152    //const char *AsString() const    { return GetString(); }
     153    //const char *AsSQLString() const { return GetSqldateTime(); }
    145154
    146155    // Calculation functions
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r8277 r8337  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MCalibrateData.cc,v 1.63 2007-01-29 13:03:43 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MCalibrateData.cc,v 1.64 2007-02-28 13:29:52 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    723723            calibConv    = -1.;
    724724            calibFFactor = -1.;
    725             *fLog << warn << GetDescriptor()
    726                 << ": WARNING - Conversion factor of Pixel " << pixidx << " out of range... set to 0. " << endl;
     725            *fLog << warn << GetDescriptor() << ": WARNING - ";
     726            *fLog << "Conversion factor " << calibConv << " of Pixel " << pixidx << " out of range ]";
     727            *fLog << fCalibConvMinLimit << "," << fCalibConvMaxLimit << "[... set to 0. " << endl;
    727728          }
    728729        cpix.SetCalibConst(calibConv);
     
    733734    if (skip>fGeomCam->GetNumPixels()*0.9)
    734735    {
    735         *fLog << warn << GetDescriptor()
    736               << ": WARNING - GetConversionFactor has skipped more than 90% of the pixels... abort." << endl;
     736        *fLog << err << GetDescriptor() << ": ERROR - ";
     737        *fLog << "GetConversionFactor has skipped more than 90% of the pixels... abort." << endl;
    737738        return kFALSE;
    738739    }
Note: See TracChangeset for help on using the changeset viewer.