#include "SpillTimeCreateKeyFile.h"#include "SpillTimeRecord.h"#include "MessageService/MsgService.h"#include "Persistency/Per.h"#include "Persistency/PerOutputStreamManager.h"#include "Persistency/PerOutputStream.h"#include "MinosObjectMap/MomNavigator.h"#include "Conventions/Munits.h"Go to the source code of this file.
Functions | |
| CVSID (" $Id: SpillTimeCreateKeyFile.cxx,v 1.1 2005/05/20 17:46:32 tagg Exp $ ") | |
| int | SpillTimeCreateKeyFile (const char *filename, int task, VldTimeStamp start, VldTimeStamp stop) |
|
||||||||||||
|
|
|
||||||||||||||||||||
|
Function to create a Loon file that contains only some very bare-bones records. These can then be used with the Input Per::kWindow method to read in events around these spills. Definition at line 12 of file SpillTimeCreateKeyFile.cxx. References MomNavigator::AdoptFragment(), VldContext::AsString(), VldTimeStamp::AsString(), MomNavigator::Clear(), PerStreamManager::CloseFile(), PerStreamManager::CloseStream(), done(), SpillTimeFinder::GetLastQueryRangeEnd(), VldTimeStamp::GetSec(), SpillTimeFinder::GetTimeOfNextSpill(), VldContext::GetTimeStamp(), MSG, PerOutputStreamManager::OpenStream(), PerOutputStreamManager::Put(), CfgPromptConfigurable::Set(), PerStreamManager::SetFile(), and PerOutputStreamManager::Write(). 00018 {
00019
00020
00021 PerOutputStreamManager perOutputStreamManager;
00022
00023 PerOutputStream* outstream =
00024 perOutputStreamManager.OpenStream("BeamMon","BeamMon",
00025 "SpillTimeRecord","","",Per::kRecSplit);
00026 if(!outstream) {
00027 MSG("SpillTime",Msg::kError) << "OpenStream failed!" << endl;
00028 return 1;
00029 }
00030
00031 bool open_ok = perOutputStreamManager.SetFile("BeamMon",filename,Per::kRecreate);
00032 if(!open_ok) {
00033 MSG("SpillTime",Msg::kError) << "SetFile failed!" << endl;
00034 return 1;
00035 }
00036
00037 // Start with the first one in VTM table:
00038 SpillTimeFinder stf;
00039 stf.Set("Task",task);
00040 VldTimeStamp ts1 = start;
00041 VldContext context(Detector::kFar,SimFlag::kData,ts1);
00042 MomNavigator mom;
00043
00044 bool done = false;
00045 do {
00046 // Get the next spill time.
00047 ts1 = stf.GetTimeOfNextSpill(context);
00048
00049 while(ts1.GetSec()==0) { // Invalid query.
00050 VldTimeStamp jumptime = stf.GetLastQueryRangeEnd();
00051 if(jumptime == context.GetTimeStamp()) {
00052 // That's it.. we're done.
00053 done = true;
00054 break;
00055 }
00056 if(jumptime > stop){
00057 done=true;
00058 break;
00059 }
00060 context = VldContext(Detector::kFar,SimFlag::kData,jumptime);
00061 MSG("SpillTime",Msg::kInfo) << "Found no spills.. skipping to " << context.AsString() << endl;
00062 ts1 = stf.GetTimeOfNextSpill(context);
00063 }
00064
00065 if(ts1>stop) done= true;
00066
00067 if(!done) {
00068
00069 MSG("SpillTime",Msg::kDebug) << ts1.AsString() << endl;
00070 // Rebuild the context for this.
00071 context = VldContext(Detector::kFar,SimFlag::kData,ts1);
00072
00073 // Create the record.
00074 mom.Clear();
00075 RecHeader* header = new RecHeader(context);
00076 SpillTimeRecord* record = new SpillTimeRecord(*header);
00077 mom.AdoptFragment(record);
00078 perOutputStreamManager.Put(&mom);
00079
00080 }
00081 } while(!done); //(ts1 > VldTimeStamp(1990,1,1,0,0,0,0,0)) && (ts1<stop));
00082
00083 perOutputStreamManager.Write(); // write the trees on all streams to file
00084 perOutputStreamManager.CloseFile(); // close files on all streams
00085 perOutputStreamManager.CloseStream();
00086
00087
00088
00089 return 0;
00090 }
|
1.3.9.1