source: branches/MarsMoreSimulationTruth/msignal/MSignalCam.h@ 19128

Last change on this file since 19128 was 17837, checked in by tbretz, 11 years ago
Allow to set island information (for the new image cleaning)
File size: 4.1 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 void SetIslandInfo(Short_t num, Float_t main, Float_t sub)
49 { fNumIslands = num; fSizeMainIsland=main; fSizeSubIslands=sub; }
50
51 // Getter functions
52 UInt_t GetNumPixels() const { return fPixels->GetEntriesFast(); }
53 Short_t GetNumIslands() const { return fNumIslands; };
54 Short_t GetNumSinglePixels() const { return fNumSinglePixels; }
55 Float_t GetSizeSinglePixels() const { return fSizeSinglePixels; }
56 Float_t GetSizeSubIslands() const { return fSizeSubIslands; }
57 Float_t GetSizeMainIsland() const { return fSizeMainIsland; }
58 Int_t GetNumPixelsSaturatedHiGain() const { return fNumPixelsSaturatedHiGain; }
59 Int_t GetNumPixelsSaturatedLoGain() const { return fNumPixelsSaturatedLoGain; }
60
61 Int_t GetNumPixelsUnmapped() const;
62
63 Float_t GetNumPhotonsMin(const MGeomCam *geom=NULL) const;
64 Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const;
65
66 Float_t GetRatioMin(const MGeomCam *geom=NULL) const;
67 Float_t GetRatioMax(const MGeomCam *geom=NULL) const;
68
69 Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const;
70 Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const;
71
72 // Getter functions to access single pixels
73 MSignalPix &operator[](int i) { return *(MSignalPix*)(fPixels->UncheckedAt(i)); }
74 MSignalPix &operator[](int i) const { return *(MSignalPix*)(fPixels->UncheckedAt(i)); }
75
76 // Functions to change the contained data
77 Int_t CalcIslands(const MGeomCam &geom);
78
79 // Functions for easy comparisons
80 Bool_t CompareCleaning(const MSignalCam &cam) const;
81 Bool_t CompareIslands(const MSignalCam &cam) const;
82
83 // class MParContainer
84 void Reset();
85
86 // class TObject
87 void Copy(TObject &obj) const;
88 void Print(Option_t *opt=NULL) const;
89 void Clear(Option_t *opt=NULL) { Reset(); }
90
91 // class MCamEvent
92 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
93 void DrawPixelContent(Int_t num) const;
94
95 // To build an iterator for this class
96 operator TIterator*() const;
97
98 ClassDef(MSignalCam, 2) // class for an event containing cerenkov photons
99};
100
101class MSignalCamIter : public TObjArrayIter
102{
103private:
104 Bool_t fUsedOnly;
105 Int_t fIdx;
106
107public:
108 MSignalCamIter(const MSignalCam *evt, Bool_t usedonly=kTRUE, Bool_t dir=kIterForward) : TObjArrayIter(evt->fPixels, dir), fUsedOnly(usedonly), fIdx(-1) { }
109 TObject *Next();
110 void Reset() { fIdx=-1; TObjArrayIter::Reset(); }
111 TIterator &operator=(const TIterator &) { return *this; }
112 Int_t GetIdx() const { return fIdx; }
113 ClassDef(MSignalCamIter, 0)
114};
115
116inline MSignalCam::operator TIterator*() const { return new MSignalCamIter(this); }
117
118#endif
Note: See TracBrowser for help on using the repository browser.