source: trunk/MagicSoft/Mars/mraw/MRawRunHeader.h@ 8665

Last change on this file since 8665 was 8584, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 6.0 KB
Line 
1#ifndef MARS_MRawRunHeader
2#define MARS_MRawRunHeader
3///////////////////////////////////////////////////////////////////////
4// //
5// MRunHeader //
6// //
7///////////////////////////////////////////////////////////////////////
8
9#ifndef MARS_MTime
10#include "MTime.h"
11#endif
12
13class TBuffer;
14class MArrayS;
15
16class MRawRunHeader : public MParContainer
17{
18public:
19 //
20 // enum for the Run Type. Monte Carlo Runs have
21 // to have a value greater than 255 (>0xff)
22 //
23 enum {
24 kRTData = 0x0000,
25 kRTPedestal = 0x0001,
26 kRTCalibration = 0x0002,
27 kRTPointRun = 0x0007,
28 kRTMonteCarlo = 0x0100,
29 kRTNone = 0xffff
30 };
31
32 //
33 // Magic number to detect the magic file type
34 //
35 static const UShort_t kMagicNumber;
36 static const Byte_t kMaxFormatVersion;
37
38private:
39 /* ---- Run Header Informations ---- */
40 UShort_t fMagicNumber; // File type identifier
41 UShort_t fFormatVersion; // File format version
42 UShort_t fSoftVersion; // DAQ software version
43 UShort_t fFadcType; // FADC type (0=Siegen, 1=MUX)
44 UShort_t fCameraVersion; // Camera Version (1=MAGIC I)
45 UShort_t fTelescopeNumber; // Telescope number (1=Magic I)
46 UShort_t fRunType; // Run Type
47 UInt_t fRunNumber; // Run number
48 Char_t fProjectName[101]; // Project name
49 Char_t fSourceName[81]; // Source name
50 Char_t fObservationMode[61]; // observation mode
51 Char_t fSourceEpochChar[2]; // epoch char of the source
52 UShort_t fSourceEpochDate; // epoch date of the source
53 UShort_t fNumCrates; // number of electronic boards
54 UShort_t fNumPixInCrate; // number of pixels in crate
55 UShort_t fNumSamplesLoGain; // number of logain samples stored
56 UShort_t fNumSamplesHiGain; // number of higain samples stored
57 UShort_t fNumBytesPerSample; // number of bytes per sample
58 UInt_t fNumEvents; // number of events stored
59 UInt_t fNumEventsRead; // number of events read by the electronics
60 UShort_t fFreqSampling; // Sampling Frequency [MHz]
61 Byte_t fNumSignificantBits; // number of significant bits
62 MTime fRunStart; // time of run start
63 MTime fRunStop; // time of run stop
64 MArrayS *fPixAssignment; //-> pixel assignment table
65
66 Bool_t SwapAssignment(Short_t id0, Short_t id1);
67 Bool_t FixAssignment();
68
69public:
70 MRawRunHeader(const char *name=NULL, const char *title=NULL);
71 ~MRawRunHeader();
72
73 // This is to be used in the MC chain only!
74 void SetMagicNumber(UShort_t a) { fMagicNumber=a; }
75 void SetFormatVersion(UShort_t a) { fFormatVersion=a; }
76 void SetSoftVersion(UShort_t a) { fSoftVersion=a; }
77 void SetRunType(UShort_t a) { fRunType=a; }
78 void SetRunNumber(UInt_t a) { fRunNumber=a; }
79 void SetNumEvents(UInt_t a) { fNumEvents=a; }
80 void SetNumSamples(UShort_t low, UShort_t high)
81 {
82 fNumSamplesLoGain=low;
83 fNumSamplesHiGain=high;
84 }
85 void SetNumCrates(UShort_t a) { fNumCrates=a; }
86 void SetNumPixInCrate(UShort_t a) { fNumPixInCrate=a; }
87 void SetRunTime(Float_t start, Float_t stop)
88 { fRunStart.SetMjd(start); fRunStop.SetMjd(stop); }
89
90 // This is to get the numbers...
91 UShort_t GetMagicNumber() const { return fMagicNumber; }
92 UShort_t GetFormatVersion() const { return fFormatVersion; }
93 UShort_t GetSoftVersion() const { return fSoftVersion; }
94 UInt_t GetRunNumber() const { return fRunNumber; }
95 UShort_t GetRunType() const { return fRunType; }
96 const Char_t *GetRunTypeStr() const;
97 const Char_t *GetProjectName() const { return fProjectName; }
98 const Char_t *GetSourceName() const { return fSourceName; }
99 const Char_t *GetSourceEpocheChar() const { return fSourceEpochChar; }
100 const Char_t *GetObservationMode() const { return fObservationMode; }
101 UShort_t GetSourceEpocheDate() const { return fSourceEpochDate; }
102 UShort_t GetNumCrates() const { return fNumCrates; }
103 UShort_t GetNumPixInCrate() const { return fNumPixInCrate; }
104 UShort_t GetNumSamplesLoGain() const { return fNumSamplesLoGain; }
105 UShort_t GetNumSamplesHiGain() const { return fNumSamplesHiGain; }
106 UInt_t GetNumSamples() const { return fNumSamplesHiGain+fNumSamplesLoGain; }
107 UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; }
108 UInt_t GetNumEvents() const { return fNumEvents; }
109 UInt_t GetNumEventsRead() const { return fNumEventsRead; }
110 UShort_t GetFreqSampling() const { return fFreqSampling; }
111 const MTime &GetRunStart() const { return fRunStart; }
112 const MTime &GetRunEnd() const { return fRunStop; }
113 Short_t GetPixAssignment(UShort_t i) const;
114 UShort_t GetMaxPixId() const;
115 UShort_t GetMinPixId() const;
116 UShort_t GetNumConnectedPixels() const;
117 UShort_t GetNumNormalPixels() const;
118 UShort_t GetNumSpecialPixels() const;
119 UInt_t GetScale() const { switch (fNumBytesPerSample) { case 1: return 0x1; case 2: return 0x100; case 4: return 0x1000000; } return 0; }
120 UInt_t GetMax() const { switch (fNumBytesPerSample) { case 1: return 0xff; case 2: return 0xffff; case 4: return 0xffffffff; } return 0; }
121
122 UInt_t GetNumSamplesPerCrate() const
123 {
124 return fNumPixInCrate*(fNumSamplesLoGain+fNumSamplesHiGain);
125 }
126
127 UShort_t GetNumPixel() const;
128 Int_t GetNumTotalBytes() const;
129
130 Bool_t IsValid() const { return fMagicNumber==0xc0c0 || fMagicNumber==0xc0c1; }
131 Bool_t IsMonteCarloRun() const { return fRunType>0x00ff; }
132
133 void Print(Option_t *t=NULL) const;
134
135 Bool_t ReadEvt(istream& fin);
136
137 ClassDef(MRawRunHeader, 7) // storage container for general info
138};
139#endif
Note: See TracBrowser for help on using the repository browser.