FairRoot/PandaRoot
Functions
style/Tools.C File Reference

Go to the source code of this file.

Functions

int Tools ()
 
bool DrawText (Double_t posX=0., Double_t posY=0., const char *text="", Double_t size=0.08, Int_t col=1)
 
bool DrawNice2DHisto (TH2 *h, const char *opt="", double range=10.)
 
bool set_nicer_2d_plot_style ()
 
bool BetterStatBox (TPad *pad)
 
bool ImproveDefaultStyle ()
 
bool LoadPandaStyle (bool)
 
TH1D TransformHisto (TH2 *h2, double min, double max)
 
bool plothistosfromfile (TString filename="histos.root", TString ext=".pdf", Int_t divx=2, Int_t divy=2, Int_t pix=300)
 
bool plotntuplefromfile (TString filename="ntps.root", TString ext=".pdf", Int_t divx=2, Int_t divy=2, Int_t pix=300)
 
bool LoadManySimFiles (TString treename="pndsim")
 
TString InitDefaultRun (TString filetag)
 
bool DrawHistSecondScale (TH1 *hist, int color=kRed)
 

Function Documentation

bool BetterStatBox ( TPad *  pad)

Vorgehensweise:

  • Histogramme in ein TPad zeichnen (1. Histogramm: Draw(), ntes Histogramm: Draw("sames"))
  • die Update() Funktion vom Canvas aufrufen (die Statistikboxen werden erst erzeugt, wenn das Histogramm wirklich gezeichnet wird)
  • der Funktion das aktuelle TPad uebergeben (z.B.: TPad* p=(TPad*)gPad; BetterStatBox(p);)

Definition at line 104 of file style/Tools.C.

References hist, i, name, obj, and TString.

104  {
112 
113  int entries = pad->GetListOfPrimitives()->GetEntries();
114  TString name = "";
115  TPaveStats *st;
116  int obj = 1;
117 
118  for(int i=0; i<entries; i++){
119  name = pad->GetListOfPrimitives()->At(i)->IsA()->GetName();
120  if( name.Contains("TH1") ){
121  TH1* hist = (TH1*)pad->GetListOfPrimitives()->At(i);
122  st = (TPaveStats*)hist->GetListOfFunctions()->FindObject("stats");
123  if(st){
124  st->SetOptStat(1);
125  st->SetX1NDC(0.80);
126  st->SetY1NDC(1-0.16*obj) ;
127  st->SetY2NDC( st->GetY1NDC()+0.15 ) ;
128  st->SetTextColor( hist->GetLineColor() );
129  st->SetLineColor( hist->GetLineColor() );
130  st->Draw("same");
131  obj++;
132  }
133  }
134  }
135  return true;
136 }
Int_t i
Definition: run_full.C:25
TString name
TH1F * hist
PndAnaPidSelector *& obj
bool DrawHistSecondScale ( TH1 *  hist,
int  color = kRed 
)

Definition at line 541 of file style/Tools.C.

542 {
543  // scale hint1 to the pad coordinates
544  Float_t rightmax = 1.1*hist->GetMaximum();
545  Float_t scale = gPad->GetUymax()/rightmax;
546  hist->SetLineColor(color);
547  hist->Scale(scale);
548  hist->Draw("same");
549 
550  // draw an axis on the right side
551  TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
552  gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L");
553  axis->SetLineColor(color);
554  axis->SetTextColor(color);
555  axis->Draw();
556  return true;
557 }
axis
Definition: PndRadMapPlane.h:9
TH1F * hist
bool DrawNice2DHisto ( TH2 *  h,
const char *  opt = "",
double  range = 10. 
)

Definition at line 67 of file style/Tools.C.

References range, and TString.

Referenced by plothistosfromfile().

