Hi,
I'm using the version 4.02/00 on Fedora Core 3.
This is the following script "test.C".
Using root I get:
root [0] .L test.C
root [1] test()
This is strange for me because the values of TString are also printed on
the screen.
Can someone help me?
Thank you a lot,
Gian Piero.
1 int test(int Ntrk=0)
2 { 3 4 gROOT->Reset(); 5 6 // gStyle->SetOptStat(111111); 7 // gStyle->SetOptFit(1111); 8 9 10 TObjArray Data; 11 12 TString folder = "TRACK_"; 13 TString dilptRel = "dilptRel_"; 14 TString dilplRel = "dilplRel_"; 15 TString dilpt = "dilpt_"; 16 17 18 if (Ntrk != 0) { 19 20 folder += Ntrk; 21 dilptRel += Ntrk; 22 dilplRel += Ntrk; 23 dilpt += Ntrk; 24 25 }else{ 26 27 folder.Append("ALL"); 28 dilptRel.Append("ALL"); 29 dilplRel.Append("ALL"); 30 dilpt.Append("ALL"); 31 } 32 33 34 TString graphs[3]={dilptRel, dilplRel, dilpt}; 35 cout << "===============================\n"; 36 cout << folder << endl; 37 cout << graphs[0] << endl; 38 cout << graphs[1] << endl; 39 cout << graphs[2] << endl; 40 cout << "===============================\n"; 41 42 43 //----- Taking DATA ----- 44 TFile* file = new TFile("../rootfiles/bu-jpsik-BDStest.root"); 45 TDirectory* dir= (TDirectory*) file->Get(folder); 46 dir->pwd(); 47 dir->cd(); 48 49 for (int i=0;i<3;i++) 50 { 51 52 TGraphErrors* graph= (TGraphErrors*) file->Get(graphs[i]); 53 Data.Add(graph); 54 55 } 56 57 58 file->Close(); 59 60 TCanvas* CANVAS1 = new TCanvas("CANVAS1","CANVAS1",950,750); 61 CANVAS1->Divide(2,2,0,0); 62 63 64 65 for (int i=1;i<4;i++) 66 { 67 68 CANVAS1->cd(i); 69 70 char PadName[200]; 71 sprintf(PadName,"%s_%d",CANVAS1->GetName(),i); 72 73 74 TPad* pad = (TPad*) CANVAS1->FindObject(PadName); 75 pad->SetGridx(); 76 pad->SetGridy(); 77 78 79 TGraphErrors* graph_data= (TGraphErrors*) Data[i-1]; 80 81 82 graph_data->SetMarkerColor(2); 83 graph_data->SetFillColor(1); 84 graph_data->GetXaxis()->SetTitle("Pt Cut (GeV)"); 85 //graph_data->GetYaxis()->SetTitle("Dilution"); 86 //graph_data->GetYaxis()->SetTitleOffset(1.5); 87 graph_data->SetMarkerSize(1.0); 88 graph_data->SetMarkerStyle(8); 89 graph_data->SetMinimum(-0.15); 90 graph_data->SetMaximum(0.28); 91 92 graph_data->Draw("AP"); 93 94 95 pad->SetFillColor(0); 96 pad->Update(); 97 TPaveText* text = (TPaveText*) pad->FindObject("title"); 98 text->SetFillColor(0); 99 pad->Update(); 100 }
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:10 MET