1 | #ifndef MARS_MHCamera
|
---|
2 | #define MARS_MHCamera
|
---|
3 |
|
---|
4 | #ifndef MARS_MAGIC
|
---|
5 | #include "MAGIC.h"
|
---|
6 | #endif
|
---|
7 | #ifndef ROOT_TArrayC
|
---|
8 | #include <TArrayC.h>
|
---|
9 | #endif
|
---|
10 | #ifndef ROOT_TArrayI
|
---|
11 | #include <TArrayI.h>
|
---|
12 | #endif
|
---|
13 | #ifndef ROOT_TClonesArray
|
---|
14 | #include <TClonesArray.h>
|
---|
15 | #endif
|
---|
16 | #ifndef ROOT_TH1
|
---|
17 | #include <TH1.h>
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | class MGeomCam;
|
---|
21 | class MCamEvent;
|
---|
22 | class MRflEvtData;
|
---|
23 | class MCerPhotEvt;
|
---|
24 | class MImgCleanStd;
|
---|
25 |
|
---|
26 | class MHCamera : public TH1D
|
---|
27 | {
|
---|
28 | private:
|
---|
29 | MGeomCam *fGeomCam; // pointer to camera geometry (y-axis)
|
---|
30 | TArrayC fUsed; // array containing flags
|
---|
31 |
|
---|
32 | TArrayI fColors; //! Color conversion table
|
---|
33 | TList *fNotify; //!
|
---|
34 |
|
---|
35 | //TGStatusBar *fStatusBar;
|
---|
36 |
|
---|
37 | Int_t GetColor(Float_t val, Float_t min, Float_t max, Bool_t islog);
|
---|
38 |
|
---|
39 | void Update(Bool_t islog, Bool_t isbox, Bool_t iscol);
|
---|
40 | void UpdateLegend(Float_t min, Float_t max, Bool_t islog);
|
---|
41 | void SetRange();
|
---|
42 |
|
---|
43 | Int_t GetPixelIndex(Int_t px, Int_t py) const;
|
---|
44 |
|
---|
45 | void PaintTitle();
|
---|
46 | void PaintAxisTitle();
|
---|
47 |
|
---|
48 | enum {
|
---|
49 | kIsUsed = BIT(1)
|
---|
50 | };
|
---|
51 |
|
---|
52 | Bool_t IsUsed(Int_t idx) const { return TESTBIT(const_cast<TArrayC&>(fUsed)[idx], kIsUsed); }
|
---|
53 | void SetUsed(Int_t idx) { SETBIT(fUsed[idx], kIsUsed); }
|
---|
54 | void ResetUsed(Int_t idx) { CLRBIT(fUsed[idx], kIsUsed); }
|
---|
55 |
|
---|
56 | // This is a trick to remove TH1 entries from the context menu
|
---|
57 | TH1 *Rebin(Int_t ngroup=2, const char*newname="") { return this; }
|
---|
58 | void DrawPanel() {}
|
---|
59 |
|
---|
60 | Int_t Fill(Axis_t x);
|
---|
61 | Int_t Fill(Axis_t x, Stat_t w);
|
---|
62 | Int_t Fill(const char *name, Stat_t w) { return -1; }
|
---|
63 | void FillN(Int_t ntimes, const Axis_t *x, const Double_t *w, Int_t stride=1) {}
|
---|
64 | void FillN(Int_t, const Axis_t *, const Axis_t *, const Double_t *, Int_t) {}
|
---|
65 |
|
---|
66 | public:
|
---|
67 | MHCamera();
|
---|
68 | MHCamera(const MGeomCam &geom, const char *name="", const char *title="");
|
---|
69 | ~MHCamera();
|
---|
70 |
|
---|
71 | //void AddPixContent(Int_t idx) const { AddBinContent(idx+1); }
|
---|
72 | //void AddPixContent(Int_t idx, Stat_t w) const { AddBinContent(idx+1, w); }
|
---|
73 |
|
---|
74 | // This is a trick to remove TH1 entries from the context menu
|
---|
75 | /*
|
---|
76 | void Add(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1) { TH1::Add(h1, h2, c1, c2); }
|
---|
77 | void Add(TF1 *h1, Double_t c1=1) { TH1::Add(h1, c1); }
|
---|
78 | void Add(const TH1 *h1, Double_t c1=1) { TH1::Add(h1, c1); }
|
---|
79 | void Divide(TF1 *f1, Double_t c1=1) { TH1::Divide(f1, c1); }
|
---|
80 | void Divide(const TH1 *h1) { TH1::Divide(h1); }
|
---|
81 | void Divide(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") { TH1::Divide(h1, h2, c1, c2, option); }
|
---|
82 | void Multiply(TF1 *h1, Double_t c1=1) { TH1::Multiply(h1, c1); }
|
---|
83 | void Multiply(const TH1 *h1) { TH1::Multiply(h1); }
|
---|
84 | void Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") { TH1::Multiply(h1, h2, c1, c2, option); }
|
---|
85 | */
|
---|
86 |
|
---|
87 | void FitPanel() { TH1::FitPanel(); }
|
---|
88 |
|
---|
89 | virtual Double_t GetPixContent(Int_t idx) const { return GetBinContent(idx+1); }
|
---|
90 | virtual void AddCamContent(const MCamEvent &evt, Int_t type=0);
|
---|
91 | virtual void AddCamContent(const MHCamera &evt, Int_t type=0);
|
---|
92 | virtual void AddCamContent(const TArrayD &arr, Bool_t ispos=kTRUE);
|
---|
93 | virtual void SetCamContent(const MCamEvent &evt, Int_t type=0) { Reset(); AddCamContent(evt, type); }
|
---|
94 | virtual void SetCamContent(const TArrayD &evt, Bool_t ispos=kTRUE) { Reset(); AddCamContent(evt, ispos); }
|
---|
95 | virtual void SetCamContent(const MHCamera &d, Int_t type=0) { Reset(), AddCamContent(d, type); }
|
---|
96 | virtual void CntCamContent(const MCamEvent &evt, Double_t threshold, Int_t type=0);
|
---|
97 | virtual void CntCamContent(const TArrayD &evt, Double_t threshold, Bool_t ispos=kTRUE);
|
---|
98 |
|
---|
99 | Double_t GetMinimum(Bool_t all) const;
|
---|
100 | Double_t GetMaximum(Bool_t all) const;
|
---|
101 |
|
---|
102 | Double_t GetMinimum() const { return GetMinimum(0/*kTRUE*/); }
|
---|
103 | Double_t GetMaximum() const { return GetMaximum(0/*kTRUE*/); }
|
---|
104 |
|
---|
105 | void FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2);
|
---|
106 | void FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean);
|
---|
107 |
|
---|
108 | void FillRandom(const char *fname, Int_t ntimes=5000) { TH1::FillRandom(fname, ntimes); }
|
---|
109 | void FillRandom(TH1 *h, Int_t ntimes=5000) { TH1::FillRandom(h, ntimes); }
|
---|
110 | void FillRandom();
|
---|
111 |
|
---|
112 | void DrawPixelIndices();
|
---|
113 |
|
---|
114 | void PrintInfo() const { Print(""); } // *MENU*
|
---|
115 | void Print(Option_t *) const;
|
---|
116 | void Paint(Option_t *option="");
|
---|
117 | void Reset(Option_t * = "");
|
---|
118 | void Draw(Option_t *option="");
|
---|
119 | void SavePrimitive(ofstream &out, Option_t *);
|
---|
120 | Int_t DistancetoPrimitive(Int_t px, Int_t py);
|
---|
121 | char *GetObjectInfo(Int_t px, Int_t py) const;
|
---|
122 | void ExecuteEvent(Int_t event, Int_t px, Int_t py);
|
---|
123 |
|
---|
124 | void SetPalette(Int_t ncolors, Int_t *colors);
|
---|
125 |
|
---|
126 | void SetPrettyPalette(); // *MENU*
|
---|
127 | void SetDeepBlueSeaPalette(); // *MENU*
|
---|
128 | void SetInvDeepBlueSeaPalette(); // *MENU*
|
---|
129 |
|
---|
130 | void SetAutoScale(); // *MENU*
|
---|
131 |
|
---|
132 | void SetPix(const Int_t pixnum, const Int_t color, Float_t min, Float_t max); // New function added by M.Lopez in 31-01-03
|
---|
133 |
|
---|
134 | void AddNotify(const MCamEvent &event) { fNotify->Add((TObject*)(&event)); }
|
---|
135 |
|
---|
136 | //void SetStatusBar(TGStatusBar *bar) { fStatusBar = bar; }
|
---|
137 |
|
---|
138 | ClassDef(MHCamera, 1) // Displays the magic camera
|
---|
139 | };
|
---|
140 |
|
---|
141 | inline void MHCamera::SetAutoScale() { fMinimum = fMaximum = -1111; }
|
---|
142 |
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | /* ------------ OK ---------------
|
---|
146 | virtual void Browse(TBrowser *b);
|
---|
147 | virtual void FillRandom(const char *fname, Int_t ntimes=5000);
|
---|
148 | virtual void FillRandom(TH1 *h, Int_t ntimes=5000);
|
---|
149 |
|
---|
150 | virtual Int_t GetQuantiles(Int_t nprobSum, Double_t *q, const Double_t *probSum=0);
|
---|
151 | virtual Axis_t GetRandom();
|
---|
152 | virtual void GetStats(Stat_t *stats) const;
|
---|
153 | virtual Stat_t GetSumOfWeights() const;
|
---|
154 | virtual Int_t GetSumw2N() const {return fSumw2.fN;}
|
---|
155 | virtual Stat_t GetRMS(Int_t axis=1) const;
|
---|
156 |
|
---|
157 | virtual Int_t GetNbinsX() const {return fXaxis.GetNbins();}
|
---|
158 | virtual Int_t GetNbinsY() const {return fYaxis.GetNbins();}
|
---|
159 | virtual Int_t GetNbinsZ() const {return fZaxis.GetNbins();}
|
---|
160 |
|
---|
161 | // ------------- to check -------------------
|
---|
162 |
|
---|
163 | virtual Double_t ComputeIntegral();
|
---|
164 | virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
|
---|
165 | virtual void Draw(Option_t *option="");
|
---|
166 | virtual TH1 *DrawCopy(Option_t *option="") const;
|
---|
167 | virtual TH1 *DrawNormalized(Option_t *option="", Double_t norm=1) const;
|
---|
168 | virtual Int_t BufferEmpty(Bool_t deleteBuffer=kFALSE);
|
---|
169 | virtual void Eval(TF1 *f1, Option_t *option="");
|
---|
170 | virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
|
---|
171 | virtual void FillN(Int_t ntimes, const Axis_t *x, const Double_t *w, Int_t stride=1);
|
---|
172 | virtual void FillN(Int_t, const Axis_t *, const Axis_t *, const Double_t *, Int_t) {;}
|
---|
173 | virtual Int_t FindBin(Axis_t x, Axis_t y=0, Axis_t z=0);
|
---|
174 | virtual TObject *FindObject(const char *name) const;
|
---|
175 | virtual TObject *FindObject(const TObject *obj) const;
|
---|
176 | virtual Int_t Fit(const char *formula ,Option_t *option="" ,Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0); // *MENU*
|
---|
177 | virtual Int_t Fit(TF1 *f1 ,Option_t *option="" ,Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0);
|
---|
178 | virtual void FitPanel(); // *MENU*
|
---|
179 | TH1 *GetAsymmetry(TH1* h2, Double_t c2=1, Double_t dc2=0);
|
---|
180 | Int_t GetBufferLength() const {return (Int_t)fBuffer[0];}
|
---|
181 | Int_t GetBufferSize () const {return fBufferSize;}
|
---|
182 | const Double_t *GetBuffer() const {return fBuffer;}
|
---|
183 | static Int_t GetDefaultBufferSize();
|
---|
184 | virtual Double_t *GetIntegral() {return fIntegral;}
|
---|
185 |
|
---|
186 | TList *GetListOfFunctions() const { return fFunctions; }
|
---|
187 |
|
---|
188 | virtual Int_t GetNdivisions(Option_t *axis="X") const;
|
---|
189 | virtual Color_t GetAxisColor(Option_t *axis="X") const;
|
---|
190 | virtual Color_t GetLabelColor(Option_t *axis="X") const;
|
---|
191 | virtual Style_t GetLabelFont(Option_t *axis="X") const;
|
---|
192 | virtual Float_t GetLabelOffset(Option_t *axis="X") const;
|
---|
193 | virtual Float_t GetLabelSize(Option_t *axis="X") const;
|
---|
194 | virtual Float_t GetTitleOffset(Option_t *axis="X") const;
|
---|
195 | virtual Float_t GetTitleSize(Option_t *axis="X") const;
|
---|
196 | virtual Float_t GetTickLength(Option_t *axis="X") const;
|
---|
197 | virtual Float_t GetBarOffset() const {return Float_t(0.001*Float_t(fBarOffset));}
|
---|
198 | virtual Float_t GetBarWidth() const {return Float_t(0.001*Float_t(fBarWidth));}
|
---|
199 | virtual Int_t GetContour(Double_t *levels=0);
|
---|
200 | virtual Double_t GetContourLevel(Int_t level) const;
|
---|
201 | virtual Double_t GetContourLevelPad(Int_t level) const;
|
---|
202 |
|
---|
203 | virtual void GetCenter(Axis_t *center) const {fXaxis.GetCenter(center);}
|
---|
204 | TDirectory *GetDirectory() const {return fDirectory;}
|
---|
205 | virtual Stat_t GetEntries() const;
|
---|
206 | virtual TF1 *GetFunction(const char *name) const;
|
---|
207 | virtual Int_t GetDimension() const { return fDimension; }
|
---|
208 | virtual void GetLowEdge(Axis_t *edge) const {fXaxis.GetLowEdge(edge);}
|
---|
209 | virtual Double_t GetMaximum() const;
|
---|
210 | virtual Int_t GetMaximumBin() const;
|
---|
211 | virtual Int_t GetMaximumBin(Int_t &locmax, Int_t &locmay, Int_t &locmaz) const;
|
---|
212 | virtual Double_t GetMaximumStored() const {return fMaximum;}
|
---|
213 | virtual Double_t GetMinimum() const;
|
---|
214 | virtual Int_t GetMinimumBin() const;
|
---|
215 | virtual Int_t GetMinimumBin(Int_t &locmix, Int_t &locmiy, Int_t &locmiz) const;
|
---|
216 | virtual Double_t GetMinimumStored() const {return fMinimum;}
|
---|
217 | virtual Stat_t GetMean(Int_t axis=1) const;
|
---|
218 | virtual Double_t GetNormFactor() const {return fNormFactor;}
|
---|
219 | virtual char *GetObjectInfo(Int_t px, Int_t py) const;
|
---|
220 | Option_t *GetOption() const {return fOption.Data();}
|
---|
221 |
|
---|
222 | TVirtualHistPainter *GetPainter();
|
---|
223 |
|
---|
224 | TAxis *GetXaxis() const;
|
---|
225 | TAxis *GetYaxis() const;
|
---|
226 | TAxis *GetZaxis() const;
|
---|
227 | virtual Stat_t Integral(Option_t *option="") const;
|
---|
228 | virtual Stat_t Integral(Int_t binx1, Int_t binx2, Option_t *option="") const;
|
---|
229 | virtual Stat_t Integral(Int_t, Int_t, Int_t, Int_t, Option_t * ="") const {return 0;}
|
---|
230 | virtual Stat_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t * ="" ) const {return 0;}
|
---|
231 | virtual Double_t KolmogorovTest(TH1 *h2, Option_t *option="") const;
|
---|
232 | virtual void LabelsDeflate(Option_t *axis="X");
|
---|
233 | virtual void LabelsInflate(Option_t *axis="X");
|
---|
234 | virtual void LabelsOption(Option_t *option="h", Option_t *axis="X");
|
---|
235 | virtual Int_t Merge(TCollection *list);
|
---|
236 | virtual void Multiply(TF1 *h1, Double_t c1=1);
|
---|
237 | virtual void Multiply(const TH1 *h1);
|
---|
238 | virtual void Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option=""); // *MENU*
|
---|
239 | virtual void Paint(Option_t *option="");
|
---|
240 | virtual void Print(Option_t *option="") const;
|
---|
241 | virtual void PutStats(Stat_t *stats);
|
---|
242 | virtual TH1 *Rebin(Int_t ngroup=2, const char*newname=""); // *MENU*
|
---|
243 | virtual void RebinAxis(Axis_t x, Option_t *axis="X");
|
---|
244 | virtual void Rebuild(Option_t *option="");
|
---|
245 | virtual void RecursiveRemove(TObject *obj);
|
---|
246 | virtual void Reset(Option_t *option="");
|
---|
247 | virtual void SavePrimitive(ofstream &out, Option_t *option);
|
---|
248 | virtual void Scale(Double_t c1=1);
|
---|
249 | virtual void SetAxisColor(Color_t color=1, Option_t *axis="X");
|
---|
250 | virtual void SetAxisRange(Axis_t xmin, Axis_t xmax, Option_t *axis="X");
|
---|
251 | virtual void SetBarOffset(Float_t offset=0.25) {fBarOffset = Short_t(1000*offset);}
|
---|
252 | virtual void SetBarWidth(Float_t width=0.5) {fBarWidth = Short_t(1000*width);}
|
---|
253 | virtual void SetBinContent(Int_t bin, Stat_t content);
|
---|
254 | virtual void SetBinContent(Int_t binx, Int_t biny, Stat_t content);
|
---|
255 | virtual void SetBinContent(Int_t binx, Int_t biny, Int_t binz, Stat_t content);
|
---|
256 | virtual void SetBinError(Int_t bin, Stat_t error);
|
---|
257 | virtual void SetBinError(Int_t binx, Int_t biny, Stat_t error);
|
---|
258 | virtual void SetBinError(Int_t binx, Int_t biny, Int_t binz, Stat_t error);
|
---|
259 | virtual void SetBins(Int_t nx, Axis_t xmin, Axis_t xmax);
|
---|
260 | virtual void SetBins(Int_t nx, Axis_t xmin, Axis_t xmax, Int_t ny, Axis_t ymin, Axis_t ymax);
|
---|
261 | virtual void SetBins(Int_t nx, Axis_t xmin, Axis_t xmax, Int_t ny, Axis_t ymin, Axis_t ymax,
|
---|
262 | Int_t nz, Axis_t zmin, Axis_t zmax);
|
---|
263 | virtual void SetBinsLength(Int_t = -1) { } //refefined in derived classes
|
---|
264 | virtual void SetBuffer(Int_t buffersize, Option_t *option="");
|
---|
265 | virtual void SetCellContent(Int_t binx, Int_t biny, Stat_t content);
|
---|
266 | virtual void SetCellError(Int_t binx, Int_t biny, Stat_t content);
|
---|
267 | virtual void SetContent(const Stat_t *content);
|
---|
268 | virtual void SetContour(Int_t nlevels, const Double_t *levels=0);
|
---|
269 | virtual void SetContourLevel(Int_t level, Double_t value);
|
---|
270 | static void SetDefaultBufferSize(Int_t buffersize=1000);
|
---|
271 | virtual void SetDirectory(TDirectory *dir);
|
---|
272 | virtual void SetEntries(Stat_t n) {fEntries = n;};
|
---|
273 | virtual void SetError(const Stat_t *error);
|
---|
274 | virtual void SetLabelColor(Color_t color=1, Option_t *axis="X");
|
---|
275 | virtual void SetLabelFont(Style_t font=62, Option_t *axis="X");
|
---|
276 | virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X");
|
---|
277 | virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="X");
|
---|
278 |
|
---|
279 | virtual void SetMaximum(Double_t maximum=-1111); // *MENU*
|
---|
280 | virtual void SetMinimum(Double_t minimum=-1111); // *MENU*
|
---|
281 | virtual void SetName(const char *name); // *MENU*
|
---|
282 | virtual void SetNameTitle(const char *name, const char *title);
|
---|
283 | virtual void SetNdivisions(Int_t n=510, Option_t *axis="X");
|
---|
284 | virtual void SetNormFactor(Double_t factor=1) {fNormFactor = factor;}
|
---|
285 | virtual void SetStats(Bool_t stats=kTRUE);
|
---|
286 | virtual void SetOption(Option_t *option=" ") {fOption = option;}
|
---|
287 | virtual void SetTickLength(Float_t length=0.02, Option_t *axis="X");
|
---|
288 | virtual void SetTitleOffset(Float_t offset=1, Option_t *axis="X");
|
---|
289 | virtual void SetTitleSize(Float_t size=0.02, Option_t *axis="X");
|
---|
290 | virtual void SetTitle(const char *title);
|
---|
291 | virtual void SetXTitle(const char *title) {fXaxis.SetTitle(title);}
|
---|
292 | virtual void SetYTitle(const char *title) {fYaxis.SetTitle(title);}
|
---|
293 | virtual void SetZTitle(const char *title) {fZaxis.SetTitle(title);}
|
---|
294 | virtual void Smooth(Int_t ntimes=1); // *MENU*
|
---|
295 | static void SmoothArray(Int_t NN, Double_t *XX, Int_t ntimes=1);
|
---|
296 | static Double_t SmoothMedian(Int_t n, Double_t *a);
|
---|
297 | virtual void Sumw2();
|
---|
298 | void UseCurrentStyle();
|
---|
299 |
|
---|
300 | ClassDef(TH1,4) //1-Dim histogram base class
|
---|
301 | };
|
---|
302 |
|
---|
303 | */
|
---|