#include double TLC (int nsum) { double sum=0; for (int i=0; i\t"; cin >> profilo; if (controlla_profilo(profilo) == 0) { cout << "|| Il tipo di profilo richiesto non รจ tra i dati che ho in memoria." << endl; cout << "|| Con chi credi di avere a che fare!?" << endl; cout << "|| Bah! Mi termino da solo." << endl; return; } /*const Int_t NRGBs = 5; Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 }; Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 }; Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };*/ // scala di grigi /*const Int_t NRGBs = 2; Double_t stops[NRGBs] = { 0.00, 1.00 }; Double_t red[NRGBs] = { 1.0, 0.10 }; Double_t green[NRGBs] = { 1.0, 0.10 }; Double_t blue[NRGBs] = { 1.0, 0.10 };*/ const Int_t NRGBs = 5; Double_t stops[NRGBs] = { 0.0, 0.23, 0.4, 0.8, 1.0 }; Double_t red[NRGBs] = { 0.0, 0.0, 0.8, 0.7, 0.5 }; Double_t green[NRGBs] = { 0.0, 0.8, 1.0, 0.0, 0.0 }; Double_t blue[NRGBs] = { 1.0, 1.0, 0.0, 0.0, 0.0 }; TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); //gROOT->SetStyle("Plain"); TCanvas *c1 = new TCanvas("c1", "plot2d", 0, 0, 600, 600); //TH2F *h2 = new TH2F ("h2", "prova", 50 , -20, 20, 50, -25, 25); TGraph2D *g = new TGraph2D(); double x, y; double posx [9] = {-22.9, -13.8, -10.7, -5.5, 5.5, 10.7, 13.8, 19, 22.9}; double posy [11] = {-25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25 }; if (profilo == 1) {ifstream in ("datatot.dat");} if (profilo == 2) {ifstream in ("datavel.dat");} string line; int yindex=0; int point=0; while ( getline(in, line) ) { if (line[0]=='#'||line[0]=='\0') continue; double value; int xindex=0; istringstream iss(line); while (iss >> value) { g->SetPoint(point, posx[xindex],posy[yindex],value); xindex++; point++; } yindex++; } if (profilo == 1) { g->SetPoint(point, -1.,0.,17); point++; g->SetPoint(point, 1.,0.,17); point++; g->SetPoint(point, 0.,0.,17); } g->Draw("COLZ"); if (profilo == 1) {c1->Print("mappa_tot.eps", "eps");} if (profilo == 2) {c1->Print("mappa_vel.eps", "eps");} if (profilo == 1) {g->SetTitle("Mappa Flusso Totale");} if (profilo == 2) {g->SetTitle("Mappa Flusso Veloce");} g->GetXaxis()->SetTitle("x (cm)"); g->GetYaxis()->SetTitle("y (cm)"); return; } int controlla_profilo(int tipo_profilo) { int check = 0; if ((tipo_profilo == 1) || (tipo_profilo == 2)) { check = 1; } return check; }