source: trunk/MagicSoft/Mars/mhist/MHCamera.h@ 2384

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