Hello,
I have a problem in small subroutine. I would like to draw an ellipse over a 2D-histogram. This is my code
[code]//
/* This routine plots energy loss dE versus energy E. */
//
#include <TFile.h>
#include <TTree.h>
#include <TH2F.h>
#include <TCanvas.h>
#include <TEllipse.h>
using namespace std;
void plot_dE_E()
{
TCanvas *c = new TCanvas(“c”,“dE_E”);
TFile f = new TFile("/space/mydata.root");
TTree t = (TTree*)f->Get(“Analysed_Data”);
TH2F *h = new TH2F(“h”,"",800,0,800,350,100,450);
t->Project(“h”,“dE:SiET”,“SiET>0.”);
h->Draw(“col”);
TEllipse el(100.,300.,75.,125.,0.,360.,0.);
el.SetLineColor(3);
el.SetLineWidth(6);
el.SetFillStyle(0000);
el.Draw();
c->Save(“save.eps”);
}[/code]
My problem is when I run this subroutine, I see briefly my ellipse and then it disappears.
But If I run this subroutine
[code]//
/* This routine plots energy loss dE versus energy E. */
//
#include <TFile.h>
#include <TTree.h>
#include <TH2F.h>
#include <TCanvas.h>
using namespace std;
void plot_dE_E()
{
TCanvas *c = new TCanvas(“c”,“dE_E”);
TFile f = new TFile("/physique/Physique/space/machaine.root");
TTree t = (TTree*)f->Get(“Analysed_Data”);
TH2F *h = new TH2F(“h”,"",800,0,800,350,100,450);
t->Project(“h”,“dE:SiET”,“SiET>0.”);
h->Draw(“col”);
c->Save(“save.eps”);
}[/code]
and then this one
{
TEllipse el(100.,300.,75.,125.,0.,360.,0.);
el.SetLineColor(6);
el.SetLineWidth(6);
el.SetFillStyle(0000);
el.Draw();
}
my ellipse stay printing on the screen.
Do you know what is the problem? I would like put in the same subroutine TH2F and TEllipse.