68 {
69  // Draw a 2D histo with the rainbow colors and the palette besides
70  TString options = "colz"; options += opt;
71  if(gPad->GetLogz() == 1 && h->GetMaximum()<range) h->SetAxisRange(0.,range,"Z");
72  else {
73  // we squeeze here to see better the mean value
74  //range = 10*h->Integral()/(h->GetNbinsX()/h->GetNbinsY());
75  cout << "range "<<range<<" max "<<h->GetMaximum()<<" min "<<h->GetMinimum()<<endl;
76  if( range < h->GetMaximum()) range = h->GetMaximum();
77  if(-range > h->GetMinimum()) range = -1*h->GetMinimum();
78  range *= 1.1; // zoom a bit out to see the max better
79  if(h->GetMinimum() < 0.) h->SetAxisRange(-range,range,"Z");
80  else h->SetAxisRange(0,range,"Z");
81  }
82  h->SetStats(kFALSE);
83  h->SetTitleOffset(0.8,"T");
84  gPad->SetRightMargin(0.15);
85  h->DrawCopy(options.Data());
86  return true;
87 }
double range[]
Definition: evaltrig.C:67
bool DrawText ( Double_t  posX = 0.,
Double_t  posY = 0.,
const char *  text = "",
Double_t  size = 0.08,
Int_t  col = 1 
)

Definition at line 49 of file style/Tools.C.

References col.

Referenced by GaussFitPlot(), and LineFitPlot().

54 {
55  // Drawing some TLatex text in a root canvas, overlaying the content
56 
57  TLatex* pText=new TLatex(posX,posY,text);
58  pText->SetNDC(kTRUE);
59  // pText->SetNDC(bNDC);
60  pText->SetTextColor(col); pText->SetTextSize(size);
61  // pText->SetTextAngle(angle);
62  // pText->SetTextFont(font); pText->SetTextAlign(align);
63  pText->Draw();
64  return true;
65 }
int col
Definition: anaLmdDigi.C:67
bool ImproveDefaultStyle ( )

Definition at line 151 of file style/Tools.C.

152 {
153  gStyle->SetOptFit ( 1011 );
154  gStyle->SetPaperSize(20,26);
155  gStyle->SetPadTopMargin(0.14);
156  gStyle->SetPadRightMargin(0.05);
157  gStyle->SetPadBottomMargin(0.14);
158  gStyle->SetPadLeftMargin(0.14);
159  gStyle->SetTextFont(22);//changed to bold (R.K.)
160  gStyle->SetTextSize(0.08);
161  gStyle->SetLabelFont(22,"x");//changed to bold (R.K.)
162  gStyle->SetLabelFont(22,"y");//changed to bold (R.K.)
163  gStyle->SetLabelFont(22,"z");//changed to bold (R.K.)
164  gStyle->SetLabelSize(0.05,"x");
165  gStyle->SetTitleSize(0.06,"x");
166  gStyle->SetLabelSize(0.05,"y");
167  gStyle->SetTitleSize(0.06,"y");
168  gStyle->SetLabelSize(0.05,"z");
169  gStyle->SetTitleSize(0.06,"z");
170  // use bold lines and markers
171  gStyle->SetMarkerStyle(8);
172  gStyle->SetHistLineWidth(1);//1.85);
173  gStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
174 
175  // do not display any of the standard histogram decorations
176  gStyle->SetOptTitle(1);
177  gStyle->SetOptStat(1);
178  gStyle->SetOptFit(1);
179 
180  // put tick marks on top and RHS of plots
181  gStyle->SetPadTickX(1);
182  gStyle->SetPadTickY(1);
183 
184  //R.K. abool clumsy axis lables
185  gStyle->SetNdivisions(509); // default root value is 510
186 
187  return true;
188 }
TString InitDefaultRun ( TString  filetag)

Definition at line 502 of file style/Tools.C.

References fRun, PndFileNameCreator::GetCustomFileName(), PndFileNameCreator::GetParFileName(), PndFileNameCreator::GetRecoFileName(), PndFileNameCreator::GetSimFileName(), namecreator, outFile, parFile, recoFile, rtdb, simFile, sysFile, and TString.

