source: trunk/Mars/mraw/MRawEvtData.h@ 11489

Last change on this file since 11489 was 11489, checked in by tbretz, 13 years ago
Added fStartCells and increased version number
File size: 3.3 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 MArrayS *fStartCells; //
39
40 UShort_t fNumBytesPerSample;
41
42 Int_t fConnectedPixels; //!
43
44 void InitArrays(UShort_t numconnected=0, UShort_t maxid=0);
45 void DeleteArrays();
46
47 Int_t GetNumBytes() const;
48
49 UInt_t GetSample(const void *ptr, Int_t n) // Helper for Draw
50 {
51 switch (fNumBytesPerSample)
52 {
53 case 1: return reinterpret_cast<const Byte_t*>(ptr)[n];
54 case 2: return reinterpret_cast<const UShort_t*>(ptr)[n];
55 case 4: return reinterpret_cast<const UInt_t*>(ptr)[n];
56 }
57 return 0;
58 }
59
60
61public:
62 MRawEvtData(const char *name=NULL, const char *title=NULL);
63 ~MRawEvtData();
64
65 void InitRead(MRawRunHeader *rh)
66 {
67 //
68 // you have to set this before you can read information
69 // from a magic binary file
70 //
71 fRunHeader = rh;
72 }
73
74 void Clear(Option_t * = NULL);
75 void Print(Option_t * = NULL) const;
76 void Draw (Option_t * = NULL);
77
78 void ResetPixels();
79 void ResetPixels(UShort_t npix, UShort_t maxid);
80 void InitStartCells();
81 void AddPixel(UShort_t nOfPixel, const TArrayC &data);
82 void Set(const MArrayI &data);
83 void SetIndices(const MArrayS &idx);
84 void SetIndices();
85
86 UShort_t GetNumHiGainSamples() const;
87 UShort_t GetNumLoGainSamples() const;
88 UInt_t GetNumSamples() const { return GetNumHiGainSamples()+GetNumLoGainSamples(); }
89 UShort_t GetNumPixels() const;
90
91 UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; }
92 UInt_t GetScale() const { return 1<<((fNumBytesPerSample-1)*8); }
93 UInt_t GetMax() const { return (UInt_t)(~1)>>((4-fNumBytesPerSample)*8); }
94
95 Byte_t *GetSamples() const;
96 UShort_t *GetStartCells() const;
97 UShort_t *GetPixelIds() const;
98
99 Bool_t HasStartCells() const;
100
101 void ReadPixel(istream &fin, Int_t npix);
102 void SetABFlag(Int_t npix, Bool_t ab);
103 void SkipEvt(istream &fin);
104
105 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
106 void DrawPixelContent(Int_t num) const
107 {
108 TString s("HIST");
109 s += num;
110 const_cast<MRawEvtData*>(this)->Draw(s);
111 }
112
113 void Copy(TObject &named)
114#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
115 const
116#endif
117 ;
118
119 ClassDef(MRawEvtData, 8) //Container to store the raw Event Data
120};
121
122#endif
Note: See TracBrowser for help on using the repository browser.