Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

RawBeamData.cxx

Go to the documentation of this file.
00001 #include "RawBeamData.h"
00002 
00003 using namespace std;
00004 
00005 RawBeamData::RawBeamData()
00006     : fName(8u,' '), fNdata(0), fData(0)
00007 {
00008 
00009 }
00010 
00011 static string unpad(string s)
00012 {
00013     string out="";
00014     for (size_t ind=0; ind<8 && ind<s.size(); ++ind) { 
00015         char c = s[ind];
00016         if (c == '[') break;
00017         if (c == ' ') break;
00018         out.push_back(c);
00019     }
00020     return out;
00021 }
00022 
00023 RawBeamData::RawBeamData(const int* data_chunk)
00024     : fName(8u,' '), fNdata(0), fData(0)
00025 {
00026     if (!data_chunk) {
00027         fData=0;
00028         return;
00029     }
00030 
00031 
00032     // The data_chunk should look like:
00033     // ------------------
00034     // 0: ACNET name part 1
00035     // 1: ACNET name part 2
00036     // 2: second timestamp
00037     // 3: msec timestamp
00038     // 4: N = number of ints in the rest of the block
00039     // 5: value 0 first 32 bits of double
00040     // 6: value 0 second 32 bits of double
00041     // 7: value 1 first 32 bits of double
00042     // 8: value 1 second 32 bits of double
00043     //    ...
00044     // N+3: value N/2-1 first 32 bits of double
00045     // N+4: value N/2-1 second 32 bits of double
00046     // ------------------
00047 
00048     int w1 = data_chunk[0];
00049     fName[0] = w1>>24;
00050     fName[1] = (w1>>16)&0xff;
00051     fName[2] = (w1>>8)&0xff;
00052     fName[3] = w1&0xff;
00053     int w2 = data_chunk[1];
00054     fName[4] = w2>>24;
00055     fName[5] = (w2>>16)&0xff;
00056     fName[6] = (w2>>8)&0xff;
00057     fName[7] = w2&0xff;
00058 
00059     fName = unpad(fName);
00060 
00061     fSeconds = data_chunk[2];
00062     fMsecs = data_chunk[3];
00063 
00064     fNdata = data_chunk[4];
00065     fData = data_chunk+5;
00066 }
00067 
00068 string RawBeamData::GetName() const
00069 {
00070     return fName;
00071 }
00072 
00073 int RawBeamData::GetSeconds() const
00074 {
00075     return fSeconds;
00076 }
00077 
00078 int RawBeamData::GetMsecs() const
00079 {
00080     return fMsecs;
00081 }
00082 
00083 
00084 ClassImp(RawBeamData)

Generated on Sat Nov 7 01:27:16 2009 for loon by  doxygen 1.3.9.1