ROOT doesn't draw TCanvas

Hi experts.
I wanna draw histogram but root doesn’t draw it.
Is there any problem in my command?
root [0] {
root (cont’ed, cancel with .@) [1]gROOT->SetStyle(“Plain”);
root (cont’ed, cancel with .@) [2]TH1F *hdet_y = new TH1F(“hdet_y”,"",40,0,20);
root (cont’ed, cancel with .@) [3]hdet_y->GetXaxis()->CenterTitle();
root (cont’ed, cancel with .@) [4]hdet_y->GetXaxis()->SetTitle(“Energy (keV)”);
root (cont’ed, cancel with .@) [5]hdet_y->GetXaxis()->SetTitleOffset(0.90);
root (cont’ed, cancel with .@) [6]hdet_y->GetXaxis()->SetTitleSize(0.05);
root (cont’ed, cancel with .@) [7]TChain *ch = new TChain(“ntp”);
root (cont’ed, cancel with .@) [8]char filename[300];
root (cont’ed, cancel with .@) [9]for (int i=1;i<=578;i++){
root (cont’ed, cancel with .@) [10]TString datadir = “/data/COSINE/MRGD/phys/V00-04-04/”;
root (cont’ed, cancel with .@) [11]sprintf(filename,“mrgd_M001544.root.%.3d”,i);
root (cont’ed, cancel with .@) [12]ch->Add(datadir+filename);
root (cont’ed, cancel with .@) [13]}
root (cont’ed, cancel with .@) [14]TString C2_noise = “(pmt21.nc>1&&pmt22.nc>1&&crystal2.t0>2.&&crystal2.x2/crystal2.x2/crystal2.x1<1.25&&abs((pmt21.qc5-pmt22.qc5)/(pmt21.qc5+pmt22.qc5))<0.5)&&”;
root (cont’ed, cancel with .@) [15]TString C1_HE = “crystal1.energyD>1295&&crystal1.energyD<1625”;
root (cont’ed, cancel with .@) [16]TString C3_HE = “crystal3.energyD>1290&&crystal3.energyD<1621”;
root (cont’ed, cancel with .@) [17]TString C4_HE = “crystal4.energyD>1310&&crystal4.energyD<1610”;
root (cont’ed, cancel with .@) [18]TString C6_HE = “crystal6.energyD>1286&&crystal6.energyD<1634”;
root (cont’ed, cancel with .@) [19]TString C7_HE = “crystal7.energyD>1286&&crystal7.energyD<1634”;
root (cont’ed, cancel with .@) [20]h_C2 = new TH1F(“h_C2”,"",40,0,20);
root (cont’ed, cancel with .@) [21]ch->Draw(“crystal2.energy>>h_C2”, C2_noise+C1_HE);
root (cont’ed, cancel with .@) [22]ch->Draw(“crystal2.energy>>+h_C2”, C2_noise+C3_HE);
root (cont’ed, cancel with .@) [23]ch->Draw(“crystal2.energy>>+h_C2”, C2_noise+C4_HE);
root (cont’ed, cancel with .@) [24]ch->Draw(“crystal2.energy>>+h_C2”, C2_noise+C6_HE);
root (cont’ed, cancel with .@) [25]ch->Draw(“crystal2.energy>>+h_C2”, C2_noise+C7_HE);
root (cont’ed, cancel with .@) [26]hdet_y->Add(h_C2,1);
root (cont’ed, cancel with .@) [27]TCanvas *c2 = new TCanvas(“c2”,“c2”,0,0,800,600);
root (cont’ed, cancel with .@) [28]hdet_y->SetMarkerStyle(6);
root (cont’ed, cancel with .@) [29]hdet_y->Draw();
root (cont’ed, cancel with .@) [30]TFile o(“y_pro_C2_1544.root”,“RECREATE”);
root (cont’ed, cancel with .@) [31]hdet_y->Write();
root (cont’ed, cancel with .@) [32]}
Info in TCanvas::MakeDefCanvas: created default TCanvas with name c1


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Instead of copy/pasting the macro at the root prompt can you please do:

root [0] . x your_macro_name.C

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