Changeset 1593


Ignore:
Timestamp:
11/08/02 10:04:04 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1590 r1593  
    11                                                                  -*-*- END -*-*-
    2 
    3  2002/11/7: Oscar Blanch
     2 2002/11/08: Thomas Bretz
     3
     4   * mhist/MHMatrix.cc:
     5     - implemented a zero suppression
     6
     7
     8
     9 2002/11/07: Thomas Bretz
     10
     11   * mfilter/Makefile, mfilter/FilterLinkDef.h:
     12     - added MFEventSelector
     13
     14   * mfilter/MFEventSelector.[h,cc]:
     15     - added
     16
     17   * mfilter/MF.[h,cc]:
     18     - made gsDef[Name,Title] a static const member
     19
     20   * manalysis/MMultiDimDistCalc.cc:
     21     - changed the default function to kernel
     22
     23
     24
     25 2002/11/07: Oscar Blanch
    426   * mmc/MMcEvt.[hxx,cxx]
    5      - Some new varaible from the reflector header event.
     27     - Some new variable from the reflector header event.
     28
     29
    630
    731 2002/11/07: Wolfgang Wittek
     
    1034     - changed to avoid warnings : "member initializers will be re-ordered
    1135                                    to match declaration order"
     36
    1237
    1338
  • trunk/MagicSoft/Mars/mhist/MHMatrix.cc

    r1582 r1593  
    427427    TMath::Sort(dists.GetSize(), dists.GetArray(), idx.GetArray(), kFALSE);
    428428
    429     const Int_t n = TMath::Abs(num)<rows ? TMath::Abs(num) : rows;
     429    Int_t from = 0;
     430    Int_t to   = TMath::Abs(num)<rows ? TMath::Abs(num) : rows;
     431    //
     432    // This is a zero-suppression for the case a test- and trainings
     433    // sample is identical. This would result in an unwanted leading
     434    // zero in the array. To suppress also numerical uncertanties of
     435    // zero we cut at 1e-5. Due to Rudy this should be enough. If
     436    // you encounter problems we can also use (eg) 1e-25
     437    //
     438    if (dists[idx[0]]<1e-5)
     439    {
     440        from++;
     441        to ++;
     442        if (to>rows)
     443            to = rows;
     444    }
    430445
    431446    if (num<0)
     
    438453
    439454        Double_t res = 0;
    440         for (int i=0; i<n; i++)
     455        for (int i=from; i<to; i++)
    441456            res += TMath::Exp(-dists[idx[i]]/hwin);
    442457
    443         return -TMath::Log(res/n);
     458        return -TMath::Log(res/(to-from));
    444459    }
    445460    else
     
    449464        //
    450465        Double_t res = 0;
    451         for (int i=0; i<n; i++)
     466        for (int i=from; i<to; i++)
    452467            res += dists[idx[i]];
    453468
    454         return TMath::Sqrt(res/n);
     469        return TMath::Sqrt(res/(to-from));
    455470    }
    456471}
Note: See TracChangeset for help on using the changeset viewer.