| 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 | 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 |
|
|---|
| 38 | private:
|
|---|
| 39 | /* ---- Run Header Informations ---- */
|
|---|
| 40 | UShort_t fMagicNumber;
|
|---|
| 41 | UShort_t fFormatVersion;
|
|---|
| 42 | UShort_t fSoftVersion;
|
|---|
| 43 | UShort_t fFadcType;
|
|---|
| 44 | UShort_t fCameraVersion;
|
|---|
| 45 | UShort_t fTelescopeNumber;
|
|---|
| 46 | UShort_t fRunType;
|
|---|
| 47 | UInt_t fRunNumber;
|
|---|
| 48 | Char_t fProjectName[101];//23];
|
|---|
| 49 | Char_t fSourceName[81]; //13];
|
|---|
| 50 | Char_t fObservationMode[61];
|
|---|
| 51 | Char_t fSourceEpochChar[2];
|
|---|
| 52 | UShort_t fSourceEpochDate;
|
|---|
| 53 | UShort_t fNumCrates;
|
|---|
| 54 | UShort_t fNumPixInCrate;
|
|---|
| 55 | UShort_t fNumSamplesLoGain;
|
|---|
| 56 | UShort_t fNumSamplesHiGain;
|
|---|
| 57 | UShort_t fNumBytesPerSample;
|
|---|
| 58 | UInt_t fNumEvents;
|
|---|
| 59 | UShort_t fFreqSampling;
|
|---|
| 60 | Byte_t fNumSignificantBits;
|
|---|
| 61 | MTime fRunStart;
|
|---|
| 62 | MTime fRunStop;
|
|---|
| 63 | MArrayS *fPixAssignment;
|
|---|
| 64 |
|
|---|
| 65 | Bool_t SwapAssignment(Short_t id0, Short_t id1);
|
|---|
| 66 | Bool_t FixAssignment();
|
|---|
| 67 |
|
|---|
| 68 | public:
|
|---|
| 69 | MRawRunHeader(const char *name=NULL, const char *title=NULL);
|
|---|
| 70 | ~MRawRunHeader();
|
|---|
| 71 |
|
|---|
| 72 | // This is to be used in the MC chain only!
|
|---|
| 73 | void SetMagicNumber(UShort_t a) { fMagicNumber=a; }
|
|---|
| 74 | void SetFormatVersion(UShort_t a) { fFormatVersion=a; }
|
|---|
| 75 | void SetSoftVersion(UShort_t a) { fSoftVersion=a; }
|
|---|
| 76 | void SetRunType(UShort_t a) { fRunType=a; }
|
|---|
| 77 | void SetRunNumber(UInt_t a) { fRunNumber=a; }
|
|---|
| 78 | void SetNumEvents(UInt_t a) { fNumEvents=a; }
|
|---|
| 79 | void SetNumSamples(UShort_t low, UShort_t high)
|
|---|
| 80 | {
|
|---|
| 81 | fNumSamplesLoGain=low;
|
|---|
| 82 | fNumSamplesHiGain=high;
|
|---|
| 83 | }
|
|---|
| 84 | void SetNumCrates(UShort_t a) { fNumCrates=a; }
|
|---|
| 85 | void SetNumPixInCrate(UShort_t a) { fNumPixInCrate=a; }
|
|---|
| 86 | void SetRunTime(Float_t start, Float_t stop)
|
|---|
| 87 | { fRunStart.SetMjd(start); fRunStop.SetMjd(stop); }
|
|---|
| 88 |
|
|---|
| 89 | // This is to get the numbers...
|
|---|
| 90 | UShort_t GetMagicNumber() const { return fMagicNumber; }
|
|---|
| 91 | UShort_t GetFormatVersion() const { return fFormatVersion; }
|
|---|
| 92 | UShort_t GetSoftVersion() const { return fSoftVersion; }
|
|---|
| 93 | UInt_t GetRunNumber() const { return fRunNumber; }
|
|---|
| 94 | UShort_t GetRunType() const { return fRunType; }
|
|---|
| 95 | const Char_t *GetRunTypeStr() const;
|
|---|
| 96 | const Char_t *GetProjectName() const { return fProjectName; }
|
|---|
| 97 | const Char_t *GetSourceName() const { return fSourceName; }
|
|---|
| 98 | const Char_t *GetSourceEpocheChar() const { return fSourceEpochChar; }
|
|---|
| 99 | const Char_t *GetObservationMode() const { return fObservationMode; }
|
|---|
| 100 | UShort_t GetSourceEpocheDate() const { return fSourceEpochDate; }
|
|---|
| 101 | UShort_t GetNumCrates() const { return fNumCrates; }
|
|---|
| 102 | UShort_t GetNumPixInCrate() const { return fNumPixInCrate; }
|
|---|
| 103 | UShort_t GetNumSamplesLoGain() const { return fNumSamplesLoGain; }
|
|---|
| 104 | UShort_t GetNumSamplesHiGain() const { return fNumSamplesHiGain; }
|
|---|
| 105 | UInt_t GetNumSamples() const { return fNumSamplesHiGain+fNumSamplesLoGain; }
|
|---|
| 106 | UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; }
|
|---|
| 107 | UInt_t GetNumEvents() const { return fNumEvents; }
|
|---|
| 108 | UShort_t GetFreqSampling() const { return fFreqSampling; }
|
|---|
| 109 | const MTime &GetRunStart() const { return fRunStart; }
|
|---|
| 110 | const MTime &GetRunEnd() const { return fRunStop; }
|
|---|
| 111 | Short_t GetPixAssignment(UShort_t i) const;
|
|---|
| 112 | UShort_t GetMaxPixId() const;
|
|---|
| 113 | UShort_t GetMinPixId() const;
|
|---|
| 114 | UShort_t GetNumConnectedPixels() const;
|
|---|
| 115 | UShort_t GetNumNormalPixels() const;
|
|---|
| 116 | UShort_t GetNumSpecialPixels() const;
|
|---|
| 117 |
|
|---|
| 118 | UInt_t GetNumSamplesPerCrate() const
|
|---|
| 119 | {
|
|---|
| 120 | return fNumPixInCrate*(fNumSamplesLoGain+fNumSamplesHiGain);
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | UShort_t GetNumPixel() const;
|
|---|
| 124 | Int_t GetNumTotalBytes() const;
|
|---|
| 125 |
|
|---|
| 126 | Bool_t IsValid() const { return fMagicNumber==0xc0c0 || fMagicNumber==0xc0c1; }
|
|---|
| 127 | Bool_t IsMonteCarloRun() const { return fRunType>0x00ff; }
|
|---|
| 128 |
|
|---|
| 129 | void Print(Option_t *t=NULL) const;
|
|---|
| 130 |
|
|---|
| 131 | Bool_t ReadEvt(istream& fin);
|
|---|
| 132 |
|
|---|
| 133 | ClassDef(MRawRunHeader, 6) // storage container for general info
|
|---|
| 134 | };
|
|---|
| 135 | #endif
|
|---|