503 {
504  cout << "-I- Using InitDefaultRun() from macro/run/Tools.C with the sim file " << filetag.Data() << endl;
505  FairRunAna* fRun = new FairRunAna();
506  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
507 
508  filetag.ReplaceAll("_sim.root",".root");
509  PndFileNameCreator namecreator(filetag.Data());
513  TString tracksFile = namecreator.GetCustomFileName("tracks");
514  TString pidFile = namecreator.GetCustomFileName("pid");
515  TString histoFile = namecreator.GetCustomFileName("histos");
516  TString evrdummy = namecreator.GetCustomFileName("evrdummy");
517  std::cout<<"simFile="<<simFile.Data()<<std::endl;
518  std::cout<<"parFile="<<parFile.Data()<<std::endl;
519  std::cout<<"recoFile="<<recoFile.Data()<<std::endl;
520  std::cout<<"trkFile="<<tracksFile.Data()<<std::endl;
521  std::cout<<"pidFile="<<pidFile.Data()<<std::endl;
522  fRun->SetInputFile(simFile);
523  fRun->AddFriend(recoFile);//,"rec");
524  fRun->AddFriend(tracksFile);//,"trk");
525  fRun->AddFriend(pidFile);//,"pid");
526  FairParRootFileIo* parIO = new FairParRootFileIo();
527  parIO->open(parFile.Data());
528  rtdb->setFirstInput(parIO);
529  rtdb->setOutput(parIO);
530 
531  TString outFile = evrdummy;
532  TString sysFile = gSystem->Getenv("VMCWORKDIR");
533 
534  fRun->SetOutputFile(outFile.Data());
535  FairGeane* geane = new FairGeane();
536  fRun->AddTask(geane);
537  fRun->Init();
538  return histoFile;
539 }
std::string GetParFileName(std::string addon="", bool cut=false)
TString outFile
Definition: hit_dirc.C:17
std::string GetSimFileName(std::string addon="", bool cut=false)
FairRunAna * fRun
Definition: hit_dirc.C:58
TString simFile
Definition: bump_emc.C:11
std::string GetRecoFileName(std::string addon="", bool cut=false)
TString sysFile
A simple class which adds the corresponding file extensions to a given base class.
TString parFile
Definition: hit_dirc.C:14
std::string GetCustomFileName(std::string ext, std::string addon="", bool cut=false)
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
PndFileNameCreator namecreator("../data/Lars/MvdDtsSim.root")
std::string recoFile
bool LoadManySimFiles ( TString  treename = "pndsim")

Definition at line 488 of file style/Tools.C.

References fi, next, and R.

489 { // to use that method you should have opened some files
490  // containing the same tree structure, like splitted files of
491  // mass production simulations. (like "root -f data/sim01*.root"
492  // tree examination is available via TTree::Draw(...)
493 
494  TIter next(gROOT->GetListOfFiles());
495  TFile *fi=0;
496  TChain *R=new TChain(treename.Data());
497  while ( (fi=(TFile*)next()) ) R->Add(fi->GetName());
498  cout<<(Int_t)R->GetEntries()<<endl;
499  return true;
500 }
TFile * fi
static int next[96]
Definition: ranlxd.cxx:374
Double_t R
Definition: checkhelixhit.C:61
bool LoadPandaStyle ( bool  )

Definition at line 190 of file style/Tools.C.

References set_nicer_2d_plot_style().

