Beispiel #1
0
void draw(const std::string& name) {

  std::string fileName = "Projections/" + name + ".root";
  TFile* file = TFile::Open(fileName.c_str());

  for(int i = 1; i<NBINS_; ++i) {

    char histName[50];
    sprintf(histName, "projection_%d", i);
    TH1F* h1 = (TH1F*)file->Get(histName);

    h1->SetTitle("");
    h1->SetLineWidth(1.5);

    TCanvas* c1 = new TCanvas("c1", "c1", 800, 600);
    c1->cd();
    std::string canvasName(histName);
    canvasName = "Projections/"+ name + "_" + canvasName + ".eps";
    h1->Draw();
    c1->SaveAs(canvasName.c_str());
    delete c1;

  } //for

} 
TGraph2D LoadTGraph2D(TString name)
{
    gROOT->ProcessLine(".x " + name + ".C");    
    std::string canvasName(name + "Canvas");
    TCanvas *pTCanvas = new TCanvas(canvasName.c_str(), canvasName.c_str(), 800, 600);
    pTCanvas->SetTopMargin(0.05);
    pTCanvas->SetBottomMargin(0.15);
    pTCanvas->SetLeftMargin(0.15);
    pTCanvas->SetRightMargin(0.05);

    gPad->SetTheta(30); // default is 30
    gPad->SetPhi(120); // default is 30
    gPad->Update();

    TH3F *pTH3F = new TH3F("AxisName","",100,-0.04,0.04,100,-0.04,0.04,100,0.75,1.25);
    pTH3F->GetXaxis()->SetTitle("#alpha_{4}");
    pTH3F->GetXaxis()->CenterTitle();
    pTH3F->GetXaxis()->SetLabelSize(0.05);
    pTH3F->GetXaxis()->SetTitleSize(0.05);
    pTH3F->GetXaxis()->SetTitleOffset(1.75);
    pTH3F->GetXaxis()->SetNdivisions(5);
    pTH3F->GetYaxis()->SetTitle("#alpha_{5}");
    pTH3F->GetYaxis()->CenterTitle();
    pTH3F->GetYaxis()->SetLabelSize(0.05);
    pTH3F->GetYaxis()->SetTitleSize(0.05);
    pTH3F->GetYaxis()->SetTitleOffset(1.75);
    pTH3F->GetYaxis()->SetNdivisions(5);
    pTH3F->GetZaxis()->SetTitle("w");
    pTH3F->GetZaxis()->CenterTitle();
    pTH3F->GetZaxis()->SetLabelSize(0.05);
    pTH3F->GetZaxis()->SetTitleSize(0.05);
    pTH3F->GetZaxis()->SetTitleOffset(1.5);
    pTH3F->GetZaxis()->SetNdivisions(5);
    pTH3F->Draw();

    Graph2D->SetMarkerStyle(20);
    Graph2D->SetMinimum(0.75);
    Graph2D->SetMaximum(1.25);
    Graph2D->Draw("surf1 same");

    Graph2DA->SetMarkerStyle(20);
    Graph2DA->SetMarkerColor(kBlack);
    Graph2DA->SetMinimum(0.75);
    Graph2DA->SetMaximum(1.25);
    Graph2DA->Draw("p same");

    pTCanvas->SaveAs(name + ".pdf");
}
Beispiel #3
0
void RootWImage::setCanvas(TCanvas* myCanvas) {
  if (myCanvas_) delete myCanvas_;
  myCanvas_ = (TCanvas*)myCanvas->DrawClone();
  std::ostringstream canvasName("");
  //int myNumber = imageNameCounter_[name_]++; //##########
  canvasName << "canvas" << setfill('0') << setw(3) << imageCounter_;
  myCanvas_->SetName(canvasName.str().c_str());
  TView* myView = myCanvas->GetView();
  if (myView) {
    TView* newView = myCanvas_->GetView();
    if (newView) {
      double min[3], max[3];
      Int_t irep;
      newView->SetView(myView->GetLongitude(),
		       myView->GetLatitude(),
		       myView->GetPsi(), irep);
      myView->GetRange(min, max);
      newView->SetRange(min, max);
    }
  }
}