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