191 {
192 
193  //--------------------------------------------------------------------------
194  // File and Version Information:
195  // $Id: PBase.C,v 1.8 2006/09/22 12:04:13 kliemt Exp $
196  //
197  // Description:
198  // Initialization code executed at the start of a ROOT session.
199  // Set up the Panda style for approved plots.
200  //
201  // Environment:
202  // Software developed for the PANDA Detector at GSI, Darmstadt
203  //
204  // Author List:
205  // Sergey Ganzhur Original Author
206  // Ralf Kliemt (2008) Small adjustments for PandaRoot use
207  //
208  // Copyright Information:
209  // Copyright (C) 2001-2002 Ruhr Universitaet Bochum
210  //
211  //------------------------------------------------------------------------
212 
213  if( strcmp(gStyle->GetName(),"PANDA")==0 ) return true;
214  // use the 'plain' style for plots (white backgrounds, etc)
215  //cout << "...using style 'Plain'" << endl;
216  //gROOT->SetStyle("Plain");
217 
218  // Create the 'PANDA' style for approved plots. Note that this style may need
219  // some fine tuning in your macro depending on what you are plotting, e.g.
220  //
221  // gStyle->SetMarkerSize(0.75); // use smaller markers in a histogram with many bins
222  // gStyle->SetTitleOffset(0.65,"y"); // bring y axis label closer to narrow values
223 
224  // Ralf Kliemt:
225  // I changed a bit for myself here
226 
227  TStyle *pandaStyle= new TStyle("PANDA","PANDA approved plots style, modified by ralfk");
228 
229  // use plain black on white colors
230  pandaStyle->SetFrameBorderMode(0);
231  pandaStyle->SetCanvasBorderMode(0);
232  pandaStyle->SetPadBorderMode(0);
233  pandaStyle->SetPadColor(0);
234  pandaStyle->SetCanvasColor(0);
235  pandaStyle->SetTitleColor(1);
236  pandaStyle->SetStatColor(0);
237  // pandaStyle->SetFillColor(0);// conflict with 2D plots
238  // pandaStyle->SetPalette(1);
239  //R.K: Now remove the title box
240  //pandaStyle->SetTitleAlign(33);
241  pandaStyle->SetTitleBorderSize(0);
242  pandaStyle->SetTitleColor(1);
243  pandaStyle->SetTitleFillColor(0);
244  pandaStyle->SetTitleFontSize(0.07);
245 
246  // set the paper & margin sizes
247  pandaStyle->SetPaperSize(20,26);
248  pandaStyle->SetPadTopMargin(0.14);
249  pandaStyle->SetPadRightMargin(0.05);
250  pandaStyle->SetPadBottomMargin(0.14);
251  pandaStyle->SetPadLeftMargin(0.14);
252 // pandaStyle->SetPaperSize(20,26);
253 // pandaStyle->SetPadTopMargin(0.05);
254 // pandaStyle->SetPadRightMargin(0.05);
255 // pandaStyle->SetPadBottomMargin(0.16);
256 // pandaStyle->SetPadLeftMargin(0.12);
257 
258  // use large Times-Roman fonts
259  // pandaStyle->SetTextFont(132);
260  // pandaStyle->SetLabelFont(132,"x");
261  // pandaStyle->SetLabelFont(132,"y");
262  // pandaStyle->SetLabelFont(132,"z");
263  pandaStyle->SetTextFont(22);//changed to bold (R.K.)
264  pandaStyle->SetTextSize(0.08);
265  pandaStyle->SetLabelFont(22,"x");//changed to bold (R.K.)
266  pandaStyle->SetLabelFont(22,"y");//changed to bold (R.K.)
267  pandaStyle->SetLabelFont(22,"z");//changed to bold (R.K.)
268  pandaStyle->SetLabelSize(0.05,"x");
269  pandaStyle->SetTitleSize(0.06,"x");
270  pandaStyle->SetLabelSize(0.05,"y");
271  pandaStyle->SetTitleSize(0.06,"y");
272  pandaStyle->SetLabelSize(0.05,"z");
273  pandaStyle->SetTitleSize(0.06,"z");
274 
275  // use bold lines and markers
276  pandaStyle->SetMarkerStyle(8);
277  pandaStyle->SetHistLineWidth(1);//2
278  pandaStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
279 
280  // do not display any of the standard histogram decorations
281  pandaStyle->SetOptTitle(1);
282  pandaStyle->SetOptStat(1);
283  pandaStyle->SetOptFit(1);
284 
285  // put tick marks on top and RHS of plots
286  pandaStyle->SetPadTickX(1);
287  pandaStyle->SetPadTickY(1);
288 
289  //R.K. abool clumsy axis lables
290  pandaStyle->SetNdivisions(509); // default root value is 510
291 
292  //cout <<" For approved plots use: gROOT->SetStyle(\"PANDA\");"<< endl;
293 
294  pandaStyle->cd();
295  gROOT->ForceStyle();
296  set_nicer_2d_plot_style();//[R.K.] use nicer 2D plots
297  return true;
298 }//bool PBase::LoadPandaStyle(bool)
bool set_nicer_2d_plot_style()
Definition: style/Tools.C:89
bool plothistosfromfile ( TString  filename = "histos.root",
TString  ext = ".pdf",
Int_t  divx = 2,
Int_t  divy = 2,
Int_t  pix = 300 
)

Definition at line 318 of file style/Tools.C.

References DrawNice2DHisto(), ext, file, filename, i, set_nicer_2d_plot_style(), and TString.

Referenced by plotall().

