Ignore:
Timestamp:
07/29/03 13:18:57 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MH.cc

    r2209 r2296  
    796796// Otherwise the present gPad is returned.
    797797//
    798 TVirtualPad *MH::GetNewPad(Option_t *opt)
    799 {
    800     TString str(opt);
    801 
    802     if (!str.Contains("nonew", TString::kIgnoreCase))
     798TVirtualPad *MH::GetNewPad(TString &opt)
     799{
     800    opt.ToLower();
     801
     802    if (!opt.Contains("nonew"))
    803803        return NULL;
     804
     805    opt.ReplaceAll("nonew", "");
    804806
    805807    return gPad;
     
    813815TObject *MH::Clone(const char *name) const
    814816{
    815     Bool_t store = TH1::AddDirectoryStatus();
     817    const Bool_t store = TH1::AddDirectoryStatus();
     818
    816819    TH1::AddDirectory(kFALSE);
    817 
    818820    TObject *o = MParContainer::Clone(name);
    819 
    820821    TH1::AddDirectory(store);
    821822
     
    831832TObject *MH::DrawClone(Option_t *opt, Int_t w, Int_t h) const
    832833{
    833     TVirtualPad *p = GetNewPad(opt);
     834    TString option(opt);
     835
     836    TVirtualPad *p = GetNewPad(option);
    834837    if (!p)
    835838        p = MakeDefCanvas(this, w, h);
     
    839842    gROOT->SetSelectedPad(NULL);
    840843
    841     TObject *o = MParContainer::DrawClone(opt);
     844    TObject *o = MParContainer::DrawClone(option);
    842845    o->SetBit(kCanDelete);
    843846    return o;
  • trunk/MagicSoft/Mars/mhist/MH.h

    r2150 r2296  
    7575    }
    7676
    77     static TVirtualPad *GetNewPad(Option_t *opt);
     77    static TVirtualPad *GetNewPad(TString &opt);
    7878
    7979    static void FindGoodLimits(Int_t nbins, Int_t &newbins, Double_t &xmin, Double_t &xmax, Bool_t isInteger);
  • trunk/MagicSoft/Mars/mhist/MHHadronness.cc

    r2225 r2296  
    430430// --------------------------------------------------------------------------
    431431//
     432// Search the hadronness corresponding to a given hadron acceptance.
     433//
     434Double_t MHHadronness::GetHadronness(Double_t acchad) const
     435{
     436    for (int i=1; i<fIntPhness->GetNbinsX()+1; i++)
     437        if (fIntPhness->GetBinContent(i)>acchad)
     438            return fIntPhness->GetBinLowEdge(i);
     439
     440    return -1;
     441}
     442
     443// --------------------------------------------------------------------------
     444//
    432445// Print the corresponding Gammas Acceptance for a hadron acceptance of
    433446// 10%, 20%, 30%, 40% and 50%. Also the minimum distance to the optimum
     
    448461
    449462    *fLog << "Used " << fGhness->GetEntries() << " Gammas and " << fPhness->GetEntries() << " Hadrons." << endl;
    450     *fLog << "acc(hadron)  acc(gamma)  acc(g)/acc(h)" << endl <<endl;
    451 
    452     *fLog << "    0.005    " << Form("%6.3f", GetGammaAcceptance(0.005)) << "    " << Form("%6.3f", GetGammaAcceptance(0.005)/0.005) << endl;
    453     *fLog << "    0.02     " << Form("%6.3f", GetGammaAcceptance(0.02))  << "    " << Form("%6.3f", GetGammaAcceptance(0.02)/0.02) << endl;
    454     *fLog << "    0.05     " << Form("%6.3f", GetGammaAcceptance(0.05))  << "    " << Form("%6.3f", GetGammaAcceptance(0.05)/0.05) << endl;
    455     *fLog << "    0.1      " << Form("%6.3f", GetGammaAcceptance(0.1 ))  << "    " << Form("%6.3f", GetGammaAcceptance(0.1)/0.1) << endl;
    456     *fLog << "    0.2      " << Form("%6.3f", GetGammaAcceptance(0.2 ))  << "    " << Form("%6.3f", GetGammaAcceptance(0.2)/0.2) << endl;
    457     *fLog << "    0.3      " << Form("%6.3f", GetGammaAcceptance(0.3 ))  << "    " << Form("%6.3f", GetGammaAcceptance(0.3)/0.3) << endl;
     463    *fLog << "acc(hadron) acc(gamma) acc(g)/acc(h)  h" << endl <<endl;
     464
     465    *fLog << "    0.005    " << Form("%6.3f", GetGammaAcceptance(0.005)) << "      " << Form("%6.3f", GetGammaAcceptance(0.005)/0.005) << "      " << GetHadronness(0.005) << endl;
     466    *fLog << "    0.02     " << Form("%6.3f", GetGammaAcceptance(0.02))  << "      " << Form("%6.3f", GetGammaAcceptance(0.02)/0.02)   << "      " << GetHadronness(0.02) << endl;
     467    *fLog << "    0.05     " << Form("%6.3f", GetGammaAcceptance(0.05))  << "      " << Form("%6.3f", GetGammaAcceptance(0.05)/0.05)   << "      " << GetHadronness(0.05) << endl;
     468    *fLog << "    0.1      " << Form("%6.3f", GetGammaAcceptance(0.1 ))  << "      " << Form("%6.3f", GetGammaAcceptance(0.1)/0.1)     << "      " << GetHadronness(0.1) << endl;
     469    *fLog << "    0.2      " << Form("%6.3f", GetGammaAcceptance(0.2 ))  << "      " << Form("%6.3f", GetGammaAcceptance(0.2)/0.2)     << "      " << GetHadronness(0.2) << endl;
     470    *fLog << "    0.3      " << Form("%6.3f", GetGammaAcceptance(0.3 ))  << "      " << Form("%6.3f", GetGammaAcceptance(0.3)/0.3)     << "      " << GetHadronness(0.3) << endl;
    458471    *fLog << Form("%6.3f", GetHadronAcceptance(0.1)) << "        0.1  " << endl;
    459472    *fLog << Form("%6.3f", GetHadronAcceptance(0.2)) << "        0.2  " << endl;
  • trunk/MagicSoft/Mars/mhist/MHHadronness.h

    r2225 r2296  
    3838    Double_t GetGammaAcceptance(Double_t acchad) const;
    3939    Double_t GetHadronAcceptance(Double_t accgam) const;
     40    Double_t GetHadronness(Double_t acchad) const;
    4041
    4142    TH1D *Getghness() const  { return fGhness; }
  • trunk/MagicSoft/Mars/mhist/MHMatrix.cc

    r2282 r2296  
    260260    return kTRUE;
    261261}
     262
    262263/*
    263264// --------------------------------------------------------------------------
     
    503504    if (!fM2.IsValid())
    504505    {
     506        if (!fM.IsValid())
     507        {
     508            *fLog << err << "MHMatrix::CalcDist - ERROR: fM not valid." << endl;
     509            return -1;
     510        }
     511
    505512        const TMatrix *m = InvertPosDef();
    506513        if (!m)
     
    625632    tlist.AddToList(&fillh);
    626633
    627     MProgressBar bar;
     634    //MProgressBar bar;
    628635    MEvtLoop evtloop;
    629636    evtloop.SetParList(plist);
    630     evtloop.SetProgressBar(&bar);
     637    //evtloop.SetProgressBar(&bar);
    631638
    632639    if (!evtloop.Eventloop())
    633640        return kFALSE;
    634641
    635     tlist.PrintStatistics(0, kTRUE);
     642    tlist.PrintStatistics();
    636643
    637644    plist->Remove(&tlist);
     
    10971104void MHMatrix::ShuffleRows(UInt_t seed)
    10981105{
    1099   TRandom rnd(seed);
    1100 
    1101   for (Int_t irow = 0; irow < fNumRow; irow++)
    1102     {
    1103       Int_t jrow = rnd.Integer(fNumRow);
    1104 
    1105       for (Int_t icol = 0; icol < fM.GetNcols(); icol++)
    1106         {
    1107           Real_t tmp = fM(irow,icol);
    1108           fM(irow,icol) = fM(jrow,icol);
    1109           fM(jrow,icol) = tmp;
    1110         }
    1111     }
    1112 
    1113   *fLog << warn << this->GetName() << " : Attention! Matrix rows have been shuffled." << endl;
    1114 
    1115 }
     1106    TRandom rnd(seed);
     1107
     1108    TVector v(fM.GetNcols());
     1109    TVector tmp(fM.GetNcols());
     1110    for (Int_t irow = 0; irow<fNumRow; irow++)
     1111    {
     1112        const Int_t jrow = rnd.Integer(fNumRow);
     1113
     1114        v = TMatrixRow(fM, irow);
     1115        TMatrixRow(fM, irow) = tmp = TMatrixRow(fM, jrow);
     1116        TMatrixRow(fM, jrow) = v;
     1117    }
     1118
     1119    *fLog << warn << GetDescriptor() << ": Attention! Matrix rows have been shuffled." << endl;
     1120}
     1121
     1122void MHMatrix::ReduceRows(UInt_t num)
     1123{
     1124    if ((Int_t)num>=fM.GetNrows())
     1125    {
     1126        *fLog << warn << GetDescriptor() << ": Warning - " << num << " >= rows=" << fM.GetNrows() << endl;
     1127        return;
     1128    }
     1129
     1130    const TMatrix m(fM);
     1131    fM.ResizeTo(num, fM.GetNcols());
     1132
     1133    TVector tmp(fM.GetNcols());
     1134    for (UInt_t irow=0; irow<num; irow++)
     1135        TMatrixRow(fM, irow) = tmp = TMatrixRow(m, irow);
     1136}
  • trunk/MagicSoft/Mars/mhist/MHMatrix.h

    r2133 r2296  
    113113
    114114    void ShuffleRows(UInt_t seed);
     115    void ReduceRows(UInt_t num);
    115116
    116117    ClassDef(MHMatrix, 1) // Multidimensional Matrix to store events
Note: See TracChangeset for help on using the changeset viewer.