Changeset 4828 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
09/02/04 14:32:50 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4826 r4828  
    1919
    2020                                                 -*-*- END OF LINE -*-*-
    21 
    22  2004/09/1: Thomas Bretz
     21 2004/09/02: Thomas Bretz
     22
     23   * star.cc:
     24     - fixed treatment of batch-mode
     25
     26   * mbase/MParContainer.h:
     27     - added a comment
     28
     29   * mbase/MParList.[h,cc]:
     30     - added FindTaskListWithTask
     31
     32   * mbase/MTaskList.[h,cc]:
     33     - added sanity checks in AddToList
     34     - added FindTaskList
     35
     36   * mhbase/MH3.[h,cc]:
     37     - moved some drawing code from Draw to Paint
     38     - added possibility to set logarithmic axis manually
     39
     40   * mhist/MHAlpha.cc:
     41     - paint significance
     42
     43   * mhvstime/MHVsTime.[h,cc]:
     44     - added option to average data
     45
     46   * mjobs/MJCalibrateSignal.cc:
     47     - added MPointingPosCalc for "Drive"
     48
     49   * mmain/MEventDisplay.cc:
     50     - fixed some problems with the display
     51
     52   * msignal/MArrivalTime.[h,cc]:
     53     - added Print()
     54
     55
     56
     57 2004/09/01: Thomas Bretz
    2358
    2459   * mfileio/MWriteRootFile.[h,cc]:
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r4710 r4828  
    101101    virtual void SetDisplay(MStatusDisplay *d) { fDisplay = d; }
    102102
    103     // FIXME: Change to ostream!
     103    // FIXME: Change to ostream! Seems to be difficult, because
     104    //        MTaskListStreamPrimitive calls SavePrimitive(ofstream&).
     105    //        Maybe with a cast?
    104106    virtual void StreamPrimitive(ofstream &out) const;
    105107
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r4694 r4828  
    5151
    5252#include "MIter.h"
     53#include "MTaskList.h"
    5354
    5455ClassImp(MParList);
     
    376377    TObject *l = FindObject(tlist, "MTaskList");
    377378    return (MTask*)(l ? l->FindObject(name) : NULL);
     379}
     380
     381// --------------------------------------------------------------------------
     382//
     383//  Find a tasklist which contains a task with name name
     384//
     385MTaskList *MParList::FindTaskListWithTask(const char *name) const
     386{
     387    TIter Next(fContainer);
     388    TObject *o=0;
     389    while ((o=Next()))
     390    {
     391        MTaskList *l1 = dynamic_cast<MTaskList*>(o);
     392        if (!l1)
     393            continue;
     394
     395        MTaskList *l2 = l1->FindTaskList(name);
     396        if (l2)
     397            return l2;
     398    }
     399    return 0;
     400}
     401
     402// --------------------------------------------------------------------------
     403//
     404//  Find a tasklist which contains a task task
     405//
     406MTaskList *MParList::FindTaskListWithTask(const MTask *task) const
     407{
     408    TIter Next(fContainer);
     409    TObject *o=0;
     410    while ((o=Next()))
     411    {
     412        MTaskList *l1 = dynamic_cast<MTaskList*>(o);
     413        if (!l1)
     414            continue;
     415
     416        MTaskList *l2 = l1->FindTaskList(task);
     417        if (l2)
     418            return l2;
     419    }
     420    return 0;
    378421}
    379422
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r4694 r4828  
    2222class MLog;
    2323class MTask;
     24class MTaskList;
    2425
    2526class MParList : public MParContainer
     
    5354    void SetDisplay(MStatusDisplay *d);
    5455
    55     TObject *FindObject(const char *name) const;
    56     TObject *FindObject(const TObject *obj) const;
     56    TObject   *FindObject(const char *name) const;
     57    TObject   *FindObject(const TObject *obj) const;
    5758
    58     TObject *FindObject(const char *name, const char *classname) const;
    59     TObject *FindObject(const TObject *obj, const char *classname) const;
     59    TObject   *FindObject(const char *name, const char *classname) const;
     60    TObject   *FindObject(const TObject *obj, const char *classname) const;
    6061
    61     MTask   *FindTask(const char *name, const char *tlist="MTaskList") const;
     62    MTask     *FindTask(const char *name, const char *tlist="MTaskList") const;
     63    MTaskList *FindTaskListWithTask(const char *name) const;
     64    MTaskList *FindTaskListWithTask(const MTask *task) const;
    6265
    6366    MParContainer *FindCreateObj(const char *classname, const char *objname=NULL);
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r4601 r4828  
    229229Bool_t MTaskList::AddToListBefore(MTask *task, const MTask *where, const char *type)
    230230{
     231    if (task==this)
     232    {
     233        *fLog << warn << "WARNING - You cannot add a tasklist to itself.  This" << endl;
     234        *fLog << "          would create infinite recursions...ignored." << endl;
     235        return kFALSE;
     236
     237    }
     238
    231239    // FIXME: We agreed to put the task into list in an ordered way.
    232240    if (!CheckAddToList(task, type, where))
     
    249257Bool_t MTaskList::AddToListAfter(MTask *task, const MTask *where, const char *type)
    250258{
     259    if (task==this)
     260    {
     261        *fLog << warn << "WARNING - You cannot add a tasklist to itself.  This" << endl;
     262        *fLog << "          would create infinite recursions...ignored." << endl;
     263        return kFALSE;
     264
     265    }
     266
    251267    // FIXME: We agreed to put the task into list in an ordered way.
    252 
    253268    if (!CheckAddToList(task, type, where))
    254269        return kFALSE;
     
    270285Bool_t MTaskList::AddToList(MTask *task, const char *type)
    271286{
     287    if (task==this)
     288    {
     289        *fLog << warn << "WARNING - You cannot add a tasklist to itself.  This" << endl;
     290        *fLog << "          would create infinite recursions...ignored." << endl;
     291        return kFALSE;
     292
     293    }
     294
    272295    // FIXME: We agreed to put the task into list in an ordered way.
    273 
    274296    if (!CheckAddToList(task, type))
    275297        return kFALSE;
     
    301323{
    302324    return fTasks->FindObject(obj);
     325}
     326
     327// --------------------------------------------------------------------------
     328//
     329// find recursively a tasklist which contains a task with name task
     330//
     331MTaskList *MTaskList::FindTaskList(const char *task)
     332{
     333    if (FindObject(task))
     334        return this;
     335
     336    TIter Next(fTasks);
     337    TObject *o = 0;
     338    while ((o=Next()))
     339    {
     340        MTaskList *l = dynamic_cast<MTaskList*>(o);
     341        if (!l)
     342            continue;
     343
     344        if (l->FindObject(task))
     345            return l;
     346    }
     347    return 0;
     348}
     349
     350// --------------------------------------------------------------------------
     351//
     352// find recursively a tasklist which contains a task task
     353//
     354MTaskList *MTaskList::FindTaskList(const MTask *task)
     355{
     356    if (FindObject(task))
     357        return this;
     358
     359    TIter Next(fTasks);
     360    TObject *o = 0;
     361    while ((o=Next()))
     362    {
     363        MTaskList *l = dynamic_cast<MTaskList*>(o);
     364        if (!l)
     365            continue;
     366
     367        if (l->FindObject(task))
     368            return l;
     369    }
     370
     371    return 0;
    303372}
    304373
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r4601 r4828  
    6262        return (MTask*)FindObject(obj);
    6363    }
     64    MTaskList *FindTaskList(const char *task);
     65    MTaskList *FindTaskList(const MTask *task);
    6466
    6567    Bool_t ReInit(MParList *pList=NULL);
  • trunk/MagicSoft/Mars/mhbase/MH3.cc

    r2737 r4828  
    113113
    114114    fName  = gsDefName;
    115     fTitle = Form(gsDefTitle.Data(), 1);
     115    fTitle = Form(gsDefTitle.Data(), fDimension);
    116116
    117117    if (fHist)
     
    514514*/
    515515
     516/*
     517void MH3::Paint(Option_t *opt)
     518{
     519    if (fHist->TestBit(kIsLogx)) pad->SetLogx();
     520    if (fHist->TestBit(kIsLogy)) pad->SetLogy();
     521    if (fHist->TestBit(kIsLogz)) pad->SetLogz();
     522}
     523*/
     524
     525void MH3::Paint(Option_t *o)
     526{
     527    TString str(o);
     528
     529    // FIXME: Do it in Paint()
     530    if (str.Contains("COL", TString::kIgnoreCase))
     531        SetColors();
     532
     533    if (fHist->TestBit(kIsLogx) && fHist->GetEntries()>0) gPad->SetLogx();
     534    if (fHist->TestBit(kIsLogy) && fHist->GetEntries()>0) gPad->SetLogy();
     535    if (fHist->TestBit(kIsLogz) && fHist->GetEntries()>0) gPad->SetLogz();
     536
     537    // Set pretty color palette
     538    gStyle->SetPalette(1, 0);
     539
     540    TVirtualPad *padsave = gPad;
     541
     542    TProfile* h0;
     543    if ((h0 = (TProfile*)gPad->FindObject("_pfx")))
     544    {
     545        // Get projection for range
     546        TProfile *p = ((TH2*)fHist)->ProfileX("_pfx", -1, 9999, "s");
     547
     548        // Move contents from projection to h3
     549        h0->Reset();
     550        h0->Add(p);
     551        delete p;
     552
     553        // Set Minimum as minimum value Greater Than 0
     554        //h0->SetMinimum(GetMinimumGT(*h0));
     555    }
     556    if ((h0 = (TProfile*)gPad->FindObject("_pfy")))
     557    {
     558        // Get projection for range
     559        TProfile *p = ((TH2*)fHist)->ProfileY("_pfy", -1, 9999, "s");
     560
     561        // Move contents from projection to h3
     562        h0->Reset();
     563        h0->Add(p);
     564        delete p;
     565
     566        // Set Minimum as minimum value Greater Than 0
     567        //h0->SetMinimum(GetMinimumGT(*h0));
     568    }
     569
     570    gPad = padsave;
     571}
     572
    516573// --------------------------------------------------------------------------
    517574//
     
    534591    pad->SetBorderMode(0);
    535592
    536     AppendPad("");
     593    fHist->SetFillStyle(4000);
    537594
    538595    TString str(opt);
    539 
    540     // FIXME: Do it in Paint()
    541     if (str.Contains("COL", TString::kIgnoreCase))
    542         SetColors();
    543 
    544     fHist->SetFillStyle(4000);
    545596
    546597    Bool_t only = str.Contains("ONLY", TString::kIgnoreCase) && fDimension==2;
     
    565616    }
    566617
     618    AppendPad("");
     619/*
    567620    if (fHist->TestBit(kIsLogx)) pad->SetLogx();
    568621    if (fHist->TestBit(kIsLogy)) pad->SetLogy();
    569622    if (fHist->TestBit(kIsLogz)) pad->SetLogz();
    570 
    571     pad->Modified();
    572     pad->Update();
     623  */
     624    //pad->Modified();
     625    //pad->Update();
    573626}
    574627
  • trunk/MagicSoft/Mars/mhbase/MH3.h

    r2737 r4828  
    4141    void SetScaleZ(Double_t scale) { fScale[2] = scale; }
    4242
     43    void SetLogx(Bool_t b=kTRUE) { b ? fHist->SetBit(kIsLogx) : fHist->ResetBit(kIsLogx); }
     44    void SetLogy(Bool_t b=kTRUE) { b ? fHist->SetBit(kIsLogy) : fHist->ResetBit(kIsLogy); }
     45    void SetLogz(Bool_t b=kTRUE) { b ? fHist->SetBit(kIsLogz) : fHist->ResetBit(kIsLogz); }
     46
    4347    Int_t GetDimension() const { return fDimension; }
    4448    Int_t GetNbins() const;
     
    6165    void SetColors() const;
    6266    void Draw(Option_t *opt=NULL);
     67    void Paint(Option_t *opt="");
    6368
    6469    MParContainer *New() const;
  • trunk/MagicSoft/Mars/mhist/MHAlpha.cc

    r4826 r4828  
    4343#include <TGraph.h>
    4444#include <TStyle.h>
     45#include <TLatex.h>
    4546#include <TCanvas.h>
    46 #include <TPaveText.h>
    4747#include <TStopwatch.h>
    4848
     
    5858#include "MHMatrix.h"
    5959
     60#include "MMath.h"
    6061#include "MBinning.h"
    6162#include "MParList.h"
     
    220221    func.SetLineColor(kGreen);
    221222    func.Paint("same");
     223
     224    const Double_t w=fHist.GetXaxis()->GetBinWidth(1);
     225
     226    const Double_t s   = func.Integral(0, sigint)/w;
     227    func.SetParameter(0, 0);
     228    func.SetParameter(2, 1);
     229    const Double_t b   = func.Integral(0, sigint)/w;
     230    const Double_t sig = MMath::SignificanceLiMaSigned(s, b);
     231
     232    TLatex text;
     233    text.PaintLatex(35, fHist.GetMaximum()*1.1, 0, 0.05, Form("\\sigma=%.1f E=%d", sig, (int)(s-b)));
    222234}
    223235
  • trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc

    r4703 r4828  
    8282    fGraph = new TGraph;
    8383    fData = new MDataChain(rule);
     84
     85    fGraph->SetMarkerStyle(kFullDotMedium);
    8486}
    8587
     
    131133
    132134    fGraph->SetNameTitle(fName, title);
     135
     136    fMean = 0;
     137    fN    = 0;
    133138
    134139    return kTRUE;
     
    186191        fGraph->RemovePoint(0);
    187192
    188     fGraph->SetPoint(fGraph->GetN(), t, v);
     193    fMean += v;
     194    fN++;
     195
     196    if (fN==fNumEvents)
     197    {
     198        fGraph->SetPoint(fGraph->GetN(), t, fMean/fN);
     199        fMean = 0;
     200        fN = 0;
     201    }
    189202
    190203    return kTRUE;
  • trunk/MagicSoft/Mars/mhvstime/MHVsTime.h

    r4703 r4828  
    1313protected:
    1414    // Could be const but root < 3.02/06 doesn't like this...
    15     TGraph     *fGraph;  // Histogram to fill
    16     MDataChain *fData;   // Object from which the data is filled
    17     Double_t    fScale;  // Scale for axis (eg unit)
    18     Int_t       fMaxPts; // Maximum number of data points
     15    TGraph     *fGraph;     // Histogram to fill
     16    MDataChain *fData;      // Object from which the data is filled
     17    Double_t    fScale;     // Scale for axis (eg unit)
     18    Int_t       fMaxPts;    // Maximum number of data points
     19
     20    Int_t       fNumEvents; // Number of events to average
     21    Double_t    fMean;      //! Mean value
     22    Int_t       fN;
     23
    1924
    2025    enum {
     
    5156
    5257    void SetUseEventNumber(Bool_t use = kTRUE) { fUseEventNumber = use; }
     58    void SetNumEvents(Int_t n) { fNumEvents=n; }
    5359
    5460    void Draw(Option_t *opt=NULL);
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r4760 r4828  
    5959#include "MReadReports.h"
    6060#include "MGeomApply.h"
     61#include "MPointingPosCalc.h"
    6162#include "MPedCalcFromLoGain.h"
    6263#include "MExtractor.h"
     
    345346    write.AddContainer("MTimeTrigger",        "Trigger", kFALSE);
    346347    // Slow-Control: Drive
     348    write.AddContainer("MPointingPos",        "Drive", kFALSE);
    347349    write.AddContainer("MReportDrive",        "Drive", kFALSE);
    348350    write.AddContainer("MTimeDrive",          "Drive", kFALSE);
     
    371373    tlist2.AddToList(&fill5);
    372374
     375    // Setup List for Drive-tree
     376    MPointingPosCalc pcalc;
     377
    373378    // Now setup main tasklist
    374379    tlist.AddToList(&read);
    375380    tlist.AddToList(&tlist2, "Events");
     381    tlist.AddToList(&pcalc,  "Drive");
    376382    tlist.AddToList(&write);
    377383
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r4823 r4828  
    7373#include "MImgCleanStd.h"         // MImgCleanStd
    7474#include "MHillasCalc.h"          // MHillasCalc
    75 #include "MHillasSrcCalc.h"       // MHillasSrcCalc
     75//#include "MHillasSrcCalc.h"       // MHillasSrcCalc
    7676//#include "MBlindPixelCalc.h"      // MBlindPixelCalc
    7777#include "MArrivalTimeCalc.h"     // MArrivalTimeCalc
     
    8888#include "MHillasExt.h"            // MHillasExt::Print(const MGeomCam&)
    8989#include "MHillasSrc.h"            // MHillasSrc::Print(const MGeomCam&)
     90#include "MImagePar.h"             // MImagePar::Print(const MGeomCam&)
    9091#include "MNewImagePar.h"          // MNewImagePar::Print(const MGeomCam&)
    9192#include "MHEvent.h"               // MHEvent
     
    292293    MFillH             *fill04 = new MFillH(evt04, "MPedPhotCam", "MFillH04");
    293294    MFillH             *fill05 = new MFillH(evt05, "MCameraData", "MFillH05");
    294     MFillH             *fill06a= new MFillH(evt06a, "MCameraData", "MFillH06");
    295     MFillH             *fill06b= new MFillH(evt06b, "MCameraData", "MFillH06");
    296 //    MBlindPixelCalc   *blind = new MBlindPixelCalc;
     295    MFillH             *fill06a= new MFillH(evt06a, "MCameraData", "MFillH06a");
     296    MFillH             *fill06b= new MFillH(evt06b, "MCameraData", "MFillH06b");
     297    //MBlindPixelCalc   *blind = new MBlindPixelCalc;
    297298    MHillasCalc        *hcalc  = new MHillasCalc;
    298     MHillasSrcCalc     *scalc  = new MHillasSrcCalc;
    299299    MMcTriggerLvl2Calc *trcal  = new MMcTriggerLvl2Calc;
    300300    MFillH             *fill09 = new MFillH(evt09, "MMcTriggerLvl2", "MFillH09");
     
    362362    tlist->AddToList(fill06a);
    363363    tlist->AddToList(fill06b);
    364 //    tlist->AddToList(blind);
     364    //tlist->AddToList(blind);
     365    tlist->AddToList(fill10);
    365366    tlist->AddToList(hcalc);
    366     tlist->AddToList(scalc);
    367     tlist->AddToList(fill10);
    368 
    369367    if ((!pcam || !ccam) && type==2)
    370368    {
     
    379377        tlist->AddToList(fill09);
    380378    }
    381 
    382379    if (type==1)
    383380    {
     
    588585    ((MHillasExt*)  plist->FindObject("MHillasExt"))->Print(*geom);
    589586    ((MHillasSrc*)  plist->FindObject("MHillasSrc"))->Print(*geom);
     587    plist->FindObject("MImagePar")->Print();
    590588    ((MNewImagePar*)plist->FindObject("MNewImagePar"))->Print(*geom);
    591    
     589
    592590    //
    593591    // UpdateDisplay
     
    635633    {
    636634        TCanvas *c = GetCanvas(i);
    637         c->GetPad(1)->cd(1);
     635        c->cd(1);
    638636        hillas->Draw();
    639637    }
  • trunk/MagicSoft/Mars/msignal/MArrivalTime.cc

    r4577 r4828  
    9191    fDataErr[i] = t;
    9292}
    93      
     93
     94void MArrivalTime::Print(Option_t *o) const
     95{
     96    *fLog << all << GetDescriptor() << ":" << endl;
     97    for (int i=0; i<fData.GetSize(); i++)
     98        *fLog << fData[i] << " ";
     99    *fLog << endl;
     100}
     101
    94102// --------------------------------------------------------------------------
    95103//
  • trunk/MagicSoft/Mars/msignal/MArrivalTime.h

    r4716 r4828  
    4343    Double_t operator[](int i) const { return fData[i]; }
    4444
     45    void Print(Option_t *o="") const;
     46
    4547    // Do not do such things! It is highly dangerous to use two very similar operators
    4648    // to do completely different things! People won't recognize it...
  • trunk/MagicSoft/Mars/star.cc

    r4817 r4828  
    7272    // Evaluate arguments
    7373    //
    74     MArgs arg(argc, argv);
     74    MArgs arg(argc, argv, kFALSE);
    7575
    7676    if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help"))
Note: See TracChangeset for help on using the changeset viewer.