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