Changeset 2594 for trunk/MagicSoft/Mars/macros
- Timestamp:
- 12/02/03 16:25:24 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/readrep.C
r2578 r2594 23 23 \* ======================================================================== */ 24 24 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 25 34 void readrep(const char *fname="CC_2003_11_04_23_53_18.rep") 26 35 { 36 // 37 // Read a report file and write containers into a root file 38 // 27 39 MParList plist; 28 40 MTaskList tlist; … … 32 44 tlist.AddToList(&read); 33 45 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"); 42 50 43 51 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"); 52 64 tlist.AddToList(&write); 53 65 … … 60 72 tlist.PrintStatistics(); 61 73 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); 64 80 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 70 82 MTaskList list1("ProcessCamera"); 71 83 MPrint print1("MTimeCamera"); 72 84 list1.AddToList(&print1); 73 85 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"); 76 89 list2.AddToList(&print2); 77 90 91 // Tell the reader to read the trees Drive, Trigger and Camera 78 92 MReadReports read; 79 read.AddTree("DAQ");80 93 read.AddTree("Drive"); 81 94 read.AddTree("Trigger"); 82 95 read.AddTree("Camera"); 83 //read.AddTree("Events", "MTime"); 96 //read.AddTree("Events", "MTime"); // for later use! 84 97 98 // Now (not earlier!) set the file to read! 85 99 read.AddFile("test.root"); 86 100 101 // First read the events 87 102 tlist.AddToList(&read); 103 // Process the events from the Camera tree with the task list list1 88 104 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"); 90 107 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 91 113 92 114 MEvtLoop evtloop; 93 115 evtloop.SetParList(&plist); 94 116 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 // 95 121 if (!evtloop.Eventloop()) 96 122 return; 97 123 98 plist.Print();99 124 tlist.PrintStatistics(); 100 125 }
Note:
See TracChangeset
for help on using the changeset viewer.