source: trunk/Mars/msignal/MSignalCam.h@ 15197

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