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

Last change on this file since 9463 was 9226, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 3.1 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
59
60public:
61 MRawEvtData(const char *name=NULL, const char *title=NULL);
62 ~MRawEvtData();
63
64 void InitRead(MRawRunHeader *rh)
65 {
66 //
67 // you have to set this before you can read information
68 // from a magic binary file
69 //
70 fRunHeader = rh;
71 }
72
73 void Clear(Option_t * = NULL);
74 void Print(Option_t * = NULL) const;
75 void Draw (Option_t * = NULL);
76
77 void ResetPixels();
78 void ResetPixels(UShort_t npix, UShort_t maxid);
79 void AddPixel(UShort_t nOfPixel, const TArrayC &data);
80 void Set(const MArrayI &data);
81 void SetIndices(const MArrayS &idx);
82 void SetIndices();
83
84 UShort_t GetNumHiGainSamples() const;
85 UShort_t GetNumLoGainSamples() const;
86 UInt_t GetNumSamples() const { return GetNumHiGainSamples()+GetNumLoGainSamples(); }
87 UShort_t GetNumPixels() const;
88
89 UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; }
90 UInt_t GetScale() const { return 1<<((fNumBytesPerSample-1)*8); }
91 UInt_t GetMax() const { return (UInt_t)(~1)>>((4-fNumBytesPerSample)*8); }
92
93 void ReadPixel(istream &fin, Int_t npix);
94 void SetABFlag(Int_t npix, Bool_t ab);
95 void SkipEvt(istream &fin);
96
97 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
98 void DrawPixelContent(Int_t num) const
99 {
100 TString s("HIST");
101 s += num;
102 const_cast<MRawEvtData*>(this)->Draw(s);
103 }
104
105 void Copy(TObject &named)
106#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
107 const
108#endif
109 ;
110
111 ClassDef(MRawEvtData, 7) //Container to store the raw Event Data
112};
113
114#endif
Note: See TracBrowser for help on using the repository browser.