Ignore:
Timestamp:
08/08/02 09:15:26 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
3 edited

Legend:

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

    r1434 r1488  
    116116    }
    117117
    118     fDist = dist;
    119                                                  // [mm]
    120118    //
    121119    // Calculate Alpha and Cosda = cos(d,a)
     
    123121    // a head-tail information
    124122    //
    125     const Double_t arg = (sy-tand*sx) / (fDist*sqrt(tand*tand+1));
     123    const Double_t arg = (sy-tand*sx) / (dist*sqrt(tand*tand+1));
    126124
    127125    fAlpha         = asin(arg)*kRad2Deg;        // [deg]
    128     fCosDeltaAlpha = fHeadTail/fDist;           // [1]
     126    fCosDeltaAlpha = fHeadTail/dist;            // [1]
     127    fDist          = dist;                      // [mm]
    129128
    130129    SetReadyToSave();
  • trunk/MagicSoft/Mars/manalysis/MMultiDimDistCalc.cc

    r1337 r1488  
    2626/////////////////////////////////////////////////////////////////////////////
    2727//
    28 // MMultiDimDistCalc
    29 //
    30 // Calculated a multidimensional distance. It calculates the distance to
    31 // all vectors in a given matrix describing Gammas and another one
    32 // describing Hadrons (non gammas). The shortest distances are avaraged.
    33 // How many distances are used for avaraging can be specified in the
    34 // constructor.
     28//  MMultiDimDistCalc
     29//
     30//  Calculated a multidimensional distance. It calculates the distance to
     31//  all vectors in a given matrix describing Gammas and another one
     32//  describing Hadrons (non gammas). The shortest distances are avaraged.
     33//  How many distances are used for avaraging can be specified in the
     34//  constructor.
     35//
     36//  * If you want to use the kernel function to calculate the distance use:
     37//      MMultiDimDistCalc::SetUseKernelMethod();
     38//  * To use only the n next neighbors for your calculation use:
     39//      MMultiDimDistCalc::SetUseNumRows(n);
     40//  * To use all reference events set the number to 0 <default>
    3541//
    3642////////////////////////////////////////////////////////////////////////////
    3743#include "MMultiDimDistCalc.h"
    3844
     45#include <fstream.h>
     46
    3947#include "MHMatrix.h" // must be before MLogManip.h
    4048
     
    4957ClassImp(MMultiDimDistCalc);
    5058
     59static const TString gsDefName  = "MMultiDimDistCalc";
     60static const TString gsDefTitle = "Composite Probabilities Loop 1/2";
    5161// --------------------------------------------------------------------------
    5262//
     
    5464// avaraging in CalcDist
    5565//
    56 MMultiDimDistCalc::MMultiDimDistCalc(Int_t num, const char *name, const char *title)
    57     : fNum(num)
     66MMultiDimDistCalc::MMultiDimDistCalc(const char *name, const char *title)
     67    : fNum(0), fUseKernel(kFALSE)
    5868{
    5969    //
    6070    //   set the name and title of this object
    6171    //
    62     fName  = name  ? name  : "MMultiDimDistCalc";
    63     fTitle = title ? title : "Composite Probabilities Loop 1/2";
     72    fName  = name  ? name  : gsDefName.Data();
     73    fTitle = title ? title : gsDefTitle.Data();
    6474
    6575    fData = new TList;
     
    152162        event(n++) = data->GetValue();
    153163
    154     Double_t dg = fMGammas->CalcDist(event, fNum);
    155     Double_t dh = fMHadrons->CalcDist(event, fNum);
    156 
     164    Double_t numg = fNum;
     165    Double_t numh = fNum;
     166    if (fNum==0)
     167    {
     168        numg = fMGammas->GetM().GetNrows();
     169        numh = fMHadrons->GetM().GetNrows();
     170    }
     171    if (fUseKernel)
     172    {
     173        numg = -numg;
     174        numh = -numh;
     175    }
     176
     177    Double_t dg = fMGammas->CalcDist(event, numg);
     178    Double_t dh = fMHadrons->CalcDist(event, numh);
     179
     180    //fHadroness->SetHadroness(dg/(dg+dh));
    157181    fHadroness->SetHadroness(exp(-dh/dg));
    158182
     
    160184}
    161185
     186void MMultiDimDistCalc::StreamPrimitive(ofstream &out) const
     187{
     188    out << "   MMultiDimDist " << GetUniqueName();
     189
     190    if (fName!=gsDefName || fTitle!=gsDefTitle)
     191    {
     192        out << "(\"" << fName << "\"";
     193        if (fTitle!=gsDefTitle)
     194            out << ", \"" << fTitle << "\")";
     195    }
     196    out << ";" << endl;
     197
     198    if (fNum!=0)
     199        out << "   " << GetUniqueName() << ".SetUseNumRows(" << fNum << ");" << endl;
     200    if (fUseKernel)
     201        out << "   " << GetUniqueName() << ".SetUseKernelMethod();" << endl;
     202}
  • trunk/MagicSoft/Mars/manalysis/MMultiDimDistCalc.h

    r1337 r1488  
    1313{
    1414private:
    15     Int_t fNum;             // number of distances used for an avarage
     15    Int_t  fNum;            // number of distances used for an avarage
     16    Bool_t fUseKernel;      // Flag whether kernel method should be used
    1617
    1718    MHMatrix   *fMGammas;   //! Gammas describing matrix
     
    2223    TList *fData;           //! Used to store the MDataChains to get the event values
    2324
     25    void StreamPrimitive(ofstream &out) const;
     26
    2427public:
    25     MMultiDimDistCalc(Int_t num, const char *name=NULL, const char *title=NULL);
     28    MMultiDimDistCalc(const char *name=NULL, const char *title=NULL);
    2629    ~MMultiDimDistCalc();
     30
     31    void SetUseNumRows(UShort_t n=0) { fNum = n; }
     32    void SetUseKernelMethod(Bool_t k=kTRUE) { fUseKernel = k; }
    2733
    2834    Bool_t PreProcess(MParList *plist);
    2935    Bool_t Process();
    3036
    31     ClassDef(MMultiDimDistCalc, 1) // Task to calculate multidimensional distances
     37    ClassDef(MMultiDimDistCalc, 0) // Task to calculate multidimensional distances
    3238};
    3339
Note: See TracChangeset for help on using the changeset viewer.