source: trunk/MagicSoft/Mars/msignal/MSignalCam.h@ 7344

Last change on this file since 7344 was 6856, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 3.9 KB
Line 
1#ifndef MARS_MSignalCam
2#define MARS_MSignalCam
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_MSignalPix
14#include "MSignalPix.h"
15#endif
16
17class MGeomCam;
18class MSignalPix;
19class MSignalCamIter;
20
21class MSignalCam : public MParContainer, public MCamEvent
22{
23 friend class MSignalCamIter;
24private:
25 Short_t fNumIslands;
26 Short_t fNumSinglePixels;
27 Float_t fSizeSinglePixels;
28 Float_t fSizeSubIslands;
29 Float_t fSizeMainIsland;
30
31 Int_t fNumPixelsSaturatedHiGain;
32 Int_t fNumPixelsSaturatedLoGain;
33 TClonesArray *fPixels; //-> FIXME: Change TClonesArray away from a pointer?
34
35 Double_t CalcIsland(const MGeomCam &geom, Int_t idx, Int_t num);
36
37public:
38 MSignalCam(const char *name=NULL, const char *title=NULL);
39 ~MSignalCam() { delete fPixels; }
40
41 // Setter function to fill pixels
42 MSignalPix *AddPixel(Int_t idx, Float_t nph=0, Float_t er=0);
43 void InitSize(const UInt_t i)
44 {
45 fPixels->ExpandCreate(i);
46 }
47
48 // Getter functions
49 UInt_t GetNumPixels() const { return fPixels->GetEntriesFast(); }
50 Short_t GetNumIslands() const { return fNumIslands; };
51 Short_t GetNumSinglePixels() const { return fNumSinglePixels; }
52 Float_t GetSizeSinglePixels() const { return fSizeSinglePixels; }
53 Float_t GetSizeSubIslands() const { return fSizeSubIslands; }
54 Float_t GetSizeMainIsland() const { return fSizeMainIsland; }
55 Int_t GetNumPixelsSaturatedHiGain() const { return fNumPixelsSaturatedHiGain; }
56 Int_t GetNumPixelsSaturatedLoGain() const { return fNumPixelsSaturatedLoGain; }
57
58 // Setter functions for use in image cleaning classes only
59 void SetSinglePixels(Short_t num, Float_t size) { fNumSinglePixels=num; fSizeSinglePixels=size; }
60 void SetNumPixelsSaturated(UInt_t hi, UInt_t lo) { fNumPixelsSaturatedHiGain=hi;fNumPixelsSaturatedLoGain=lo; }
61
62 Bool_t IsPixelExisting(Int_t id) const;
63 Bool_t IsPixelUsed (Int_t id) const;
64 Bool_t IsPixelCore (Int_t id) const;
65
66 Float_t GetNumPhotonsMin(const MGeomCam *geom=NULL) const;
67 Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const;
68
69 Float_t GetRatioMin(const MGeomCam *geom=NULL) const;
70 Float_t GetRatioMax(const MGeomCam *geom=NULL) const;
71
72 Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const;
73 Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const;
74
75 // Getter functions to access single pixels
76 MSignalPix &operator[](int i) { return *(MSignalPix*)(fPixels->UncheckedAt(i)); }
77 MSignalPix &operator[](int i) const { return *(MSignalPix*)(fPixels->UncheckedAt(i)); }
78
79 MSignalPix *GetPixById(Int_t idx) const;
80
81 // Functions to change the contained data
82 void Scale(Double_t f) { fPixels->ForEach(MSignalPix, Scale)(f); }
83 Int_t CalcIslands(const MGeomCam &geom);
84
85 // class MParContainer
86 void Reset();
87
88 // class TObject
89 void Print(Option_t *opt=NULL) const;
90 void Clear(Option_t *opt=NULL) { Reset(); }
91
92 // class MCamEvent
93 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
94 void DrawPixelContent(Int_t num) const;
95
96 // To build an iterator for this class
97 operator TIterator*() const;
98
99 ClassDef(MSignalCam, 1) // class for an event containing cerenkov photons
100};
101
102class MSignalCamIter : public TObjArrayIter
103{
104private:
105 Bool_t fUsedOnly;
106 Int_t fIdx;
107
108public:
109 MSignalCamIter(const MSignalCam *evt, Bool_t usedonly=kTRUE, Bool_t dir=kIterForward) : TObjArrayIter(evt->fPixels, dir), fUsedOnly(usedonly), fIdx(-1) { }
110 TObject *Next();
111 void Reset() { fIdx=-1; TObjArrayIter::Reset(); }
112 TIterator &operator=(const TIterator &) { return *this; }
113 Int_t GetIdx() const { return fIdx; }
114 ClassDef(MSignalCamIter, 0)
115};
116
117inline MSignalCam::operator TIterator*() const { return new MSignalCamIter(this); }
118
119#endif
Note: See TracBrowser for help on using the repository browser.