1 | #ifndef MARS_MCerPhotEvt
|
---|
2 | #define MARS_MCerPhotEvt
|
---|
3 |
|
---|
4 | #ifndef ROOT_TClonesArray
|
---|
5 | #include <TClonesArray.h>
|
---|
6 | #endif
|
---|
7 | #ifndef ROOT_TArrayI
|
---|
8 | #include <TArrayI.h>
|
---|
9 | #endif
|
---|
10 | #ifndef MARS_MCamEvent
|
---|
11 | #include "MCamEvent.h"
|
---|
12 | #endif
|
---|
13 | #ifndef MARS_MCerPhotPix
|
---|
14 | #include "MCerPhotPix.h"
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | class MGeomCam;
|
---|
18 | class MCerPhotPix;
|
---|
19 | class MCerPhotEvtIter;
|
---|
20 |
|
---|
21 | class MCerPhotEvt : public MParContainer, public MCamEvent
|
---|
22 | {
|
---|
23 | friend class MCerPhotEvtIter;
|
---|
24 | private:
|
---|
25 | UInt_t fNumPixels;
|
---|
26 | Short_t fNumIslands;
|
---|
27 | Int_t fMaxIndex;
|
---|
28 | TArrayI fLut; // Lookup tabel to lookup pixel by index
|
---|
29 | TClonesArray *fPixels; //-> FIXME: Change TClonesArray away from a pointer?
|
---|
30 |
|
---|
31 | void RebuildLut()
|
---|
32 | {
|
---|
33 | // Resize Lut
|
---|
34 | fLut.Set(fMaxIndex+1);
|
---|
35 |
|
---|
36 | // Reset Lut
|
---|
37 | fLut.Reset(-1);
|
---|
38 |
|
---|
39 | // Rebuild Lut
|
---|
40 | for (UInt_t i=0; i<GetNumPixels(); i++)
|
---|
41 | {
|
---|
42 | const MCerPhotPix &pix = (*this)[i];
|
---|
43 | fLut[pix.GetPixId()] = i;
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 | Double_t CalcIsland(const MGeomCam &geom, Int_t idx, Int_t num);
|
---|
48 |
|
---|
49 | public:
|
---|
50 | MCerPhotEvt(const char *name=NULL, const char *title=NULL);
|
---|
51 | ~MCerPhotEvt() { delete fPixels; }
|
---|
52 |
|
---|
53 | // Setter function to fill pixels
|
---|
54 | MCerPhotPix *AddPixel(Int_t idx, Float_t nph=0, Float_t er=0);
|
---|
55 | void FixSize();
|
---|
56 |
|
---|
57 | // Getter functions
|
---|
58 | UInt_t GetNumPixels() const { return fNumPixels; }
|
---|
59 | Short_t GetNumIslands() const { return fNumIslands; };
|
---|
60 |
|
---|
61 | Bool_t IsPixelExisting(Int_t id) const;
|
---|
62 | Bool_t IsPixelUsed (Int_t id) const;
|
---|
63 | Bool_t IsPixelCore (Int_t id) const;
|
---|
64 |
|
---|
65 | Float_t GetNumPhotonsMin(const MGeomCam *geom=NULL) const;
|
---|
66 | Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const;
|
---|
67 |
|
---|
68 | Float_t GetRatioMin(const MGeomCam *geom=NULL) const;
|
---|
69 | Float_t GetRatioMax(const MGeomCam *geom=NULL) const;
|
---|
70 |
|
---|
71 | Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const;
|
---|
72 | Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const;
|
---|
73 |
|
---|
74 | // Getter functions to access single pixels
|
---|
75 | MCerPhotPix &operator[](int i) { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
|
---|
76 | MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
|
---|
77 |
|
---|
78 | MCerPhotPix *GetPixById(Int_t idx) const;
|
---|
79 |
|
---|
80 | // Functions to change the contained data
|
---|
81 | void Scale(Double_t f) { fPixels->ForEach(MCerPhotPix, Scale)(f); }
|
---|
82 | void RemoveUnusedPixels();
|
---|
83 | Int_t CalcIslands(const MGeomCam &geom);
|
---|
84 | void Sort(Int_t upto = kMaxInt)
|
---|
85 | {
|
---|
86 | // Sort pixels by index
|
---|
87 | fPixels->Sort(upto);
|
---|
88 | RebuildLut();
|
---|
89 | } // For convinience: Sort pixels by index
|
---|
90 |
|
---|
91 | // class MParContainer
|
---|
92 | void Reset();
|
---|
93 |
|
---|
94 | // class TObject
|
---|
95 | void Print(Option_t *opt=NULL) const;
|
---|
96 | void Clear(Option_t *opt=NULL) { Reset(); }
|
---|
97 |
|
---|
98 | // class MCamEvent
|
---|
99 | Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
|
---|
100 | void DrawPixelContent(Int_t num) const;
|
---|
101 |
|
---|
102 | // To build an iterator for this class
|
---|
103 | operator TIterator*() const;
|
---|
104 |
|
---|
105 | ClassDef(MCerPhotEvt, 3) // class for an event containing cerenkov photons
|
---|
106 | };
|
---|
107 |
|
---|
108 | class MCerPhotEvtIter : public TObjArrayIter
|
---|
109 | {
|
---|
110 | private:
|
---|
111 | Bool_t fUsedOnly;
|
---|
112 | public:
|
---|
113 | MCerPhotEvtIter(const MCerPhotEvt *evt, Bool_t usedonly=kTRUE, Bool_t dir=kIterForward) : TObjArrayIter(evt->fPixels, dir), fUsedOnly(usedonly) { }
|
---|
114 | TObject *Next();
|
---|
115 | TIterator &operator=(const TIterator &) { return *this; }
|
---|
116 | ClassDef(MCerPhotEvtIter, 0)
|
---|
117 | };
|
---|
118 |
|
---|
119 | inline MCerPhotEvt::operator TIterator*() const { return new MCerPhotEvtIter(this); }
|
---|
120 |
|
---|
121 | #endif
|
---|