Ignore:
Timestamp:
07/25/02 09:14:36 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc

    r1350 r1434  
    1919!   Author(s): Harald Kornmayer 1/2001
    2020!   Author(s): Rudolf Bock     10/2001 <mailto:Rudolf.Bock@cern.ch>
     21!   Author(s): Wolfgang Wittek 06/2002 <mailto:wittek@mppmu.mpg.de>
    2122!
    2223!   Copyright: MAGIC Software Development, 2000-2002
     
    3233//
    3334//    source-dependent image parameters
    34 // fAlpha    angle between major axis and line source-to-center
    35 // fDist     distance from source to center of ellipse
     35//
     36// Version 1:
     37// ----------
     38//  fAlpha          angle between major axis and line source-to-center
     39//  fDist           distance from source to center of ellipse
     40//
     41// Version 2:
     42// ----------
     43//  fHeadTail
     44//
     45// Version 3:
     46// ----------
     47//  fCosDeltaLenth  cosine of angle between d and a, where
     48//                   - d is the vector from the source position to the
     49//                     center of the ellipse
     50//                   - a is a vector along the main axis of the ellipse
    3651//
    3752/////////////////////////////////////////////////////////////////////////////
     
    5772}
    5873
     74void MHillasSrc::Reset()
     75{
     76    fDist          = -1;
     77    fAlpha         =  0;
     78    fHeadTail      =  0;
     79    fCosDeltaAlpha =  0;
     80}
     81
    5982// --------------------------------------------------------------------------
    6083//
    61 //  calculation of source-dependent parameters
     84//  Calculation of source-dependent parameters
     85//  In case you don't call Calc from within an eventloop make sure, that
     86//  you call the Reset member function before.
    6287//
    63 void MHillasSrc::Calc(const MHillas *hillas)
     88Bool_t MHillasSrc::Calc(const MHillas *hillas)
    6489{
    65     const Double_t mx = hillas->GetMeanX();        // [mm]
    66     const Double_t my = hillas->GetMeanY();        // [mm]
     90    fHillas = hillas;
    6791
    68     const Double_t sx = mx - fSrcPos->GetX();      // [mm]
    69     const Double_t sy = my - fSrcPos->GetY();      // [mm]
     92    const Double_t mx   = GetMeanX();            // [mm]
     93    const Double_t my   = GetMeanY();            // [mm]
    7094
    71     const Double_t sd = sin(hillas->GetDelta());   // [1]
    72     const Double_t cd = cos(hillas->GetDelta());   // [1]
     95    const Double_t sx   = mx - fSrcPos->GetX();  // [mm]
     96    const Double_t sy   = my - fSrcPos->GetY();  // [mm]
    7397
     98    const Double_t sd   = sin(GetDelta());       // [1]
     99    const Double_t cd   = cos(GetDelta());       // [1]
    74100
    75     fHeadTail = cd*sx + sd*sy;                     // [mm]
    76     fDist     = sqrt(sx*sx + sy*sy);               // [mm]
    77     fAlpha    = atan((cd*sy - sd*sx)/fHeadTail);   // [rad]
    78     fAlpha   *= kRad2Deg;                          // [deg]
     101    const Double_t tand = tan(GetDelta());       // [1]
    79102
    80     fHillas   = hillas;
     103    fHeadTail = cd*sx + sd*sy;                   // [mm]
     104
     105    //
     106    // Distance from source position to center of ellipse.
     107    // If the distance is 0 distance, Alpha is not specified.
     108    // The calculation has failed and returnes kFALSE.
     109    //
     110    Double_t dist = sqrt(sx*sx + sy*sy);         // [mm]
     111
     112    if (dist==0)
     113    {
     114        *fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl;
     115        return kFALSE;
     116    }
     117
     118    fDist = dist;
     119                                                 // [mm]
     120    //
     121    // Calculate Alpha and Cosda = cos(d,a)
     122    // The sign of Cosda will be used for quantities containing
     123    // a head-tail information
     124    //
     125    const Double_t arg = (sy-tand*sx) / (fDist*sqrt(tand*tand+1));
     126
     127    fAlpha         = asin(arg)*kRad2Deg;        // [deg]
     128    fCosDeltaAlpha = fHeadTail/fDist;           // [1]
    81129
    82130    SetReadyToSave();
     131
     132    return kTRUE;
    83133}
    84134
     
    87137    *fLog << all;
    88138    *fLog << "Source dependant Image Parameters (" << GetName() << ")" << endl;
    89     *fLog << " - Dist     = " << fDist     << " mm"  << endl;
    90     *fLog << " - Alpha    = " << fAlpha    << " deg" << endl;
    91     *fLog << " - HeadTail = " << fHeadTail << " mm"  << endl;
     139    *fLog << " - Dist          [mm]  = " << fDist << endl;
     140    *fLog << " - Alpha         [deg] = " << fAlpha << endl;
     141    *fLog << " - HeadTail      [mm]  = " << fHeadTail << endl;
     142    *fLog << " - CosDeltaAlpha       = " << fCosDeltaAlpha << endl;
    92143}
    93144
     
    96147// overloaded MParContainer to read MHillasSrc from an ascii file
    97148//
     149/*
    98150void MHillasSrc::AsciiRead(ifstream &fin)
    99151{
     
    102154    fin >> fHeadTail;
    103155}
    104 
     156*/
    105157// -----------------------------------------------------------------------
    106158//
Note: See TracChangeset for help on using the changeset viewer.