319 { // Plot all histograms into a ps file
320  // works with TH1, TH2, & TProfile
321  //LoadPandaStyle();
323  TFile* file = new TFile(filename.Data());
324  if (!file) {cout<<"File \""<<filename.Data()<<"\" is not there..."<<endl;return true;}
325  TCanvas* can = new TCanvas();
326  Int_t pixx = ceil(1.4*pix*divx);
327  Int_t pixy = pix*divy;
328  can->SetCanvasSize(pixx,pixy);
329  can->Divide(divx, divy);
330  TString picname = filename;
331  ext="."+ext;
332  ext.ReplaceAll("..",".");
333  picname.ReplaceAll(".root",ext); // ps, png, pdf ...
334  TString pic = picname + "["; // open empty ps
335  cout << "opening: " << pic.Data()<<endl;
336  can->Print(pic);
337  pic=picname;
338 
339  TList* list = file->GetListOfKeys();
340  if (!list) {cout<<"List not there..."<<endl;return true;}
341  int padcount = 1;
342  TString keyclass="";
343  for(int i=0;i<list->GetEntries();i++)
344  {
345  if(padcount > divx*divy)
346  {
347  can->Print(pic.Data());
348  can->Clear();
349  can->SetCanvasSize(pixx,pixy);
350  can->Divide(divx, divy);
351  padcount=1;
352  }
353  can->cd(padcount);
354  TKey* key = (TKey*)list->At(i);
355  keyclass = key->GetClassName();
356  //cout<<keyclass.Data()<<endl;
357  if(keyclass.Contains("TH1"))
358  {
359  //cout<<"try plotting a TH1"<<endl;
360  TH1* his = (TH1*)key->ReadObj();
361  his->GetXaxis()->SetNoExponent(); // put exponents to numbers directly
362  his->GetYaxis()->SetNoExponent(); // put exponents to numbers directly
363  TString options(his->GetOption());
364  if(options.Contains("log")){
365  gPad->SetLogy();
366  options.ReplaceAll("log","");
367  his->SetOption(options.Data());
368  }
369  his->Draw();
370  }else if(keyclass.Contains("TH2"))
371  {
372  //cout<<"try plotting a TH2"<<endl;
373  TH2* his2 = (TH2*)key->ReadObj();
374  his2->GetXaxis()->SetNoExponent(); // put exponents to numbers directly
375  his2->GetYaxis()->SetNoExponent(); // put exponents to numbers directly
376  TString options(his2->GetOption());
377  if(options.Contains("log")){
378  gPad->SetLogz();
379  options.ReplaceAll("log","");
380  his2->SetOption(options.Data());
381  }
382  if(options.Contains("nice")){
383  options.ReplaceAll("nice","");
384  his2->SetOption(options.Data());
385  DrawNice2DHisto(his2);
386  } else {
387  his2->Draw("colz");
388  }
389  }else if(keyclass.Contains("TProfile"))
390  {
391  //cout<<"try plotting a TH2"<<endl;
392  TProfile* hpro = (TProfile*)key->ReadObj();
393  hpro->GetXaxis()->SetNoExponent(); // put exponents to numbers directly
394  hpro->GetYaxis()->SetNoExponent(); // put exponents to numbers directly
395  TString options(hpro->GetOption());
396  if(options.Contains("log")){
397  gPad->SetLogy();
398  options.ReplaceAll("log","");
399  hpro->SetOption(options.Data());
400  }
401  hpro->Draw();
402  } else continue;
403 
404  padcount++;
405  }
406 
407  can->Print(pic.Data());
408  pic = picname + "]"; // close ps
409  can->Print(pic.Data());
410  cout << "closed: " << pic.Data()<<endl;
411  //TString convertcmd = "test -r ps2pdf && ps2pdf ";
412  //convertcmd += pic.Data();
413  //gSystem->Exec(convertcmd.Data());
414  delete can;
415  return true;
416 }
bool DrawNice2DHisto(TH2 *h, const char *opt="", double range=10.)
Definition: style/Tools.C:67
Int_t i
Definition: run_full.C:25
TFile * file
bool set_nicer_2d_plot_style()
Definition: style/Tools.C:89
TNtuple * ext
Definition: reco_muo.C:24
const string filename
bool plotntuplefromfile ( TString  filename = "ntps.root",
TString  ext = ".pdf",
Int_t  divx = 2,
Int_t  divy = 2,
Int_t  pix = 300 
)

Definition at line 418 of file style/Tools.C.

References ext, file, filename, i, printf(), and TString.

