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

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