Changeset 2594 for trunk/MagicSoft


Ignore:
Timestamp:
12/02/03 16:25:24 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2590 r2594  
    1515
    1616   * manalysis/MEventRate.[h,cc], manalysis/MEventRateCalc.[h,cc],
    17      mfileio/MReadReports.[h,cc]:
     17     mfileio/MReadReports.[h,cc], mreport/MReport*.[h,cc],
     18     mcamera/MCamera*.[h,cc]:
    1819     - fixed and added comments.
    1920
     
    2122     - added static member functions AddDerialNumber to simplify
    2223       using different Serial numbers.
     24
     25   * macros/readrep.C:
     26     - updated to be an example for more functionality
    2327
    2428
  • trunk/MagicSoft/Mars/NEWS

    r2580 r2594  
    1717   - Added a preliminary 'synchronizer' (MReadReports) which will
    1818     replace MReadMarsFile as soon as it is finished.
     19
     20   - Added a tutorial macro demonstrating how report files are merpped
     21     and how they can be read from the root file in the correct order
     22     of time (readrep.C)
    1923
    2024   - Added a generalized histogram (similar to MH3) called MVsTime
  • trunk/MagicSoft/Mars/macros/readrep.C

    r2578 r2594  
    2323\* ======================================================================== */
    2424
     25//////////////////////////////////////////////////////////////////////////////
     26//
     27// This macro demonstrates how to read a central control report file.
     28// (rootification, see merpp, too)
     29//
     30// In a second eventloop it gives an example on how to read such a root file.
     31//
     32//////////////////////////////////////////////////////////////////////////////
     33
    2534void readrep(const char *fname="CC_2003_11_04_23_53_18.rep")
    2635{
     36    //
     37    // Read a report file and write containers into a root file
     38    //
    2739    MParList  plist;
    2840    MTaskList tlist;
     
    3244    tlist.AddToList(&read);
    3345
    34     MReportDAQ daq;
    35     MReportDrive drive;
    36     MReportCamera camera;
    37     MReportTrigger trigger;
    38     read.AddToList(&daq);
    39     read.AddToList(&drive);
    40     read.AddToList(&camera);
    41     read.AddToList(&trigger);
     46    read.AddToList("DAQ");
     47    read.AddToList("Drive");
     48    read.AddToList("Camera");
     49    read.AddToList("Trigger");
    4250
    4351    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    write.AddContainer("MReportCamera",      "Camera");
     53    write.AddContainer("MTimeCamera",        "Camera");
     54    write.AddContainer("MCameraAUX",         "Camera");
     55    write.AddContainer("MCameraCalibration", "Camera");
     56    write.AddContainer("MCameraCooling",     "Camera");
     57    write.AddContainer("MCameraHV",          "Camera");
     58    write.AddContainer("MCameraLV",          "Camera");
     59    write.AddContainer("MCameraLids",        "Camera");
     60    write.AddContainer("MReportTrigger",     "Trigger");
     61    write.AddContainer("MTimeTrigger",       "Trigger");
     62    write.AddContainer("MReportDrive",       "Drive");
     63    write.AddContainer("MTimeDrive",         "Drive");
    5264    tlist.AddToList(&write);
    5365
     
    6072    tlist.PrintStatistics();
    6173
    62     return;
    63     // ------------------------------------------
     74    // ----------------------------------------------------------------
     75    //
     76    // Read a report file and write containers into a root file
     77    //
     78    MTaskList tlist2;
     79    plist.Replace(&tlist2);
    6480
    65     MParList  plist;
    66 
    67     MTaskList tlist;
    68     plist.AddToList(&tlist);
    69 
     81    // Create a tasklist to process the read events from the Camera tree
    7082    MTaskList list1("ProcessCamera");
    7183    MPrint print1("MTimeCamera");
    7284    list1.AddToList(&print1);
    7385
    74     MTaskList list2("ProcessDAQ");
    75     MPrint print2("MTimeDAQ");
     86    // Create a tasklist to process the read events from the Drive tree
     87    MTaskList list2("ProcessDrive");
     88    MPrint print2("MTimeDrive");
    7689    list2.AddToList(&print2);
    7790
     91    // Tell the reader to read the trees Drive, Trigger and Camera
    7892    MReadReports read;
    79     read.AddTree("DAQ");
    8093    read.AddTree("Drive");
    8194    read.AddTree("Trigger");
    8295    read.AddTree("Camera");
    83     //read.AddTree("Events", "MTime");
     96    //read.AddTree("Events", "MTime"); // for later use!
    8497
     98    // Now (not earlier!) set the file to read!
    8599    read.AddFile("test.root");
    86100
     101    // First read the events
    87102    tlist.AddToList(&read);
     103    // Process the events from the Camera tree with the task list list1
    88104    tlist.AddToList(&list1, "Camera");
    89     tlist.AddToList(&list2, "DAQ");
     105    // Process the events from the Camera tree with the task list list2
     106    tlist.AddToList(&list2, "Drive");
    90107
     108    // The task lists list1 and list2 are only executed (according to
     109    // their stream id - the second argument of AddToList) if a
     110    // corresponding event was read and MReadReports has set the stream
     111    // id accoringly. MReadReports always sets the stream id to the name
     112    // of the tree from which the event was read
    91113
    92114    MEvtLoop evtloop;
    93115    evtloop.SetParList(&plist);
    94116
     117    //
     118    // Execute the eventloop which should print the time-stamps of the subsystem
     119    // events from Drive and Camera in the correct order...
     120    //
    95121    if (!evtloop.Eventloop())
    96122        return;
    97123
    98     plist.Print();
    99124    tlist.PrintStatistics();
    100125}
Note: See TracChangeset for help on using the changeset viewer.