source: branches/Mars_use_drstimefiles/mraw/MRawEvtData.h@ 18066

Last change on this file since 18066 was 17148, checked in by ftemme, 11 years ago
Merging changes from the MC branch in the trunk
File size: 4.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#include <stdint.h>
15
16class MRawRunHeader;
17class MRawCrateArray;
18
19class TArrayC;
20class MArrayS;
21class MArrayB;
22class MArrayI;
23
24class MRawEvtData : public MParContainer, public MCamEvent
25{
26 friend class MRawEvtPixelIter;
27private:
28 MRawRunHeader *fRunHeader; //! provides information about numbers
29
30 // FIXME: COMMENT ABOUT ORDERING
31
32 MArrayS *fHiGainPixId; //-> list of pixel IDs of hi gain channel
33 MArrayB *fHiGainFadcSamples; //-> list of hi gain samples of all pixels (ordering: see fHiGainPixId) {fits: unit=mV ; name=Data }
34
35 MArrayS *fLoGainPixId; //-> list of pixel IDs of lo gain channel
36 MArrayB *fLoGainFadcSamples; //-> list of lo gain samples of all pixels (ordering: see fLoGainPixId)
37
38 MArrayB *fABFlags; //-> A information about the exact trigger position
39 MArrayS *fStartCells; // {fits: unit=uint16 ; name=StartCellData }
40
41 UShort_t fTriggerType; // {fits: unit=uint16 ; name=TriggerType }
42
43 UShort_t fNumBytesPerSample;
44
45 Bool_t fIsSigned;
46
47 Int_t fConnectedPixels; //!
48
49 void InitArrays(UShort_t numconnected=0, UShort_t maxid=0);
50 void DeleteArrays();
51
52 Int_t GetNumBytes() const;
53
54 Long_t GetSample(const void *ptr, Int_t n) // Helper for Draw
55 {
56 fIsSigned = kTRUE;
57 switch (fNumBytesPerSample)
58 {
59 case 1: return fIsSigned ? (Long_t)reinterpret_cast<const Char_t*>(ptr)[n] : (Long_t)reinterpret_cast<const Byte_t*>(ptr)[n];
60 case 2: return fIsSigned ? (Long_t)reinterpret_cast<const Short_t*>(ptr)[n] : (Long_t)reinterpret_cast<const UShort_t*>(ptr)[n];
61 case 4: return fIsSigned ? (Long_t)reinterpret_cast<const Int_t*>(ptr)[n] : (Long_t)reinterpret_cast<const UInt_t*>(ptr)[n];
62 }
63 return 0;
64 }
65
66
67public:
68 MRawEvtData(const char *name=NULL, const char *title=NULL);
69 ~MRawEvtData();
70
71 void InitRead(MRawRunHeader *rh)
72 {
73 //
74 // you have to set this before you can read information
75 // from a magic binary file
76 //
77 fRunHeader = rh;
78 }
79
80 void Clear(Option_t * = NULL);
81 void Print(Option_t * = NULL) const;
82 void Draw (Option_t * = NULL);
83
84 void ResetPixels();
85 void ResetPixels(UShort_t npix, UShort_t maxid);
86 void InitStartCells();
87 void AddPixel(UShort_t nOfPixel, const TArrayC &data);
88 void Set(const MArrayI &data);
89 void SetIndices(const MArrayS &idx);
90 void SetIndices();
91
92 UShort_t GetNumHiGainSamples() const;
93 UShort_t GetNumLoGainSamples() const;
94 UInt_t GetNumSamples() const { return GetNumHiGainSamples()+GetNumLoGainSamples(); }
95 UShort_t GetNumPixels() const;
96
97 UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; }
98 UInt_t GetScale() const { return 1<<((fNumBytesPerSample-1)*8); }
99 Long_t GetMin() const { return fIsSigned ? -GetMax()-1 : 0; }
100 Long_t GetMax() const {
101 switch (fNumBytesPerSample)
102 {
103 case 1: return fIsSigned ? 0x7f : 0xff;
104 case 2: return fIsSigned ? 0x7fff : 0xffff;
105 case 4: return fIsSigned ? 0x7fffffff : 0xffffffff;
106 }
107 return 0;
108 }
109 Byte_t *GetSamples() const;
110 UShort_t *GetStartCells() const;
111 UShort_t *GetPixelIds() const;
112
113 Bool_t HasStartCells() const;
114
115 void ReadPixel(std::istream &fin, Int_t npix);
116 void SetABFlag(Int_t npix, Bool_t ab);
117 void SkipEvt(std::istream &fin);
118
119 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
120 void DrawPixelContent(Int_t num) const
121 {
122 TString s("HIST");
123 s += num;
124 const_cast<MRawEvtData*>(this)->Draw(s);
125 }
126
127 void Copy(TObject &named)
128#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
129 const
130#endif
131 ;
132
133 ClassDef(MRawEvtData, 8) //Container to store the raw Event Data
134};
135
136#endif
Note: See TracBrowser for help on using the repository browser.