Changeset 2578 for trunk


Ignore:
Timestamp:
12/01/03 16:21:53 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/macros/readrep.C

    r2520 r2578  
    2222!
    2323\* ======================================================================== */
    24 /*
    25 Bool_t HandleInput()
    26 {
    27     TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
    28     while (1)
    29     {
    30         //
    31         // While reading the input process gui events asynchronously
    32         //
    33         timer.TurnOn();
    34         TString input = Getline("Type 'q' to exit, <return> to go on: ");
    35         timer.TurnOff();
    3624
    37         if (input=="q\n")
    38             return kFALSE;
    39 
    40         if (input=="\n")
    41             return kTRUE;
    42     };
    43 
    44     return kFALSE;
    45 }
    46 */
    4725void readrep(const char *fname="CC_2003_11_04_23_53_18.rep")
    4826{
     
    6341    read.AddToList(&trigger);
    6442
     43    MWriteRootFile write("test.root");
     44    write.AddContainer("MReportDAQ",     "DAQ");
     45    write.AddContainer("MTimeDAQ",       "DAQ");
     46    write.AddContainer("MReportDrive",   "Drive");
     47    write.AddContainer("MTimeDrive",     "Drive");
     48    write.AddContainer("MReportTrigger", "Trigger");
     49    write.AddContainer("MTimeTrigger",   "Trigger");
     50    write.AddContainer("MReportCamera",  "Camera");
     51    write.AddContainer("MTimeCamera",    "Camera");
     52    tlist.AddToList(&write);
     53
    6554    MEvtLoop evtloop;
    6655    evtloop.SetParList(&plist);
     
    7059
    7160    tlist.PrintStatistics();
     61
     62    return;
     63    // ------------------------------------------
     64
     65    MParList  plist;
     66
     67    MTaskList tlist;
     68    plist.AddToList(&tlist);
     69
     70    MTaskList list1("ProcessCamera");
     71    MPrint print1("MTimeCamera");
     72    list1.AddToList(&print1);
     73
     74    MTaskList list2("ProcessDAQ");
     75    MPrint print2("MTimeDAQ");
     76    list2.AddToList(&print2);
     77
     78    MReadReports read;
     79    read.AddTree("DAQ");
     80    read.AddTree("Drive");
     81    read.AddTree("Trigger");
     82    read.AddTree("Camera");
     83    //read.AddTree("Events", "MTime");
     84
     85    read.AddFile("test.root");
     86
     87    tlist.AddToList(&read);
     88    tlist.AddToList(&list1, "Camera");
     89    tlist.AddToList(&list2, "DAQ");
     90
     91
     92    MEvtLoop evtloop;
     93    evtloop.SetParList(&plist);
     94
     95    if (!evtloop.Eventloop())
     96        return;
     97
     98    plist.Print();
     99    tlist.PrintStatistics();
    72100}
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc

    r2566 r2578  
    21602160Bool_t MStatusDisplay::HandleEvent(Event_t *event)
    21612161{
    2162 #if ROOT_VERSION_CODE == ROOT_VERSION(3,05,07)
    2163     // Strange... crashes on the LP machines...
    2164     if (event->fType==kClientMessage)
    2165         if (event->fHandle == gROOT_MESSAGE)
    2166             if (event->fUser[0]==264 && event->fUser[1] == 0 && event->fUser[2]==0)
    2167                 return kTRUE;
    2168 #endif
    2169 
    21702162    Bool_t rc = TGMainFrame::HandleEvent(event);
    21712163
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r2557 r2578  
    105105
    106106    //
    107     // Readin foirst event and display it
     107    // Readin first event and display it
    108108    //
    109109    ReadFirstEvent();
     
    538538                // Set name for 'FADC canvas'. The name is the anchor for MHCamera.
    539539                // and clear the canvas
    540                 //
    541                 MHEvent *o = (MHEvent*)fEvtLoop->GetParList()->FindObject(GetCanvas(mp1)->GetName());
    542                 if (o)
    543                     fCanvas->SetName(Form("%p;%p;PixelContent", o->GetHist(),
    544                                           GetCanvas(mp1)->GetPad(1)));
     540                TCanvas *c = GetCanvas(mp1);
     541                if (!c)
     542                    break;
     543                MHEvent *o = (MHEvent*)fEvtLoop->GetParList()->FindObject(c->GetName());
     544                if (!o)
     545                    break;
     546                fCanvas->SetName(Form("%p;%p;PixelContent", o->GetHist(), c->GetPad(1)));
    545547            }
    546548            break;
  • trunk/MagicSoft/Mars/mmain/MOnlineDisplay.cc

    r2564 r2578  
    8989{
    9090    //
    91     // Setup Task list for hillas calculation
    92     //
    93     //SetupTaskList("Events", filename);
    94 
    95     //
    9691    // Add MOnlineDisplay GUI elements to the display
    9792    //
    98     AddUserFrame("");
     93    AddUserFrame();
    9994
    10095    //
     
    10398    // FIXME: This should be done by MStatusDisplay automatically
    10499    Resize(GetWidth(), GetHeight() + fUserFrame->GetDefaultHeight());
    105     //SetWindowName("Online Display");
     100    SetWindowName("Online Display");
    106101    MapSubwindows();
    107     //MapWindow();
    108 
    109     //
    110     // Readin foirst event and display it
    111     //
    112     //ReadFirstEvent();
    113 }
    114 
    115 // --------------------------------------------------------------------------
    116 //
    117 //  Destructor: PostProcess eventloop, delete eventloop with all containers
    118 //
    119 MOnlineDisplay::~MOnlineDisplay()
    120 {
    121     //fEvtLoop->PostProcess();
    122     //delete fEvtLoop;
    123 }
    124 
    125 // --------------------------------------------------------------------------
    126 //
    127 //  Return reading task
    128 //
    129 /*
    130 MReadTree *MOnlineDisplay::GetReader() const
    131 {
    132     MParList  *plist  = (MParList*)fEvtLoop->GetParList();
    133     MTaskList *tlist  = (MTaskList*)plist->FindObject("MTaskList");
    134     MReadTree *reader = (MReadTree*)tlist->FindObject("MRead");
    135     return reader;
    136 }
    137 
    138 // --------------------------------------------------------------------------
    139 //
    140 //  Setup Task and parameter list for hillas calculation,
    141 //  preprocess tasks and read in first event (process)
    142 //
    143 void MOnlineDisplay::SetupTaskList(const char *tname, const char *fname)
    144 {
    145     //
    146     // Setup an empty job, with a reader task only.
    147     // All tasks and parameter containers are deleted automatically
    148     // (via SetOwner())
    149     //
    150     MTaskList *tlist = new MTaskList;
    151     tlist->SetOwner();
    152 
    153     MReadMarsFile *read = new MReadMarsFile(tname, fname);
    154     read->DisableAutoScheme();
    155     tlist->AddToList(read);
    156 
    157     MGeomApply *apl = new MGeomApply;
    158     tlist->AddToList(apl);
    159 
    160     MParList *plist = new MParList;
    161     plist->SetOwner();
    162     plist->AddToList(tlist);
    163 
    164     fEvtLoop = new MEvtLoop;
    165     fEvtLoop->SetOwner();
    166     fEvtLoop->SetParList(plist);
    167 
    168     MHEvent *evt1 = new MHEvent(MHEvent::kEvtSignal);
    169     MHEvent *evt2 = new MHEvent(MHEvent::kEvtSignal);
    170     MHEvent *evt3 = new MHEvent(MHEvent::kEvtPedestal);
    171     MHEvent *evt4 = new MHEvent(MHEvent::kEvtPedestalRMS);
    172     MHEvent *evt5 = new MHEvent(MHEvent::kEvtRelativeSignal);
    173     MHEvent *evt6 = new MHEvent(MHEvent::kEvtCleaningLevels);
    174     evt1->SetName("Signal");
    175     evt2->SetName("Cleaned");
    176     evt3->SetName("Pedestal");
    177     evt4->SetName("PedRMS");
    178     evt5->SetName("Signal/PedRMS");
    179     evt6->SetName("CleanLevels");
    180     plist->AddToList(evt1);
    181     plist->AddToList(evt2);
    182     plist->AddToList(evt3);
    183     plist->AddToList(evt4);
    184     plist->AddToList(evt5);
    185     plist->AddToList(evt6);
    186 
    187     MMcPedestalCopy   *pcopy = new MMcPedestalCopy;
    188     MMcPedestalNSBAdd *pdnsb = new MMcPedestalNSBAdd;
    189     MCerPhotCalc      *ncalc = new MCerPhotCalc;
    190     MCerPhotAnal2     *nanal = new MCerPhotAnal2;
    191     MFillH            *fill1 = new MFillH(evt1, "MCerPhotEvt",  "MFillH1");
    192     MImgCleanStd      *clean = new MImgCleanStd;
    193     MFillH            *fill2 = new MFillH(evt2, "MCerPhotEvt",  "MFillH2");
    194     MFillH            *fill3 = new MFillH(evt3, "MPedestalCam", "MFillH3");
    195     MFillH            *fill4 = new MFillH(evt4, "MPedestalCam", "MFillH4");
    196     MFillH            *fill5 = new MFillH(evt5, "MCameraData",  "MFillH5");
    197     MFillH            *fill6 = new MFillH(evt6, "MCameraData",  "MFillH6");
    198     MBlindPixelCalc   *blind = new MBlindPixelCalc;
    199     MHillasCalc       *hcalc = new MHillasCalc;
    200     MHillasSrcCalc    *scalc = new MHillasSrcCalc;
    201 
    202     MFilter *f1=new MFDataMember("MRawRunHeader.fRunType", '>', 255.5);
    203     MFilter *f2=new MFDataMember("MRawRunHeader.fRunType", '<', 255.5);
    204 
    205     ncalc->SetFilter(f1);
    206     nanal->SetFilter(f2);
    207 
    208     tlist->AddToList(f1);
    209     tlist->AddToList(f2);
    210     tlist->AddToList(pcopy);
    211     tlist->AddToList(pdnsb);
    212     tlist->AddToList(ncalc);
    213     tlist->AddToList(nanal);
    214     tlist->AddToList(fill1);
    215     tlist->AddToList(clean);
    216     tlist->AddToList(fill2);
    217     tlist->AddToList(fill3);
    218     tlist->AddToList(fill4);
    219     tlist->AddToList(fill5);
    220     tlist->AddToList(fill6);
    221     tlist->AddToList(blind);
    222     tlist->AddToList(hcalc);
    223     tlist->AddToList(scalc);
    224 
    225     //
    226     // Now distribute Display to all tasks
    227     //
    228     tlist->SetDisplay(this);
    229 }
    230 */
     102}
     103
    231104// --------------------------------------------------------------------------
    232105//
     
    234107//
    235108void MOnlineDisplay::AddTopFramePart1(TGCompositeFrame *vf1)
    236 {/*
    237     //
    238     //  --- the top1 part of the window ---
    239     //
    240     TGHorizontalFrame *top1 = new TGHorizontalFrame(frame, 1, 1);
    241     fList->Add(top1);
    242 
    243     //
    244     // create gui elements
    245     //
    246     TGLabel *file = new TGLabel(top1, new TGString(Form("%s#%s", filename, treename)));
    247     fList->Add(file);
    248 
    249     //
    250     // layout and add gui elements in/to frame
    251     //
    252     TGLayoutHints *laystd = new TGLayoutHints(kLHintsCenterX, 5, 5);
    253     fList->Add(laystd);
    254 
    255     top1->AddFrame(file,  laystd);
    256 
    257     //
    258     //  --- the top1 part of the window ---
    259     //
    260     TGHorizontalFrame *top2 = new TGHorizontalFrame(frame, 1, 1);
    261     fList->Add(top2);
    262 
    263     //
    264     // layout and add frames
    265     //
    266     TGLayoutHints *laytop1 = new TGLayoutHints(kLHintsCenterX, 5, 5, 5);
    267     fList->Add(laytop1);
    268     frame->AddFrame(top1, laytop1);
    269     frame->AddFrame(top2, laytop1);*/
    270     TGLabel *file = new TGLabel(vf1, new TGString("Magic Online Display -- MONA"));
     109{
     110    TGLabel *file = new TGLabel(vf1, new TGString("Magic Online Analysis -- MONA"));
    271111    TGLayoutHints *laystd = new TGLayoutHints(kLHintsCenterX, 5, 5);
    272112    fList->Add(file);
     
    323163//  Add the user frame part of the display
    324164//
    325 void MOnlineDisplay::AddUserFrame(const char* filename)
     165void MOnlineDisplay::AddUserFrame()
    326166{
    327167    fUserFrame->ChangeOptions(kHorizontalFrame);
     
    369209}
    370210
    371 /*
    372 // --------------------------------------------------------------------------
    373 //
    374 //  Checks if the event number is valid, and if so reads the new event
    375 //  and updates the display
    376 //
    377 void MOnlineDisplay::ReadinEvent(Int_t dir)
    378 {
    379     MParList    *plist = (MParList*)fEvtLoop->GetParList();
    380     MTaskList   *tlist = (MTaskList*)plist->FindObject("MTaskList");
    381     MRawEvtData *raw = (MRawEvtData*)plist->FindObject("MRawEvtData");
    382     if (!raw)
    383         return;
    384 
    385     //
    386     // Read first event.
    387     //
    388     MReadTree *reader = GetReader();
    389 
    390     const Int_t num = reader->GetNumEntry();
    391 
    392     do
    393     {
    394         if (dir<0 && !reader->DecEventNum())
    395         {
    396             reader->SetEventNum(num);
    397             return;
    398         }
    399         if (dir>0 && !reader->IncEventNum())
    400         {
    401             reader->SetEventNum(num);
    402             return;
    403         }
    404 
    405         if (!tlist->Process())
    406             return;
    407 
    408         reader->DecEventNum();
    409 
    410     } while (raw->GetNumPixels()<1 && dir!=0);
    411 
    412     //
    413     // Cleare the 'FADC canvas'
    414     //
    415     fCanvas->Clear();
    416     fCanvas->Modified();
    417     fCanvas->Update();
    418 
    419     //
    420     // Print parameters
    421     //
    422     plist->FindObject("MHillas")->Print();
    423     plist->FindObject("MHillasExt")->Print();
    424     plist->FindObject("MHillasSrc")->Print();
    425     plist->FindObject("MNewImagePar")->Print();
    426 
    427     //
    428     // UpdateDisplay
    429     //
    430     gStyle->SetOptStat(1101);
    431     Update();
    432 
    433     TGTextEntry *entry = (TGTextEntry*)fList->FindWidget(kEvtNumber);
    434     entry->SetText(Form("%d", reader->GetNumEntry()+1));
    435 }
    436 
    437 // --------------------------------------------------------------------------
    438 //
    439 //  Read first event to get display booted
    440 //
    441 void MOnlineDisplay::ReadFirstEvent()
    442 {
    443     if (!fEvtLoop->PreProcess())
    444         return;
    445 
    446     //
    447     // Get parlist
    448     //
    449     MParList *plist = (MParList*)fEvtLoop->GetParList();
    450 
    451     //
    452     // Add Geometry tab
    453     //
    454     MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    455 
    456     TCanvas &c=AddTab("Geometry");
    457 
    458     c.SetFillColor(16);
    459 
    460     MHCamera *cam = new MHCamera(*geom);
    461     cam->SetBit(TH1::kNoStats|MHCamera::kNoLegend);
    462     cam->Draw();
    463     cam->DrawPixelIndices();
    464     fList->Add(cam);
    465 
    466     c.Modified();
    467     c.Update();
    468 
    469     //
    470     // Now read event...
    471     //
    472     ReadinEvent();
    473 
    474     TGString *txt = new TGString(Form("of %d", GetReader()->GetEntries()));
    475     fNumOfEvts->SetText(txt);
    476 
    477     //
    478     // Set name for 'FADC canvas'. The name is the anchor for MHCamera.
    479     // and clear the canvas
    480     //
    481     MHEvent *o = (MHEvent*)plist->FindObject("Signal");
    482     fCanvas->SetName(Form("%p;%p;PixelContent", o->GetHist(),
    483                           GetCanvas(1)->GetPad(1)));
    484 
    485     //
    486     // Draw ellipse on top of all pads
    487     //
    488     TObject *hillas = plist->FindObject("MHillas");
    489     for (int i=1; i<7;i++)
    490     {
    491         TCanvas *c = GetCanvas(i);
    492         c->GetPad(1)->cd(1);
    493         hillas->Draw();
    494     }
    495 }
    496 */
    497 // --------------------------------------------------------------------------
    498 //
    499 //  Adds the geometry tab
    500 //
    501 void MOnlineDisplay::AddGeometryTab()
    502 {
    503     /*
    504     MGeomCam *geom = (MGeomCam*)fEvtLoop->GetParList()->FindObject("MGeomCam");
    505     if (!geom)
    506         return;
    507 
    508     TCanvas &c=AddTab("Geometry");
    509 
    510     MHCamera *cam = new MHCamera(*geom);
    511     cam->SetBit(TH1::kNoStats);
    512     cam->Draw();
    513     cam->DrawPixelIndices();
    514     fList->Add(cam);
    515 
    516     c.Modified();
    517     c.Update();
    518     */
    519 }
    520 
    521211// --------------------------------------------------------------------------
    522212//
  • trunk/MagicSoft/Mars/mmain/MOnlineDisplay.h

    r2564 r2578  
    2929    TGCompositeFrame *fTab2;
    3030
    31     //TGLabel  *fNumOfEvts;
    32     TCanvas  *fCanvas;
    33     //MEvtLoop *fEvtLoop;
     31    TCanvas *fCanvas;
    3432
    3533    MGTask *fTask;
     
    3735    void AddTopFramePart1(TGCompositeFrame *frame);
    3836    void AddTopFramePart2(TGCompositeFrame *frame);
    39     void AddGeometryTab();
    40     void AddUserFrame(const char *filename);
     37    void AddUserFrame();
    4138
    4239    void UpdateDisplay();
    43     //void SetupTaskList(const char *tname, const char *fname);
    44 
    45     //void ReadFirstEvent();
    46     //void ReadinEvent(Int_t dir=0);
    47 
    48     //MReadTree *GetReader() const;
    4940
    5041    Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
     
    5243public:
    5344    MOnlineDisplay();
    54     ~MOnlineDisplay();
    5545
    5646    void SetTask(MGTask *t) { fTask=t; }
  • trunk/MagicSoft/Mars/mmain/MOnlineDump.cc

    r2576 r2578  
    1818#include "MHEvent.h"
    1919#include "MHCamera.h"
     20#include "MHCamEvent.h"
    2021#include "MParList.h"
    2122#include "MTaskList.h"
     
    164165        return kFALSE;
    165166    }
     167
     168    MHCamEvent *idxhi = (MHCamEvent*)pList->FindObject("MaxIdxHi");
     169    MHCamEvent *idxlo = (MHCamEvent*)pList->FindObject("MaxIdxLo");
     170    if (!idxhi || !idxlo)
     171    {
     172        *fLog << err << "MaxIdxHi or MaxIdxLo not found... abort." << endl;
     173        return kFALSE;
     174    }
     175
     176    idxhi->GetHistByName("sum")->SetMinimum(0);
     177    idxlo->GetHistByName("sum")->SetMinimum(0);
     178    idxhi->GetHistByName("sum")->SetMaximum(15);
     179    idxlo->GetHistByName("sum")->SetMaximum(15);
     180
     181
    166182    fRawEvtHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
    167183    if (!fRawEvtHeader)
     
    175191    {
    176192        *fLog << err << "MRawRunHeader not found... abort." << endl;
    177         return kFALSE;;
     193        return kFALSE;
    178194    }
    179195
     
    223239{
    224240    if (fDisplay)
     241    {
    225242        fDisplay->SetProgressBarPosition(1);
     243        //fDisplay->Reset();
     244    }
    226245
    227246    return kTRUE;
  • trunk/MagicSoft/Mars/mona.cc

    r2564 r2578  
    135135    tasks.AddToList(&fill3);
    136136
    137     MOnlineDump dump;
    138     dump.SetFilter(&filter);
    139     display->SetTask(&dump);
    140     tasks.AddToList(&dump);
    141 
    142137    MHCamEvent hist("PedestalRms");
    143138    hist.SetType(1);
     
    155150    // -------------------------------------------
    156151
    157     MFillH hfilla("MaxIdxHi", "MRawEvtData");
    158     MFillH hfillb("MaxIdxLo", "MRawEvtData");
    159     MFillH hfillc("Pedestals [MHCamEvent]", "MPedestalCam");
    160     MFillH hfilld("PedestalRms", "MPedestalCam");
     152    MFillH hfilla("MaxIdxHi", "MRawEvtData", "FillMaxIdxHi");
     153    MFillH hfillb("MaxIdxLo", "MRawEvtData", "FillMaxIdxLo");
     154    MFillH hfillc("Pedestals [MHCamEvent]", "MPedestalCam", "FillPedestal");
     155    MFillH hfilld("PedestalRms", "MPedestalCam", "FillPedestalRms");
    161156    tasks.AddToList(&hfilla);
    162157    tasks.AddToList(&hfillb);
    163158    tasks.AddToList(&hfillc);
    164159    tasks.AddToList(&hfilld);
     160
     161    MOnlineDump dump;
     162    dump.SetFilter(&filter);
     163    display->SetTask(&dump);
     164    tasks.AddToList(&dump);
     165
    165166
    166167    MImgCleanStd      clean;
  • trunk/MagicSoft/Mars/mtemp/MObservatory.cc

    r1954 r2578  
    6161    {
    6262    case kMagic1:
    63         // Values taken from the GPS Receiver positined in
    64         // the CT1 control room
    65         fLatitude  = Dms2Rad( 28, 45, 42.564);
    66         fLongitude = Dms2Rad(-17, 53, 27.426);
    67         fHeight    = 2198.7; // m
     63        // Values taken from the GPS Receiver (avg 20h)
     64        // on 26/11/2003 at 17h30 in the counting house
     65        fLatitude  = Dms2Rad( 28, 45, 42.576);
     66        fLongitude = Dms2Rad(-17, 53, 26.460);
     67        fHeight    = 2196.5; // m
    6868        fObservatoryName = "Observatorio del Roque de los Muchachos (Magic1)";
    6969        return;
Note: See TracChangeset for help on using the changeset viewer.