Changeset 2636 for trunk/MagicSoft/Mars
- Timestamp:
- 12/11/03 11:48:32 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2632 r2636 4 4 5 5 -*-*- END OF LINE -*-*- 6 2003/12/11: Thomas Bretz 7 8 * mbase/MTime.[h,cc]: 9 - small change to GetString 10 - added ReadBinary 11 12 * mraw/MRawCrateData.[h,c], mraw/MRawFileRead.[h,cc], 13 mraw/MRawRunHeader.[h,cc], mraw/MRawSocketRead.cc: 14 - adapted to new DAQ file format Version 2 15 - changed ClassDef version accordingly 16 17 18 6 19 2003/12/10: Thomas Bretz 7 20 … … 30 43 - replaced non working ReadLine by ReadToDelim (reason unknown!) 31 44 - added SetHasNoHeader and kHasNoHeader 45 46 * macros/readcurrents.C: 47 - fixed accordingly 48 49 * macros/sumcurrents.C: 50 - fixed accordingly 32 51 33 52 -
trunk/MagicSoft/Mars/mbase/MTime.cc
r2619 r2636 239 239 GetTime(h, m, s, ms); 240 240 241 return TString(Form("%2d/%02d/%02d % d:%02d:%02d.%03d", y, mon, d, h, m, s, ms));241 return TString(Form("%2d/%02d/%02d %02d:%02d:%02d.%03d", y, mon, d, h, m, s, ms)); 242 242 } 243 243 … … 273 273 *fLog << GetString() << Form(" (+%dns)", fNanoSec) << endl; 274 274 } 275 276 istream &MTime::ReadBinary(istream &fin) 277 { 278 UShort_t y; 279 Byte_t mon, d, h, m, s; 280 281 fin.read((char*)&y, 2); 282 fin.read((char*)&mon, 1); 283 fin.read((char*)&d, 1); 284 fin.read((char*)&h, 1); 285 fin.read((char*)&m, 1); 286 fin.read((char*)&s, 1); // Total=7 287 288 Set(y, mon, d, h, m, s, 0); 289 290 return fin; 291 } -
trunk/MagicSoft/Mars/mbase/MTime.h
r2617 r2636 12 12 #ifndef MARS_MParContainer 13 13 #include "MParContainer.h" 14 #endif 15 16 #ifndef _CPP_IOSFWD 17 #include <iosfwd> 14 18 #endif 15 19 … … 95 99 UInt_t Sec() const { Byte_t h, m, s; GetTime(h,m,s); return s; } 96 100 101 istream &ReadBinary(istream &fin); 102 97 103 operator double() const //[s] 98 104 { -
trunk/MagicSoft/Mars/mraw/MRawCrateArray.cc
r2607 r2636 122 122 return &fArray; 123 123 } 124 -
trunk/MagicSoft/Mars/mraw/MRawCrateData.cc
r2173 r2636 45 45 using namespace std; 46 46 47 MRawCrateData::MRawCrateData() : fDAQCrateNumber(0), fFADCEvtNumber(0), fFADCClockTick(0) 47 MRawCrateData::MRawCrateData() : fDAQCrateNumber(0), fFADCEvtNumber(0), fFADCClockTick(0), fABFlags(0) 48 48 { 49 49 } … … 54 54 // like specified in a TDAS note 55 55 // 56 void MRawCrateData::ReadEvt(istream& fin )56 void MRawCrateData::ReadEvt(istream& fin, UShort_t ver) 57 57 { 58 58 fin.read((char*)&fDAQCrateNumber, 2); 59 59 fin.read((char*)&fFADCEvtNumber, 4); 60 60 fin.read((char*)&fFADCClockTick, 4); 61 if (ver>1) 62 fin.read((char*)&fABFlags, 1); 61 63 } 62 64 … … 68 70 { 69 71 *fLog << all; 70 *fLog << "Crate Number " << fDAQCrateNumber << ": "; 71 *fLog << "FADCEventNr=" << fFADCEvtNumber << " "; 72 *fLog << "FADCClockTick=" << fFADCClockTick << " (20MHz)" << endl; 72 *fLog << "Crate Number " << dec << fDAQCrateNumber << ": "; 73 *fLog << "FADCEventNr = " << fFADCEvtNumber << " "; 74 *fLog << "FADCClockTick = " << fFADCClockTick << " (20MHz)" << endl; 75 *fLog << "ABFlags = " << hex << fABFlags << " (20MHz)" << endl; 73 76 } -
trunk/MagicSoft/Mars/mraw/MRawCrateData.h
r2173 r2636 16 16 UInt_t fFADCEvtNumber; // event number from the fadc 17 17 UInt_t fFADCClockTick; // clock tick from the fadc (20MHz) 18 Byte_t fABFlags; // flag describing in which two-slice block the trigger was raised 18 19 19 20 public: … … 26 27 void Print(Option_t *t=NULL) const; 27 28 28 void ReadEvt(istream& fin );29 void ReadEvt(istream& fin, UShort_t ver); 29 30 30 ClassDef(MRawCrateData, 1) //Container to store the Raw CRATE DATA31 ClassDef(MRawCrateData, 2) //Container to store the Raw CRATE DATA 31 32 }; 32 33 -
trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
r2632 r2636 218 218 219 219 // 220 // Get file format version 221 // 222 const UShort_t ver = fRawRunHeader->GetFormatVersion(); 223 224 // 220 225 // read the CRATE DATA (see specification) from file 221 226 // 222 227 for (int i=0; i<nc; i++) 223 228 { 224 fRawCrateArray->GetEntry(i)->ReadEvt(*fIn );229 fRawCrateArray->GetEntry(i)->ReadEvt(*fIn, ver); 225 230 if (!*fIn) 226 231 return kFALSE; … … 246 251 247 252 // Create an artificial time stamp! 248 UInt_t m 253 UInt_t m = (Byte_t)fmod(t/60e6, 60); 249 254 //const Byte_t h = (Byte_t)(t/3600e6); 250 255 m += fRawRunHeader->GetRunNumber()*10; 251 256 m %= 360; // 6h 252 257 253 fRawEvtTime->Set(fRawRunHeader->Get DateYear(),254 fRawRunHeader->Get DateMonth(),255 fRawRunHeader->Get DateDay(),258 fRawEvtTime->Set(fRawRunHeader->GetRunStart().Year(), 259 fRawRunHeader->GetRunStart().Month(), 260 fRawRunHeader->GetRunStart().Day(), 256 261 m/60, m%60, s, ms, ns); 257 262 } -
trunk/MagicSoft/Mars/mraw/MRawFileRead.h
r2207 r2636 33 33 Int_t PostProcess(); 34 34 35 36 35 public: 37 36 MRawFileRead(const char *filename, const char *name=NULL, const char *title=NULL); -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r2386 r2636 29 29 // Root storage container for the RUN HEADER information 30 30 // 31 // 32 // 33 // Version 2: 34 // ---------- 35 // - removed fMJD, fYear, fMonth, fDay 36 // - added fRunStart 37 // - added fRunStop 38 // 39 // Version 1: 40 // ---------- 41 // - first implementation 42 // 31 43 //////////////////////////////////////////////////////////////////////////// 32 44 … … 65 77 fSourceEpochChar[0]=0; 66 78 fSourceEpochDate=0; 67 fMJD=0;68 fDateYear=0;69 fDateMonth=0;70 fDateDay=0;71 79 fNumCrates=0; 72 80 fNumPixInCrate=0; … … 113 121 114 122 fin.read((char*)&fFormatVersion, 2); // Total=4 123 if (fFormatVersion>2) 124 *fLog << warn << "WARNING - Format version V" << fFormatVersion << " unknown!" << endl; 125 115 126 fin.read((char*)&fSoftVersion, 2); // Total=6 116 127 fin.read((char*)&fRunType, 2); // Total=8 … … 122 133 fin.read((char*)&fSourceEpochChar, 2); // Total=56 123 134 fin.read((char*)&fSourceEpochDate, 2); // Total=58 124 fin.read((char*)&fMJD, 4); // Total=62 125 fin.read((char*)&fDateYear, 2); // Total=64 126 fin.read((char*)&fDateMonth, 2); // Total=66 127 fin.read((char*)&fDateDay, 2); // Total=68 135 if (fFormatVersion<2) 136 { 137 UShort_t y, m, d; 138 fin.read((char*)dummy, 4); // Former fMJD[4], 139 fin.read((char*)&y, 2); // Former fDateYear[2] 140 fin.read((char*)&m, 2); // Former fDateMonth[2] 141 fin.read((char*)&d, 2); // Former fDateDay[2] 142 fRunStart.Set(y, m, d, 0, 0, 0, 0); 143 } 128 144 fin.read((char*)&fNumCrates, 2); // Total=70 129 145 fin.read((char*)&fNumPixInCrate, 2); // Total=72 … … 131 147 fin.read((char*)&fNumSamplesHiGain, 2); // Total=76 132 148 fin.read((char*)&fNumEvents, 4); // Total=80 133 149 if (fFormatVersion>1) 150 { 151 fRunStart.ReadBinary(fin); 152 fRunStop.ReadBinary(fin); 153 } 134 154 135 155 // … … 175 195 *fLog << "Monte Carlo Data"; 176 196 break; 197 default: 198 *fLog << "<unknown>"; 199 break; 177 200 } 178 201 *fLog << ")" << endl; … … 180 203 *fLog << "Source: '" << fSourceName << "' " << " "; 181 204 *fLog << fSourceEpochChar << dec << fSourceEpochDate << endl; 182 *fLog << "Date: " << setprecision(1) << setiosflags(ios::fixed) << fMJD << " (MJD) " << fDateYear << "/" << fDateMonth << "/" << fDateDay << endl; 205 *fLog << "Run Start: " << fRunStart << endl; 206 *fLog << "Run Stop: " << fRunStop << endl; 183 207 *fLog << "Crates: " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl; 184 208 *fLog << "Samples: " << fNumSamplesLoGain << "/" << fNumSamplesHiGain << " (lo/hi) = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate /1024 << "kB/Evt" << endl; -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r2521 r2636 7 7 /////////////////////////////////////////////////////////////////////// 8 8 9 #ifndef MARS_M ParContainer10 #include "M ParContainer.h"9 #ifndef MARS_MTime 10 #include "MTime.h" 11 11 #endif 12 13 // gcc 3.214 //class ifstream;15 #include <iosfwd>16 12 17 13 class TBuffer; … … 45 41 Char_t fProjectName[22]; 46 42 Char_t fSourceName[12]; 47 //Float_t fSourceRA;48 //Float_t fSourceDEC;49 43 Char_t fSourceEpochChar[2]; 50 44 UShort_t fSourceEpochDate; 51 Float_t fMJD;52 UShort_t fDateYear;53 UShort_t fDateMonth;54 UShort_t fDateDay;55 45 UShort_t fNumCrates; 56 46 UShort_t fNumPixInCrate; … … 58 48 UShort_t fNumSamplesHiGain; 59 49 UInt_t fNumEvents; 50 MTime fRunStart; 51 MTime fRunStop; 60 52 MArrayS *fPixAssignment; 61 53 … … 64 56 ~MRawRunHeader(); 65 57 66 void SetMagicNumber(UShort_t a) { fMagicNumber=a; } 67 void SetFormatVersion(UShort_t a){ fFormatVersion=a; } 68 void SetSoftVersion(UShort_t a) { fSoftVersion=a; } 69 void SetRunType(UShort_t a) { fRunType=a; } 70 void SetRunNumber(UInt_t a) { fRunNumber=a; } 71 void SetNumEvents(UInt_t a) { fNumEvents=a; } 58 // This is to be used in the MC chain only! 59 void SetMagicNumber(UShort_t a) { fMagicNumber=a; } 60 void SetFormatVersion(UShort_t a) { fFormatVersion=a; } 61 void SetSoftVersion(UShort_t a) { fSoftVersion=a; } 62 void SetRunType(UShort_t a) { fRunType=a; } 63 void SetRunNumber(UInt_t a) { fRunNumber=a; } 64 void SetNumEvents(UInt_t a) { fNumEvents=a; } 72 65 void SetNumSamples(UShort_t low, UShort_t high) 73 66 { … … 75 68 fNumSamplesHiGain=high; 76 69 } 77 void SetNumCrates(UShort_t a) {fNumCrates=a; } 78 void SetNumPixInCrate(UShort_t a){fNumPixInCrate=a; } 79 void SetMJD(Float_t a) {fMJD=a; } 70 void SetNumCrates(UShort_t a) { fNumCrates=a; } 71 void SetNumPixInCrate(UShort_t a) { fNumPixInCrate=a; } 80 72 73 // This is to get the numbers... 81 74 UShort_t GetMagicNumber() const { return fMagicNumber; } 82 UShort_t GetFormat version() const { return fFormatVersion; }75 UShort_t GetFormatVersion() const { return fFormatVersion; } 83 76 UShort_t GetSoftVersion() const { return fSoftVersion; } 84 77 UShort_t GetRunType() const { return fRunType; } … … 86 79 const Char_t *GetProjectName() const { return fProjectName; } 87 80 const Char_t *GetSourceName() const { return fSourceName; } 88 //Float_t GetSourceRa() const { return fSourceRA; }89 //Float_t GetSourceDec() const { return fSourceDEC; }90 81 const Char_t *GetSourceEpocheChar() const { return fSourceEpochChar; } 91 82 UShort_t GetSourceEpocheDate() const { return fSourceEpochDate; } 92 Float_t GetMJD() const { return fMJD; }93 UShort_t GetDateYear() const { return fDateYear; }94 Byte_t GetDateMonth() const { return fDateMonth; }95 Byte_t GetDateDay() const { return fDateDay; }96 83 UShort_t GetNumCrates() const { return fNumCrates; } 97 84 UShort_t GetNumPixInCrate() const { return fNumPixInCrate; } … … 99 86 UShort_t GetNumSamplesHiGain() const { return fNumSamplesHiGain; } 100 87 UInt_t GetNumEvents() const { return fNumEvents; } 88 const MTime &GetRunStart() const { return fRunStart; } 89 const MTime &GetRunEnd() const { return fRunStop; } 101 90 UShort_t GetPixAssignment(UShort_t i) const; 102 91 UShort_t GetNumConnectedPixels() const; … … 114 103 void ReadEvt(istream& fin); 115 104 116 ClassDef(MRawRunHeader, 1) // storage container for general info105 ClassDef(MRawRunHeader, 2) // storage container for general info 117 106 }; 118 107 #endif -
trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc
r2563 r2636 303 303 304 304 // 305 // Get file format version 306 // 307 const UShort_t ver = fRawRunHeader->GetFormatVersion(); 308 309 // 305 310 // read the CRATE DATA (see specification) from file 306 311 // 307 312 for (int i=0; i<nc; i++) 308 313 { 309 fRawCrateArray->GetEntry(i)->ReadEvt(*fIn );314 fRawCrateArray->GetEntry(i)->ReadEvt(*fIn, ver); 310 315 if (!*fIn) 311 316 return kFALSE; -
trunk/MagicSoft/Mars/mraw/Makefile
r2386 r2636 23 23 # 24 24 INCLUDES = -I. -I../mbase -I../mgui -I../mgeom -I../MBase 25 # mgui (MCamEvent), mgeom(MGeomCam) 25 26 26 27 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.