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