Difference between arrays

Thank you wile! it was that I want!

Hi @Wile_E_Coyote, following your reply, I made 1D plot about an array Calo_EnDep in this way

TCanvas *c20 = new TCanvas("c20",canvtitle,1280,1024);
			c20->Divide (2,2);
			TCut cut1 = TString::Format("TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f) && TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f) && TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f)", a, b, p1, csig, p2, a, c, p13sub, csig, p23sub,a, d, p14sub, csig, p24sub).Data();
			TCut cut2 = TString::Format("TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f) && TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f) && TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f) && TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f)", a, b, p1, csig, p2, a, c, p13sub, csig, p23sub,a, d, p14sub, csig, p24sub,a, e, p15sub, csig, p25sub).Data();
			TCut cut3 = TString::Format("TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f) && TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f) && TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f) && TMath::Abs(Calo_Time[%d] - Calo_Time[%d] - (%f)) < (%d)*(%f)", a, b, p1, csig, p2, a, c, p13sub, csig, p23sub,a, d, p14sub, csig, p24sub,a, e2, p15sub2, csig, p25sub2).Data();
 			c20->cd(1);
 			t->SetLineColor(kBlue);
 			TString henea4substringcut = TString::Format("Calo_EnDep[%d] >> htemp(5000., 0., 5000.)", a);
			t->Draw(henea4substringcut, cut1 && !cut2 && !cut3);
			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
			t->GetHistogram()->SetTitle(cdenenamea);
 			TH1F *henea4subcut = (TH1F*)gPad->GetPrimitive("htemp"); 
			henea4subcut->GetXaxis()->SetTitle(cdeneXnameab); 
			henea4subcut->GetYaxis()->SetTitle(cdeneYnameab);
			henea4subcut->GetYaxis()->SetTitleSize(c2_YTitleSize);
			henea4subcut->GetYaxis()->SetTitleFont(c2_YTitleFont);
			henea4subcut->GetYaxis()->SetTitleOffset(c2_YTitleOffset);
			henea4subcut->GetYaxis()->SetLabelFont(c2_YLabelFont); 
			henea4subcut->GetYaxis()->SetLabelSize(c2_YLabelSize);
			henea4subcut->GetXaxis()->SetTitleSize(c2_XTitleSize);
			henea4subcut->GetXaxis()->SetTitleFont(c2_XTitleFont);
			henea4subcut->GetXaxis()->SetTitleOffset(c2_XTitleOffset);
			henea4subcut->GetXaxis()->SetLabelFont(c2_XLabelFont); 
			henea4subcut->GetXaxis()->SetLabelSize(c2_XLabelSize);
			henea4subcut->SetFillColorAlpha(kBlue, heneabfillcolor);
			henea4subcut->Draw(); 	
			henea4subcut->SetName(heneabname);
			//henea->GetXaxis()->SetRangeUser(c2_XSetRangem,c2_XSetRangeMa);
   			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn

Should it also possible to make a 2D plot of 2 arrays?
I mean to plot a TH2F having on x-axis a culomn of the Calo_EnDep [a] array and on y-axis one other culomn Calo_EnDep[b]…then I would define for example:

TString heneasubstringcutrelab = TString::Format("Calo_EnDep[%d] >> htemp(5000., 0., 5000.)", a);
TString henebsubstringcutrelab = TString::Format("Calo_EnDep[%d] >> htemp(5000., 0., 5000.)", b);

then to plot them in a 2D plot setting the condition
cut1 yes
cut2 no (discard)
cut3 no (discard)

just like in the 1D plot

t->Draw(henea4substringcut, cut1 && !cut2 && !cut3);

Thank you

Try:

TString what = TString::Format("Calo_EnDep[%d] : Calo_EnDep[%d] >> htemp(100, 0., 5000., 100, 0., 5000.)", b, a);
t->Draw(what, cut1 && !cut2 && !cut3);

Hi @Wile_E_Coyote thank you for your reply. Your code works, I get the plot just writing

TCanvas *c25 = new TCanvas("c25",canvtitle,1280,1024);
 			t->SetLineColor(kBlue);
 			TString henecdsubstringcutrel = TString::Format("Calo_EnDep[%d] :  Calo_EnDep[%d]>> htemp(4500., 0., 4500.)", c,d);
 			t->Draw(henecdsubstringcutrel, cut1 && !cut2 && !cut3);

