Changeset 1488


Ignore:
Timestamp:
08/08/02 09:15:26 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
6 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
  • trunk/MagicSoft/Mars/mdata/DataLinkDef.h

    r1287 r1488  
    66
    77#pragma link C++ class MData+;
     8#pragma link C++ class MDataArray+;
    89#pragma link C++ class MDataList+;
    910#pragma link C++ class MDataValue+;
  • trunk/MagicSoft/Mars/mdata/Makefile

    r1287 r1488  
    3232
    3333SRCFILES = MData.cc \
     34           MDataArray.cc \
    3435           MDataMember.cc \
    3536           MDataValue.cc \
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r1483 r1488  
    4949ClassImp(MWriteRootFile);
    5050
     51static const TString gsDefName  = "MWriteRootFile";
     52static const TString gsDefTitle = "Task which writes a root-output file";
    5153// --------------------------------------------------------------------------
    5254//
     
    5658MWriteRootFile::MWriteRootFile() : fOut(NULL)
    5759{
    58     fName  = "MWriteRootFile";
    59     fTitle = "Task which writes a root-output file";
     60    fName  = gsDefName;
     61    fTitle = gsDefTitle;
    6062
    6163    fBranches.SetOwner();
     
    7678                               const char *title)
    7779{
    78     fName  = name  ? name  : "MWriteRootFile";
    79     fTitle = title ? title : "Task which writes a root-output file";
     80    fName  = name  ? name  : gsDefName.Data();
     81    fTitle = title ? title : gsDefTitle.Data();
    8082
    8183    //
     
    409411    out << fOut->GetOption() << "\", \"";
    410412    out << fOut->GetTitle() << "\", ";
    411     out << fOut->GetCompressionLevel() << ", \"";
    412     out << fName << "\", \"" << fTitle << "\");" << endl;;
     413    out << fOut->GetCompressionLevel();
     414
     415    if (fName!=gsDefName || fTitle!=gsDefTitle)
     416    {
     417        out << ", \"" << fName << "\"";
     418        if (fTitle!=gsDefTitle)
     419            out << ", \"" << fTitle << "\"";
     420    }
     421    out << ");" << endl;
     422
    413423
    414424    MRootFileBranch *entry;
     
    416426    while ((entry=(MRootFileBranch*)Next()))
    417427    {
     428        out << "   " << GetUniqueName() << ".AddContainer(";
     429
    418430        if  (entry->GetContainer())
    419431        {
     
    424436            out << "\"" << entry->GetContName() << "\"";
    425437
    426         out << ", \"" << entry->GetName() << "\", \"";
    427         out << entry->GetTitle() << "\");" << endl;
     438        out << ", \"" << entry->GetName() << "\"";
     439        if ((TString)entry->GetTitle()!="")
     440            out << ", \"" << entry->GetTitle() << "\"";
     441
     442        out <<");" << endl;
    428443    }
    429444}
Note: See TracChangeset for help on using the changeset viewer.