///////////////////////////////////////////////////////////////////////////// // // MRawRunHeader // // Root storage container for the RUN HEADER information // //////////////////////////////////////////////////////////////////////////// #include "MRawRunHeader.h" #include #include #include "MLog.h" #include "MArrayS.h" ClassImp(MRawRunHeader) MRawRunHeader::MRawRunHeader(const char *name, const char *title) : fPixAssignment(NULL) { *fName = name ? name : "MRawRunHeader"; *fTitle = title ? title : "Raw Run Header Information"; fPixAssignment = new MArrayS(0); // This is only valid for root > 3.0 // IsA()->CanIgnoreTObjectStreamer(); } MRawRunHeader::~MRawRunHeader() { delete fPixAssignment; } void MRawRunHeader::ReadEvt(ifstream& fin) { // // read one RUN HEADER from the input stream // fin.read((Byte_t*)&fMagicNumber, 2); // // check whether the the file has the right file type or not // if (fMagicNumber != kMagicNumber) { *fLog << "Error: Wrong Magic Number: Not a Magic File!" << endl; return; } Byte_t dummy[16]; fin.read((Byte_t*)&fFormatVersion, 2); fin.read((Byte_t*)&fSoftVersion, 2); fin.read((Byte_t*)&fRunType, 2); fin.read((Byte_t*)&fRunNumber, 4); fin.read((Byte_t*)&fProjectName, 22); fin.read((Byte_t*)&fSourceName, 12); fin.read((Byte_t*)dummy, 4); // was RA fin.read((Byte_t*)dummy, 4); // was DEC fin.read((Byte_t*)&fSourceEpochChar, 2); fin.read((Byte_t*)&fSourceEpochDate, 2); fin.read((Byte_t*)&fMJD, 4); fin.read((Byte_t*)&fDateYear, 2); fin.read((Byte_t*)&fDateMonth, 2); fin.read((Byte_t*)&fDateDay, 2); fin.read((Byte_t*)&fNumCrates, 2); fin.read((Byte_t*)&fNumPixInCrate, 2); fin.read((Byte_t*)&fNumSamplesLoGain, 2); fin.read((Byte_t*)&fNumSamplesHiGain, 2); fin.read((Byte_t*)&fNumEvents, 4); // // calculate size of array, create it and fill it // Int_t nPixel = fNumCrates*fNumPixInCrate; fPixAssignment->Set(nPixel); fin.read((Byte_t*)fPixAssignment->GetArray(), nPixel*2); fin.read((Byte_t*)&dummy, 16); } void MRawRunHeader::Print(Option_t *t) { // // print run header information on screen // *fLog << "MagicNumber: 0x" << hex << fMagicNumber << " - " << (fMagicNumber==0xc0c0?"OK":"Wrong!") << endl; *fLog << "Version: " << dec << "Format=" << fFormatVersion << " "; *fLog << "Software=" << fSoftVersion << endl; *fLog << "RunNumber: " << fRunNumber << " (Type="; switch (fRunType) { case 0: *fLog << "Data"; break; case 1: *fLog << "Pedestal"; break; case 2: *fLog << "Calibration"; break; } *fLog << ")" << endl; *fLog << "ProjectName: '" << fProjectName << "'" << endl; *fLog << "Source: '" << fSourceName << "' " << " "; *fLog << fSourceEpochChar << dec << fSourceEpochDate << endl; *fLog << "Date: " << setprecision(1) << setiosflags(ios::fixed) << fMJD << " (MJD) " << fDateYear << "/" << fDateMonth << "/" << fDateDay << endl; *fLog << "Crates: " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl; *fLog << "Samples: " << fNumSamplesLoGain << "/" << fNumSamplesHiGain << " (lo/hi) = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate /1024 << "kB/Evt" << endl; *fLog << "Evt Counter: " << fNumEvents << endl; *fLog << hex; for (int i=0; iGetSize(); }