but it looks like having problem because:

  1. If I add the code
TH2F *henecdsubstringcutrelTHF = (TH2F*)gPad->GetPrimitive("htemp"); 
			henecdsubstringcutrelTHF->GetXaxis()->SetTitle(cdeneXnameab); 
			henecdsubstringcutrelTHF->GetYaxis()->SetTitle(cdeneXnameab);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleSize(c2_YTitleSize);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleFont(c2_YTitleFont);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleOffset(c2_YTitleOffset);
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelFont(c2_YLabelFont); 
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelSize(c2_YLabelSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleSize(c2_XTitleSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleFont(c2_XTitleFont);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleOffset(c2_XTitleOffset);
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelFont(c2_XLabelFont); 
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelSize(c2_XLabelSize);
			henecdsubstringcutrelTHF->SetMarkerColor(kBlue);
			henecdsubstringcutrelTHF->Draw(); 	
			henecdsubstringcutrelTHF->SetName(heneabname);
			//henea->GetXaxis()->SetRangeUser(c2_XSetRangem,c2_XSetRangeMa);
   			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
   			TLegend* leghenecdsubstringcutrelTHF = new TLegend(0.65, 0.7, .75, .75);
   			leghenecdsubstringcutrelTHF->SetHeader("Legend");
			leghenecdsubstringcutrelTHF->SetNColumns(1);
			leghenecdsubstringcutrelTHF->AddEntry(leghenecdsubstringcutrelTHF, "Data", "l");
			leghenecdsubstringcutrelTHF->Draw(); 
			gPad->Update();
			TPaveStats *statsghenecdsubstringcutrelTHF = (TPaveStats*)henecdsubstringcutrelTHF->GetListOfFunctions()->FindObject("stats");
			statsghenecdsubstringcutrelTHF->SetTextColor(kBlue);
			statsghenecdsubstringcutrelTHF->SetX1NDC(0.80); statsghenecdsubstringcutrelTHF->SetX2NDC(0.98);
			statsghenecdsubstringcutrelTHF->SetY1NDC(0.77); statsghenecdsubstringcutrelTHF->SetY2NDC(0.92)
			gPad->Update();

I get the error due to the TStats:

  1. If I don’t add the TStats, I don’t get any error, but the plot is white and ROOT doesn’t add my personal title of the plot

It’s strange, because I use these codes in other plots from tree (but in TH1F typology)

  1. Lastly,I would like to plot using the “COLZ” typology then I tried to write
TString henecdsubstringcutrel = TString::Format("Calo_EnDep[%d] :  Calo_EnDep[%d]>> htemp(4500., 0., 4500.)", c,d);
 			t->Draw("COLZ",henecdsubstringcutrel, cut1 && !cut2 && !cut3);

but I get error

Thank you

See how I defined “htemp” (for the 2D case) in my previous post above.

Hi @Wile_E_Coyote, you are right…I forgot to write the bin number and the range for the y-axis…anyway, even if now I replaced

TString henecdsubstringcutrel = TString::Format("Calo_EnDep[%d] :  Calo_EnDep[%d]>> htemp(4500., 0., 4500.)", c,d);

with

TString henecdsubstringcutrel = TString::Format("Calo_EnDep[%d] :  Calo_EnDep[%d]>> htemp(4500., 0., 4500.,1800.,0.,1800)", c,d);

I get the same problems explained in my previous post…

@couet It seems that ROOT does not create the “stats” box for the 2D case when the “htemp” is created by the “Draw”.
So, if you want it, you will need to create the histogram in advance:

TH2F *htemp = new TH2F("htemp", "", 100, 0., 5000., 100, 0., 5000.);
TString what = TString::Format("Calo_EnDep[%d] : Calo_EnDep[%d] >> htemp", b, a);
t->Draw(what, cut1 && !cut2 && !cut3);

Hi @Wile_E_Coyote, I wrote:

	TCanvas *c25 = new TCanvas("c25",canvtitle,1280,1024);
			TH2F *htemp2 = new TH2F("htemp2", "", 4500., 0., 4500., 1800, 0., 1800.);
 			t->SetLineColor(kBlue);
 			TString henecdsubstringcutrel = TString::Format("Calo_EnDep[%d] :  Calo_EnDep[%d]>> htemp2", c,d);
 			t->Draw(henecdsubstringcutrel, cut1 && !cut2 && !cut3);
			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
			t->GetHistogram()->SetTitle(cdhenecdsubstringcutrelTHFname);
 			TH2F *henecdsubstringcutrelTHF = (TH2F*)gPad->GetPrimitive("htemp"); 
			henecdsubstringcutrelTHF->GetXaxis()->SetTitle(cdeneXnameab); 
			henecdsubstringcutrelTHF->GetYaxis()->SetTitle(cdeneXnameab);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleSize(c2_YTitleSize);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleFont(c2_YTitleFont);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleOffset(c2_YTitleOffset);
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelFont(c2_YLabelFont); 
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelSize(c2_YLabelSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleSize(c2_XTitleSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleFont(c2_XTitleFont);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleOffset(c2_XTitleOffset);
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelFont(c2_XLabelFont); 
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelSize(c2_XLabelSize);
			henecdsubstringcutrelTHF->SetMarkerColor(kBlue);
			henecdsubstringcutrelTHF->Draw(); 	
			henecdsubstringcutrelTHF->SetName(heneabname);
			//henea->GetXaxis()->SetRangeUser(c2_XSetRangem,c2_XSetRangeMa);
   			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
   			TLegend* leghenecdsubstringcutrelTHF = new TLegend(0.65, 0.7, .75, .75);
   			leghenecdsubstringcutrelTHF->SetHeader("Legend");
			leghenecdsubstringcutrelTHF->SetNColumns(1);
			leghenecdsubstringcutrelTHF->AddEntry(leghenecdsubstringcutrelTHF, "Data", "l");
			leghenecdsubstringcutrelTHF->Draw(); 
			gPad->Update();
			TPaveStats *statsghenecdsubstringcutrelTHF = (TPaveStats*)henecdsubstringcutrelTHF->GetListOfFunctions()->FindObject("stats");
			statsghenecdsubstringcutrelTHF->SetTextColor(kBlue);
			statsghenecdsubstringcutrelTHF->SetX1NDC(0.80); statsghenecdsubstringcutrelTHF->SetX2NDC(0.98);
			statsghenecdsubstringcutrelTHF->SetY1NDC(0.77); statsghenecdsubstringcutrelTHF->SetY2NDC(0.92)
			gPad->Update();
			c25->Print(myplothenecdsubstringcutrelTHF);

but now I get the error

where the line 2684 is

henecdsubstringcutrelTHF->GetXaxis()->SetTitle(cdeneXnameab); 

It looks like a big problem to plot a 2D plot by using arrays of a tree…
Can’t be possible to fill a new TH2F by using the 2 arrays and later just to draw the TH2F instead of the tree?

Hi @Wile_E_Coyote, I tried to fill a 2D histogram in this way

TCanvas *c25 = new TCanvas("c25",canvtitle,1280,1024);
			//TH2F *htemp2 = new TH2F("htemp2", "", 4500., 0., 4500., 1800, 0., 1800.);
 			//t->SetLineColor(kBlue);
 			TH2F *henecdsubstringcutrelTHF = new TH2F("henecdsubstringcutrelTHF", "", 4500., 0., 4500., 1800, 0., 1800.);
 			int entries=t->getEntry();
 			for (int ient=0;ient<entries;++ient){
 				henecdsubstringcutrelTHF->Fill((Form("Calo_EnDep[%d]",c)),(Form("Calo_EnDep[%d]",d)));
			 }
			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
		//	t->GetHistogram()->SetTitle(cdhenecdsubstringcutrelTHFname);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitle(cdeneXnameab); 
			henecdsubstringcutrelTHF->GetYaxis()->SetTitle(cdeneXnameab);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleSize(c2_YTitleSize);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleFont(c2_YTitleFont);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleOffset(c2_YTitleOffset);
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelFont(c2_YLabelFont); 
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelSize(c2_YLabelSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleSize(c2_XTitleSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleFont(c2_XTitleFont);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleOffset(c2_XTitleOffset);
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelFont(c2_XLabelFont); 
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelSize(c2_XLabelSize);
			henecdsubstringcutrelTHF->SetMarkerColor(kBlue);
			henecdsubstringcutrelTHF->Draw(); 	
			henecdsubstringcutrelTHF->SetName(heneabname);
			//henea->GetXaxis()->SetRangeUser(c2_XSetRangem,c2_XSetRangeMa);
   			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
   			TLegend* leghenecdsubstringcutrelTHF = new TLegend(0.65, 0.7, .75, .75);
   			leghenecdsubstringcutrelTHF->SetHeader("Legend");
			leghenecdsubstringcutrelTHF->SetNColumns(1);
			leghenecdsubstringcutrelTHF->AddEntry(leghenecdsubstringcutrelTHF, "Data", "l");
			leghenecdsubstringcutrelTHF->Draw(); 
			gPad->Update();
			TPaveStats *statsghenecdsubstringcutrelTHF = (TPaveStats*)henecdsubstringcutrelTHF->GetListOfFunctions()->FindObject("stats");
			statsghenecdsubstringcutrelTHF->SetTextColor(kBlue);
			statsghenecdsubstringcutrelTHF->SetX1NDC(0.80); statsghenecdsubstringcutrelTHF->SetX2NDC(0.98);
			statsghenecdsubstringcutrelTHF->SetY1NDC(0.77); statsghenecdsubstringcutrelTHF->SetY2NDC(0.92)
			gPad->Update();
			c25->Print(myplothenecdsubstringcutrelTHF);

but I get this error

the line 2679 is

	int entries=t->getEntry();

If you name your histogram "henecdsubstringcutrelTHF", then use "Calo_EnDep[%d] : Calo_EnDep[%d] >> henecdsubstringcutrelTHF".

Hi @Wile_E_Coyote, thank you for your reply. I’m no ture if I understood what you mean…anyway I wrote this:

TCanvas *c25 = new TCanvas("c25",canvtitle,1280,1024);
			//TH2F *htemp2 = new TH2F("htemp2", "", 4500., 0., 4500., 1800, 0., 1800.);
 			//t->SetLineColor(kBlue);
 			TH2F *henecdsubstringcutrelTHF = new TH2F("henecdsubstringcutrelTHF", "", 4500., 0., 4500., 1800, 0., 1800.);
 			int entries=t->getEntry();
 			for (int ient=0;ient<entries;++ient){
 				henecdsubstringcutrelTHF->Fill("Calo_EnDep[%d] :  Calo_EnDep[%d]>> henecdsubstringcutrelTHF", c,d);
			 }
			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
		//	t->GetHistogram()->SetTitle(cdhenecdsubstringcutrelTHFname);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitle(cdeneXnameab); 
			henecdsubstringcutrelTHF->GetYaxis()->SetTitle(cdeneXnameab);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleSize(c2_YTitleSize);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleFont(c2_YTitleFont);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleOffset(c2_YTitleOffset);
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelFont(c2_YLabelFont); 
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelSize(c2_YLabelSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleSize(c2_XTitleSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleFont(c2_XTitleFont);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleOffset(c2_XTitleOffset);
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelFont(c2_XLabelFont); 
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelSize(c2_XLabelSize);
			henecdsubstringcutrelTHF->SetMarkerColor(kBlue);
			henecdsubstringcutrelTHF->Draw(); 	
			henecdsubstringcutrelTHF->SetName(heneabname);
			//henea->GetXaxis()->SetRangeUser(c2_XSetRangem,c2_XSetRangeMa);
   			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
   			TLegend* leghenecdsubstringcutrelTHF = new TLegend(0.65, 0.7, .75, .75);
   			leghenecdsubstringcutrelTHF->SetHeader("Legend");
			leghenecdsubstringcutrelTHF->SetNColumns(1);
			leghenecdsubstringcutrelTHF->AddEntry(leghenecdsubstringcutrelTHF, "Data", "l");
			leghenecdsubstringcutrelTHF->Draw(); 
			gPad->Update();
			TPaveStats *statsghenecdsubstringcutrelTHF = (TPaveStats*)henecdsubstringcutrelTHF->GetListOfFunctions()->FindObject("stats");
			statsghenecdsubstringcutrelTHF->SetTextColor(kBlue);
			statsghenecdsubstringcutrelTHF->SetX1NDC(0.80); statsghenecdsubstringcutrelTHF->SetX2NDC(0.98);
			statsghenecdsubstringcutrelTHF->SetY1NDC(0.77); statsghenecdsubstringcutrelTHF->SetY2NDC(0.92)
			gPad->Update();
			c25->Print(myplothenecdsubstringcutrelTHF);

but I get this error

The line 2679 is

int entries=t->getEntry();
TH2F *henecdsubstringcutrelTHF = new TH2F("henecdsubstringcutrelTHF", "", 4500, 0., 4500., 1800, 0., 1800.);
TString what = TString::Format("Calo_EnDep[%d] : Calo_EnDep[%d] >> henecdsubstringcutrelTHF", d, c);
t->Draw(what, cut1 && !cut2 && !cut3);

Hi @Wile_E_Coyote than you again…but I think it’s what I did 2 days ago (read my message number 10)

this one

but as you can see reading the message, I also got error…

I you use your own "henecdsubstringcutrelTHF" when Draw()'ing, the "htemp" will not be created at all.

Hi @Wile_E_Coyote, then I wrote:

TCanvas *c25 = new TCanvas("c25",canvtitle,1280,1024);
 			TH2F *henecdsubstringcutrelTHF = new TH2F("henecdsubstringcutrelTHF", "", 4500, 0., 4500., 1800, 0., 1800.);
			TString what = TString::Format("Calo_EnDep[%d] : Calo_EnDep[%d] >> henecdsubstringcutrelTHFh", d, c);
			t->Draw(what, cut1 && !cut2 && !cut3);
			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
			henecdsubstringcutrelTHF->SetTitle(cdhenecdsubstringcutrelTHFname);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitle(cdeneXnameab); 
			henecdsubstringcutrelTHF->GetYaxis()->SetTitle(cdeneXnameab);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleSize(c2_YTitleSize);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleFont(c2_YTitleFont);
			henecdsubstringcutrelTHF->GetYaxis()->SetTitleOffset(c2_YTitleOffset);
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelFont(c2_YLabelFont); 
			henecdsubstringcutrelTHF->GetYaxis()->SetLabelSize(c2_YLabelSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleSize(c2_XTitleSize);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleFont(c2_XTitleFont);
			henecdsubstringcutrelTHF->GetXaxis()->SetTitleOffset(c2_XTitleOffset);
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelFont(c2_XLabelFont); 
			henecdsubstringcutrelTHF->GetXaxis()->SetLabelSize(c2_XLabelSize);
			henecdsubstringcutrelTHF->SetMarkerColor(kBlue);
			henecdsubstringcutrelTHF->Draw("COLZ"); 	
			henecdsubstringcutrelTHF->SetName(heneabname);
			//henea->GetXaxis()->SetRangeUser(c2_XSetRangem,c2_XSetRangeMa);
   			gPad->Modified();
			gPad->Update(); // make sure it's really (re)drawn
   			TLegend* leghenecdsubstringcutrelTHF = new TLegend(0.65, 0.7, .75, .75);
   			leghenecdsubstringcutrelTHF->SetHeader("Legend");
			leghenecdsubstringcutrelTHF->SetNColumns(1);
			leghenecdsubstringcutrelTHF->AddEntry(leghenecdsubstringcutrelTHF, "Data", "l");
			leghenecdsubstringcutrelTHF->Draw(); 
			gPad->Update();
			TPaveStats *statsghenecdsubstringcutrelTHF = (TPaveStats*)henecdsubstringcutrelTHF->GetListOfFunctions()->FindObject("stats");
			statsghenecdsubstringcutrelTHF->SetTextColor(kBlue);
			statsghenecdsubstringcutrelTHF->SetX1NDC(0.80); statsghenecdsubstringcutrelTHF->SetX2NDC(0.98);
			statsghenecdsubstringcutrelTHF->SetY1NDC(0.77); statsghenecdsubstringcutrelTHF->SetY2NDC(0.92);
			gPad->Update();
			c25->Print(myplothenecdsubstringcutrelTHF);

I don’t get any error, but I get an empty plot

Try first without any cuts and then e.g. add them one by one.

Hi @Wile_E_Coyote Thank you for all the time you are spending for me. I replaced

t->Draw(what, cut1 && !cut2 && !cut3);

with

t->Draw(what);

but I also get an empty plot.

Anyway, running the macro, I see on the screen that ROOT fill the histogram (I see black point on the screen), but at the end, it replace the plot with an empty plot. Then I think it happens when ROOT run this line

henecdsubstringcutrelTHF->Draw("COLZ"); 

it looks like that when it run that line, it make a new empty histogram (but it doesn’t happen with TH1F plots, just with TH2F)

And what is the “h” in the end of the “... >> henecdsubstringcutrelTHFh” string supposed to do?

Hi @Wile_E_Coyote, thank you! it was a typing error…and I didn’t see it!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.