Changeset 6932


Ignore:
Timestamp:
04/12/05 17:05:49 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r6931 r6932  
    8282   * mranforest/MRFEnergyEst.[h,cc]:
    8383     - replaced MEnergyEst by MParameterD
     84
     85   * mfileio/MReadTree.cc:
     86     - shortened the output a bit when siwtching to the next file
    8487
    8588
  • trunk/MagicSoft/Mars/Makefile

    r6855 r6932  
    6666          mgui \
    6767          mranforest \
    68           mhistmc \
    6968          mjobs \
    7069          mtools \
  • trunk/MagicSoft/Mars/ganymed.cc

    r6907 r6932  
    143143        arg.Print("options");
    144144        gLog << endl;
     145        return 2;
    145146    }
    146147
  • trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h

    r6915 r6932  
    1212#pragma link C++ class MMultiDimDistCalc+;
    1313
    14 #pragma link C++ class MEnergyEst+;
    1514#pragma link C++ class MEnergyEstimate+;
    1615
  • trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.cc

    r5956 r6932  
    4747
    4848#include "MDataChain.h"
    49 #include "MEnergyEst.h"
     49#include "MParameters.h"
    5050
    5151#include "MLog.h"
     
    107107Int_t MEnergyEstimate::PreProcess(MParList *plist)
    108108{
    109     fEnergy = (MEnergyEst*)plist->FindCreateObj("MEnergyEst");
     109    fEnergy = (MParameterD*)plist->FindCreateObj("MParameterD", "MEnergyEst");
    110110    if (!fEnergy)
    111111        return kFALSE;
     
    130130        return kCONTINUE;
    131131
    132     fEnergy->SetEnergy(val);
     132    fEnergy->SetVal(val);
    133133    fEnergy->SetReadyToSave();
    134134    return kTRUE;
     135}
     136
     137// --------------------------------------------------------------------------
     138//
     139// Print the rule used for energy estimation
     140//
     141void MEnergyEstimate::Print(Option_t *o) const
     142{
     143    *fLog << all << GetDescriptor() << ":";
     144    if (!fData)
     145        *fLog << " <n/a>" << endl;
     146    else
     147        *fLog << endl << fData->GetRule() << endl;
    135148}
    136149
  • trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.h

    r5956 r6932  
    77
    88class MData;
    9 class MEnergyEst;
     9class MParameterD;
    1010
    1111class MEnergyEstimate : public MTask
    1212{
    1313private:
    14     MData      *fData;    //->
    15     MEnergyEst *fEnergy;
     14    MData       *fData;    //->
     15    MParameterD *fEnergy;  //!
    1616
    1717    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     
    2828    void SetVariables(const TArrayD &);
    2929
    30     ClassDef(MEnergyEstimate, 0) // Task to estimate the energy by a rule
     30    void Print(Option_t *o="") const;
     31
     32    ClassDef(MEnergyEstimate, 1) // Task to estimate the energy by a rule
    3133};
    3234
  • trunk/MagicSoft/Mars/manalysis/Makefile

    r6915 r6932  
    2828SRCFILES = MGeomApply.cc \
    2929           MCameraData.cc \
    30            MEnergyEst.cc \
    3130           MEnergyEstimate.cc \
    3231           MMatrixLoop.cc \
  • trunk/MagicSoft/Mars/mbase/MStatusArray.cc

    r4981 r6932  
    6161    delete d;
    6262    return 0;
     63}
     64
     65void MStatusArray::DisplayIn(MStatusDisplay &d, const char *tab) const
     66{
     67    d.Display(*this, tab);
    6368}
    6469
     
    149154    {
    150155        if (!c)
     156        {
     157            gLog << warn << "Canvas '" << canvas << "' not found..." << endl;
    151158            return 0;
     159        }
    152160
    153161        TObject *o = FindObjectInPad(c, object, cls);
    154162        if (!o)
     163        {
     164            gLog << warn << "Object '" << object << "' [" << base << "] not found in canvas '" << canvas << "'..." << endl;
    155165            return 0;
     166        }
    156167
    157         return o->InheritsFrom(cls) ? o : 0;
     168        return o; //o->InheritsFrom(cls) ? o : 0;
    158169    }
    159170
     
    169180    }
    170181
     182    gLog << warn << "Object '" << object << "' [" << base << "] not found in canvas '" << canvas << "'..." << endl;
    171183    return NULL;
    172184}
  • trunk/MagicSoft/Mars/mbase/MStatusArray.h

    r4966 r6932  
    1010class TVirtualPad;
    1111
     12class MStatusDisplay;
     13
    1214class MStatusArray : public TObjArray
    1315{
     
    1820public:
    1921    TObject *DisplayIn(Option_t *o=0) const;         // *MENU*
     22    void     DisplayIn(MStatusDisplay &d, const char *tab=0) const;
    2023    TObject *Display() const { return DisplayIn(); } // *MENU*
    2124
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc

    r6890 r6932  
    16861686}
    16871687
    1688 Bool_t MStatusDisplay::Display(const TObjArray &list)
     1688Bool_t MStatusDisplay::Display(const TObjArray &list, const char *tab)
    16891689{
    16901690    TIter Next(&list);
     
    17021702    while ((c=(TCanvas*)Next()))
    17031703        //if (!GetCanvas(c->GetName()))
     1704        if (!tab || c->GetName()==(TString)tab)
    17041705            DrawClonePad(AddTab(c->GetName()), *c);
    17051706
     
    17111712// Reads the contents of a saved MStatusDisplay from a file.
    17121713//
    1713 Int_t MStatusDisplay::Read(const char *name)
     1714Int_t MStatusDisplay::Read(const char *name, const char *tab)
    17141715{
    17151716    if (!gFile)
     
    17341735    }
    17351736
    1736     if (!Display(list))
     1737    if (!Display(list, tab))
    17371738    {
    17381739        *fLog << err << "MStatusDisplay::Display: No entry in " << name << "." << endl;
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.h

    r6890 r6932  
    122122    void DrawClonePad(TCanvas &newc, TCanvas &oldc) const;
    123123    void CanvasSetFillColor(TPad &c, Int_t col) const;
    124     Bool_t Display(const TObjArray &list);
     124    Bool_t Display(const TObjArray &list, const char *tab=0);
    125125
    126126    void AddExtension(TString &name, const TString &ext, Int_t num) const;
     
    167167     Int_t Write(Int_t num, const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0) const;
    168168
    169      Int_t Read(const char *name="MStatusDisplay");
     169     Int_t Read(const char *name, const char *tab);
     170     Int_t Read(const char *name="MStatusDisplay")
     171     {
     172         return Read(name, 0);
     173     }
    170174     Int_t Write(const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0)
    171175     {
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r6913 r6932  
    390390    {
    391391    case kPhe:
    392       *fLog << warn << "WARNING - Renormalization to photo-electrons applied!" << endl;
     392      *fLog << inf << "Calibrating in units of equivalent (outer/inner=4) photo-electrons." << endl;
    393393      break;
    394394    case kPhot:
     395      *fLog << inf << "Calibrating in units of photons." << endl;
    395396      break;
    396397    }
     
    403404        if (fCalibrations->GetSize() != npixels)
    404405          {
    405             *fLog << err << GetDescriptor()
    406                   << ": Size mismatch between MGeomCam and MCalibrationChargeCam ... abort!" << endl;
     406            *fLog << "Size mismatch between MGeomCam and MCalibrationChargeCam... abort!" << endl;
    407407            return kFALSE;
    408408          }
     
    410410        if (fBadPixels->GetSize() != npixels)
    411411          {
    412             *fLog << err << GetDescriptor()
    413                   << ": Size mismatch between MGeomCam and MBadPixelsCam ... abort!" << endl;
     412            *fLog << "Size mismatch between MGeomCam and MBadPixelsCam... abort!" << endl;
    414413            return kFALSE;
    415414          }
     
    417416        if (fBadPixels->GetSize() != npixels)
    418417          {
    419             *fLog << err << GetDescriptor()
    420                   << ": Size mismatch between MGeomCam and MBadPixelsCam ... abort!" << endl;
     418            *fLog << "Size mismatch between MGeomCam and MBadPixelsCam... abort!" << endl;
    421419            return kFALSE;
    422420          }
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc

    r6242 r6932  
    270270                    Form("%s%2.1f%s","Time resolution less than ",fRelTimeResolutionLimit," FADC slices from Mean:   "));
    271271  PrintUncalibrated(MBadPixelsPix::kRelTimeOscillating,   
    272                     "Pixels with changing Rel. Times   over time:      ");
     272                    "Pixels with changing Rel. Times over time:             ");
    273273  PrintUncalibrated(MBadPixelsPix::kRelTimeNotFitted,     
    274                     "Pixels with unsuccesful Gauss fit to the times:   ");
     274                    "Pixels with unsuccesful Gauss fit to the times:        ");
    275275
    276276  if (asciilog)
  • trunk/MagicSoft/Mars/mfbase/MF.cc

    r6905 r6932  
    106106// Default Constructor. Don't use.
    107107//
    108 MF::MF() : fF(NULL)
     108MF::MF() : fF(NULL), fAllowEmpty(kFALSE)
    109109{
    110110    fName  = gsDefName.Data();
     
    117117// the class description above.
    118118//
    119 MF::MF(const char *text, const char *name, const char *title)
     119MF::MF(const char *text, const char *name, const char *title) : fAllowEmpty(kFALSE)
    120120{
    121121    fName  = name  ? name  : gsDefName.Data();
  • trunk/MagicSoft/Mars/mfbase/MF.h

    r5911 r6932  
    2121    static const TString gsDefTitle; //!
    2222
    23     MFilter *fF; // Filter
     23    MFilter *fF;                     // Filter
     24    Bool_t fAllowEmpty;              // Not a Bit to be stored
    2425
    2526    Int_t IsRule(TString &txt, TString &rule) const;
     
    3233    void StreamPrimitive(ofstream &out) const;
    3334
    34     enum { kAllowEmpty = BIT(14) };
    35 
    3635public:
    3736    MF();
     
    4039
    4140    // MF
    42     void SetAllowEmpty(Bool_t b=kTRUE) { b ? SetBit(kAllowEmpty) : ResetBit(kAllowEmpty); }
    43     Bool_t IsAllowEmpty() const { return TestBit(kAllowEmpty); }
     41    void SetAllowEmpty(Bool_t b=kTRUE) { fAllowEmpty = b; }
     42    Bool_t IsAllowEmpty() const { return fAllowEmpty; }
    4443
    4544    // MFilter
     
    6160    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    6261
    63     ClassDef(MF, 0) // A Filter for cuts in any data member
     62    ClassDef(MF, 1) // A Filter for cuts in any data member
    6463};
    6564
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r6513 r6932  
    277277        return kFALSE;
    278278
    279     *fLog << inf << GetDescriptor() << ": Switching to #" << GetFileIndex();
    280     *fLog << " '" << GetFileName() << "' (before event #";
     279    *fLog << inf << GetDescriptor() << ": Next file #" << GetFileIndex();
     280    *fLog << " '" << GetFileName() << "' (next evt #";
    281281    *fLog << GetNumEntry()-1 << ")" << endl;
    282282
  • trunk/MagicSoft/Mars/mhbase/MBinning.cc

    r5971 r6932  
    248248    str = str.Strip(TString::kBoth);
    249249
    250     TString typ;
     250    TString typ(str);
    251251    Ssiz_t pos = str.First(' ');
    252252    if (pos>=0)
    253253    {
    254254        typ = str(0, pos);
     255        str.Remove(0, pos);
     256        str = str.Strip(TString::kBoth);
    255257        if (typ!=(TString)"lin" && typ!=(TString)"log" && typ!=(TString)"cos")
    256258        {
     
    261263
    262264    SetEdges(nbins, loedge, upedge, typ.Data());
    263 
    264     str = str.Strip(TString::kBoth);
    265265
    266266    if (!str.IsNull())
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.cc

    r6907 r6932  
    5757#include "MSrcPosCam.h"
    5858#include "MHillasSrc.h"
    59 #include "MEnergyEst.h"
    6059#include "MTime.h"
    6160#include "MObservatory.h"
     
    116115    fHEnergy.UseCurrentStyle();
    117116
    118     fHTheta.SetName("Theta");
     117    fHTheta.SetName("ExcessTheta");
    119118    fHTheta.SetTitle(" N_{exc} vs. \\Theta ");
    120119    fHTheta.SetXTitle("\\Theta [\\circ]");
     
    124123
    125124    // effective on time versus time
    126     fHTime.SetName("Time");
     125    fHTime.SetName("ExcessTime");
    127126    fHTime.SetTitle(" N_{exc} vs. Time ");
    128127    fHTime.SetXTitle("Time");
     
    268267    }
    269268    */
    270     fEnergy = (MEnergyEst*)pl->FindObject("MEnergyEst");
     269    fEnergy = (MParameterD*)pl->FindObject("MEnergyEst", "MParameterD");
    271270    if (!fEnergy)
    272271    { /*
     
    277276        } */
    278277
    279         *fLog << warn << "MEnergyEst not found... " << flush;
     278        *fLog << warn << "MEnergyEst [MParameterD] not found... " << flush;
    280279
    281280        if (!fHillas)
     
    286285            *fLog << "ignored." << endl;
    287286
    288         fHEnergy.SetName("Size");
     287        fHEnergy.SetName("ExcessSize");
    289288        fHEnergy.SetTitle(" N_{exc} vs. Size ");
    290289        fHEnergy.SetXTitle("Size [\\gamma]");
     
    292291    else
    293292    {
    294         fHEnergy.SetName("Energy");
     293        fHEnergy.SetName("ExcessEnergy");
    295294        fHEnergy.SetTitle(" N_{exc} vs. E_{est} ");
    296295        fHEnergy.SetXTitle("E_{est} [GeV]");
     
    488487        if (fHillas)
    489488            size = fHillas->GetSize();
    490         energy = fEnergy   ? fEnergy->GetEnergy() : (fHillas?fHillas->GetSize():1000);
     489        energy = fEnergy   ? fEnergy->GetVal() : (fHillas?fHillas->GetSize():1000);
    491490        theta  = fPointPos ? fPointPos->GetZd()   : 0;
    492491    }
     
    715714        pad->cd(2);
    716715        gPad->SetBorderMode(0);
     716        gPad->SetGridx();
     717        gPad->SetGridy();
    717718        fHEnergy.Draw();
    718719
     
    737738        pad->cd(3);
    738739        gPad->SetBorderMode(0);
     740        gPad->SetGridx();
     741        gPad->SetGridy();
    739742        fHTime.Draw();
    740743        AppendPad("time");
     
    746749    {
    747750        pad->cd(4);
     751        gPad->SetGridx();
     752        gPad->SetGridy();
    748753        gPad->SetBorderMode(0);
    749754        fHTheta.Draw();
     
    910915        if (type==0)
    911916        {
    912             fMap[1] = fMatrix->AddColumn("MEnergyEst.fEnergy");
     917            fMap[1] = fMatrix->AddColumn("MEnergyEst.fVal");
    913918            fMap[2] = -1;
    914919        }
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.h

    r6907 r6932  
    2020class MParList;
    2121class MParameterD;
    22 class MEnergyEst;
    2322class MHillas;
    2423class MHMatrix;
     
    9695
    9796    MParameterD  *fResult;      //!
    98     MEnergyEst   *fEnergy;      //!
     97    MParameterD  *fEnergy;      //!
    9998    MHillas      *fHillas;      //!
    10099    MPointingPos *fPointPos;    //!
  • trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc

    r6924 r6932  
    120120    }
    121121
    122     fEnergy = (MEnergyEst*)plist->FindObject("MEnergyEst");
     122    fEnergy = (MParameterD*)plist->FindObject("MEnergyEst", "MParameterD");
    123123    if (!fEnergy)
    124124    {
    125         *fLog << err << "MEnergyEst not found... aborting." << endl;
     125        *fLog << err << "MEnergyEst [MParameterD] not found... aborting." << endl;
    126126        return kFALSE;
    127127    }
     
    160160Bool_t MHEnergyEst::Fill(const MParContainer *par, const Stat_t w)
    161161{
    162     const Double_t eest  = fEnergy->GetEnergy();
     162    const Double_t eest  = fEnergy->GetVal();
    163163    const Double_t etru  = fMatrix ? GetVal(0) : fMcEvt->GetEnergy();
    164164    const Double_t imp   = fMatrix ? GetVal(1) : fMcEvt->GetImpact()/100;
     
    185185    fResult->SetVal(sigma);
    186186
    187     *fLog << all << "Mean log10(Energy) Resoltion: " << Form("%.1f%%", TMath::Sqrt(fChisq-fBias*fBias)*100) << endl;
    188     *fLog << all << "Mean log10(Energy) Bias:      " << Form("%.1f%%", fBias*100) << endl;
     187    Print();
    189188
    190189    return kTRUE;
     190}
     191
     192void MHEnergyEst::Print(Option_t *o) const
     193{
     194    *fLog << all;
     195    *fLog << "Mean log10(Energy) Resoltion: " << Form("%5.2f%%", TMath::Sqrt(fChisq-fBias*fBias)) << endl;
     196    *fLog << "Mean log10(Energy) Bias:      " << Form("%5.2f%%", fBias) << endl;
    191197}
    192198
     
    298304    gPad->SetGridy();
    299305
     306    // Results in crashes....
    300307    //gROOT->GetListOfCleanups()->Add(gPad); // WHY?
    301308
     
    315322
    316323    h2->Draw("");
    317     h1->Draw("E3same");
    318     h1->Draw("Chistsame");
     324    h1->Draw("E3 hist C same");
     325//    h1->Draw("Chistsame");
    319326
    320327    return h1;
  • trunk/MagicSoft/Mars/mhflux/MHEnergyEst.h

    r6890 r6932  
    1515
    1616class MMcEvt;
    17 class MEnergyEst;
    1817class MParList;
    1918class MParameterD;
     
    2423private:
    2524    MMcEvt      *fMcEvt;  //!
    26     MEnergyEst *fEnergy; //!
     25    MParameterD *fEnergy; //!
    2726    MParameterD *fResult; //!
    2827
     
    5453    void Paint(Option_t *opt="");
    5554    void Draw(Option_t *option="");
     55    void Print(Option_t *o="") const;
    5656
    5757    ClassDef(MHEnergyEst, 1) //
  • trunk/MagicSoft/Mars/mjobs/MJOptimize.cc

    r6924 r6932  
    109109#include "MFilterList.h"
    110110#include "../mfilter/MFMagicCuts.h"
     111#include "../mfilter/MFMagicCuts2.h"
    111112#include "MContinue.h"
    112113#include "MGeomCamMagic.h"
     
    333334void MJOptimize::AddPreCut(const char *rule)
    334335{
    335     fPreCuts.Add(new MF(rule));
     336    MFilter *f = new MF(rule);
     337    f->SetBit(kCanDelete);
     338    AddPreCut(f);
     339}
     340
     341//------------------------------------------------------------------------
     342//
     343// Add a cut which is used to fill the matrix. If kCanDelete is set
     344// MJOptimize takes the ownership.
     345//
     346void MJOptimize::AddPreCut(MFilter *f)
     347{
     348    fPreCuts.Add(f);
    336349}
    337350
     
    823836    if (filter && filter->InheritsFrom(MFMagicCuts::Class()))
    824837        ((MFMagicCuts*)filter)->InitMapping(&m);
     838    if (filter && filter->InheritsFrom(MFMagicCuts2::Class()))
     839        ((MFMagicCuts2*)filter)->InitMapping(&m);
    825840
    826841    MReadTree read("Events");
     
    898913    if (filter && filter->InheritsFrom(MFMagicCuts::Class()))
    899914        ((MFMagicCuts*)filter)->InitMapping(&m);
     915    if (filter && filter->InheritsFrom(MFMagicCuts2::Class()))
     916        ((MFMagicCuts2*)filter)->InitMapping(&m);
    900917
    901918    parlist.AddToList(&histon);
     
    10251042        return kFALSE;
    10261043
     1044    hist.Print();
     1045
    10271046    TObjArray cont;
    10281047    cont.Add(&est);
  • trunk/MagicSoft/Mars/mjobs/MJOptimize.h

    r6924 r6932  
    101101    void AddFilter(const char *rule);
    102102    void AddPreCut(const char *rule);
     103    void AddPreCut(MFilter *f);
    103104
    104105    // Steering of optimization
  • trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.cc

    r6797 r6932  
    3434#include <TList.h>
    3535
    36 #include <TH1F.h>
    37 #include <TH2F.h>
     36#include <TH1.h>
     37#include <TH2.h>
    3838#include <TStyle.h>
    3939#include <TCanvas.h>
     40#include <TMath.h>
     41#include <TVector.h>
    4042
    4143#include "MHMatrix.h"
     
    5355
    5456#include "MData.h"
    55 
    56 #include "TFile.h"
    57 #include "TList.h"
    58 
    59 #include "TH1F.h"
    60 #include "TH2F.h"
    61 #include "TStyle.h"
    62 #include "TCanvas.h"
    63 #include "TMath.h"
    64 #include "TVector.h"
    65 
    66 #include "MEnergyEst.h"
     57#include "MParameters.h"
    6758
    6859
     
    287278        Double_t e_true = (*mptr)(i,ncols-1);
    288279        Double_t e_est = 0;
    289         Double_t hmax  = 0;
     280        //Double_t hmax  = 0;
    290281        Double_t hsum  = 0;
    291282
     
    388379Int_t MRFEnergyEst::PreProcess(MParList *plist)
    389380{
    390     fEnergyEst = (MEnergyEst*)plist->FindCreateObj("MEnergyEst");
     381    fEnergyEst = (MParameterD*)plist->FindCreateObj("MParameterD", "MEnergyEst");
    391382    if (!fEnergyEst)
    392383    {
    393         *fLog << err << dbginf << "MEnergyEst not found... aborting." << endl;
     384        *fLog << err << dbginf << "MEnergyEst [MParameterD] not found... aborting." << endl;
    394385        return kFALSE;
    395386    }
     
    424415    *fData >> event;
    425416
    426     Double_t e_est = 0;
    427     Double_t hmax  = 0;
     417    Double_t eest = 0;
     418    //Double_t hmax  = 0;
    428419    Double_t hsum  = 0;
    429420       
     
    438429        }*/
    439430        hsum+=h;
    440         e_est+=h*e;
    441     }
    442     e_est/=hsum;
    443     e_est=pow(10.,e_est);
    444 
    445     fEnergyEst->SetEnergy(e_est);
     431        eest+=h*e;
     432    }
     433    eest/=hsum;
     434    eest=pow(10.,eest);
     435
     436    fEnergyEst->SetVal(eest);
    446437    fEnergyEst->SetReadyToSave();
    447438
    448439    return kTRUE;
    449440}
    450 
    451 Int_t MRFEnergyEst::PostProcess()
    452 {
    453 
    454     return kTRUE;
    455 }
  • trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.h

    r6530 r6932  
    1616class MHMatrix;
    1717class MDataArray;
    18 class MEnergyEst;
     18class MParameterD;
    1919
    2020class MRFEnergyEst : public MTask
     
    3333    TObjArray fEForests;
    3434
    35     MEnergyEst *fEnergyEst;
     35    MParameterD *fEnergyEst;
    3636
    3737    Int_t PreProcess(MParList *plist);
    3838    Int_t Process();
    39     Int_t PostProcess();
    4039
    4140    Int_t ReadForests(MParList *plist=NULL);
Note: See TracChangeset for help on using the changeset viewer.