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 |
|
---|
13 | class TBuffer;
|
---|
14 | class MArrayS;
|
---|
15 |
|
---|
16 | //
|
---|
17 | // Magic number to detect the magic file type
|
---|
18 | //
|
---|
19 | const UShort_t kMagicNumber = 0xc0c0;
|
---|
20 | const Byte_t kMaxFormatVersion = 3;
|
---|
21 |
|
---|
22 | //
|
---|
23 | // enum for the Run Type. Monte Carlo Runs have
|
---|
24 | // to have a value greater than 255 (>0xff)
|
---|
25 | //
|
---|
26 | enum {
|
---|
27 | kRTData = 0x0000,
|
---|
28 | kRTPedestal = 0x0001,
|
---|
29 | kRTCalibration = 0x0002,
|
---|
30 | kRTMonteCarlo = 0x0100,
|
---|
31 | kRTNone = 0xffff
|
---|
32 | };
|
---|
33 |
|
---|
34 | class MRawRunHeader : public MParContainer
|
---|
35 | {
|
---|
36 | private:
|
---|
37 | /* ---- Run Header Informations ---- */
|
---|
38 | UShort_t fMagicNumber;
|
---|
39 | UShort_t fFormatVersion;
|
---|
40 | UShort_t fSoftVersion;
|
---|
41 | UShort_t fRunType;
|
---|
42 | UInt_t fRunNumber;
|
---|
43 | Char_t fProjectName[22];
|
---|
44 | Char_t fSourceName[12];
|
---|
45 | Char_t fSourceEpochChar[2];
|
---|
46 | UShort_t fSourceEpochDate;
|
---|
47 | UShort_t fNumCrates;
|
---|
48 | UShort_t fNumPixInCrate;
|
---|
49 | UShort_t fNumSamplesLoGain;
|
---|
50 | UShort_t fNumSamplesHiGain;
|
---|
51 | UInt_t fNumEvents;
|
---|
52 | MTime fRunStart;
|
---|
53 | MTime fRunStop;
|
---|
54 | MArrayS *fPixAssignment;
|
---|
55 |
|
---|
56 | public:
|
---|
57 | MRawRunHeader(const char *name=NULL, const char *title=NULL);
|
---|
58 | ~MRawRunHeader();
|
---|
59 |
|
---|
60 | // This is to be used in the MC chain only!
|
---|
61 | void SetMagicNumber(UShort_t a) { fMagicNumber=a; }
|
---|
62 | void SetFormatVersion(UShort_t a) { fFormatVersion=a; }
|
---|
63 | void SetSoftVersion(UShort_t a) { fSoftVersion=a; }
|
---|
64 | void SetRunType(UShort_t a) { fRunType=a; }
|
---|
65 | void SetRunNumber(UInt_t a) { fRunNumber=a; }
|
---|
66 | void SetNumEvents(UInt_t a) { fNumEvents=a; }
|
---|
67 | void SetNumSamples(UShort_t low, UShort_t high)
|
---|
68 | {
|
---|
69 | fNumSamplesLoGain=low;
|
---|
70 | fNumSamplesHiGain=high;
|
---|
71 | }
|
---|
72 | void SetNumCrates(UShort_t a) { fNumCrates=a; }
|
---|
73 | void SetNumPixInCrate(UShort_t a) { fNumPixInCrate=a; }
|
---|
74 | void SetRunTime(Float_t start, Float_t stop)
|
---|
75 | { fRunStart.SetMjd(start); fRunStop.SetMjd(stop); }
|
---|
76 |
|
---|
77 | // This is to get the numbers...
|
---|
78 | UShort_t GetMagicNumber() const { return fMagicNumber; }
|
---|
79 | UShort_t GetFormatVersion() const { return fFormatVersion; }
|
---|
80 | UShort_t GetSoftVersion() const { return fSoftVersion; }
|
---|
81 | UShort_t GetRunType() const { return fRunType; }
|
---|
82 | const char *GetRunTypeStr() const;
|
---|
83 | UInt_t GetRunNumber() const { return fRunNumber; }
|
---|
84 | const Char_t *GetProjectName() const { return fProjectName; }
|
---|
85 | const Char_t *GetSourceName() const { return fSourceName; }
|
---|
86 | const Char_t *GetSourceEpocheChar() const { return fSourceEpochChar; }
|
---|
87 | UShort_t GetSourceEpocheDate() const { return fSourceEpochDate; }
|
---|
88 | UShort_t GetNumCrates() const { return fNumCrates; }
|
---|
89 | UShort_t GetNumPixInCrate() const { return fNumPixInCrate; }
|
---|
90 | UShort_t GetNumSamplesLoGain() const { return fNumSamplesLoGain; }
|
---|
91 | UShort_t GetNumSamplesHiGain() const { return fNumSamplesHiGain; }
|
---|
92 | UInt_t GetNumEvents() const { return fNumEvents; }
|
---|
93 | const MTime &GetRunStart() const { return fRunStart; }
|
---|
94 | const MTime &GetRunEnd() const { return fRunStop; }
|
---|
95 | UShort_t GetPixAssignment(UShort_t i) const;
|
---|
96 | UShort_t GetMaxPixId() const;
|
---|
97 | UShort_t GetNumConnectedPixels() const;
|
---|
98 |
|
---|
99 | UInt_t GetNumSamplesPerCrate() const
|
---|
100 | {
|
---|
101 | return fNumPixInCrate*(fNumSamplesLoGain+fNumSamplesHiGain);
|
---|
102 | }
|
---|
103 |
|
---|
104 | UShort_t GetNumPixel() const;
|
---|
105 | Int_t GetNumTotalBytes() const;
|
---|
106 |
|
---|
107 | void Print(Option_t *t=NULL) const;
|
---|
108 |
|
---|
109 | Bool_t ReadEvt(istream& fin);
|
---|
110 |
|
---|
111 | ClassDef(MRawRunHeader, 2) // storage container for general info
|
---|
112 | };
|
---|
113 | #endif
|
---|