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