#include <iostream>#include "MippIo/MippIoFile.h"#include "MippIo/MippIoBlock.h"#include "MippIo/MippIoFileHeader.h"#include "MippIo/MippIoEvent.h"#include "MippIo/MippIoEOFBlock.h"#include "MippIo/MippIoEventHeader.h"#include "MippIo/MippIoMDDBlock.h"#include "MippIo/MippIoStatsBlock.h"Go to the source code of this file.
Functions | |
| static void | gsDumpFileHeader (const MippIoFileHeader *h) |
| static void | gsDumpSpills (const MippIoEvent *evt) |
| static void | gsDumpEOF (const MippIoEOFBlock *eof) |
| static void | gsDumpEvent (const MippIoEvent *evt) |
| static void | gsRawDump (const char *filename) |
| int | main (int argc, char **argv) |
Variables | |
| std::ostream & | os = std::cout |
| static void gsDumpEOF | ( | const MippIoEOFBlock * | eof | ) | [static] |
Definition at line 98 of file aemspillmipp.cc.
References os.
Referenced by gsRawDump().
00099 { 00100 os << 00101 "*" << 00102 "** File closed" << 00103 " on " << eof->Data().fDateClosed << 00104 " size = " << eof->Data().fFileSize << " bytes" << 00105 " nEvents = " << eof->Data().fNevents << std::endl << 00106 "************************************" << 00107 "************************************" << std::endl; 00108 }
| static void gsDumpEvent | ( | const MippIoEvent * | evt | ) | [static] |
Definition at line 112 of file aemspillmipp.cc.
References gsDumpSpills().
Referenced by gsRawDump().
00113 { 00114 gsDumpSpills(evt); 00115 }
| static void gsDumpFileHeader | ( | const MippIoFileHeader * | h | ) | [static] |
Definition at line 21 of file aemspillmipp.cc.
References os.
Referenced by gsRawDump().
00022 { 00023 os << 00024 "************************************" 00025 "************************************" << std::endl; 00026 os << "* Run: " << h->Data().fRunNumber << 00027 "." << h->Data().fSubRunNumber << std::endl << 00028 "* Run type: " << MippIo::GetRunTypeName(h->GetRunType()); 00029 time_t t = h->Data().fCreationDate; 00030 os << "\n* Date opened: " << ctime(&t) << 00031 "* Beam momentum: " << h->GetMomentum() << 00032 "\n* Enabled triggers:"; 00033 for (int i = 0; i < 16; ++i) 00034 if(h->IsTrigOn(i)) std::cout << " " << i; 00035 os << "\n* File size: " << h->Data().fFileSize << 00036 "\n* Number of events: " << h->Data().fNevents << std::endl << 00037 "* Run Comment: " << h->Data().fRunComment << std::endl << 00038 "* End of Run Comment: " << h->Data().fEndRunComment << 00039 "\n*"; 00040 00041 for (int i = 0; i < MippIoFileHeader::fsNTrigBit; ++i) { 00042 os << "\n* Trigger " << i << ": " << h->GetTrigCfg(i).fName 00043 << ", prescale: " << h->GetTrigCfg(i).fPrescale; 00044 } 00045 os << "\n*"; 00046 for (int i = 0; i < MippIoFileHeader::fsNTrigInput; ++i) { 00047 os << "\n* Trigger input " << i << ": " << h->GetTrigInputName(i); 00048 } 00049 00050 os << "\n*****" << std::endl; 00051 }
| static void gsDumpSpills | ( | const MippIoEvent * | evt | ) | [static] |
Definition at line 55 of file aemspillmipp.cc.
References os.
Referenced by gsDumpEvent().
00056 { 00057 //====================================================================== 00058 // Dump Spill data from MDD block 00059 //====================================================================== 00060 00061 static int fNTrigInSpill = 0; 00062 00063 //Skip inter-spill calibration events 00064 const MippIoStatsBlock* stBlk = 00065 evt->Block<MippIoStatsBlock>(MippIoBlock::kStatsId); 00066 bool calibEvent = false; 00067 if (stBlk) { 00068 const MippIoStat104* st = 00069 dynamic_cast<const MippIoStat104*>(stBlk->GetStat()); 00070 if (st) { 00071 if (!st->fLatch.empty()) { 00072 if (st->fLatch[0] & 0x2000) calibEvent = true; 00073 } 00074 } 00075 } 00076 if (calibEvent) return; 00077 00078 //Count In-spill triggers for each spill 00079 const MippIoMDDBlock* mddb = 00080 evt->Block<MippIoMDDBlock>(MippIoBlock::kBeamPPCId); 00081 if (mddb) { 00082 const MippIoMDDBlock::Data_t& mddData = mddb->Data(); 00083 00084 if (mddData.fIRQ == 3) { 00085 os << fNTrigInSpill << " events_at " << mddData.fSec << std::endl; 00086 fNTrigInSpill = 0; 00087 } 00088 else { 00089 fNTrigInSpill++; 00090 } 00091 00092 } // valid mdd block 00093 }
| static void gsRawDump | ( | const char * | filename | ) | [static] |
Definition at line 119 of file aemspillmipp.cc.
References f, gsDumpEOF(), gsDumpEvent(), and gsDumpFileHeader().
Referenced by main().
00120 { 00121 MippIoFile f(MippIoFile::kReadable); 00122 00123 f.Open(filename); 00124 00125 const MippIoBlock* b = 0; 00126 bool eof = false; 00127 while (1) { 00128 b = f.ReadBlock(); 00129 if (b<=0) { 00130 std::cerr << "rawdump: ReadBlock failed..." << std::endl; 00131 break; 00132 } 00133 switch (b->Prefix().fId) { 00134 case MippIoBlock::kFileHeaderId: 00135 gsDumpFileHeader((const MippIoFileHeader*)b); 00136 break; 00137 case MippIoBlock::kEventId: 00138 gsDumpEvent((const MippIoEvent*)b); 00139 break; 00140 case MippIoBlock::kEOFId: 00141 gsDumpEOF((const MippIoEOFBlock*)b); 00142 eof=true; 00143 break; 00144 default: 00145 std::cerr << "rawdump: Bad block. prefix=" 00146 << (void*)b->Prefix().fId << " " 00147 << (void*)b->Prefix().fVersion << " " 00148 << (void*)b->Prefix().fBlockSize << " " 00149 << std::endl; 00150 } 00151 if (eof) break; 00152 } 00153 f.Close(); 00154 }
| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 158 of file aemspillmipp.cc.
References gsRawDump().
00159 { 00160 for (int i=1; i<argc; ++i) { 00161 gsRawDump(argv[i]); 00162 } 00163 return 1; 00164 }
| std::ostream& os = std::cout |
Definition at line 19 of file aemspillmipp.cc.
Referenced by CfgConfig::EditOK(), CfgParam::Get(), gsDumpEOF(), gsDumpFileHeader(), gsDumpSpills(), HyperVector::info(), main(), CfgConfig::operator()(), operator<<(), and CfgConfig::Param().
1.4.7