FairRoot/PandaRoot
DrawEveHisto.C
Go to the documentation of this file.
1 int DrawEveHisto(TH2* histo, TGeoHMatrix* matrix, double max = -1., TEveCompound* comp = 0)
2 {
3  //TEveCompound* comp = new TEveCompound();
4 
5  TEveBoxSet* q = new TEveBoxSet(histo->GetTitle());
6  gStyle->SetPalette(1, 0);
7 
8 
9  if (max < 0)
10  TEveRGBAPalette* pal = new TEveRGBAPalette(1, histo->GetMaximum());
11  else
12  TEveRGBAPalette* pal = new TEveRGBAPalette(1, max);
13 
14  q->SetPalette(pal);
15 
16  int histoSize = histo->GetNbinsX() * histo->GetNbinsY();
17  q->Reset(TEveBoxSet::kBT_AABoxFixedDim, kFALSE, histoSize);
18  q->SetDefDepth(1);
19  q->SetDefHeight(1);
20  q->SetDefWidth(1);
21 
22  double xoffset = histo->GetNbinsX()/2;
23  double yoffset = histo->GetNbinsY()/2;
24  for (Int_t x=0; x < histo->GetNbinsX(); x++) {
25  for (Int_t y=0; y < histo->GetNbinsY(); y++){
26  q->AddBox(x-xoffset,y-yoffset,0);
27  q->DigitValue(histo->GetBinContent(x,y));
28  }
29  }
30  q->RefitPlex();
31 
32  TGeoHMatrix testMatrix = (*matrix);
33  Double_t scale[] = {0.1,0.1,0.1}; //Dim is 1 mm^3
34  testMatrix.SetScale(scale);
35  TEveTrans& t = q->RefMainTrans();
36  t.SetFrom(testMatrix);
37 
38  if (comp > 0)
39  comp->AddElement(q);
40  else
41  gEve->AddGlobalElement(q);
42  //gEve->Redraw3D(kTRUE);
43  return 0;
44 }
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
int DrawEveHisto(TH2 *histo, TGeoHMatrix *matrix, double max=-1., TEveCompound *comp=0)
Definition: DrawEveHisto.C:1
Double_t
Double_t x
TTree * t
Definition: bump_analys.C:13
Double_t y