source: trunk/MagicSoft/Mars/mhbase/MH3.cc@ 8670

Last change on this file since 8670 was 8669, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 21.6 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz 2002 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2007
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MH3
28//
29// With this histogram you can fill a histogram with up to three
30// variables from Mars parameter containers in an eventloop.
31//
32// In the constructor you can give up to three variables which should be
33// filled in the histogram. Dependend on the number of given variables
34// (data members) a TH1D, TH2D or TH3D is created.
35// Specify the data mamber like the following:
36// "MHillas.fLength"
37// Where MHillas is the name of the parameter container in the parameter
38// list and fLength is the name of the data member which should be filled
39// in the histogram. Assuming that your MHillas container has a different
40// name (MyHillas) the name to give would be:
41// "MyHillas.fLength"
42//
43// If you want to use a different unit for histogramming use SetScaleX,
44// SetScaleY and SetScaleZ.
45//
46//
47// Binning name
48// ============
49//
50// The axis binning is retrieved from the parameter list, too. Create a
51// MBinning with the name "Binning" plus the name of your MH3 container
52// plus the axis name ("X", "Y" or "Z") and add it to the parameter list.
53//
54// If the binning should have a different name than the histogram name
55// the binning name can be added to the name, eg.:
56// SetName("MyHistName;MyBinning")
57// Instead of BinningMyHistName[XYZ] the parameter list will be searched
58// for BinningMyBinning[XYZ].
59//
60//
61// Axis titles
62// ===========
63//
64// 1) If no other title is given the rule for this axis is used.
65// 2) If the MBinning used for this axis has a non-default Title
66// (MBinning::HasTitle) this title is used for the corresponding axis
67// 3) If the MH3 has a non-default title (MH3::SetTitle called)
68// this title is set as the histogram title. It can be used to overwrite
69// the axis titles. For more information see TH1::SetTitle, eg.
70// SetTitle("MyHist;x[mm];y[cm];Counts");
71//
72//
73// For example:
74// MH3 myhist("MHillas.fLength");
75// myhist.SetName("MyHist");
76// myhist.SetScaleX(geomcam.GetConvMm2Deg()); //convert length to degree
77// MBinning bins("BinningMyHistX");
78// bins.SetEdges(10, 0, 150);
79// plist.AddToList(&myhist);
80// plist.AddToList(&bins);
81//
82//
83// Class Version 2:
84// ----------------
85// - MDataChain *fData[3]; // Object from which the data is filled
86// + MData *fData[3]; // Object from which the data is filled
87//
88//
89/////////////////////////////////////////////////////////////////////////////
90#include "MH3.h"
91
92#include <ctype.h> // tolower
93#include <fstream>
94
95#include <TPad.h>
96#include <TStyle.h>
97#include <TCanvas.h>
98
99#include <TH2.h>
100#include <TH3.h>
101#include <TProfile.h>
102#include <TProfile2D.h>
103
104#include "MLog.h"
105#include "MLogManip.h"
106
107#include "MParList.h"
108#include "MBinning.h"
109#include "MDataPhrase.h"
110
111ClassImp(MH3);
112
113using namespace std;
114
115const TString MH3::gsDefName = "MH3";
116const TString MH3::gsDefTitle = "Container for a n-D Mars Histogram";
117
118// --------------------------------------------------------------------------
119//
120// Default constructor.
121//
122MH3::MH3(const unsigned int dim)
123 : fDimension(dim>3?3:dim), fHist(NULL)
124{
125 switch (fDimension)
126 {
127 case 1:
128 fHist = new TH1D;
129 fHist->SetYTitle("Counts");
130 break;
131 case 2:
132 fHist = new TH2D;
133 fHist->SetZTitle("Counts");
134 break;
135 case 3:
136 fHist = new TH3D;
137 break;
138 }
139
140 fData[0] = NULL;
141 fData[1] = NULL;
142 fData[2] = NULL;
143
144 fName = gsDefName;
145 fTitle = gsDefTitle;
146
147 if (fHist)
148 {
149 fHist->SetDirectory(NULL);
150 fHist->UseCurrentStyle();
151 }
152
153 fScale[0] = 1;
154 fScale[1] = 1;
155 fScale[2] = 1;
156}
157
158// --------------------------------------------------------------------------
159//
160// Creates an TH1D. memberx is filled into the X-bins. For a more detailed
161// description see the class description above.
162//
163MH3::MH3(const char *memberx)
164 : fDimension(1)
165{
166 fHist = new TH1D;
167
168 fData[0] = new MDataPhrase(memberx);
169 fData[1] = NULL;
170 fData[2] = NULL;
171
172 fName = gsDefName;
173 fTitle = gsDefTitle;
174
175 fHist->UseCurrentStyle();
176 fHist->SetDirectory(NULL);
177 fHist->SetYTitle("Counts");
178
179 fScale[0] = 1;
180 fScale[1] = 1;
181 fScale[2] = 1;
182}
183
184MH3::MH3(const TH1 &h1) : fDimension(1)
185{
186 if (h1.InheritsFrom(TH3::Class()))
187 fDimension = 3;
188 if (h1.InheritsFrom(TH2::Class()))
189 fDimension = 2;
190
191 fData[0] = NULL;
192 fData[1] = NULL;
193 fData[2] = NULL;
194
195 switch (fDimension)
196 {
197 case 3:
198 fData[2] = new MDataPhrase(h1.GetZaxis()->GetTitle());
199 case 2:
200 fData[1] = new MDataPhrase(h1.GetYaxis()->GetTitle());
201 case 1:
202 fData[0] = new MDataPhrase(h1.GetXaxis()->GetTitle());
203 }
204
205 fName = gsDefName;
206 fTitle = gsDefTitle;
207
208 fHist = (TH1*)h1.Clone();
209 fHist->SetDirectory(NULL);
210
211 fScale[0] = 1;
212 fScale[1] = 1;
213 fScale[2] = 1;
214}
215
216// --------------------------------------------------------------------------
217//
218// Creates an TH2D. memberx is filled into the X-bins. membery is filled
219// into the Y-bins. For a more detailed description see the class
220// description above.
221//
222MH3::MH3(const char *memberx, const char *membery)
223 : fDimension(2)
224{
225 fHist = new TH2D;
226
227 fData[0] = new MDataPhrase(memberx);
228 fData[1] = new MDataPhrase(membery);
229 fData[2] = NULL;
230
231 fName = gsDefName;
232 fTitle = gsDefTitle;
233
234 fHist->UseCurrentStyle();
235 fHist->SetDirectory(NULL);
236 fHist->SetZTitle("Counts");
237
238 fScale[0] = 1;
239 fScale[1] = 1;
240 fScale[2] = 1;
241}
242
243// --------------------------------------------------------------------------
244//
245// Creates an TH3D. memberx is filled into the X-bins. membery is filled
246// into the Y-bins. membery is filled into the Z-bins. For a more detailed
247// description see the class description above.
248//
249MH3::MH3(const char *memberx, const char *membery, const char *memberz)
250 : fDimension(3)
251{
252 fHist = new TH3D;
253
254 fData[0] = new MDataPhrase(memberx);
255 fData[1] = new MDataPhrase(membery);
256 fData[2] = new MDataPhrase(memberz);
257
258 fName = gsDefName;
259 fTitle = gsDefTitle;
260
261 fHist->UseCurrentStyle();
262 fHist->SetDirectory(NULL);
263
264 fScale[0] = 1;
265 fScale[1] = 1;
266 fScale[2] = 1;
267}
268
269// --------------------------------------------------------------------------
270//
271// Deletes the histogram
272//
273MH3::~MH3()
274{
275 delete fHist;
276
277 for (int i=0; i<3; i++)
278 if (fData[i])
279 delete fData[i];
280}
281
282// --------------------------------------------------------------------------
283//
284// Return the data members used by the data chain to be used in
285// MTask::AddBranchToList
286//
287TString MH3::GetDataMember() const
288{
289 TString str=fData[0]->GetDataMember();
290 if (fData[1])
291 {
292 str += ";";
293 str += fData[1]->GetDataMember();
294 }
295 if (fData[2])
296 {
297 str += ";";
298 str += fData[2]->GetDataMember();
299 }
300 return str;
301}
302
303// --------------------------------------------------------------------------
304//
305// Setup the Binning for the histograms automatically if the correct
306// instances of MBinning are found in the parameter list
307// For a more detailed description see class description above.
308//
309Bool_t MH3::SetupFill(const MParList *plist)
310{
311 // reset histogram (necessary if the same eventloop is run more than once)
312 fHist->Reset();
313
314 const Int_t split = fName.First(';');
315
316 const TString name = split<0 ? fName : fName(0, split);
317 const TString bins = split<0 ? fName : fName(split+1, fName.Length());
318
319 TString bname("Binning");
320 bname += bins;
321
322 MBinning *binsx = NULL;
323 MBinning *binsy = NULL;
324 MBinning *binsz = NULL;
325
326 switch (fDimension)
327 {
328 case 3:
329 binsz = (MBinning*)plist->FindObject(bname+"Z", "MBinning");
330 if (!binsz)
331 {
332 *fLog << err << dbginf << "MBinning '" << bname << "X' not found... aborting." << endl;
333 return kFALSE;
334 }
335 if (fData[2] && !fData[2]->PreProcess(plist))
336 return kFALSE;
337 if (fData[2])
338 fHist->SetZTitle(fData[2]->GetTitle());
339 if (binsz->HasTitle())
340 fHist->SetZTitle(binsz->GetTitle());
341 if (binsz->IsLogarithmic())
342 fHist->SetBit(kIsLogz);
343 case 2:
344 binsy = (MBinning*)plist->FindObject(bname+"Y", "MBinning");
345 if (!binsy)
346 {
347 *fLog << err << dbginf << "MBinning '" << bname << "Y' not found... aborting." << endl;
348 return kFALSE;
349 }
350 if (fData[1] && !fData[1]->PreProcess(plist))
351 return kFALSE;
352 if (fData[1])
353 fHist->SetYTitle(fData[1]->GetTitle());
354 if (binsy->HasTitle())
355 fHist->SetYTitle(binsy->GetTitle());
356 if (binsy->IsLogarithmic())
357 fHist->SetBit(kIsLogy);
358 case 1:
359 binsx = (MBinning*)plist->FindObject(bname+"X", "MBinning");
360 if (!binsx)
361 {
362 if (fDimension==1)
363 binsx = (MBinning*)plist->FindObject(bname, "MBinning");
364
365 if (!binsx)
366 {
367 *fLog << err << dbginf << "Neither MBinning '" << bname << "X' nor '" << bname << "' found... aborting." << endl;
368 return kFALSE;
369 }
370 }
371 if (fData[0] && !fData[0]->PreProcess(plist))
372 return kFALSE;
373 if (fData[0]!=NULL)
374 fHist->SetXTitle(fData[0]->GetTitle());
375 if (binsx->HasTitle())
376 fHist->SetXTitle(binsx->GetTitle());
377 if (binsx->IsLogarithmic())
378 fHist->SetBit(kIsLogx);
379 }
380
381 TString title("Histogram for ");
382 title += name;
383 title += Form(" (%dD)", fDimension);
384
385 fHist->SetName(name);
386 fHist->SetTitle(fTitle==gsDefTitle ? title : fTitle);
387 fHist->SetDirectory(0);
388
389 switch (fDimension)
390 {
391 case 1:
392 SetBinning(fHist, binsx);
393 return kTRUE;
394 case 2:
395 SetBinning((TH2*)fHist, binsx, binsy);
396 return kTRUE;
397 case 3:
398 SetBinning((TH3*)fHist, binsx, binsy, binsz);
399 return kTRUE;
400 }
401
402 *fLog << err << "ERROR - MH3 has " << fDimension << " dimensions!" << endl;
403 return kFALSE;
404}
405
406// --------------------------------------------------------------------------
407//
408// Set the name of the histogram ant the MH3 container
409//
410void MH3::SetName(const char *name)
411{
412 if (fHist)
413 {
414 if (gPad)
415 {
416 const TString pfx(Form("%sProfX", fHist->GetName()));
417 const TString pfy(Form("%sProfY", fHist->GetName()));
418
419 TProfile *p = 0;
420 if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfx))))
421 p->SetName(Form("%sProfX", name));
422 if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfy))))
423 p->SetName(Form("%sProfY", name));
424 }
425
426 fHist->SetName(name);
427 fHist->SetDirectory(0);
428
429 }
430 MParContainer::SetName(name);
431}
432
433// --------------------------------------------------------------------------
434//
435// Set the title of the histogram ant the MH3 container
436//
437void MH3::SetTitle(const char *title)
438{
439 if (fHist)
440 fHist->SetTitle(title);
441 MParContainer::SetTitle(title);
442}
443
444// --------------------------------------------------------------------------
445//
446// Fills the one, two or three data members into our histogram
447//
448Bool_t MH3::Fill(const MParContainer *par, const Stat_t w)
449{
450 Double_t x=0;
451 Double_t y=0;
452 Double_t z=0;
453
454 switch (fDimension)
455 {
456 case 3:
457 z = fData[2]->GetValue()*fScale[2];
458 case 2:
459 y = fData[1]->GetValue()*fScale[1];
460 case 1:
461 x = fData[0]->GetValue()*fScale[0];
462 }
463
464 switch (fDimension)
465 {
466 case 3:
467 ((TH3*)fHist)->Fill(x, y, z, w);
468 return kTRUE;
469 case 2:
470 ((TH2*)fHist)->Fill(x, y, w);
471 return kTRUE;
472 case 1:
473 fHist->Fill(x, w);
474 return kTRUE;
475 }
476
477 return kFALSE;
478}
479/*
480// --------------------------------------------------------------------------
481//
482// Set the palette you wanna use:
483// - you could set the root "Pretty Palette Violet->Red" by
484// gStyle->SetPalette(1, 0), but in some cases this may look
485// confusing
486// - The maximum colors root allowes us to set by ourself
487// is 50 (idx: 51-100). This colors are set to a grayscaled
488// palette
489// - the number of contours must be two less than the number
490// of palette entries
491//
492void MHStarMap::PrepareDrawing() const
493{
494 const Int_t numg = 32; // number of gray scaled colors
495 const Int_t numw = 32; // number of white
496
497 Int_t palette[numg+numw];
498
499 //
500 // The first half of the colors are white.
501 // This is some kind of optical background supression
502 //
503 gROOT->GetColor(51)->SetRGB(1, 1, 1);
504
505 Int_t i;
506 for (i=0; i<numw; i++)
507 palette[i] = 51;
508
509 //
510 // now the (gray) scaled part is coming
511 //
512 for (;i<numw+numg; i++)
513 {
514 const Float_t gray = 1.0-(float)(i-numw)/(numg-1.0);
515
516 gROOT->GetColor(52+i)->SetRGB(gray, gray, gray);
517 palette[i] = 52+i;
518 }
519
520 //
521 // Set the palette and the number of contour levels
522 //
523 gStyle->SetPalette(numg+numw, palette);
524 fStarMap->SetContour(numg+numw-2);
525}
526*/
527// --------------------------------------------------------------------------
528//
529// Setup a inversed deep blue sea palette for the fCenter histogram.
530//
531void MH3::SetColors() const
532{
533 // FIXME: This must be redone each time the canvas is repainted....
534 gStyle->SetPalette(51, NULL);
535 Int_t c[50];
536 for (int i=0; i<50; i++)
537 c[49-i] = gStyle->GetColorPalette(i);
538 gStyle->SetPalette(50, c);
539}
540
541void MH3::Paint(Option_t *o)
542{
543 TProfile *p=0;
544
545 const TString pfx(Form("%sProfX", fHist->GetName()));
546 if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfx))))
547 {
548 Int_t col = p->GetLineColor();
549 p = ((TH2*)fHist)->ProfileX(pfx, -1, 9999, "s");
550 p->SetLineColor(col);
551 }
552
553 const TString pfy(Form("%sProfY", fHist->GetName()));
554 if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfy))))
555 {
556 Int_t col = p->GetLineColor();
557 p = ((TH2*)fHist)->ProfileY(pfy, -1, 9999, "s");
558 p->SetLineColor(col);
559 }
560
561 if (fHist->TestBit(kIsLogx) && fHist->GetEntries()>0) gPad->SetLogx();
562 if (fHist->TestBit(kIsLogy) && fHist->GetEntries()>0) gPad->SetLogy();
563 if (fHist->TestBit(kIsLogz) && fHist->GetEntries()>0) gPad->SetLogz();
564}
565
566// --------------------------------------------------------------------------
567//
568// Creates a new canvas and draws the histogram into it.
569//
570// Possible options are:
571// PROFX: Draw a x-profile into the histogram (for 2D histograms only)
572// PROFY: Draw a y-profile into the histogram (for 2D histograms only)
573// ONLY: Draw the profile histogram only (for 2D histograms only)
574// BLUE: Draw the profile in blue color instead of the histograms line color
575//
576// If the kIsLog?-Bit is set the axis is displayed lkogarithmically.
577// eg this is set when applying a logarithmic MBinning
578//
579// Be careful: The histogram belongs to this object and won't get deleted
580// together with the canvas.
581//
582void MH3::Draw(Option_t *opt)
583{
584 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist);
585 pad->SetBorderMode(0);
586 pad->SetGridx();
587 pad->SetGridy();
588
589 fHist->SetFillStyle(4000);
590
591 TString str(opt);
592 str.ToLower();
593
594 const Bool_t only = str.Contains("only") && fDimension==2;
595 const Bool_t same = str.Contains("same") && fDimension<3;
596 const Bool_t blue = str.Contains("blue") && fDimension==2;
597 const Bool_t profx = str.Contains("profx") && fDimension==2;
598 const Bool_t profy = str.Contains("profy") && fDimension==2;
599
600 str.ReplaceAll("only", "");
601 str.ReplaceAll("blue", "");
602 str.ReplaceAll("profx", "");
603 str.ReplaceAll("profy", "");
604 str.ReplaceAll(" ", "");
605
606 if (same && fDimension==1)
607 {
608 fHist->SetLineColor(kBlue);
609 fHist->SetMarkerColor(kBlue);
610 }
611
612 // FIXME: We may have to remove all our own options from str!
613 if (!only)
614 fHist->Draw(str);
615
616 AppendPad();
617
618 TProfile *p=0;
619 if (profx)
620 {
621 const TString pfx(Form("%sProfX", fHist->GetName()));
622
623 if (same && (p=dynamic_cast<TProfile*>(gPad->FindObject(pfx))))
624 *fLog << warn << "TProfile " << pfx << " already in pad." << endl;
625
626 p = ((TH2*)fHist)->ProfileX(pfx, -1, 9999, "s");
627 p->UseCurrentStyle();
628 p->SetLineColor(blue ? kBlue : fHist->GetLineColor());
629 p->SetBit(kCanDelete);
630 p->SetDirectory(NULL);
631 p->SetXTitle(fHist->GetXaxis()->GetTitle());
632 p->SetYTitle(fHist->GetYaxis()->GetTitle());
633 p->Draw(only&&!same?"":"same");
634 }
635 if (profy)
636 {
637 const TString pfy(Form("%sProfY", fHist->GetName()));
638
639 if (same && (p=dynamic_cast<TProfile*>(gPad->FindObject(pfy))))
640 *fLog << warn << "TProfile " << pfy << " already in pad." << endl;
641
642 p = ((TH2*)fHist)->ProfileY(pfy, -1, 9999, "s");
643 p->UseCurrentStyle();
644 p->SetLineColor(blue ? kBlue : fHist->GetLineColor());
645 p->SetBit(kCanDelete);
646 p->SetDirectory(NULL);
647 p->SetYTitle(fHist->GetXaxis()->GetTitle());
648 p->SetXTitle(fHist->GetYaxis()->GetTitle());
649 p->Draw(only&&!same?"":"same");
650 }
651
652 //AppendPad("log");
653}
654
655// --------------------------------------------------------------------------
656//
657// Implementation of SavePrimitive. Used to write the call to a constructor
658// to a macro. In the original root implementation it is used to write
659// gui elements to a macro-file.
660//
661void MH3::StreamPrimitive(ostream &out) const
662{
663 TString name = GetUniqueName();
664
665 out << " MH3 " << name << "(\"";
666 out << fData[0]->GetRule() << "\"";
667 if (fDimension>1)
668 out << ", \"" << fData[1]->GetRule() << "\"";
669 if (fDimension>2)
670 out << ", \"" << fData[2]->GetRule() << "\"";
671
672 out << ");" << endl;
673
674 if (fName!=gsDefName)
675 out << " " << name << ".SetName(\"" << fName << "\");" << endl;
676
677 if (fTitle!=gsDefTitle)
678 out << " " << name << ".SetTitle(\"" << fTitle << "\");" << endl;
679
680 switch (fDimension)
681 {
682 case 3:
683 if (fScale[2]!=1)
684 out << " " << name << ".SetScaleZ(" << fScale[2] << ");" << endl;
685 case 2:
686 if (fScale[1]!=1)
687 out << " " << name << ".SetScaleY(" << fScale[1] << ");" << endl;
688 case 1:
689 if (fScale[0]!=1)
690 out << " " << name << ".SetScaleX(" << fScale[0] << ");" << endl;
691 }
692}
693
694// --------------------------------------------------------------------------
695//
696// Used to rebuild a MH3 object of the same type (data members,
697// dimension, ...)
698//
699MParContainer *MH3::New() const
700{
701 MH3 *h = NULL;
702
703 if (fData[0] == NULL)
704 h=new MH3(fDimension);
705 else
706 switch (fDimension)
707 {
708 case 1:
709 h=new MH3(fData[0]->GetRule());
710 break;
711 case 2:
712 h=new MH3(fData[0]->GetRule(), fData[1]->GetRule());
713 break;
714 case 3:
715 h=new MH3(fData[0]->GetRule(), fData[1]->GetRule(), fData[2]->GetRule());
716 break;
717 }
718 switch (fDimension)
719 {
720 case 3:
721 h->SetScaleZ(fScale[2]);
722 case 2:
723 h->SetScaleY(fScale[1]);
724 case 1:
725 h->SetScaleX(fScale[0]);
726 }
727 return h;
728}
729
730TString MH3::GetRule(const Char_t axis) const
731{
732 switch (tolower(axis))
733 {
734 case 'x':
735 return fData[0] ? fData[0]->GetRule() : TString("");
736 case 'y':
737 return fData[1] ? fData[1]->GetRule() : TString("");
738 case 'z':
739 return fData[2] ? fData[2]->GetRule() : TString("");
740 default:
741 return "<n/a>";
742 }
743}
744
745// --------------------------------------------------------------------------
746//
747// Returns the total number of bins in a histogram (excluding under- and
748// overflow bins)
749//
750Int_t MH3::GetNbins() const
751{
752 Int_t num = 1;
753
754 switch (fDimension)
755 {
756 case 3:
757 num *= fHist->GetNbinsZ()+2;
758 case 2:
759 num *= fHist->GetNbinsY()+2;
760 case 1:
761 num *= fHist->GetNbinsX()+2;
762 }
763
764 return num;
765}
766
767// --------------------------------------------------------------------------
768//
769// Returns the total number of bins in a histogram (excluding under- and
770// overflow bins) Return -1 if bin is underflow or overflow
771//
772Int_t MH3::FindFixBin(Double_t x, Double_t y, Double_t z) const
773{
774 const TAxis &axex = *fHist->GetXaxis();
775 const TAxis &axey = *fHist->GetYaxis();
776 const TAxis &axez = *fHist->GetZaxis();
777
778 Int_t binz = 0;
779 Int_t biny = 0;
780 Int_t binx = 0;
781
782 switch (fDimension)
783 {
784 case 3:
785 binz = axez.FindFixBin(z);
786 if (binz>axez.GetLast() || binz<axez.GetFirst())
787 return -1;
788 case 2:
789 biny = axey.FindFixBin(y);
790 if (biny>axey.GetLast() || biny<axey.GetFirst())
791 return -1;
792 case 1:
793 binx = axex.FindFixBin(x);
794 if (binx<axex.GetFirst() || binx>axex.GetLast())
795 return -1;
796 }
797
798 const Int_t nx = fHist->GetNbinsX()+2;
799 const Int_t ny = fHist->GetNbinsY()+2;
800
801 return binx + nx*(biny +ny*binz);
802}
Note: See TracBrowser for help on using the repository browser.