PageRenderTime 57ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/leggi_bin/parametri.cpp

https://github.com/ALaDyn/tools-ALaDyn
C++ | 2409 lines | 2331 code | 62 blank | 16 comment | 1083 complexity | 5d49a93e16095f2a2f88087362321990 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. #ifndef __BINNING_C
  2. #define __BINNING_C
  3. #include "leggi_binario_ALaDyn_fortran.h"
  4. /* costruttore default - inizializza a zero per ora. Siccome tutto e' inizializzato a zero
  5. non puo' nemmeno calcolare le le dimensioni dei bin!
  6. Verificare che non ci siano cose intelligenti da poter fare! */
  7. Parametri::Parametri()
  8. {
  9. intpar.resize(NUMERO_PARAMETRI_FILE_DAT, 0);
  10. realpar.resize(NUMERO_PARAMETRI_FILE_DAT, 0.0);
  11. subsample = 1;
  12. span = 5;
  13. ncpu_x = ncpu_y = ncpu_z = ncpu = 0;
  14. ndv = npunti_x = npunti_x_ricampionati = fattore_ricampionamento = npunti_y_ricampionati = npunti_z_ricampionati = npx_per_cpu = npy_per_cpu = npz_per_cpu = 0;
  15. endianness = 0;
  16. nuovi_dati_su_griglia = false;
  17. multifile = false;
  18. stretched_grid = true;
  19. stretched_along_x = 1;
  20. massa_particella_MeV = 0.;
  21. nbin = nbin_x = nbin_px = nbin_y = nbin_py = nbin_z = nbin_pz = nbin_w = nbin_E = nbin_gamma = nbin_theta = nbin_thetaT = nbin_ty = nbin_tz = 120;
  22. tnow = 0.0;
  23. xmin = pxmin = ymin = pymin = zmin = pzmin = wmin = thetamin = thetaTmin = Emin = gammamin = 0.0;
  24. xmax = pxmax = ymax = pymax = zmax = pzmax = wmax = thetamax = thetaTmax = Emax = gammamax = 1.0;
  25. tymin = tzmin = -1.0;
  26. tymax = tzmax = 1.0;
  27. ymin_b = ymax_b = pymin_b = pymax_b = zmin_b = zmax_b = pzmin_b = pzmax_b = wmin_b = wmax_b = gammamin_b = gammamax_b = true;
  28. xmin_b = xmax_b = pxmin_b = pxmax_b = Emin_b = Emax_b = thetaTmin_b = thetaTmax_b = thetamin_b = thetamax_b = true;
  29. tymin_b = tymax_b = tzmin_b = tzmax_b = nbin_ty_b = nbin_tz_b = true;
  30. nbin_b = true;
  31. nbin_E_b = nbin_theta_b = nbin_thetaT_b = nbin_gamma_b = true;
  32. nbin_x_b = nbin_px_b = nbin_y_b = nbin_py_b = nbin_z_b = nbin_pz_b = true;
  33. fai_plot_wspec = fai_plot_Espec = fai_plot_thetaspec = fai_plot_thetaTspec = fai_plot_Etheta = fai_plot_EthetaT = false;
  34. fai_plot_xy = fai_plot_xz = fai_plot_yz = fai_plot_xpx = fai_plot_xpy = fai_plot_xpz = fai_plot_ypx = false;
  35. fai_plot_ypy = fai_plot_ypz = fai_plot_zpx = fai_plot_zpy = fai_plot_zpz = fai_plot_pxpy = fai_plot_pxpz = fai_plot_pypz = fai_plot_xw = fai_plot_rcf = false;
  36. overwrite_weight = false;
  37. overwrite_weight_value = 1.0;
  38. do_not_ask_missing = false;
  39. last_cpu = MAX_NUMBER_OF_CPUS; // il tool funziona quindi per un ncpu_max, attualmente, pari a 32768
  40. for (int i = 0; i < NPARAMETRI; i++)
  41. {
  42. p_b[i] = true;
  43. p[i] = -1;
  44. }
  45. old_fortran_bin = false;
  46. endian_file = 0;
  47. endian_machine = is_big_endian();
  48. file_particelle_P = file_particelle_E = file_particelle_HI = file_particelle_LI = false;
  49. file_campi_Ex = file_campi_Ey = file_campi_Ez = file_campi_Bx = file_campi_By = file_campi_Bz = false;
  50. file_densita_elettroni = file_densita_protoni = file_densita_LI = file_densita_HI = file_densita_driver = false;
  51. file_densita_energia_griglia_elettroni = file_densita_energia_griglia_protoni = file_densita_energia_griglia_HI = file_densita_energia_griglia_LI = false;
  52. }
  53. float Parametri::dimmi_dimx()
  54. {
  55. return (xmax - xmin) / static_cast <float> (nbin_x);
  56. }
  57. float Parametri::dimmi_dimy()
  58. {
  59. return (ymax - ymin) / static_cast <float> (nbin_y);
  60. }
  61. float Parametri::dimmi_dimz()
  62. {
  63. return (zmax - zmin) / static_cast <float> (nbin_z);
  64. }
  65. float Parametri::dimmi_dimty()
  66. {
  67. return (tymax - tymin) / static_cast <float> (nbin_ty);
  68. }
  69. float Parametri::dimmi_dimtz()
  70. {
  71. return (tzmax - tzmin) / static_cast <float> (nbin_tz);
  72. }
  73. float Parametri::dimmi_dimpx()
  74. {
  75. return (pxmax - pxmin) / static_cast <float> (nbin_px);
  76. }
  77. float Parametri::dimmi_dimpy()
  78. {
  79. return (pymax - pymin) / static_cast <float> (nbin_py);
  80. }
  81. float Parametri::dimmi_dimpz()
  82. {
  83. return (pzmax - pzmin) / static_cast <float> (nbin_pz);
  84. }
  85. float Parametri::dimmi_dimw()
  86. {
  87. return (wmax - wmin) / static_cast <float> (nbin_w);
  88. }
  89. float Parametri::dimmi_dimgamma()
  90. {
  91. return (gammamax - gammamin) / static_cast <float> (nbin_gamma);
  92. }
  93. float Parametri::dimmi_dimtheta()
  94. {
  95. return (thetamax - thetamin) / static_cast <float> (nbin_theta);
  96. }
  97. float Parametri::dimmi_dimthetaT()
  98. {
  99. return (thetaTmax - thetaTmin) / static_cast <float> (nbin_thetaT);
  100. }
  101. float Parametri::dimmi_dimE()
  102. {
  103. return (Emax - Emin) / static_cast <float> (nbin_E);
  104. }
  105. int Parametri::dimmi_nbin(int colonna)
  106. {
  107. if (colonna == 0) return nbin_x;
  108. else if (colonna == 1) return nbin_y;
  109. else if (colonna == 2) return nbin_z;
  110. else if (colonna == 3) return nbin_px;
  111. else if (colonna == 4) return nbin_py;
  112. else if (colonna == 5) return nbin_pz;
  113. else if (colonna == 6) return nbin_gamma;
  114. else if (colonna == 7) return nbin_theta;
  115. else if (colonna == 8) return nbin_E;
  116. else if (colonna == 9) return nbin_thetaT;
  117. else if (colonna == 10) return nbin_ty;
  118. else if (colonna == 11) return nbin_tz;
  119. else if (colonna == 12) return nbin_w;
  120. else return 120;
  121. }
  122. float Parametri::dimmi_dim(int colonna)
  123. {
  124. if (colonna == 0) return dimmi_dimx();
  125. else if (colonna == 1) return dimmi_dimy();
  126. else if (colonna == 2) return dimmi_dimz();
  127. else if (colonna == 3) return dimmi_dimpx();
  128. else if (colonna == 4) return dimmi_dimpy();
  129. else if (colonna == 5) return dimmi_dimpz();
  130. else if (colonna == 6) return dimmi_dimgamma();
  131. else if (colonna == 7) return dimmi_dimtheta();
  132. else if (colonna == 8) return dimmi_dimE();
  133. else if (colonna == 9) return dimmi_dimthetaT();
  134. else if (colonna == 10) return dimmi_dimty();
  135. else if (colonna == 11) return dimmi_dimtz();
  136. else if (colonna == 12) return dimmi_dimw();
  137. else return 1.0;
  138. }
  139. void Parametri::leggi_file_dat(std::ifstream& file_dat)
  140. {
  141. std::string riga_persa;
  142. int fattore_ricampionamento;
  143. int discriminante_versione_file;
  144. float coord;
  145. std::getline(file_dat, riga_persa); // per leggere la riga Integer parameters
  146. for (int i = 0; i < NUMERO_PARAMETRI_FILE_DAT; i++) file_dat >> intpar[i];
  147. ncpu_x = 1;
  148. ncpu_y = intpar[0];
  149. ncpu_z = intpar[1];
  150. ncpu = ncpu_x * ncpu_y * ncpu_z;
  151. npunti_x = intpar[2];
  152. npunti_x_ricampionati = intpar[3];
  153. fattore_ricampionamento = npunti_x / npunti_x_ricampionati;
  154. npx_per_cpu = npunti_x_ricampionati;
  155. npunti_y_ricampionati = intpar[4];
  156. npy_per_cpu = intpar[5];
  157. npunti_z_ricampionati = intpar[6];
  158. npz_per_cpu = intpar[7];
  159. ndv = intpar[17];
  160. discriminante_versione_file = intpar[18]; // poco piu' sotto viene poi associato a parametri->nuovi_dati_su_griglia che e' un semplice bool e di piu' difficile lettura
  161. endianness = intpar[19];
  162. std::getline(file_dat, riga_persa); // per pulire i caratteri rimanenti sull'ultima riga degli interi
  163. std::getline(file_dat, riga_persa); // per leggere la riga Real parameters
  164. for (int i = 0; i < NUMERO_PARAMETRI_FILE_DAT; i++) file_dat >> realpar[i];
  165. tnow = realpar[0];
  166. xmin = realpar[1];
  167. xmax = realpar[2];
  168. ymin = realpar[3];
  169. ymax = realpar[4];
  170. zmin = realpar[5];
  171. zmax = realpar[6];
  172. if (file_particelle_P || file_particelle_E || file_particelle_HI || file_particelle_LI)
  173. {
  174. if (ndv == 4 || ndv == 6) p[WEIGHT] = 0;
  175. else if (ndv == 5 || ndv == 7) p[WEIGHT] = 1;
  176. else printf("Attenzione: valore illegale di ndv\n"), exit(-17);
  177. if (ndv == 4 || ndv == 5) zmin = 0.0, zmax = 1.0;
  178. p[NCOLONNE] = ndv;
  179. p_b[NCOLONNE] = false;
  180. p_b[WEIGHT] = false;
  181. }
  182. else
  183. {
  184. if (npunti_z_ricampionati == 1) zmin = 0.0, zmax = 1.0;
  185. if (discriminante_versione_file == -1) nuovi_dati_su_griglia = true;
  186. p[WEIGHT] = 0;
  187. p[NCOLONNE] = npunti_z_ricampionati;
  188. p_b[NCOLONNE] = false;
  189. p_b[WEIGHT] = false;
  190. if (nuovi_dati_su_griglia)
  191. {
  192. std::getline(file_dat, riga_persa); // per pulire i caratteri rimanenti sull'ultima riga dei float
  193. std::getline(file_dat, riga_persa); // per togliere la riga vuota che separa la griglia dai parametri
  194. for (int i = 0; i < npunti_x_ricampionati; i++)
  195. {
  196. file_dat >> coord;
  197. xcoord.push_back(coord);
  198. }
  199. for (int i = 0; i < npunti_y_ricampionati; i++)
  200. {
  201. file_dat >> coord;
  202. ycoord.push_back(coord);
  203. }
  204. for (int i = 0; i < npunti_z_ricampionati; i++)
  205. {
  206. file_dat >> coord;
  207. zcoord.push_back(coord);
  208. }
  209. }
  210. else // mettiamo una griglia temporanea fissa, che al limite sara' sovrascritta da quella stretchata se presente nel binario
  211. {
  212. float dx, dy, dz;
  213. if (npunti_x_ricampionati > 1) dx = (xmax - xmin) / (npunti_x_ricampionati - 1);
  214. else dx = (xmax - xmin);
  215. if (npunti_y_ricampionati > 1) dy = (ymax - ymin) / (npunti_y_ricampionati - 1);
  216. else dy = (ymax - ymin);
  217. if (npunti_z_ricampionati > 1) dz = (zmax - zmin) / (npunti_z_ricampionati - 1);
  218. else dz = (zmax - zmin);
  219. for (int i = 0; i < npunti_x_ricampionati; i++)
  220. {
  221. coord = xmin + dx*i;
  222. xcoord.push_back(coord);
  223. }
  224. for (int i = 0; i < npunti_y_ricampionati; i++)
  225. {
  226. coord = ymin + dy*i;
  227. ycoord.push_back(coord);
  228. }
  229. for (int i = 0; i < npunti_z_ricampionati; i++)
  230. {
  231. coord = zmin + dz*i;
  232. zcoord.push_back(coord);
  233. }
  234. }
  235. }
  236. endian_file = (endianness - 1);
  237. }
  238. void Parametri::chiedi_numero_colonne()
  239. {
  240. int ncolonne;
  241. std::cout << "Il file contiene 4, 5, 6 o 7 colonne? ";
  242. std::cin >> ncolonne;
  243. if (ncolonne == 6 || ncolonne == 4) p[WEIGHT] = 0;
  244. else if (ncolonne == 7 || ncolonne == 5) p[WEIGHT] = 1;
  245. else exit(-5);
  246. p[NCOLONNE] = ncolonne;
  247. p_b[NCOLONNE] = false;
  248. p_b[WEIGHT] = false;
  249. }
  250. void Parametri::chiedi_2Do3D()
  251. {
  252. int dimensioni;
  253. std::cout << "E' una griglia 3D (3) o 2D (2)? ";
  254. std::cin >> dimensioni;
  255. if (dimensioni == 2) p[NCOLONNE] = 1;
  256. else if (dimensioni == 3) p[NCOLONNE] = 3;
  257. else
  258. {
  259. std::cout << "Choice not valid" << std::endl;
  260. exit(-5);
  261. }
  262. p_b[NCOLONNE] = false;
  263. }
  264. void Parametri::chiedi_endian_file()
  265. {
  266. std::cout << "Il file e' little [x86] (0) o big [ppc] (1) endian? ";
  267. std::cin >> endian_file;
  268. if (endian_file != 1 && endian_file != 0) exit(-4);
  269. }
  270. void Parametri::check_filename(const char *nomefile)
  271. {
  272. if (nomefile[0] == 'P')
  273. {
  274. if (nomefile[1] == 'r')
  275. {
  276. if (nomefile[2] == 'p')
  277. {
  278. massa_particella_MeV = (float)MP_MEV;
  279. file_particelle_P = true;
  280. }
  281. else if (nomefile[2] == 'e')
  282. {
  283. file_densita_energia_griglia_protoni = true;
  284. sprintf(support_label, "pren");
  285. }
  286. else
  287. {
  288. std::cout << "File non riconosciuto" << std::endl;
  289. exit(-15);
  290. }
  291. }
  292. else if (nomefile[1] == 'd')
  293. {
  294. file_densita_protoni = true;
  295. sprintf(support_label, "pden");
  296. }
  297. else
  298. {
  299. std::cout << "File non riconosciuto" << std::endl;
  300. exit(-15);
  301. }
  302. }
  303. else if (nomefile[0] == 'H')
  304. {
  305. if (nomefile[1] == 'i')
  306. {
  307. if (nomefile[2] == 'p')
  308. {
  309. massa_particella_MeV = (float)MP_MEV;
  310. file_particelle_HI = true;
  311. }
  312. else if (nomefile[2] == 'd')
  313. {
  314. file_densita_HI = true;
  315. sprintf(support_label, "hidn");
  316. }
  317. else if (nomefile[2] == 'e')
  318. {
  319. file_densita_energia_griglia_HI = true;
  320. sprintf(support_label, "hien");
  321. }
  322. else
  323. {
  324. std::cout << "File non riconosciuto" << std::endl;
  325. exit(-15);
  326. }
  327. }
  328. else
  329. {
  330. std::cout << "File non riconosciuto" << std::endl;
  331. exit(-15);
  332. }
  333. }
  334. else if (nomefile[0] == 'L')
  335. {
  336. if (nomefile[1] == 'i')
  337. {
  338. if (nomefile[2] == 'p')
  339. {
  340. massa_particella_MeV = (float)MP_MEV;
  341. file_particelle_LI = true;
  342. }
  343. else if (nomefile[2] == 'd')
  344. {
  345. file_densita_LI = true;
  346. sprintf(support_label, "lidn");
  347. }
  348. else if (nomefile[2] == 'e')
  349. {
  350. file_densita_energia_griglia_LI = true;
  351. sprintf(support_label, "lien");
  352. }
  353. else
  354. {
  355. std::cout << "File non riconosciuto" << std::endl;
  356. exit(-15);
  357. }
  358. }
  359. else
  360. {
  361. std::cout << "File non riconosciuto" << std::endl;
  362. exit(-15);
  363. }
  364. }
  365. else if (nomefile[0] == 'E')
  366. {
  367. if (nomefile[1] == 'l')
  368. {
  369. if (nomefile[2] == 'p')
  370. {
  371. massa_particella_MeV = (float)ME_MEV;
  372. file_particelle_E = true;
  373. }
  374. else if (nomefile[2] == 'e')
  375. {
  376. file_densita_energia_griglia_elettroni = true;
  377. sprintf(support_label, "elen");
  378. }
  379. else
  380. {
  381. std::cout << "File non riconosciuto" << std::endl;
  382. exit(-15);
  383. }
  384. }
  385. else if (nomefile[1] == 'x')
  386. {
  387. if (nomefile[2] == 'f')
  388. {
  389. file_campi_Ex = true;
  390. sprintf(support_label, "Ex");
  391. }
  392. else
  393. {
  394. std::cout << "File non riconosciuto" << std::endl;
  395. exit(-15);
  396. }
  397. }
  398. else if (nomefile[1] == 'y')
  399. {
  400. if (nomefile[2] == 'f')
  401. {
  402. file_campi_Ey = true;
  403. sprintf(support_label, "Ey");
  404. }
  405. else
  406. {
  407. std::cout << "File non riconosciuto" << std::endl;
  408. exit(-15);
  409. }
  410. }
  411. else if (nomefile[1] == 'z')
  412. {
  413. if (nomefile[2] == 'f')
  414. {
  415. file_campi_Ez = true;
  416. sprintf(support_label, "Ez");
  417. }
  418. else
  419. {
  420. std::cout << "File non riconosciuto" << std::endl;
  421. exit(-15);
  422. }
  423. }
  424. else if (nomefile[1] == 'd')
  425. {
  426. file_densita_elettroni = true;
  427. sprintf(support_label, "eden");
  428. }
  429. else
  430. {
  431. std::cout << "File non riconosciuto" << std::endl;
  432. exit(-15);
  433. }
  434. }
  435. else if (nomefile[0] == 'B')
  436. {
  437. if (nomefile[1] == 'x')
  438. {
  439. if (nomefile[2] == 'f')
  440. {
  441. file_campi_Bx = true;
  442. sprintf(support_label, "Bx");
  443. }
  444. else
  445. {
  446. std::cout << "File non riconosciuto" << std::endl;
  447. exit(-15);
  448. }
  449. }
  450. else if (nomefile[1] == 'y')
  451. {
  452. if (nomefile[2] == 'f')
  453. {
  454. file_campi_By = true;
  455. sprintf(support_label, "By");
  456. }
  457. else
  458. {
  459. std::cout << "File non riconosciuto" << std::endl;
  460. exit(-15);
  461. }
  462. }
  463. else if (nomefile[1] == 'z')
  464. {
  465. if (nomefile[2] == 'f')
  466. {
  467. file_campi_Bz = true;
  468. sprintf(support_label, "Bz");
  469. }
  470. else
  471. {
  472. std::cout << "File non riconosciuto" << std::endl;
  473. exit(-15);
  474. }
  475. }
  476. else if (nomefile[1] == 'd')
  477. {
  478. file_densita_driver = true;
  479. sprintf(support_label, "Bd");
  480. }
  481. else
  482. {
  483. std::cout << "File non riconosciuto" << std::endl;
  484. exit(-15);
  485. }
  486. }
  487. else
  488. {
  489. std::cout << "File non riconosciuto" << std::endl;
  490. exit(-15);
  491. }
  492. }
  493. void Parametri::parse_command_line(int argc, const char ** argv)
  494. {
  495. std::ifstream fileParametri;
  496. std::string nomefile;
  497. bool usa_file_parametri = false;
  498. bool failed_opening_file;
  499. for (int i = 2; i < argc; i++)
  500. /************************************************************************
  501. We will iterate over argv[] to get the parameters stored inside.
  502. Note that we're starting on 1 because we don't need to know the
  503. path of the program, which is stored in argv[0], and the input file,
  504. which is supposed to be given as the first argument and so is in argv[1]
  505. ************************************************************************/
  506. {
  507. // std::cout << argv[i] << std::endl;
  508. if (std::string(argv[i]) == "-readParamsfromFile" || std::string(argv[i]) == "-readParamsFromFile" || std::string(argv[i]) == "-readParams" || std::string(argv[i]) == "-readparamsfromfile")
  509. {
  510. if (i < argc - 1 && argv[i + 1][0] != '-')
  511. {
  512. nomefile = std::string(argv[i + 1]);
  513. usa_file_parametri = true;
  514. i++;
  515. std::cout << "Using " << nomefile << " as the binning parameters file" << std::endl;
  516. }
  517. else
  518. {
  519. nomefile = std::string(argv[1]) + ".extremes";
  520. usa_file_parametri = true;
  521. std::cout << "Using " << nomefile << " as the binning parameters file" << std::endl;
  522. }
  523. }
  524. else if (std::string(argv[i]) == "-params")
  525. {
  526. std::cout << "Forcing the output of the parameters from .dat/.bin files" << std::endl;
  527. p[OUT_PARAMS] = 1;
  528. p_b[OUT_PARAMS] = false;
  529. }
  530. else if (std::string(argv[i]) == "-swap")
  531. {
  532. std::cout << "Forcing a bit endianness swapping" << std::endl;
  533. p[SWAP] = 1;
  534. p_b[SWAP] = false;
  535. }
  536. else if (std::string(argv[i]) == "-noswap")
  537. {
  538. std::cout << "Forcing a bit endianness NON swapping" << std::endl;
  539. p[SWAP] = 0;
  540. p_b[SWAP] = false;
  541. }
  542. else if (std::string(argv[i]) == "-force_new")
  543. {
  544. std::cout << "Forced using new files routine even without .dat file" << std::endl;
  545. old_fortran_bin = false;
  546. }
  547. else if (std::string(argv[i]) == "-stop")
  548. {
  549. last_cpu = atoi(argv[i + 1]);
  550. if (last_cpu < 1) last_cpu = 1;
  551. std::cout << "Forced stopping reading at CPU #" << last_cpu << std::endl;
  552. i++;
  553. }
  554. else if (std::string(argv[i]) == "-span")
  555. {
  556. span = atoi(argv[i + 1]);
  557. if (span < 0) span = 0;
  558. std::cout << "Span factor for lineout: " << span << std::endl;
  559. i++;
  560. }
  561. else if (std::string(argv[i]) == "-subsample")
  562. {
  563. subsample = atoi(argv[i + 1]);
  564. if (file_particelle_P || file_particelle_E || file_particelle_HI || file_particelle_LI)
  565. {
  566. if (subsample < 1)
  567. {
  568. subsample = 1;
  569. std::cout << "Value for subsampling not valid, disabled" << std::endl;
  570. }
  571. else
  572. {
  573. std::cout << "Will subsample with a ratio of 1:" << subsample << " if any ASCII dump will be requested" << std::endl;
  574. }
  575. }
  576. else
  577. {
  578. std::cout << "Subsample factor is valid only for phase space files and will be used only for ASCII output" << std::endl;
  579. }
  580. i++;
  581. }
  582. else if (std::string(argv[i]) == "-ncol")
  583. {
  584. int ncolumns = atoi(argv[i + 1]);
  585. p[NCOLONNE] = ncolumns;
  586. if (ncolumns == 6) p[WEIGHT] = 0;
  587. else if (ncolumns == 7) p[WEIGHT] = 1;
  588. std::cout << "Forced number of columns in binary file to " << ncolumns << std::endl;
  589. p_b[NCOLONNE] = false;
  590. p_b[WEIGHT] = false;
  591. i++;
  592. }
  593. else if (std::string(argv[i]) == "-dump_vtk")
  594. {
  595. std::cout << "You asked to have a VTK dump of the input file" << std::endl;
  596. p[OUT_VTK] = 1;
  597. p_b[OUT_VTK] = false;
  598. }
  599. else if (std::string(argv[i]) == "-dump_vtk_nostretch")
  600. {
  601. std::cout << "You asked to have a VTK dump of the non-stretched grid.\n";
  602. std::cout << "If not explicitly said, the grid will be considered stretched in ALL directions" << std::endl;
  603. p[OUT_VTK_NOSTRETCH] = 1;
  604. p_b[OUT_VTK_NOSTRETCH] = false;
  605. }
  606. else if (std::string(argv[i]) == "-no_stretch_x")
  607. {
  608. std::cout << "Assuming the grid is NOT stretched along x axis.\n";
  609. stretched_along_x = 0;
  610. }
  611. else if (std::string(argv[i]) == "-dump_cutx")
  612. {
  613. if (p[NCOLONNE] > 1)
  614. {
  615. if (argv[i + 1][0] != '-')
  616. {
  617. float posizione_taglio = (float)atof(argv[i + 1]);
  618. posizioni_taglio_griglia_x.push_back(posizione_taglio);
  619. std::cout << "You asked to cut the grid at x = " << posizione_taglio << std::endl;
  620. i++;
  621. }
  622. else
  623. {
  624. std::cout << "You asked to cut the grid at the middle of the x-axis" << std::endl;
  625. }
  626. p[OUT_CUTX] = 1;
  627. p_b[OUT_CUTX] = false;
  628. }
  629. else
  630. {
  631. std::cout << "Unable to apply a cut on the grid in 2D, please use -dump_gnuplot" << std::endl;
  632. if (argv[i + 1][0] != '-') i++;
  633. p[OUT_CUTX] = 0;
  634. p_b[OUT_CUTX] = false;
  635. }
  636. }
  637. else if (std::string(argv[i]) == "-dump_cuty")
  638. {
  639. if (p[NCOLONNE] > 1)
  640. {
  641. if (argv[i + 1][0] != '-')
  642. {
  643. float posizione_taglio = (float)atof(argv[i + 1]);
  644. posizioni_taglio_griglia_y.push_back(posizione_taglio);
  645. std::cout << "You asked to cut the grid at y = " << posizione_taglio << std::endl;
  646. i++;
  647. }
  648. else
  649. {
  650. std::cout << "You asked to cut the grid at the middle of the y-axis" << std::endl;
  651. }
  652. p[OUT_CUTY] = 1;
  653. p_b[OUT_CUTY] = false;
  654. }
  655. else
  656. {
  657. std::cout << "Unable to apply a cut on the grid in 2D, please use -dump_gnuplot" << std::endl;
  658. if (argv[i + 1][0] != '-') i++;
  659. p[OUT_CUTY] = 0;
  660. p_b[OUT_CUTY] = false;
  661. }
  662. }
  663. else if (std::string(argv[i]) == "-dump_cutz")
  664. {
  665. if (p[NCOLONNE] > 1)
  666. {
  667. if (argv[i + 1][0] != '-')
  668. {
  669. float posizione_taglio = (float)atof(argv[i + 1]);
  670. posizioni_taglio_griglia_z.push_back(posizione_taglio);
  671. std::cout << "You asked to cut the grid at z = " << posizione_taglio << std::endl;
  672. i++;
  673. }
  674. else
  675. {
  676. std::cout << "You asked to cut the grid at the middle of the z-axis" << std::endl;
  677. }
  678. p[OUT_CUTZ] = 1;
  679. p_b[OUT_CUTZ] = false;
  680. }
  681. else
  682. {
  683. std::cout << "Unable to apply a cut on the grid in 2D, please use -dump_gnuplot" << std::endl;
  684. if (argv[i + 1][0] != '-') i++;
  685. p[OUT_CUTZ] = 0;
  686. p_b[OUT_CUTZ] = false;
  687. }
  688. }
  689. else if (std::string(argv[i]) == "-dump_lineoutx")
  690. {
  691. std::cout << "You asked to have a lineout of the grid along the x-axis" << std::endl;
  692. p[OUT_LINEOUT_X] = 1;
  693. p_b[OUT_LINEOUT_X] = false;
  694. }
  695. else if (std::string(argv[i]) == "-dump_gnuplot")
  696. {
  697. if (p[NCOLONNE] == 1)
  698. {
  699. std::cout << "You asked to rewrite the 2D grid in ASCII format for gnuplot" << std::endl;
  700. p[OUT_GRID2D] = 1;
  701. p_b[OUT_GRID2D] = false;
  702. }
  703. else
  704. {
  705. std::cout << "Unable to write a 3D grid for gnuplot without slicing it, please use dump_cutx/y/z" << std::endl;
  706. p[OUT_GRID2D] = 0;
  707. p_b[OUT_GRID2D] = false;
  708. }
  709. }
  710. else if (std::string(argv[i]) == "-dump_propaga")
  711. {
  712. std::cout << "You asked to have a .ppg dump of the input phase space" << std::endl;
  713. p[OUT_PROPAGA] = 1;
  714. p_b[OUT_PROPAGA] = false;
  715. }
  716. else if (std::string(argv[i]) == "-dump_csv")
  717. {
  718. std::cout << "You asked to have a .csv dump of the input phase space" << std::endl;
  719. p[OUT_CSV] = 1;
  720. p_b[OUT_CSV] = false;
  721. }
  722. else if (std::string(argv[i]) == "-dump_xyzE")
  723. {
  724. std::cout << "You asked to have a xy(z)E dump of the input phase space" << std::endl;
  725. p[OUT_XYZE] = 1;
  726. p_b[OUT_XYZE] = false;
  727. }
  728. else if (std::string(argv[i]) == "-dump_clean")
  729. {
  730. std::cout << "You asked to have a unique, clean binary file as the output" << std::endl;
  731. p[OUT_CLEAN_BINARY] = 1;
  732. p_b[OUT_CLEAN_BINARY] = false;
  733. }
  734. else if (std::string(argv[i]) == "-parameters")
  735. {
  736. std::cout << "You asked to write the simulation parameters file" << std::endl;
  737. p[OUT_PARAMS] = 1;
  738. p_b[OUT_PARAMS] = false;
  739. }
  740. else if (std::string(argv[i]) == "-find_minmax")
  741. {
  742. std::cout << "You asked to search for minima and maxima" << std::endl;
  743. p[FIND_MINMAX] = 1;
  744. p_b[FIND_MINMAX] = false;
  745. }
  746. else if (std::string(argv[i]) == "-do_binning")
  747. {
  748. std::cout << "You asked to enable plotting functions" << std::endl;
  749. p[DO_BINNING] = 1;
  750. p_b[DO_BINNING] = false;
  751. }
  752. else if (std::string(argv[i]) == "-xmin")
  753. {
  754. xmin = (float)atof(argv[i + 1]);
  755. xmin_b = false;
  756. i++;
  757. }
  758. else if (std::string(argv[i]) == "-xmax")
  759. {
  760. xmax = (float)atof(argv[i + 1]);
  761. xmax_b = false;
  762. i++;
  763. }
  764. else if (std::string(argv[i]) == "-weight")
  765. {
  766. overwrite_weight = true;
  767. overwrite_weight_value = (float)atof(argv[i + 1]);
  768. i++;
  769. }
  770. else if (std::string(argv[i]) == "-wmin")
  771. {
  772. wmin = (float)atof(argv[i + 1]);
  773. wmin_b = false;
  774. i++;
  775. }
  776. else if (std::string(argv[i]) == "-wmax")
  777. {
  778. wmax = (float)atof(argv[i + 1]);
  779. wmax_b = false;
  780. i++;
  781. }
  782. else if (std::string(argv[i]) == "-ymin")
  783. {
  784. ymin = (float)atof(argv[i + 1]);
  785. ymin_b = false;
  786. i++;
  787. }
  788. else if (std::string(argv[i]) == "-ymax")
  789. {
  790. ymax = (float)atof(argv[i + 1]);
  791. ymax_b = false;
  792. i++;
  793. }
  794. else if (std::string(argv[i]) == "-zmin")
  795. {
  796. if (p[NCOLONNE] > 5)
  797. {
  798. zmin = (float)atof(argv[i + 1]);
  799. zmin_b = false;
  800. i++;
  801. }
  802. else
  803. {
  804. std::cout << "Unable to apply a cut in z-dimension on a 2D file" << std::endl;
  805. }
  806. }
  807. else if (std::string(argv[i]) == "-zmax")
  808. {
  809. if (p[NCOLONNE] > 5)
  810. {
  811. zmax = (float)atof(argv[i + 1]);
  812. zmax_b = false;
  813. i++;
  814. }
  815. else
  816. {
  817. std::cout << "Unable to apply a cut in z-dimension on a 2D file" << std::endl;
  818. }
  819. }
  820. else if (std::string(argv[i]) == "-tymin")
  821. {
  822. tymin = (float)atof(argv[i + 1]);
  823. tymin_b = false;
  824. i++;
  825. }
  826. else if (std::string(argv[i]) == "-tymax")
  827. {
  828. tymax = (float)atof(argv[i + 1]);
  829. tymax_b = false;
  830. i++;
  831. }
  832. else if (std::string(argv[i]) == "-tzmin")
  833. {
  834. if (p[NCOLONNE] > 5)
  835. {
  836. tzmin = (float)atof(argv[i + 1]);
  837. tzmin_b = false;
  838. i++;
  839. }
  840. else
  841. {
  842. std::cout << "Unable to apply a cut in z-dimension on a 2D file" << std::endl;
  843. }
  844. }
  845. else if (std::string(argv[i]) == "-tzmax")
  846. {
  847. if (p[NCOLONNE] > 5)
  848. {
  849. tzmax = (float)atof(argv[i + 1]);
  850. tzmax_b = false;
  851. i++;
  852. }
  853. else
  854. {
  855. std::cout << "Unable to apply a cut in z-dimension on a 2D file" << std::endl;
  856. }
  857. }
  858. else if (std::string(argv[i]) == "-pxmin")
  859. {
  860. pxmin = (float)atof(argv[i + 1]);
  861. pxmin_b = false;
  862. i++;
  863. }
  864. else if (std::string(argv[i]) == "-pxmax")
  865. {
  866. pxmax = (float)atof(argv[i + 1]);
  867. pxmax_b = false;
  868. i++;
  869. }
  870. else if (std::string(argv[i]) == "-pymin")
  871. {
  872. pymin = (float)atof(argv[i + 1]);
  873. pymin_b = false;
  874. i++;
  875. }
  876. else if (std::string(argv[i]) == "-pymax")
  877. {
  878. pymax = (float)atof(argv[i + 1]);
  879. pymax_b = false;
  880. i++;
  881. }
  882. else if (std::string(argv[i]) == "-pzmin")
  883. {
  884. if (p[NCOLONNE] > 5)
  885. {
  886. pzmin = (float)atof(argv[i + 1]);
  887. pzmin_b = false;
  888. i++;
  889. }
  890. else
  891. {
  892. std::cout << "Unable to apply a cut in z-dimension on a 2D file" << std::endl;
  893. }
  894. }
  895. else if (std::string(argv[i]) == "-pzmax")
  896. {
  897. if (p[NCOLONNE] > 5)
  898. {
  899. pzmax = (float)atof(argv[i + 1]);
  900. pzmax_b = false;
  901. i++;
  902. }
  903. else
  904. {
  905. std::cout << "Unable to apply a cut in z-dimension on a 2D file" << std::endl;
  906. }
  907. }
  908. else if (std::string(argv[i]) == "-thetamin")
  909. {
  910. thetamin = (float)atof(argv[i + 1]);
  911. thetamin_b = false;
  912. i++;
  913. }
  914. else if (std::string(argv[i]) == "-thetamax")
  915. {
  916. thetamax = (float)atof(argv[i + 1]);
  917. thetamax_b = false;
  918. i++;
  919. }
  920. else if (std::string(argv[i]) == "-thetaTmin")
  921. {
  922. thetaTmin = (float)atof(argv[i + 1]);
  923. thetaTmin_b = false;
  924. i++;
  925. }
  926. else if (std::string(argv[i]) == "-thetaTmax")
  927. {
  928. thetaTmax = (float)atof(argv[i + 1]);
  929. thetaTmax_b = false;
  930. i++;
  931. }
  932. else if (std::string(argv[i]) == "-gammamin")
  933. {
  934. gammamin = (float)atof(argv[i + 1]);
  935. gammamin_b = false;
  936. i++;
  937. }
  938. else if (std::string(argv[i]) == "-gammamax")
  939. {
  940. gammamax = (float)atof(argv[i + 1]);
  941. gammamax_b = false;
  942. i++;
  943. }
  944. else if (std::string(argv[i]) == "-Emin")
  945. {
  946. Emin = (float)atof(argv[i + 1]);
  947. Emin_b = false;
  948. i++;
  949. }
  950. else if (std::string(argv[i]) == "-Emax")
  951. {
  952. Emax = (float)atof(argv[i + 1]);
  953. Emax_b = false;
  954. i++;
  955. }
  956. else if (std::string(argv[i]) == "-plot_xy")
  957. {
  958. fai_plot_xy = 1;
  959. }
  960. else if (std::string(argv[i]) == "-plot_xw")
  961. {
  962. if (p[WEIGHT])
  963. {
  964. fai_plot_xw = 1;
  965. }
  966. else
  967. {
  968. std::cout << "Unable to do a plot with weight using a file without weight!" << std::endl;
  969. }
  970. }
  971. else if (std::string(argv[i]) == "-plot_xz")
  972. {
  973. if (p[NCOLONNE] > 5)
  974. {
  975. fai_plot_xz = 1;
  976. }
  977. else
  978. {
  979. std::cout << "Unable to do a plot with z using a 2D file" << std::endl;
  980. }
  981. }
  982. else if (std::string(argv[i]) == "-plot_yz")
  983. {
  984. if (p[NCOLONNE] > 5)
  985. {
  986. fai_plot_yz = 1;
  987. }
  988. else
  989. {
  990. std::cout << "Unable to do a plot with z using a 2D file" << std::endl;
  991. }
  992. }
  993. else if (std::string(argv[i]) == "-plot_rcf")
  994. {
  995. if (p[NCOLONNE] > 5)
  996. {
  997. fai_plot_rcf = 1;
  998. }
  999. else
  1000. {
  1001. std::cout << "Unable to do a plot with tz using a 2D file" << std::endl;
  1002. }
  1003. }
  1004. else if (std::string(argv[i]) == "-plot_xpx")
  1005. {
  1006. fai_plot_xpx = 1;
  1007. }
  1008. else if (std::string(argv[i]) == "-plot_xpy")
  1009. {
  1010. fai_plot_xpy = 1;
  1011. }
  1012. else if (std::string(argv[i]) == "-plot_xpz")
  1013. {
  1014. if (p[NCOLONNE] > 5)
  1015. {
  1016. fai_plot_xpz = 1;
  1017. }
  1018. else
  1019. {
  1020. std::cout << "Unable to do a plot with z using a 2D file" << std::endl;
  1021. }
  1022. }
  1023. else if (std::string(argv[i]) == "-plot_ypx")
  1024. {
  1025. fai_plot_ypx = 1;
  1026. }
  1027. else if (std::string(argv[i]) == "-plot_ypy")
  1028. {
  1029. fai_plot_ypy = 1;
  1030. }
  1031. else if (std::string(argv[i]) == "-plot_ypz")
  1032. {
  1033. if (p[NCOLONNE] > 5)
  1034. {
  1035. fai_plot_ypz = 1;
  1036. }
  1037. else
  1038. {
  1039. std::cout << "Unable to do a plot with z using a 2D file" << std::endl;
  1040. }
  1041. }
  1042. else if (std::string(argv[i]) == "-plot_zpx")
  1043. {
  1044. if (p[NCOLONNE] > 5)
  1045. {
  1046. fai_plot_zpx = 1;
  1047. }
  1048. else
  1049. {
  1050. std::cout << "Unable to do a plot with z using a 2D file" << std::endl;
  1051. }
  1052. }
  1053. else if (std::string(argv[i]) == "-plot_zpy")
  1054. {
  1055. if (p[NCOLONNE] > 5)
  1056. {
  1057. fai_plot_zpy = 1;
  1058. }
  1059. else
  1060. {
  1061. std::cout << "Unable to do a plot with z using a 2D file" << std::endl;
  1062. }
  1063. }
  1064. else if (std::string(argv[i]) == "-plot_zpz")
  1065. {
  1066. if (p[NCOLONNE] > 5)
  1067. {
  1068. fai_plot_zpz = 1;
  1069. }
  1070. else
  1071. {
  1072. std::cout << "Unable to do a plot with z using a 2D file" << std::endl;
  1073. }
  1074. }
  1075. else if (std::string(argv[i]) == "-plot_pxpy")
  1076. {
  1077. fai_plot_pxpy = 1;
  1078. }
  1079. else if (std::string(argv[i]) == "-plot_pxpz")
  1080. {
  1081. if (p[NCOLONNE] > 5)
  1082. {
  1083. fai_plot_pxpz = 1;
  1084. }
  1085. else
  1086. {
  1087. std::cout << "Unable to do a plot with z using a 2D file" << std::endl;
  1088. }
  1089. }
  1090. else if (std::string(argv[i]) == "-plot_pypz")
  1091. {
  1092. if (p[NCOLONNE] > 5)
  1093. {
  1094. fai_plot_pypz = 1;
  1095. }
  1096. else
  1097. {
  1098. std::cout << "Unable to do a plot with z using a 2D file" << std::endl;
  1099. }
  1100. }
  1101. else if (std::string(argv[i]) == "-plot_etheta")
  1102. {
  1103. fai_plot_Etheta = 1;
  1104. }
  1105. else if (std::string(argv[i]) == "-plot_ethetaT")
  1106. {
  1107. fai_plot_EthetaT = 1;
  1108. }
  1109. else if (std::string(argv[i]) == "-plot_espec")
  1110. {
  1111. fai_plot_Espec = 1;
  1112. }
  1113. else if (std::string(argv[i]) == "-plot_wspec")
  1114. {
  1115. if (p[WEIGHT])
  1116. {
  1117. fai_plot_wspec = 1;
  1118. }
  1119. else
  1120. {
  1121. std::cout << "Unable to do a plot with weight using a file without weight!" << std::endl;
  1122. }
  1123. }
  1124. else if (std::string(argv[i]) == "-plot_thetaspec")
  1125. {
  1126. fai_plot_thetaspec = 1;
  1127. }
  1128. else if (std::string(argv[i]) == "-plot_thetaTspec")
  1129. {
  1130. fai_plot_thetaTspec = 1;
  1131. }
  1132. else if (std::string(argv[i]) == "-nbin")
  1133. {
  1134. nbin = atoi(argv[i + 1]);
  1135. if (nbin_x_b) nbin_x = nbin;
  1136. if (nbin_y_b) nbin_y = nbin;
  1137. if (nbin_z_b) nbin_z = nbin;
  1138. if (nbin_px_b) nbin_px = nbin;
  1139. if (nbin_py_b) nbin_py = nbin;
  1140. if (nbin_pz_b) nbin_pz = nbin;
  1141. if (nbin_ty_b) nbin_ty = nbin;
  1142. if (nbin_tz_b) nbin_tz = nbin;
  1143. if (nbin_gamma_b) nbin_gamma = nbin;
  1144. if (nbin_theta_b) nbin_theta = nbin;
  1145. if (nbin_theta_b) nbin_thetaT = nbin;
  1146. if (nbin_E_b) nbin_E = nbin;
  1147. if (nbin_w_b) nbin_w = nbin;
  1148. nbin_b = false;
  1149. i++;
  1150. }
  1151. else if (std::string(argv[i]) == "-nbinx")
  1152. {
  1153. nbin_x = atoi(argv[i + 1]);
  1154. nbin_x_b = false;
  1155. nbin_b = false;
  1156. i++;
  1157. }
  1158. else if (std::string(argv[i]) == "-nbiny")
  1159. {
  1160. nbin_y = atoi(argv[i + 1]);
  1161. nbin_y_b = false;
  1162. nbin_b = false;
  1163. i++;
  1164. }
  1165. else if (std::string(argv[i]) == "-nbinz")
  1166. {
  1167. nbin_z = atoi(argv[i + 1]);
  1168. nbin_z_b = false;
  1169. nbin_b = false;
  1170. i++;
  1171. }
  1172. else if (std::string(argv[i]) == "-nbinty")
  1173. {
  1174. nbin_ty = atoi(argv[i + 1]);
  1175. nbin_ty_b = false;
  1176. nbin_b = false;
  1177. i++;
  1178. }
  1179. else if (std::string(argv[i]) == "-nbintz")
  1180. {
  1181. nbin_tz = atoi(argv[i + 1]);
  1182. nbin_tz_b = false;
  1183. nbin_b = false;
  1184. i++;
  1185. }
  1186. else if (std::string(argv[i]) == "-nbinpx")
  1187. {
  1188. nbin_px = atoi(argv[i + 1]);
  1189. nbin_px_b = false;
  1190. nbin_b = false;
  1191. i++;
  1192. }
  1193. else if (std::string(argv[i]) == "-nbinpy")
  1194. {
  1195. nbin_py = atoi(argv[i + 1]);
  1196. nbin_py_b = false;
  1197. nbin_b = false;
  1198. i++;
  1199. }
  1200. else if (std::string(argv[i]) == "-nbinpz")
  1201. {
  1202. nbin_pz = atoi(argv[i + 1]);
  1203. nbin_pz_b = false;
  1204. nbin_b = false;
  1205. i++;
  1206. }
  1207. else if (std::string(argv[i]) == "-nbintheta")
  1208. {
  1209. nbin_theta = atoi(argv[i + 1]);
  1210. nbin_theta_b = false;
  1211. nbin_b = false;
  1212. i++;
  1213. }
  1214. else if (std::string(argv[i]) == "-nbinthetaT")
  1215. {
  1216. nbin_thetaT = atoi(argv[i + 1]);
  1217. nbin_thetaT_b = false;
  1218. nbin_b = false;
  1219. i++;
  1220. }
  1221. else if (std::string(argv[i]) == "-nbingamma")
  1222. {
  1223. nbin_gamma = atoi(argv[i + 1]);
  1224. nbin_gamma_b = false;
  1225. nbin_b = false;
  1226. i++;
  1227. }
  1228. else if (std::string(argv[i]) == "-nbinE")
  1229. {
  1230. nbin_E = atoi(argv[i + 1]);
  1231. nbin_E_b = false;
  1232. nbin_b = false;
  1233. i++;
  1234. }
  1235. else if (std::string(argv[i]) == "-nbinw")
  1236. {
  1237. nbin_w = atoi(argv[i + 1]);
  1238. nbin_w_b = false;
  1239. nbin_b = false;
  1240. i++;
  1241. }
  1242. else if (std::string(argv[i]) == "-dontask")
  1243. {
  1244. do_not_ask_missing = true;
  1245. }
  1246. }
  1247. std::string nomepar, evita, leggi;
  1248. if (file_particelle_P || file_particelle_E || file_particelle_HI || file_particelle_LI)
  1249. {
  1250. if (usa_file_parametri)
  1251. {
  1252. fileParametri.open(nomefile.c_str());
  1253. failed_opening_file = fileParametri.fail();
  1254. if (failed_opening_file)
  1255. {
  1256. std::cout << "Impossibile aprire il file " << nomefile << " contenente i parametri di binnaggio" << std::endl;
  1257. exit(50);
  1258. }
  1259. while (!fileParametri.eof())
  1260. {
  1261. fileParametri >> nomepar >> evita >> leggi;
  1262. if ((nomepar == "xmin" || nomepar == "XMIN") && xmin_b)
  1263. {
  1264. xmin = (float)std::atof(leggi.c_str());
  1265. xmin_b = false;
  1266. }
  1267. else if ((nomepar == "xmax" || nomepar == "XMAX") && xmax_b)
  1268. {
  1269. xmax = (float)std::atof(leggi.c_str());
  1270. xmax_b = false;
  1271. }
  1272. else if ((nomepar == "ymin" || nomepar == "YMIN") && ymin_b)
  1273. {
  1274. ymin = (float)std::atof(leggi.c_str());
  1275. ymin_b = false;
  1276. }
  1277. else if ((nomepar == "ymax" || nomepar == "YMAX") && ymax_b)
  1278. {
  1279. ymax = (float)std::atof(leggi.c_str());
  1280. ymax_b = false;
  1281. }
  1282. else if ((nomepar == "zmin" || nomepar == "ZMIN") && zmin_b)
  1283. {
  1284. zmin = (float)std::atof(leggi.c_str());
  1285. zmin_b = false;
  1286. }
  1287. else if ((nomepar == "zmax" || nomepar == "ZMAX") && zmax_b)
  1288. {
  1289. zmax = (float)std::atof(leggi.c_str());
  1290. zmax_b = false;
  1291. }
  1292. else if ((nomepar == "tymin" || nomepar == "TYMIN") && tymin_b)
  1293. {
  1294. tymin = (float)std::atof(leggi.c_str());
  1295. tymin_b = false;
  1296. }
  1297. else if ((nomepar == "tymax" || nomepar == "TYMAX") && tymax_b)
  1298. {
  1299. tymax = (float)std::atof(leggi.c_str());
  1300. tymax_b = false;
  1301. }
  1302. else if ((nomepar == "tzmin" || nomepar == "TZMIN") && tzmin_b)
  1303. {
  1304. tzmin = (float)std::atof(leggi.c_str());
  1305. tzmin_b = false;
  1306. }
  1307. else if ((nomepar == "tzmax" || nomepar == "TZMAX") && tzmax_b)
  1308. {
  1309. tzmax = (float)std::atof(leggi.c_str());
  1310. tzmax_b = false;
  1311. }
  1312. else if ((nomepar == "pxmin" || nomepar == "PXMIN") && pxmin_b)
  1313. {
  1314. pxmin = (float)std::atof(leggi.c_str());
  1315. pxmin_b = false;
  1316. }
  1317. else if ((nomepar == "pxmax" || nomepar == "PXMAX") && pxmax_b)
  1318. {
  1319. pxmax = (float)std::atof(leggi.c_str());
  1320. pxmax_b = false;
  1321. }
  1322. else if ((nomepar == "pymin" || nomepar == "PYMIN") && pymin_b)
  1323. {
  1324. pymin = (float)std::atof(leggi.c_str());
  1325. pymin_b = false;
  1326. }
  1327. else if ((nomepar == "pymax" || nomepar == "PYMAX") && pymax_b)
  1328. {
  1329. pymax = (float)std::atof(leggi.c_str());
  1330. pymax_b = false;
  1331. }
  1332. else if ((nomepar == "pzmin" || nomepar == "PZMIN") && pzmin_b)
  1333. {
  1334. pzmin = (float)std::atof(leggi.c_str());
  1335. pzmin_b = false;
  1336. }
  1337. else if ((nomepar == "pzmax" || nomepar == "PZMAX") && pzmax_b)
  1338. {
  1339. pzmax = (float)std::atof(leggi.c_str());
  1340. pzmax_b = false;
  1341. }
  1342. else if ((nomepar == "gammamin" || nomepar == "GAMMAMIN") && gammamin_b)
  1343. {
  1344. gammamin = (float)std::atof(leggi.c_str());
  1345. gammamin_b = false;
  1346. }
  1347. else if ((nomepar == "gammamax" || nomepar == "GAMMAMAX") && gammamax_b)
  1348. {
  1349. gammamax = (float)std::atof(leggi.c_str());
  1350. gammamax_b = false;
  1351. }
  1352. else if ((nomepar == "thetamin" || nomepar == "THETAMIN") && thetamin_b)
  1353. {
  1354. thetamin = (float)std::atof(leggi.c_str());
  1355. thetamin_b = false;
  1356. }
  1357. else if ((nomepar == "thetamax" || nomepar == "THETAMAX") && thetamax_b)
  1358. {
  1359. thetamax = (float)std::atof(leggi.c_str());
  1360. thetamax_b = false;
  1361. }
  1362. else if ((nomepar == "thetaradmin" || nomepar == "THETARADMIN") && thetaTmin_b)
  1363. {
  1364. thetaTmin = (float)std::atof(leggi.c_str());
  1365. thetaTmin_b = false;
  1366. }
  1367. else if ((nomepar == "thetaradmax" || nomepar == "THETARADMAX") && thetaTmax_b)
  1368. {
  1369. thetaTmax = (float)std::atof(leggi.c_str());
  1370. thetaTmax_b = false;
  1371. }
  1372. else if ((nomepar == "emin" || nomepar == "EMIN") && Emin_b)
  1373. {
  1374. Emin = (float)std::atof(leggi.c_str());
  1375. Emin_b = false;
  1376. }
  1377. else if ((nomepar == "emax" || nomepar == "EMAX") && Emax_b)
  1378. {
  1379. Emax = (float)std::atof(leggi.c_str());
  1380. Emax_b = false;
  1381. }
  1382. else if ((nomepar == "wmin" || nomepar == "WMIN") && wmin_b)
  1383. {
  1384. wmin = (float)std::atof(leggi.c_str());
  1385. wmin_b = false;
  1386. }
  1387. else if ((nomepar == "wmax" || nomepar == "WMAX") && wmax_b)
  1388. {
  1389. wmax = (float)std::atof(leggi.c_str());
  1390. wmax_b = false;
  1391. }
  1392. /*
  1393. else
  1394. {
  1395. std::cout << "Parametro " << nomepar << " non riconosciuto." << std::endl;
  1396. }
  1397. */
  1398. }
  1399. fileParametri.close();
  1400. }
  1401. if (p_b[FIND_MINMAX] && !do_not_ask_missing)
  1402. {
  1403. std::cout << "Vuoi cercare massimi e minimi? 0 per no, 1 per si': ";
  1404. std::cin >> p[FIND_MINMAX];
  1405. p_b[FIND_MINMAX] = false;
  1406. }
  1407. if (p_b[DO_BINNING] && !do_not_ask_missing)
  1408. {
  1409. std::cout << "Vuoi fare il binnaggio dei dati? 1 si', 0 no: ";
  1410. std::cin >> p[DO_BINNING];
  1411. p_b[DO_BINNING] = false;
  1412. }
  1413. if (p[DO_BINNING] == 1 && nbin_b && !do_not_ask_missing)
  1414. {
  1415. std::cout << "Quanti bin per asse vuoi usare? (consiglio: 120): ";
  1416. std::cin >> nbin;
  1417. nbin_x = nbin_y = nbin_z = nbin_px = nbin_py = nbin_pz = nbin_E = nbin_theta = nbin_thetaT = nbin_ty = nbin_tz = nbin;
  1418. }
  1419. if (p[DO_BINNING] == 1 && !do_not_ask_missing)
  1420. {
  1421. std::cout << "Vuoi fare il plot x-px? 0 per no, 1 per si': ";
  1422. std::cin >> fai_plot_xpx;
  1423. std::cout << "Vuoi fare il plot E-theta (deg)? 0 per no, 1 per si': ";
  1424. std::cin >> fai_plot_Etheta;
  1425. std::cout << "Vuoi fare il plot E-theta (rad)? 0 per no, 1 per si': ";
  1426. std::cin >> fai_plot_EthetaT;
  1427. std::cout << "Vuoi fare lo spettro in energia? 0 per no, 1 per si': ";
  1428. std::cin >> fai_plot_Espec;
  1429. std::cout << "Vuoi fare il plot rfc? 0 per no, 1 per si': ";
  1430. std::cin >> fai_plot_rcf;
  1431. if (fai_plot_xpx)
  1432. {
  1433. if (xmin_b)
  1434. {
  1435. std::cout << "xmin = ";
  1436. std::cin >> xmin;
  1437. xmin_b = false;
  1438. }
  1439. if (xmax_b)
  1440. {
  1441. std::cout << "xmax = ";
  1442. std::cin >> xmax;
  1443. xmax_b = false;
  1444. }
  1445. if (nbin_x_b)
  1446. {
  1447. std::cout << "nbin_x = ";
  1448. std::cin >> nbin_x;
  1449. nbin_x_b = false;
  1450. }
  1451. if (pxmin_b)
  1452. {
  1453. std::cout << "pxmin = ";
  1454. std::cin >> pxmin;
  1455. pxmin_b = false;
  1456. }
  1457. if (pxmax_b)
  1458. {
  1459. std::cout << "pxmax = ";
  1460. std::cin >> pxmax;
  1461. pxmax_b = false;
  1462. }
  1463. if (nbin_px_b)
  1464. {
  1465. std::cout << "nbin_px = ";
  1466. std::cin >> nbin_px;
  1467. nbin_px_b = false;
  1468. }
  1469. }
  1470. if (fai_plot_Etheta || fai_plot_Espec || fai_plot_EthetaT)
  1471. {
  1472. if (Emin_b)
  1473. {
  1474. std::cout << "Emin = ";
  1475. std::cin >> Emin;
  1476. Emin_b = false;
  1477. }
  1478. if (Emax_b)
  1479. {
  1480. std::cout << "Emax = ";
  1481. std::cin >> Emax;
  1482. Emax_b = false;
  1483. }
  1484. if (nbin_E_b)
  1485. {
  1486. std::cout << "nbin_E = ";
  1487. std::cin >> nbin_E;
  1488. nbin_E_b = false;
  1489. }
  1490. }
  1491. if (fai_plot_Etheta)
  1492. {
  1493. if (thetamin_b)
  1494. {
  1495. std::cout << "thetamin = ";
  1496. std::cin >> thetamin;
  1497. thetamin_b = false;
  1498. }
  1499. if (thetamax_b)
  1500. {
  1501. std::cout << "thetamax = ";
  1502. std::cin >> thetamax;
  1503. thetamax_b = false;
  1504. }
  1505. if (nbin_theta_b)
  1506. {
  1507. std::cout << "nbin_theta = ";
  1508. std::cin >> nbin_theta;
  1509. nbin_theta_b = false;
  1510. }
  1511. }
  1512. if (fai_plot_EthetaT)
  1513. {
  1514. if (thetaTmin_b)
  1515. {
  1516. std::cout << "thetaRADmin = ";
  1517. std::cin >> thetaTmin;
  1518. thetaTmin_b = false;
  1519. }
  1520. if (thetaTmax_b)
  1521. {
  1522. std::cout << "thetaRADmax = ";
  1523. std::cin >> thetaTmax;
  1524. thetaTmax_b = false;
  1525. }
  1526. if (nbin_thetaT_b)
  1527. {
  1528. std::cout << "nbin_thetaRAD = ";
  1529. std::cin >> nbin_thetaT;
  1530. nbin_thetaT_b = false;
  1531. }
  1532. }
  1533. if (fai_plot_rcf)
  1534. {
  1535. if (tymin_b)
  1536. {
  1537. std::cout << "tymin = ";
  1538. std::cin >> tymin;
  1539. tymin_b = false;
  1540. }
  1541. if (tymax_b)
  1542. {
  1543. std::cout << "tymax = ";
  1544. std::cin >> tymax;
  1545. tymax_b = false;
  1546. }
  1547. if (nbin_ty_b)
  1548. {
  1549. std::cout << "nbin_ty = ";
  1550. std::cin >> nbin_ty;
  1551. nbin_ty_b = false;
  1552. }
  1553. if (tzmin_b)
  1554. {
  1555. std::cout << "tzmin = ";
  1556. std::cin >> tzmin;
  1557. tzmin_b = false;
  1558. }
  1559. if (tzmax_b)
  1560. {
  1561. std::cout << "tzmax = ";
  1562. std::cin >> tzmax;
  1563. tzmax_b = false;
  1564. }
  1565. if (nbin_tz_b)
  1566. {
  1567. std::cout << "nbin_tz = ";
  1568. std::cin >> nbin_tz;
  1569. nbin_tz_b = false;
  1570. }
  1571. }
  1572. }
  1573. #ifdef ENABLE_DEBUG
  1574. std::cout << "Dal file " << nomefile << " ho letto i seguenti estremi:" << std::endl;
  1575. std::cout << "XMIN = " << xmin << std::endl;
  1576. std::cout << "XMAX = " << xmax << std::endl;
  1577. std::cout << "YMIN = " << ymin << std::endl;
  1578. std::cout << "YMAX = " << ymax << std::endl;
  1579. std::cout << "ZMIN = " << zmin << std::endl;
  1580. std::cout << "ZMAX = " << zmax << std::endl;
  1581. std::cout << "PXMIN = " << pxmin << std::endl;
  1582. std::cout << "PXMAX = " << pxmax << std::endl;
  1583. std::cout << "PYMIN = " << pymin << std::endl;
  1584. std::cout << "PYMAX = " << pymax << std::endl;
  1585. std::cout << "PZMIN = " << pzmin << std::endl;
  1586. std::cout << "PZMAX = " << pzmax << std::endl;
  1587. std::cout << "GAMMAMIN = " << gammamin << std::endl;
  1588. std::cout << "GAMMAMAX = " << gammamax << std::endl;
  1589. std::cout << "THETAMIN = " << thetamin << std::endl;
  1590. std::cout << "THETAMAX = " << thetamax << std::endl;
  1591. std::cout << "THETARADMIN = " << thetaTmin << std::endl;
  1592. std::cout << "THETARADMAX = " << thetaTmax << std::endl;
  1593. std::cout << "EMIN = " << Emin << std::endl;
  1594. std::cout << "EMAX = " << Emax << std::endl;
  1595. std::cout << "TYMIN = " << tymin << std::endl;
  1596. std::cout << "TYMAX = " << tymax << std::endl;
  1597. std::cout << "TZMIN = " << tzmin << std::endl;
  1598. std::cout << "TZMAX = " << tzmax << std::endl;
  1599. std::cout << "WMIN = " << wmin << std::endl;
  1600. std::cout << "WMAX = " << wmax << std::endl;
  1601. #endif
  1602. if (p_b[OUT_VTK] && !do_not_ask_missing)
  1603. {
  1604. std::cout << "Vuoi l'output completo binario VTK? 1 si', 0 no: ";
  1605. std::cin >> p[OUT_VTK];
  1606. p_b[OUT_VTK] = false;
  1607. }
  1608. if (p_b[OUT_CLEAN_BINARY] && !do_not_ask_missing)
  1609. {
  1610. std::cout << "Vuoi l'output completo binario pulito? 1 si', 0 no: ";
  1611. std::cin >> p[OUT_CLEAN_BINARY];
  1612. p_b[OUT_CLEAN_BINARY] = false;
  1613. }
  1614. if (p_b[OUT_PROPAGA] && !do_not_ask_missing)
  1615. {
  1616. std::cout << "Vuoi l'output completo per Propaga? 1 si', 0 no: ";
  1617. std::cin >> p[OUT_PROPAGA];
  1618. p_b[OUT_PROPAGA] = false;
  1619. }
  1620. if (p_b[OUT_XYZE] && !do_not_ask_missing)
  1621. {
  1622. std::cout << "Vuoi l'output di un file ASCII contenente x y (z) ed energia? 1 si', 0 no: ";
  1623. std::cin >> p[OUT_XYZE];
  1624. p_b[OUT_XYZE] = false;
  1625. }
  1626. if (p_b[OUT_CSV] && !do_not_ask_missing)
  1627. {
  1628. std::cout << "Vuoi l'output completo CSV per Paraview? 1 si', 0 no: ";
  1629. std::cin >> p[OUT_CSV];
  1630. p_b[OUT_CSV] = false;
  1631. }
  1632. if (p_b[OUT_PARAMS] && !do_not_ask_missing)
  1633. {
  1634. std::cout << "Vuoi l'output dei parametri contenuti nel file? 1 si', 0 no: ";
  1635. std::cin >> p[OUT_PARAMS];
  1636. p_b[OUT_PARAMS] = false;
  1637. }
  1638. }
  1639. else
  1640. {
  1641. if (p_b[OUT_VTK] && !do_not_ask_missing)
  1642. {
  1643. std::cout << "Vuoi l'output completo binario VTK? 1 si', 0 no: ";
  1644. std::cin >> p[OUT_VTK];
  1645. p_b[OUT_VTK] = false;
  1646. }
  1647. if (p_b[OUT_VTK_NOSTRETCH] && !do_not_ask_missing)
  1648. {
  1649. std::cout << "Vuoi l'output binario VTK della parte non stretchata? 1 si', 0 no: ";
  1650. std::cin >> p[OUT_VTK_NOSTRETCH];
  1651. p_b[OUT_VTK_NOSTRETCH] = false;
  1652. }
  1653. if (p[OUT_VTK_NOSTRETCH] && !do_not_ask_missing)
  1654. {
  1655. std::cout << "La griglia e' stretchata anche lungo l'asse x? 1 si', 0 no: ";
  1656. std::cin >> stretched_along_x;
  1657. }
  1658. if (p[NCOLONNE] > 1)
  1659. {
  1660. if (p_b[OUT_CUTX] && !do_not_ask_missing)
  1661. {
  1662. std::cout << "Vuoi l'output di una slice tagliata lungo x per gnuplot? 1 si', 0 no: ";
  1663. std::cin >> p[OUT_CUTX];
  1664. p_b[OUT_CUTX] = false;
  1665. float posizione_taglio = 0.0;
  1666. if (p[OUT_CUTX] == 1)
  1667. {
  1668. std::cout << "Dimmi in che posizione (in micrometri) tagliare: ";
  1669. std::cin >> posizione_taglio;
  1670. posizioni_taglio_griglia_x.push_back(posizione_taglio);
  1671. }
  1672. }
  1673. if (p_b[OUT_CUTY] && !do_not_ask_missing)
  1674. {
  1675. std::cout << "Vuoi l'output di una slice tagliata lungo y per gnuplot? 1 si', 0 no: ";
  1676. std::cin >> p[OUT_CUTY];
  1677. p_b[OUT_CUTY] = false;
  1678. float posizione_taglio = 0.0;
  1679. if (p[OUT_CUTY] == 1)
  1680. {
  1681. std::cout << "Dimmi in che posizione (in micrometri) tagliare: ";
  1682. std::cin >> posizione_taglio;
  1683. posizioni_taglio_griglia_y.push_back(posizione_taglio);
  1684. }
  1685. }
  1686. if (p_b[OUT_CUTZ] && !do_not_ask_missing)
  1687. {
  1688. std::cout << "Vuoi l'output di una slice tagliata lungo z per gnuplot? 1 si', 0 no: ";
  1689. std::cin >> p[OUT_CUTZ];
  1690. p_b[OUT_CUTZ] = false;
  1691. float posizione_taglio = 0.0;
  1692. if (p[OUT_CUTZ] == 1)
  1693. {
  1694. std::cout << "Dimmi in che posizione (in micrometri) tagliare: ";
  1695. std::cin >> posizione_taglio;
  1696. posizioni_taglio_griglia_z.push_back(posizione_taglio);
  1697. }
  1698. }
  1699. p[OUT_GRID2D] = 0;
  1700. p_b[OUT_GRID2D] = false;
  1701. }
  1702. else
  1703. {
  1704. if (p_b[OUT_GRID2D] && !do_not_ask_missing)
  1705. {
  1706. std::cout << "Vuoi riscrivere la griglia in ASCII per gnuplot? 1 si', 0 no: ";
  1707. std::cin >> p[OUT_GRID2D];
  1708. p_b[OUT_GRID2D] = false;
  1709. }
  1710. p[OUT_CUTX] = 0;
  1711. p_b[OUT_CUTX] = false;
  1712. p[OUT_CUTY] = 0;
  1713. p_b[OUT_CUTY] = false;
  1714. p[OUT_CUTZ] = 0;
  1715. p_b[OUT_CUTZ] = false;
  1716. }
  1717. if (p_b[OUT_PARAMS] && !do_not_ask_missing)
  1718. {
  1719. std::cout << "Vuoi l'output dei parametri contenuti nel file? 1 si', 0 no: ";
  1720. std::cin >> p[OUT_PARAMS];
  1721. p_b[OUT_PARAMS] = false;
  1722. }
  1723. if (p_b[OUT_LINEOUT_X] && !do_not_ask_missing)
  1724. {
  1725. std::cout << "Vuoi l'output di un lineout della griglia lungo x? 1 si', 0 no: ";
  1726. std::cin >> p[OUT_LINEOUT_X];
  1727. p_b[OUT_LINEOUT_X] = false;
  1728. }
  1729. }
  1730. fileParametri.close();
  1731. }
  1732. bool Parametri::check_parametri()
  1733. {
  1734. bool test = true;
  1735. if (!p_b[SWAP] && p[SWAP] != 0 && p[SWAP] != 1) // check swap o non-swap
  1736. {
  1737. printf("Attenzione: modalita` swap mal definita\n");
  1738. test = false;
  1739. }
  1740. else
  1741. {
  1742. if (!p_b[SWAP] && (p[SWAP] == 0 || p[SWAP] == 1))
  1743. {
  1744. test = true; // tutto ok, in questo caso il parametro va bene!
  1745. }
  1746. else if (p_b[SWAP] && do_not_ask_missing)
  1747. {
  1748. p[SWAP] = 0;
  1749. p_b[SWAP] = false;
  1750. test = true;
  1751. }
  1752. else
  1753. {
  1754. printf("Attenzione: modalita` swap non definita\n");
  1755. test = false;
  1756. }
  1757. }
  1758. if (file_particelle_P || file_particelle_E || file_particelle_HI || file_particelle_LI)
  1759. {
  1760. if (!p_b[WEIGHT] && p[WEIGHT] != 0 && p[WEIGHT] != 1)
  1761. {
  1762. printf("Attenzione: modalita` weight mal definita\n");
  1763. test = false;
  1764. }
  1765. else
  1766. {
  1767. if (!p_b[WEIGHT] && (p_b[WEIGHT] == 0 || p_b[WEIGHT] == 1))
  1768. {
  1769. test = true; // tutto ok, in questo caso il parametro va bene!
  1770. }
  1771. else if (p_b[WEIGHT] && do_not_ask_missing)
  1772. {
  1773. p[WEIGHT] = 1;
  1774. p_b[WEIGHT] = false;
  1775. test = true;
  1776. }
  1777. else
  1778. {
  1779. printf("Attenzione: modalita` weight non definita\n");
  1780. test = false;
  1781. }
  1782. }
  1783. if (!p_b[OUT_CSV] && p[OUT_CSV] != 0 && p[OUT_CSV] != 1) // check leggi_particelle: out-ascii o non-out-ascii
  1784. {
  1785. printf("Attenzione: output csv mal definito\n");
  1786. test = false;
  1787. }
  1788. else
  1789. {
  1790. if (!p_b[OUT_CSV] && (p_b[OUT_CSV] == 0 || p_b[OUT_CSV] == 1))
  1791. {
  1792. test = true; // tutto ok, in questo caso il parametro va bene!
  1793. }
  1794. else if (p_b[OUT_CSV] && do_not_ask_missing)
  1795. {
  1796. p[OUT_CSV] = 0;
  1797. p_b[OUT_CSV] = false;
  1798. test = true;
  1799. }
  1800. else
  1801. {
  1802. printf("Attenzione: output csv non definito\n");
  1803. test = false;
  1804. }
  1805. }
  1806. if (!p_b[OUT_PROPAGA] && p[OUT_PROPAGA] != 0 && p[OUT_PROPAGA] != 1) // check leggi_particelle: out-ascii o non-out-ascii
  1807. {
  1808. printf("Attenzione: output ppg mal definito\n");
  1809. test = false;
  1810. }
  1811. else
  1812. {
  1813. if (!p_b[OUT_PROPAGA] && (p_b[OUT_PROPAGA] == 0 || p_b[OUT_PROPAGA] == 1))
  1814. {
  1815. test = true; // tutto ok, in questo caso il parametro va bene!
  1816. }
  1817. else if (p_b[OUT_PROPAGA] && do_not_ask_missing)
  1818. {
  1819. p[OUT_PROPAGA] = 0;
  1820. p_b[OUT_PROPAGA] = false;
  1821. test = true;
  1822. }
  1823. else
  1824. {
  1825. printf("Attenzione: output ppg non definito\n");
  1826. test = false;
  1827. }
  1828. }
  1829. if (!p_b[OUT_XYZE] && p[OUT_XYZE] != 0 && p[OUT_XYZE] != 1)
  1830. {
  1831. printf("Attenzione: output xyzE mal definito\n");
  1832. test = false;
  1833. }
  1834. else
  1835. {
  1836. if (!p_b[OUT_XYZE] && (p_b[OUT_XYZE] == 0 || p_b[OUT_XYZE] == 1))
  1837. {
  1838. test = true; // tutto ok, in questo caso il parametro va bene!
  1839. }
  1840. else if (p_b[OUT_XYZE] && do_not_ask_missing)
  1841. {
  1842. p[OUT_XYZE] = 0;
  1843. p_b[OUT_XYZE] = false;
  1844. test = true;
  1845. }
  1846. else
  1847. {
  1848. printf("Attenzione: output xyzE non definito\n");
  1849. test = false;
  1850. }
  1851. }
  1852. if (!p_b[OUT_VTK] && p[OUT_VTK] != 0 && p[OUT_VTK] != 1)
  1853. {
  1854. printf("Attenzione: output vtk mal definito\n");
  1855. test = false;
  1856. }
  1857. else
  1858. {
  1859. if (!p_b[OUT_VTK] && (p[OUT_VTK] == 0 || p[OUT_VTK] == 1))
  1860. {
  1861. test = true; // tutto ok, in questo caso il parametro va bene!
  1862. }
  1863. else if (p_b[OUT_VTK] && do_not_ask_missing)
  1864. {
  1865. p[OUT_VTK] = 0;
  1866. p_b[OUT_VTK] = false;
  1867. test = true;
  1868. }
  1869. else
  1870. {
  1871. printf("Attenzione: output vtk non definito\n");
  1872. test = false;
  1873. }
  1874. }
  1875. if (!p_b[OUT_CLEAN_BINARY] && p[OUT_CLEAN_BINARY] != 0 && p[OUT_CLEAN_BINARY] != 1)
  1876. {
  1877. printf("Attenzione: output binario pulito mal definito\n");
  1878. test = false;
  1879. }
  1880. else
  1881. {
  1882. if (!p_b[OUT_CLEAN_BINARY] && (p[OUT_CLEAN_BINARY] == 0 || p[OUT_CLEAN_BINARY] == 1))
  1883. {
  1884. test = true; // tutto ok, in questo caso il parametro va bene!
  1885. }
  1886. else if (p_b[OUT_CLEAN_BINARY] && do_not_ask_missing)
  1887. {
  1888. p[OUT_CLEAN_BINARY] = 0;
  1889. p_b[OUT_CLEAN_BINARY] = false;
  1890. test = true;
  1891. }
  1892. else
  1893. {
  1894. printf("Attenzione: output binario pulito non definito\n");
  1895. test = false;
  1896. }
  1897. }
  1898. if (!p_b[FIND_MINMAX] && p[FIND_MINMAX] != 0 && p[FIND_MINMAX] != 1)
  1899. {
  1900. printf("Attenzione: ricerca minimi/massimi mal definita\n");
  1901. test = false;
  1902. }
  1903. else
  1904. {
  1905. if (!p_b[FIND_MINMAX] && (p[FIND_MINMAX] == 0 || p[FIND_MINMAX] == 1))
  1906. {
  1907. test = true; // tutto ok, in questo caso il parametro va bene!
  1908. }
  1909. else if (p_b[FIND_MINMAX] && do_not_ask_missing)
  1910. {
  1911. p[FIND_MINMAX] = 0;
  1912. p_b[FIND_MINMAX] = false;
  1913. test = true;
  1914. }
  1915. else
  1916. {
  1917. printf("Attenzione: ricerca minimi/massimi non definita\n");
  1918. test = false;
  1919. }
  1920. }
  1921. if (!p_b[DO_BINNING] && p[DO_BINNING] != 0 && p[DO_BINNING] != 1)
  1922. {
  1923. printf("Attenzione: parametro binnaggio mal definito\n");
  1924. test = false;
  1925. }
  1926. else
  1927. {
  1928. if (!p_b[DO_BINNING] && (p[DO_BINNING] == 0 || p[DO_BINNING] == 1))
  1929. {
  1930. test = true; // tutto ok, in questo caso il parametro va bene!
  1931. }
  1932. else if (p_b[DO_BINNING] && do_not_ask_missing)
  1933. {
  1934. p[DO_BIN

Large files files are truncated, but you can click here to view the full file