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

Last change on this file since 7593 was 7441, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 4.2 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;
41 UShort_t fFormatVersion;
42 UShort_t fSoftVersion;
43 UShort_t fRunType;
44 UInt_t fRunNumber;
45 Char_t fProjectName[23];
46 Char_t fSourceName[13];
47 Char_t fSourceEpochChar[2];
48 UShort_t fSourceEpochDate;
49 UShort_t fNumCrates;
50 UShort_t fNumPixInCrate;
51 UShort_t fNumSamplesLoGain;
52 UShort_t fNumSamplesHiGain;
53 UInt_t fNumEvents;
54 MTime fRunStart;
55 MTime fRunStop;
56 MArrayS *fPixAssignment;
57
58 Bool_t SwapAssignment(Short_t id0, Short_t id1);
59 Bool_t FixAssignment();
60
61public:
62 MRawRunHeader(const char *name=NULL, const char *title=NULL);
63 ~MRawRunHeader();
64
65 // This is to be used in the MC chain only!
66 void SetMagicNumber(UShort_t a) { fMagicNumber=a; }
67 void SetFormatVersion(UShort_t a) { fFormatVersion=a; }
68 void SetSoftVersion(UShort_t a) { fSoftVersion=a; }
69 void SetRunType(UShort_t a) { fRunType=a; }
70 void SetRunNumber(UInt_t a) { fRunNumber=a; }
71 void SetNumEvents(UInt_t a) { fNumEvents=a; }
72 void SetNumSamples(UShort_t low, UShort_t high)
73 {
74 fNumSamplesLoGain=low;
75 fNumSamplesHiGain=high;
76 }
77 void SetNumCrates(UShort_t a) { fNumCrates=a; }
78 void SetNumPixInCrate(UShort_t a) { fNumPixInCrate=a; }
79 void SetRunTime(Float_t start, Float_t stop)
80 { fRunStart.SetMjd(start); fRunStop.SetMjd(stop); }
81
82 // This is to get the numbers...
83 UShort_t GetMagicNumber() const { return fMagicNumber; }
84 UShort_t GetFormatVersion() const { return fFormatVersion; }
85 UShort_t GetSoftVersion() const { return fSoftVersion; }
86 UInt_t GetRunNumber() const { return fRunNumber; }
87 UShort_t GetRunType() const { return fRunType; }
88 const Char_t *GetRunTypeStr() const;
89 const Char_t *GetProjectName() const { return fProjectName; }
90 const Char_t *GetSourceName() const { return fSourceName; }
91 const Char_t *GetSourceEpocheChar() const { return fSourceEpochChar; }
92 UShort_t GetSourceEpocheDate() const { return fSourceEpochDate; }
93 UShort_t GetNumCrates() const { return fNumCrates; }
94 UShort_t GetNumPixInCrate() const { return fNumPixInCrate; }
95 UShort_t GetNumSamplesLoGain() const { return fNumSamplesLoGain; }
96 UShort_t GetNumSamplesHiGain() const { return fNumSamplesHiGain; }
97 UInt_t GetNumEvents() const { return fNumEvents; }
98 const MTime &GetRunStart() const { return fRunStart; }
99 const MTime &GetRunEnd() const { return fRunStop; }
100 Short_t GetPixAssignment(UShort_t i) const;
101 UShort_t GetMaxPixId() const;
102 UShort_t GetMinPixId() const;
103 UShort_t GetNumConnectedPixels() const;
104 UShort_t GetNumNormalPixels() const;
105 UShort_t GetNumSpecialPixels() const;
106
107 UInt_t GetNumSamplesPerCrate() const
108 {
109 return fNumPixInCrate*(fNumSamplesLoGain+fNumSamplesHiGain);
110 }
111
112 UShort_t GetNumPixel() const;
113 Int_t GetNumTotalBytes() const;
114
115 Bool_t IsMonteCarloRun() const { return fRunType>0x00ff; }
116
117 void Print(Option_t *t=NULL) const;
118
119 Bool_t ReadEvt(istream& fin);
120
121 ClassDef(MRawRunHeader, 3) // storage container for general info
122};
123#endif
Note: See TracBrowser for help on using the repository browser.