source: trunk/MagicSoft/Mars/mraw/MRawEvtData.h@ 9223

Last change on this file since 9223 was 9212, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 3.0 KB
Line 
1#ifndef MARS_MRawEvtData
2#define MARS_MRawEvtData
3
4#ifndef MARS_MParContainer
5#include "MParContainer.h"
6#endif
7#ifndef MARS_MCamEvent
8#include "MCamEvent.h"
9#endif
10
11// gcc 3.2
12//class ifstream;
13#include <iosfwd>
14
15class MRawRunHeader;
16class MRawCrateArray;
17
18class TArrayC;
19class MArrayS;
20class MArrayB;
21class MArrayI;
22
23class MRawEvtData : public MParContainer, public MCamEvent
24{
25 friend class MRawEvtPixelIter;
26private:
27 MRawRunHeader *fRunHeader; //! provides information about numbers
28
29 // FIXME: COMMENT ABOUT ORDERING
30
31 MArrayS *fHiGainPixId; //-> list of pixel IDs of hi gain channel
32 MArrayB *fHiGainFadcSamples; //-> list of hi gain samples of all pixels (ordering: see fHiGainPixId)
33
34 MArrayS *fLoGainPixId; //-> list of pixel IDs of lo gain channel
35 MArrayB *fLoGainFadcSamples; //-> list of lo gain samples of all pixels (ordering: see fLoGainPixId)
36
37 MArrayB *fABFlags; //-> A information about the exact trigger position
38
39 UShort_t fNumBytesPerSample;
40
41 Int_t fConnectedPixels; //!
42
43 void InitArrays(UShort_t numconnected=0, UShort_t maxid=0);
44 void DeleteArrays();
45
46 Int_t GetNumBytes() const;
47
48 UInt_t GetSample(const void *ptr, Int_t n) // Helper for Draw
49 {
50 switch (fNumBytesPerSample)
51 {
52 case 1: return reinterpret_cast<const Byte_t*>(ptr)[n];
53 case 2: return reinterpret_cast<const UShort_t*>(ptr)[n];
54 case 4: return reinterpret_cast<const UInt_t*>(ptr)[n];
55 }
56 return 0;
57 }
58
59public:
60 MRawEvtData(const char *name=NULL, const char *title=NULL);
61 ~MRawEvtData();
62
63 void InitRead(MRawRunHeader *rh)
64 {
65 //
66 // you have to set this before you can read information
67 // from a magic binary file
68 //
69 fRunHeader = rh;
70 }
71
72 void Clear(Option_t * = NULL);
73 void Print(Option_t * = NULL) const;
74 void Draw (Option_t * = NULL);
75
76 void ResetPixels(UShort_t npix, UShort_t maxid);
77 void AddPixel(UShort_t nOfPixel, const TArrayC &data);
78 void Set(const MArrayI &data);
79
80 UShort_t GetNumHiGainSamples() const;
81 UShort_t GetNumLoGainSamples() const;
82 UInt_t GetNumSamples() const { return GetNumHiGainSamples()+GetNumLoGainSamples(); }
83 UShort_t GetNumPixels() const;
84
85 UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; }
86 UInt_t GetScale() const { return 1<<((fNumBytesPerSample-1)*8); }
87 UInt_t GetMax() const { return (UInt_t)(~1)>>((4-fNumBytesPerSample)*8); }
88
89 void ReadPixel(istream &fin, Int_t npix);
90 void SetABFlag(Int_t npix, Bool_t ab);
91 void SkipEvt(istream &fin);
92
93 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
94 void DrawPixelContent(Int_t num) const
95 {
96 TString s("HIST");
97 s += num;
98 const_cast<MRawEvtData*>(this)->Draw(s);
99 }
100
101 void Copy(TObject &named)
102#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
103 const
104#endif
105 ;
106
107 ClassDef(MRawEvtData, 7) //Container to store the raw Event Data
108};
109
110#endif
Note: See TracBrowser for help on using the repository browser.