Changeset 7177


Ignore:
Timestamp:
07/08/05 11:49:41 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7176 r7177  
    4343   * mmuon/MMuonCalibPar.cc, mmuon/MMuonSearchPar.cc:
    4444     - fixed Print output
     45
     46   * mimage/MHillas.cc:
     47     - implemented plotting a estimate of disp
     48     - fixed some units in output
     49     - fixed the special case in which the shower is symmetric to
     50       the axis
     51
     52   * mimage/MHillasCalc.cc:
     53     - skipped printing the removed case 4 from MHillas::Calc
    4554
    4655
  • trunk/MagicSoft/Mars/NEWS

    r7176 r7177  
    1414
    1515   - general: MH::SetPalette offers a lot of new palettes
     16
     17   - general: MHillas - the case of CorrXY==0 is now handled properly
    1618
    1719   - showplot: got a new option to start a root interpreter, too
  • trunk/MagicSoft/Mars/mimage/MHillas.cc

    r6873 r7177  
    159159    *fLog << " - Width          [mm]  = " << fWidth  << endl;
    160160    *fLog << " - Delta          [deg] = " << fDelta*kRad2Deg << endl;
    161     *fLog << " - Size           [1]   = " << fSize   << " #CherPhot"   << endl;
     161    *fLog << " - Size           [phe] = " << fSize   << endl;
    162162    *fLog << " - Meanx          [mm]  = " << fMeanX  << endl;
    163163    *fLog << " - Meany          [mm]  = " << fMeanY  << endl;
     
    182182    *fLog << " - Width          [deg] = " << fWidth *geom.GetConvMm2Deg() << endl;
    183183    *fLog << " - Delta          [deg] = " << fDelta*kRad2Deg << endl;
    184     *fLog << " - Size           [1]   = " << fSize   << " #CherPhot"  << endl;
     184    *fLog << " - Size           [phe] = " << fSize << endl;
    185185    *fLog << " - Meanx          [deg] = " << fMeanX *geom.GetConvMm2Deg() << endl;
    186186    *fLog << " - Meany          [deg] = " << fMeanY *geom.GetConvMm2Deg() << endl;
     
    215215    line.PaintLine(+w*fSinDelta+fMeanX, -w*fCosDelta+fMeanY,
    216216                   -w*fSinDelta+fMeanX, +w*fCosDelta+fMeanY);
     217
     218    // Rough estimate for disp
     219    const Double_t p = 362*(1-fWidth/fLength);
     220
     221    // Disp line
     222    line.PaintLine( p*fCosDelta+20*fSinDelta+fMeanX,  p*fSinDelta-20*fCosDelta+fMeanY,
     223                    p*fCosDelta-20*fSinDelta+fMeanX,  p*fSinDelta+20*fCosDelta+fMeanY);
     224    line.PaintLine(-p*fCosDelta+20*fSinDelta+fMeanX, -p*fSinDelta-20*fCosDelta+fMeanY,
     225                   -p*fCosDelta-20*fSinDelta+fMeanX, -p*fSinDelta+20*fCosDelta+fMeanY);
    217226
    218227    TEllipse e(fMeanX, fMeanY, fLength, fWidth, 0, 360, fDelta*kRad2Deg+180);
     
    259268
    260269    UInt_t numused = 0;
    261 /*
    262     MSignalPix *pix = 0;
    263 
    264     TIter Next(evt);
    265     while ((pix=(MSignalPix*)Next()))*/
     270
    266271    for (UInt_t i=0; i<numpix; i++)
    267272    {
     
    273278            continue;
    274279
    275         const MGeomPix &gpix = geom[i/*pix->GetPixId()*/];
     280        const MGeomPix &gpix = geom[i];
    276281
    277282        const Float_t nphot = pix.GetNumPhotons();
     
    312317    Double_t corryy=0;                               // [m^2]
    313318
    314     //Next.Reset();
    315     //while ((pix=(MSignalPix*)Next()))
    316     //{
    317319    for (UInt_t i=0; i<numpix; i++)
    318320    {
     
    324326            continue;
    325327
    326         const MGeomPix &gpix = geom[i/*pix->GetPixId()*/];
     328        const MGeomPix &gpix = geom[i];
    327329
    328330        const Float_t dx = gpix.GetX() - fMeanX;     // [mm]
     
    337339
    338340    //
    339     // If corrxy=0 (which should happen not very often, because fSize>0)
    340     // we cannot calculate Length and Width.
    341     // In reallity it is almost impossible to have a distribution of
    342     // cerenkov photons in the used pixels which is exactly symmetric
    343     // along one of the axis.
    344     // It seems to be less than 0.1% of all events.
    345     //
    346     if (corrxy==0)
    347         return 4;
    348 
    349     //
    350341    // calculate the basic Hillas parameters: orientation and size of axes
    351342    // -------------------------------------------------------------------
     
    360351    const Double_t d0    = corryy - corrxx;
    361352    const Double_t d1    = corrxy*2;
    362     const Double_t d2    = d0 + TMath::Sqrt(d0*d0 + d1*d1);
    363     const Double_t tand  = d2 / d1;
     353    const Double_t d2    = TMath::Sqrt(d0*d0 + d1*d1) + d0; // [0
     354
     355    const Double_t tand  = d2==0 ? 0 : d2 / d1; // Force 0 also if d1==0
    364356    const Double_t tand2 = tand*tand;
    365357
    366     fDelta = TMath::ATan(tand);
    367 
    368     const Double_t s2 = tand2+1;
    369     const Double_t s  = TMath::Sqrt(s2);
    370 
    371     fCosDelta =  1.0/s;   // need these in derived classes
    372     fSinDelta = tand/s;   // like MHillasExt
    373 
    374     const Double_t axis1 = (tand2*corryy + d2 + corrxx)/s2/fSize;
    375     const Double_t axis2 = (tand2*corrxx - d2 + corryy)/s2/fSize;
    376 
    377     //
    378     // fLength^2 is the second moment along the major axis of the ellipse
    379     // fWidth^2  is the second moment along the minor axis of the ellipse
     358    const Double_t s2    = tand2+1;
     359    const Double_t s     = TMath::Sqrt(s2);
     360
     361    // Set default for the case in which the image is symmetric on the y-axis
     362    fDelta    = TMath::Pi()/2;
     363    fCosDelta = 0;
     364    fSinDelta = 1;
     365
     366    Double_t axis1 = corryy;
     367    Double_t axis2 = corrxx;
     368
     369    // This are all cases in which the image is not symmetric on the y-axis
     370    if (d1!=0 || d2==0)
     371    {
     372        fDelta    = TMath::ATan(tand);
     373
     374        fCosDelta = 1.0 /s;   // need these in derived classes
     375        fSinDelta = tand/s;   // like MHillasExt
     376
     377        axis1 = (tand2*corryy + d2 + corrxx)/s2;
     378        axis2 = (tand2*corrxx - d2 + corryy)/s2;
     379    }
     380
     381    //
     382    // fLength^2 is the second moment along the major axis of the distribution
     383    // fWidth^2  is the second moment along the minor axis of the distribution
    380384    //
    381385    // From the algorithm we get: fWidth <= fLength is always true
     
    383387    // very small numbers can get negative by rounding
    384388    //
    385     fLength = axis1<0 ? 0 : TMath::Sqrt(axis1);  // [mm]
    386     fWidth  = axis2<0 ? 0 : TMath::Sqrt(axis2);  // [mm]
     389    fLength = axis1<0 ? 0 : TMath::Sqrt(axis1/fSize);  // [mm]
     390    fWidth  = axis2<0 ? 0 : TMath::Sqrt(axis2/fSize);  // [mm]
    387391
    388392    SetReadyToSave();
  • trunk/MagicSoft/Mars/mimage/MHillasCalc.cc

    r6910 r7177  
    376376        PrintSkipped(fErrors[2], "Calculated Size == 0 (after cleaning)");
    377377        PrintSkipped(fErrors[3], "Number of used pixels < 3");
    378         PrintSkipped(fErrors[4], "CorrXY==0");
     378        //PrintSkipped(fErrors[4], "CorrXY==0");
    379379    }
    380380    if (TestFlag(kCalcHillasSrc))
Note: See TracChangeset for help on using the changeset viewer.