419 {
420  // Plot all columns of an NTuple into a pdf (or ps file)
421  TFile* file = new TFile(filename.Data());
422  if (!file) {cout<<"File \""<<filename.Data()<<"\" is not there..."<<endl;return true;}
423  TCanvas* can = new TCanvas();
424  Int_t pixx = ceil(1.4*pix*divx);
425  Int_t pixy = pix*divy;
426  can->SetCanvasSize(pixx,pixy);
427  can->Divide(divx, divy);
428  TString picname = filename;
429  ext="."+ext;
430  ext.ReplaceAll("..",".");
431  picname.ReplaceAll(".root",ext); // ps, png, pdf ...
432  TString pic = picname + "["; // open empty ps
433  cout << "opening: " << pic.Data()<<endl;
434  can->Print(pic);
435  pic=picname;
436 
437  TList* list = file->GetListOfKeys();
438  if (!list) {cout<<"List not there..."<<endl;return true;}
439  int padcount = 1;
440  TString keyclass="";
441  for(int i=0;i<list->GetEntries();i++)
442  {
443  TKey* key = (TKey*)list->At(i);
444  keyclass = key->GetClassName();
445  if(keyclass.CompareTo("TTree"))continue;
446  TTree* baum = (TTree*)key->ReadObj();
447  printf("\t - Tree: %s\n",baum->GetName());
448  TObjArray* aeste = baum->GetListOfBranches();
449  for(int asti=0;asti<aeste->GetEntriesFast();asti++)
450  {
451  TBranch* ast = (TBranch*)aeste->At(asti);
452  printf("\t\t - Branch: %s\n",ast->GetName());
453  TObjArray* bleatter = ast->GetListOfLeaves();
454  for(int blatti=0;blatti<bleatter->GetEntriesFast();blatti++)
455  {
456  TLeaf* blatt = (TLeaf*)bleatter->At(blatti);
457  TString blattsorte=blatt->GetTypeName();
458  if( !blattsorte.CompareTo("Float_t") || !blattsorte.CompareTo("Int_t") || !blattsorte.CompareTo("Double_t"))
459  {
460  if(padcount > divx*divy)
461  {
462  printf(" --- canvasdump ---");
463  can->Print(pic.Data());
464  can->Clear();
465  can->SetCanvasSize(pixx,pixy);
466  can->Divide(divx, divy);
467  padcount=1;
468  }
469  can->cd(padcount);
470  printf("\t\t\t - Leaf: %s (%s)\n",blatt->GetName(),blatt->GetTypeName());
471  baum->Draw(blatt->GetName());
472  padcount++;
473  }
474  }
475  }
476  }
477  can->Print(pic.Data());
478  pic = picname + "]"; // close ps
479  can->Print(pic.Data());
480  cout << "closed: " << pic.Data()<<endl;
481 // TString convertcmd = "test -r ps2pdf && ps2pdf ";
482 // convertcmd += pic.Data();
483 // gSystem->Exec(convertcmd.Data());
484  delete can;
485  return true;
486 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Int_t i
Definition: run_full.C:25
TFile * file
TNtuple * ext
Definition: reco_muo.C:24
const string filename
bool set_nicer_2d_plot_style ( )

Definition at line 89 of file style/Tools.C.

References Double_t.

Referenced by LoadPandaStyle(), and plothistosfromfile().

90 {
91  const Int_t NRGBs = 5;
92  const Int_t NCont = 99;//255;
93 
94  Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
95  Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
96  Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
97  Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
98  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
99  // gStyle->CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
100  gStyle->SetNumberContours(NCont);
101  return true;
102 }
Double_t
int Tools ( )

Definition at line 43 of file style/Tools.C.

44 {
45  cout<<"pandaroot/macro/run/Tools.C loaded. Enjoy it."<<endl;
46  return 0;
47 }
TH1D TransformHisto ( TH2 *  h2,
double  min,
double  max 
)

Definition at line 300 of file style/Tools.C.

References i, and nbins.

Referenced by drawMvdHistos().

301 {
302  /*
303  * Created on: Feb 25, 2009
304  * Author: stockman
305  */
306 
307  TH1D result("h1","h1", 1000, min, max);
308  int nbins = h2->GetNbinsX() * h2->GetNbinsY();
309  for (int i = 0; i < nbins; i++){
310  //std::cout << h2->GetBinContent(i) << std::endl;
311  result.Fill(h2->GetBinContent(i));
312  if (i == 10)
313  cout << h2->GetBinContent(i) << endl;
314  }
315  return result;
316 }
Int_t i
Definition: run_full.C:25
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
int nbins
Definition: full_core_ntp.C:33
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:25