R__dummyintdefault14_c

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742
//----------Author's Name: B.Fabbro DSM/IRFU/SPP CEA-Saclay
//----------Copyright: Those valid for CEA sofware
//----------Modified:10/10/2011

#include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParHistos.h"
#include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaNumbering.h"

//--------------------------------------
//  TEcnaParHistos.cc
//  Class creation: 19 May 2005
//  Documentation: see TEcnaParHistos.h
//--------------------------------------

ClassImp(TEcnaParHistos);
//______________________________________________________________________________
//

TEcnaParHistos::~TEcnaParHistos() {
  //destructor

  //if (fEcalNumbering != 0){delete  fEcalNumbering; fCdelete++;}
  //if (fEcal          != 0){delete  fEcal;          fCdelete++;}

  //std::cout << "[Info Management] CLASS: TEcnaParHistos.     DESTROY OBJECT: this = " << this << std::endl;
}

//===================================================================
//
//                   Constructors
//
//===================================================================
TEcnaParHistos::TEcnaParHistos() {
  // Constructor without argument

  //std::cout << "[Info Management] CLASS: TEcnaParHistos.     CREATE OBJECT: this = " << this << std::endl;

  Init();
}

TEcnaParHistos::TEcnaParHistos(TEcnaObject* pObjectManager, const TString& SubDet) {
  // Constructor without argument

  //std::cout << "[Info Management] CLASS: TEcnaParHistos.     CREATE OBJECT: this = " << this << std::endl;

  Init();
  Long_t i_this = (Long_t)this;
  pObjectManager->RegisterPointer("TEcnaParHistos", i_this);

  //............................ fEcal  => to be changed in fParEcal
  fEcal = nullptr;
  Long_t iParEcal = pObjectManager->GetPointerValue("TEcnaParEcal");
  if (iParEcal == 0) {
    fEcal = new TEcnaParEcal(pObjectManager, SubDet.Data()); /*fCnew++*/
  } else {
    fEcal = (TEcnaParEcal*)iParEcal;
  }

  //............................ fEcalNumbering
  fEcalNumbering = nullptr;
  Long_t iEcalNumbering = pObjectManager->GetPointerValue("TEcnaNumbering");
  if (iEcalNumbering == 0) {
    fEcalNumbering = new TEcnaNumbering(pObjectManager, SubDet.Data()); /*fCnew++*/
  } else {
    fEcalNumbering = (TEcnaNumbering*)iEcalNumbering;
  }

  SetEcalSubDetector(SubDet.Data());
}

TEcnaParHistos::TEcnaParHistos(const TString& SubDet, TEcnaParEcal* pEcal, TEcnaNumbering* pEcalNumbering) {
  // Constructor with argument

  //std::cout << "[Info Management] CLASS: TEcnaParHistos.     CREATE OBJECT: this = " << this << std::endl;

  Init();
  SetEcalSubDetector(SubDet.Data(), pEcal, pEcalNumbering);
}

void TEcnaParHistos::Init() {
  fgMaxCar = (Int_t)512;  // max number of characters in TStrings

  fTTBELL = '\007';

  //................ Init CNA Command and error numbering
  fCnaCommand = 0;
  fCnaError = 0;

  //........................................................................................

  fMaxColorNumber = (Int_t)4;  // number_of_colors - 1 for histos in option SAME

  fMarginAutoMinMax = (Double_t)0.05;  // factor for automatic margin plots:
                                       // plot min = min - (max-min)*fMarginAutoMinMax
                                       // plot max = max + (max-min)*fMarginAutoMinMax

  fNbOfRunsDisplayed = (Int_t)20;  // Nb of run numbers displayed on the top of the plot
                                   // in stability/evolution plots, option ONLYONE

  fMaxNbOfRunsInLists = (Int_t)5000;  // Maximum number of runs in the ListOfRun files
                                      // used for the stability/evolution plots.

  //........................ init code plot type                      (Init)
  Int_t MaxCar = fgMaxCar;
  fOnlyOnePlot.Resize(MaxCar);
  fOnlyOnePlot = "ONLYONE";

  MaxCar = fgMaxCar;
  fSeveralPlot.Resize(MaxCar);
  fSeveralPlot = "SAME";

  MaxCar = fgMaxCar;
  fSameOnePlot.Resize(MaxCar);
  fSameOnePlot = "SAME n";

  MaxCar = fgMaxCar;
  fAllXtalsInStinPlot.Resize(MaxCar);
  fAllXtalsInStinPlot = "SAME in Stin";

  fPlotAllXtalsInStin = 0;

}  // end of Init()

void TEcnaParHistos::SetEcalSubDetector(const TString& SubDet) {
  // Set Subdetector (EB or EE)

  Int_t MaxCar = fgMaxCar;
  fFlagSubDet.Resize(MaxCar);
  fFlagSubDet = fEcal->GetEcalSubDetector();
}

void TEcnaParHistos::SetEcalSubDetector(const TString& SubDet, TEcnaParEcal* pEcal, TEcnaNumbering* pEcalNumbering) {
  // Set Subdetector (EB or EE)

  fEcal = nullptr;
  if (pEcal == nullptr) {
    fEcal = new TEcnaParEcal(SubDet.Data()); /*fCnew++*/
    ;
  } else {
    fEcal = pEcal;
  }

  Int_t MaxCar = fgMaxCar;
  fFlagSubDet.Resize(MaxCar);
  fFlagSubDet = fEcal->GetEcalSubDetector();

  fEcalNumbering = nullptr;
  if (pEcalNumbering == nullptr) {
    fEcalNumbering = new TEcnaNumbering(fFlagSubDet.Data(), fEcal); /*fCnew++*/
    ;
  } else {
    fEcalNumbering = pEcalNumbering;
  }
}

Int_t TEcnaParHistos::MaxNbOfRunsInLists() { return fMaxNbOfRunsInLists; }

//---------------------------------------------------------------------------------------------
// HistoCode list modification (06/10/09)
//
//    D = Detector Plot    ChNb = Channel Number
//                         ChDs = Channel Distribution (Y projection)
//
//    H = History  Plot    Date = date in format YYMMJJ hhmmss
//                         RuDs = Run distribution
//
//      old code             new code
//
// *  1 H1NbOfEvtsGlobal     D_NOE_ChNb    NOE  = Number Of Events
// *  2 H1NbOfEvtsProj       D_NOE_ChDs
// *  3 H1EvEvGlobal         D_Ped_ChNb    Ped  = Pedestal
// *  4 H1EvEvProj           D_Ped_ChDs
// *  5 H1EvSigGlobal        D_TNo_ChNb    TNo  = Total Noise
// *  6 H1EvSigProj          D_TNo_ChDs
// *  7 H1SigEvGlobal        D_LFN_ChNb    LFN  = Low Frequency noise
// *  8 H1SigEvProj          D_LFN_ChDs
// *  9 H1SigSigGlobal       D_HFN_ChNb    HFN  = High Frequency noise
// * 10 H1SigSigProj         D_HFN_ChDs
// * 11 H1EvCorssGlobal      D_MCs_ChNb    MCs  = Mean correlations between samples
// * 12 H1EvCorssProj        D_MCs_ChDs
// * 13 H1SigCorssGlobal     D_SCs_ChNb    SCs  = Sigma of the correlations between samples
// * 14 H1SigCorssProj       D_SCs_ChDs
// * 15 Ev                   D_MSp_SpNb    MSp  = Mean samples
// * 16 EvProj               D_MSp_SpDs
// * 17 Sigma                D_SSp_SpNb    SSp  = Sigma of the samples
// * 18 SigmaProj            D_SSp_SpDs
// * 19 SampTime             D_Adc_EvNb    Adc  = ADC count as a function of Event number
// * 20 AdcProj              D_Adc_EvDs
// * 21 EvolEvEv             H_Ped_Date
// * 22 EvolEvEvProj         H_Ped_RuDs
// * 23 EvolEvSig            H_TNo_Date
// * 24 EvolEvSigProj        H_TNo_RuDs
// * 25 EvolSigEv            H_LFN_Date
// * 26 EvolSigEvProj        H_LFN_RuDs
// * 27 EvolSigSig           H_HFN_Date
// * 28 EvolSigSigProj       H_HFN_RuDs
// * 29 EvolEvCorss          H_MCs_Date
// * 30 EvolEvCorssProj      H_MCs_RuDs
// * 31 EvolSigCorss         H_SCs_Date
// * 32 EvolSigCorssProj     H_SCs_RuDs
//
//===========================================================================
//
//    SetCanvasWidth, SetCanvasHeight,
//    CanvasFormatW, CanvasFormatH,
//
//===========================================================================
UInt_t TEcnaParHistos::SetCanvasWidth(const TString& HistoCode, const TString& opt_plot) {
  //........................................ Taille/format canvas

  UInt_t canv_w = CanvasFormatW("petit");

  if (HistoCode == "D_Adc_EvNb" || HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" ||
      HistoCode == "D_LFN_ChNb" || HistoCode == "D_TNo_ChNb" || HistoCode == "D_HFN_ChNb" ||
      HistoCode == "D_MCs_ChNb" || HistoCode == "D_SCs_ChNb" || HistoCode == "H_Ped_Date" ||
      HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" || HistoCode == "H_LFN_Date" ||
      HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" || (HistoCode == "D_MSp_SpNb" && opt_plot != "ONLYONE") ||
      (HistoCode == "D_SSp_SpNb" && opt_plot != "ONLYONE")) {
    canv_w = CanvasFormatH("moyen");  // format 29.7*21 ( = 21*29.7 en paysage)
  }

  if ((HistoCode == "D_Adc_EvDs" || HistoCode == "D_NOE_ChDs" || HistoCode == "D_Ped_ChDs" ||
       HistoCode == "D_LFN_ChDs" || HistoCode == "D_TNo_ChDs" || HistoCode == "D_HFN_ChDs" ||
       HistoCode == "D_MCs_ChDs" || HistoCode == "D_SCs_ChDs" || HistoCode == "D_MSp_SpDs" ||
       HistoCode == "D_SSp_SpDs" || HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" ||
       HistoCode == "H_MCs_RuDs" || HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" ||
       HistoCode == "H_SCs_RuDs") &&
      opt_plot != "ONLYONE") {
    canv_w = CanvasFormatH("moyen");  // format 29.7*21 ( = 21*29.7 en paysage)
  }

  return canv_w;
}

UInt_t TEcnaParHistos::SetCanvasHeight(const TString& HistoCode, const TString& opt_plot) {
  //........................................ Taille/format canvas

  UInt_t canv_h = CanvasFormatH("petit");

  if (HistoCode == "D_Adc_EvNb" || HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" ||
      HistoCode == "D_LFN_ChNb" || HistoCode == "D_TNo_ChNb" || HistoCode == "D_HFN_ChNb" ||
      HistoCode == "D_MCs_ChNb" || HistoCode == "D_SCs_ChNb" || HistoCode == "H_Ped_Date" ||
      HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" || HistoCode == "H_LFN_Date" ||
      HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date" || (HistoCode == "D_MSp_SpNb" && opt_plot != "ONLYONE") ||
      (HistoCode == "D_SSp_SpNb" && opt_plot != "ONLYONE")) {
    canv_h = CanvasFormatW("moyen");  // format 29.7*21 ( = 21*29.7 en paysage)
  }

  if ((HistoCode == "D_Adc_EvDs" || HistoCode == "D_NOE_ChDs" || HistoCode == "D_Ped_ChDs" ||
       HistoCode == "D_LFN_ChDs" || HistoCode == "D_TNo_ChDs" || HistoCode == "D_HFN_ChDs" ||
       HistoCode == "D_MCs_ChDs" || HistoCode == "D_SCs_ChDs" || HistoCode == "D_MSp_SpDs" ||
       HistoCode == "D_SSp_SpDs" || HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" ||
       HistoCode == "H_MCs_RuDs" || HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" ||
       HistoCode == "H_SCs_RuDs") &&
      opt_plot != "ONLYONE") {
    canv_h = CanvasFormatW("moyen");  // format 29.7*21 ( = 21*29.7 en paysage)
  }

  return canv_h;
}

UInt_t TEcnaParHistos::CanvasFormatW(const TString& chformat) {
  //Set Canvas width

  UInt_t canv_w = 375;  // default = "petit"

  if (chformat == "petit") {
    canv_w = 375;
  }  // 21x29.7 portrait
  if (chformat == "moyen") {
    canv_w = 450;
  }  // 21x29.7 portrait
  if (chformat == "grand") {
    canv_w = 572;
  }  // 21x29.7 portrait

  if (chformat == "etaphiSM") {
    canv_w = 760;
  }  // landscape etroit en hauteur pour plot SM
  if (chformat == "phietaEB") {
    canv_w = 636;
  }  // landscape pour plot EB (32 SMs)

  if (chformat == "IXIYDee") {
    canv_w = 320;
  }  // portrait etroit en largeur pour plot Dee
  if (chformat == "IYIXEE") {
    canv_w = 636;
  }  // landscape pour plot EE (4 dees)
  return canv_w;
}
//......................................................................
UInt_t TEcnaParHistos::CanvasFormatH(const TString& chformat) {
  //Set Canvas height

  UInt_t canv_h = 530;  // default = "petit"

  if (chformat == "petit") {
    canv_h = 530;
  }  // 21x29.7 portrait
  if (chformat == "moyen") {
    canv_h = 636;
  }  // 21x29.7 portrait
  if (chformat == "grand") {
    canv_h = 810;
  }  // 21x29.7 portrait

  if (chformat == "etaphiSM") {
    canv_h = 306;
  }  // landscape etroit en hauteur pour plot SM
  if (chformat == "phietaEB") {
    canv_h = 450;
  }  // landscape pour plot EB (32 SMs)

  if (chformat == "IXIYDee") {
    canv_h = 720;
  }  // portrait etroit en largeur pour plot Dee
  if (chformat == "IYIXEE") {
    canv_h = 450;
  }  // landscape pour plot EE (4 dees)
  return canv_h;
}

//===========================================================================
//
//          BoxLeftX, BoxRightX, BoxBottomY, BoxTopY
//
//===========================================================================
Double_t TEcnaParHistos::BoxLeftX(const TString& chtype) {
  //Set the x left coordinate of the box

  Double_t value = 0.4;

  if (chtype == "general_comment") {
    value = 0.015;
  }

  if (chtype == "top_left_box_SM") {
    value = 0.015;
  }
  if (chtype == "top_left_box_EB") {
    value = 0.015;
  }
  if (chtype == "top_mid_box_EB") {
    value = 0.350;
  }
  if (chtype == "top_right_box_EB") {
    value = 0.630;
  }

  if (chtype == "top_left_box_Dee") {
    value = 0.015;
  }
  if (chtype == "top_left_box_EE") {
    value = 0.015;
  }
  if (chtype == "top_mid_box_EE") {
    value = 0.240;
  }
  if (chtype == "top_right_box_EE") {
    value = 0.610;
  }

  if (chtype == "bottom_left_box") {
    value = 0.015;
  }
  if (chtype == "bottom_left_box_evol") {
    value = 0.015;
  }
  if (chtype == "bottom_mid_box") {
    value = 0.250;
  }
  if (chtype == "bottom_right_box") {
    value = 0.455;
  }
  if (chtype == "bottom_right_box_evol") {
    value = 0.540;
  }
  if (chtype == "bottom_right_box_evpr") {
    value = 0.540;
  }

  if (chtype == "several_plots_box") {
    value = 0.015;
  }
  if (chtype == "several_evol_box") {
    value = 0.015;
  }
  if (chtype == "several_evpr_box") {
    value = 0.015;
  }

  return value;
}
//.................................................................
Double_t TEcnaParHistos::BoxRightX(const TString& chtype) {
  //Set the x right coordinate of the box

  Double_t value = 0.6;

  if (chtype == "general_comment") {
    value = 0.680;
  }

  if (chtype == "top_left_box_SM") {
    value = 0.125;
  }
  if (chtype == "top_left_box_EB") {
    value = 0.349;
  }
  if (chtype == "top_mid_box_EB") {
    value = 0.629;
  }
  if (chtype == "top_right_box_EB") {
    value = 0.985;
  }

  if (chtype == "top_left_box_Dee") {
    value = 0.425;
  }
  if (chtype == "top_left_box_EE") {
    value = 0.260;
  }
  if (chtype == "top_mid_box_EE") {
    value = 0.609;
  }
  if (chtype == "top_right_box_EE") {
    value = 0.985;
  }

  if (chtype == "bottom_left_box") {
    value = 0.445;
  }
  if (chtype == "bottom_left_box_evol") {
    value = 0.450;
  }  // ex 370
  if (chtype == "bottom_mid_box") {
    value = 0.750;
  }
  if (chtype == "bottom_right_box") {
    value = 0.985;
  }
  if (chtype == "bottom_right_box_evol") {
    value = 0.985;
  }
  if (chtype == "bottom_right_box_evpr") {
    value = 0.985;
  }

  if (chtype == "several_plots_box") {
    value = 0.985;
  }
  if (chtype == "several_evol_box") {
    value = 0.635;
  }
  if (chtype == "several_evpr_box") {
    value = 0.635;
  }

  return value;
}
//.................................................................
Double_t TEcnaParHistos::BoxBottomY(const TString& chtype) {
  //Set the y bottom coordinate of the box

  Double_t value = 0.8;

  if (chtype == "general_comment") {
    value = 0.960;
  }

  if (chtype == "top_left_box_SM") {
    value = 0.880;
  }
  if (chtype == "top_left_box_EB") {
    value = 0.880;
  }
  if (chtype == "top_mid_box_EB") {
    value = 0.880;
  }
  if (chtype == "top_right_box_EB") {
    value = 0.880;
  }

  if (chtype == "top_left_box_Dee") {
    value = 0.925;
  }
  if (chtype == "top_left_box_EE") {
    value = 0.880;
  }
  if (chtype == "top_mid_box_EE") {
    value = 0.880;
  }
  if (chtype == "top_right_box_EE") {
    value = 0.880;
  }

  if (chtype == "bottom_left_box") {
    value = 0.010;
  }
  if (chtype == "bottom_left_box_evol") {
    value = 0.010;
  }
  if (chtype == "bottom_right_box") {
    value = 0.010;
  }
  if (chtype == "bottom_right_box_evol") {
    value = 0.010;
  }
  if (chtype == "bottom_right_box_evpr") {
    value = 0.010;
  }
  if (chtype == "several_plots_box") {
    value = 0.010;
  }
  if (chtype == "several_evol_box") {
    value = 0.010;
  }
  if (chtype == "several_evpr_box") {
    value = 0.010;
  }

  return value;
}
//.................................................................
Double_t TEcnaParHistos::BoxTopY(const TString& chtype) {
  //Set the y top coordinate of the box

  Double_t value = 0.9;

  if (chtype == "general_comment") {
    value = 0.999;
  }

  if (chtype == "top_left_box_SM") {
    value = 0.955;
  }
  if (chtype == "top_left_box_EB") {
    value = 0.955;
  }
  if (chtype == "top_mid_box_EB") {
    value = 0.955;
  }
  if (chtype == "top_right_box_EB") {
    value = 0.955;
  }

  if (chtype == "top_left_box_Dee") {
    value = 0.969;
  }
  if (chtype == "top_left_box_EE") {
    value = 0.955;
  }
  if (chtype == "top_mid_box_EE") {
    value = 0.955;
  }
  if (chtype == "top_right_box_EE") {
    value = 0.955;
  }

  if (chtype == "bottom_left_box") {
    value = 0.120;
  }
  if (chtype == "bottom_left_box_evol") {
    value = 0.120;
  }
  if (chtype == "bottom_right_box") {
    value = 0.120;
  }
  if (chtype == "bottom_right_box_Dee") {
    value = 0.100;
  }

  if (chtype == "bottom_right_box_evol") {
    value = 0.120;
  }
  if (chtype == "bottom_right_box_evpr") {
    value = 0.120;
  }
  if (chtype == "several_plots_box") {
    value = 0.200;
  }
  if (chtype == "several_evol_box") {
    value = 0.200;
  }
  if (chtype == "several_evpr_box") {
    value = 0.200;
  }

  return value;
}

//===========================================================================
//
//       SetColorPalette, ColorTab, ColorDefinition
//
//===========================================================================

void TEcnaParHistos::SetColorPalette(const TString& user_color_palette) {
  //Set color number for palette

  fMaxColorNumber = 4;  // default: 4 ==> Black/Red/Blue/Green/Braun

  if (!(user_color_palette == "Rainbow" || user_color_palette == "rainbow")) {
    fMaxColorNumber = 5;
  }
  if (user_color_palette == "Rainbow" || user_color_palette == "rainbow") {
    fMaxColorNumber = 6;
  }
}
//...........................................................................
Color_t TEcnaParHistos::ColorTab(const Int_t& user_color_number) {
  //Set color from user color number

  //=========> Color definition: see ROOT User's guide p.151

  TColor* my_color = new TColor();

  Color_t couleur = ColorDefinition("noir");  // default = "noir"

  if (fMaxColorNumber != 6) {
    //................... Standard: 6 colors (fMaxColorNumber = 5)
    if (user_color_number == 0) {
      couleur = ColorDefinition("noir");
    }  //    noir        black    1
    if (user_color_number == 1) {
      couleur = ColorDefinition("rouge");
    }  //    rouge       red      2
    if (user_color_number == 2) {
      couleur = ColorDefinition("bleu");
    }  //    bleu        blue     9
    if (user_color_number == 3) {
      couleur = (Color_t)my_color->GetColor("#009900");
    }  //    vert        green
    if (user_color_number == 4) {
      couleur = ColorDefinition("marron28");
    }  //    marron 28   braun   28
    if (user_color_number == 5) {
      couleur = (Color_t)my_color->GetColor("#9900BB");
    }  //    violet      purple
  }
  if (fMaxColorNumber == 6) {
    //................... Rainbow:7  colors (fMaxColorNumber = 6)
    if (user_color_number == 0) {
      couleur = (Color_t)my_color->GetColor("#EE0000");
    }  //   rouge
    if (user_color_number == 1) {
      couleur = (Color_t)my_color->GetColor("#FF6611");
    }  //   orange
    if (user_color_number == 2) {
      couleur = (Color_t)my_color->GetColor("#FFCC00");
    }  //   jaune
    if (user_color_number == 3) {
      couleur = (Color_t)my_color->GetColor("#009900");
    }  //   vert
    if (user_color_number == 4) {
      couleur = (Color_t)my_color->GetColor("#0044EE");
    }  //   bleu
    if (user_color_number == 5) {
      couleur = (Color_t)my_color->GetColor("#6633BB");
    }  //   indigo
    if (user_color_number == 6) {
      couleur = (Color_t)my_color->GetColor("#9900BB");
    }  //   violet
  }

  if (user_color_number < 0 || user_color_number > fMaxColorNumber) {
    couleur = 0;
  }

  return couleur;
}
// end of ColorTab

Color_t TEcnaParHistos::ColorDefinition(const TString& chcolor) {
  //Set color from color name

  //=========> Color definition: see ROOT User's guide p.151

  Color_t couleur = 1;  // default = "noir"

  if (chcolor == "noir") {
    couleur = 1;
  }
  if (chcolor == "rouge") {
    couleur = 2;
  }
  if (chcolor == "vert_fonce") {
    couleur = 3;
  }
  if (chcolor == "bleu_fonce") {
    couleur = 4;
  }
  if (chcolor == "jaune") {
    couleur = 5;
  }
  if (chcolor == "rose") {
    couleur = 6;
  }
  if (chcolor == "bleu_clair") {
    couleur = 7;
  }
  if (chcolor == "vert") {
    couleur = 8;
  }
  if (chcolor == "bleu") {
    couleur = 9;
  }
  if (chcolor == "blanc") {
    couleur = 10;
  }

  if (chcolor == "marron23") {
    couleur = 23;
  }
  if (chcolor == "marron24") {
    couleur = 24;
  }
  if (chcolor == "marron25") {
    couleur = 24;
  }
  if (chcolor == "marron27") {
    couleur = 27;
  }
  if (chcolor == "marron28") {
    couleur = 28;
  }

  if (chcolor == "bleu33") {
    couleur = 33;
  }
  if (chcolor == "bleu36") {
    couleur = 36;
  }
  if (chcolor == "bleu38") {
    couleur = 38;
  }
  if (chcolor == "bleu39") {
    couleur = 39;
  }

  if (chcolor == "orange41") {
    couleur = 41;
  }
  if (chcolor == "orange42") {
    couleur = 42;
  }

  if (chcolor == "rouge44") {
    couleur = 44;
  }
  if (chcolor == "rouge46") {
    couleur = 46;
  }
  if (chcolor == "rouge47") {
    couleur = 47;
  }
  if (chcolor == "rouge48") {
    couleur = 48;
  }
  if (chcolor == "rouge49") {
    couleur = 49;
  }
  if (chcolor == "rouge50") {
    couleur = 50;
  }

  if (chcolor == "vert31") {
    couleur = 31;
  }
  if (chcolor == "vert32") {
    couleur = 32;
  }
  if (chcolor == "vert36") {
    couleur = 36;
  }
  if (chcolor == "vert37") {
    couleur = 37;
  }

  if (chcolor == "violet") {
    couleur = 49;
  }

  if (chcolor == "turquoise29") {
    couleur = 29;
  }

  if (chcolor == "gris12") {
    couleur = 12;
  }
  if (chcolor == "gris13") {
    couleur = 13;
  }
  if (chcolor == "gris14") {
    couleur = 14;
  }
  if (chcolor == "gris15") {
    couleur = 15;
  }
  if (chcolor == "gris16") {
    couleur = 16;
  }
  if (chcolor == "gris17") {
    couleur = 17;
  }
  if (chcolor == "gris18") {
    couleur = 18;
  }

  return couleur;
}
// end of ColorDefinition

//===========================================================================
//       GetMaxNbOfColors, GetMarginAutoMinMax, GetNbOfRunsDisplayed
//===========================================================================
Int_t TEcnaParHistos::GetMaxNbOfColors() { return fMaxColorNumber; }
Int_t TEcnaParHistos::GetNbOfRunsDisplayed() { return fNbOfRunsDisplayed; }
Double_t TEcnaParHistos::GetMarginAutoMinMax() { return fMarginAutoMinMax; }

//===========================================================================
//
//      SetViewHistoStyle, SetViewHistoPadMargins
//
//===========================================================================
void TEcnaParHistos::SetViewHistoStyle(const TString& HistoType) {
  // Set style parameters for histo view

  //......................... Palette
  gStyle->SetPalette(1, nullptr);  // default: rainbow spectrum

  //............................... Date
  gStyle->SetOptDate(0);

  //............................... Histo title size
  gStyle->SetTitleW(0.5);
  gStyle->SetTitleH(0.075);  // default

  if (HistoType == "colz" || HistoType == "lego" || HistoType == "surf" || HistoType == "Stin") {
    gStyle->SetTitleW(0.8);
    gStyle->SetTitleH(0.075);
  }

  if ((HistoType == "H1Basic") || (HistoType == "Evol")) {
    gStyle->SetTitleW(0.5);
    gStyle->SetTitleH(0.075);
  }

  if (HistoType == "Stex2DEB") {
    gStyle->SetTitleW(0.2);
    gStyle->SetTitleH(0.095);
  }

  if (HistoType == "Stex2DEE") {
    gStyle->SetTitleW(0.45);
    gStyle->SetTitleH(0.08);
  }

  if (HistoType == "Stex2DEENb") {
    gStyle->SetTitleW(0.85);
    gStyle->SetTitleH(0.08);
  }

  if (HistoType == "Stas2DEB" || HistoType == "Stas2DEE") {
    gStyle->SetTitleW(0.225);
    gStyle->SetTitleH(0.095);
  }

  if (HistoType == "Global" || HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") {
    gStyle->SetTitleW(0.5);
    gStyle->SetTitleH(0.08);
  }

  //............................. Statistics box style
  gStyle->SetOptStat(1110);

  //............................. Statistics box size
  if (HistoType == "colz" || HistoType == "lego" || HistoType == "surf" || HistoType == "Stin") {
    gStyle->SetStatW(0.55);
    gStyle->SetStatH(0.2);
    gStyle->SetStatY(1);
  }

  if (HistoType == "Global") {
    gStyle->SetStatW(0.375);
    gStyle->SetStatH(0.180);
    gStyle->SetStatY(0.9875);
  }
  if (HistoType == "Proj" || HistoType == "SampProj" || HistoType == "EvolProj") {
    gStyle->SetStatW(0.375);
    gStyle->SetStatH(0.180);
    gStyle->SetStatY(0.9875);
  }

  if ((HistoType == "H1Basic") || (HistoType == "Evol")) {
    gStyle->SetStatW(0.375);
    gStyle->SetStatH(0.180);
    gStyle->SetStatY(0.9875);
  }

  //....... Marker and line style

  gStyle->SetMarkerStyle(1);
  if (HistoType == "Global") {
    gStyle->SetMarkerStyle(20);
  }
}
//------- (end of SetViewHistoStyle) ----------------

void TEcnaParHistos::SetViewHistoPadMargins(const TString& HistoType, const TString& opt_plot) {
  // Set active pad margins for histo view

  //.......... default
  gStyle->SetPadBottomMargin(0.125);
  gStyle->SetPadTopMargin(0.125);
  gStyle->SetPadLeftMargin(0.125);
  gStyle->SetPadRightMargin(0.125);

  if (HistoType == "colz" || HistoType == "lego" || HistoType == "surf" || HistoType == "Stin") {
    gStyle->SetPadBottomMargin(0.125);
    gStyle->SetPadTopMargin(0.135);
    gStyle->SetPadLeftMargin(0.135);
    gStyle->SetPadRightMargin(0.135);
  }

  if (HistoType == "Stex2DEB") {
    gStyle->SetPadBottomMargin(0.145);
    gStyle->SetPadTopMargin(0.135);
    gStyle->SetPadLeftMargin(0.125);
    gStyle->SetPadRightMargin(0.125);
  }

  if (HistoType == "Stex2DEE" || HistoType == "Stex2DEENb") {
    gStyle->SetPadBottomMargin(0.120);
    gStyle->SetPadTopMargin(0.110);
    gStyle->SetPadLeftMargin(0.130);
    gStyle->SetPadRightMargin(0.130);
  }
  if (HistoType == "Stas2DEB") {
    gStyle->SetPadBottomMargin(0.145);
    gStyle->SetPadTopMargin(0.135);
    gStyle->SetPadLeftMargin(0.125);
    gStyle->SetPadRightMargin(0.125);
  }

  if (HistoType == "Stas2DEE") {
    gStyle->SetPadBottomMargin(0.145);
    gStyle->SetPadTopMargin(0.135);
    gStyle->SetPadLeftMargin(0.105);
    gStyle->SetPadRightMargin(0.115);
  }
  if (HistoType == "Global") {
    gStyle->SetPadBottomMargin((Float_t)0.125);
    gStyle->SetPadTopMargin((Float_t)0.175);
    gStyle->SetPadLeftMargin((Float_t)0.115);
    gStyle->SetPadRightMargin((Float_t)0.05);
  }

  if (HistoType == "Proj" || HistoType == "SampProj") {
    gStyle->SetPadBottomMargin(0.115);
    gStyle->SetPadTopMargin(0.155);
    gStyle->SetPadLeftMargin(0.15);
    gStyle->SetPadRightMargin(0.05);
  }

  if (HistoType == "H1Basic") {
    gStyle->SetPadBottomMargin(0.1275);
    gStyle->SetPadTopMargin(0.165);
    gStyle->SetPadLeftMargin(0.15);
    gStyle->SetPadRightMargin(0.05);
  }

  if (HistoType == "Evol" && opt_plot == "ONLYONE") {
    gStyle->SetPadBottomMargin(0.110);
    gStyle->SetPadTopMargin(0.2);
    gStyle->SetPadLeftMargin(0.115);
    gStyle->SetPadRightMargin(0.035);
  }
  if (HistoType == "Evol" && opt_plot == "SAME") {
    gStyle->SetPadBottomMargin(0.110);
    gStyle->SetPadTopMargin(0.185);
    gStyle->SetPadLeftMargin(0.115);
    gStyle->SetPadRightMargin(0.035);
  }
  if (HistoType == "Evol" && opt_plot == "SAME n") {
    gStyle->SetPadBottomMargin(0.110);
    gStyle->SetPadTopMargin(0.1);
    gStyle->SetPadLeftMargin(0.115);
    gStyle->SetPadRightMargin(0.035);
  }

  if (HistoType == "EvolProj" && opt_plot == "ONLYONE") {
    gStyle->SetPadBottomMargin(0.1275);
    gStyle->SetPadTopMargin(0.165);
    gStyle->SetPadLeftMargin(0.15);
    gStyle->SetPadRightMargin(0.05);
  }
  if (HistoType == "EvolProj" && opt_plot == "SAME") {
    gStyle->SetPadBottomMargin(0.110);
    gStyle->SetPadTopMargin(0.185);
    gStyle->SetPadLeftMargin(0.115);
    gStyle->SetPadRightMargin(0.035);
  }
  if (HistoType == "EvolProj" && opt_plot == "SAME n") {
    gStyle->SetPadBottomMargin(0.110);
    gStyle->SetPadTopMargin(0.1);
    gStyle->SetPadLeftMargin(0.115);
    gStyle->SetPadRightMargin(0.035);
  }
}
//------- (end of SetViewHistoPadMargins) ----------------

//===========================================================================
//
//      SetViewHistoStats, SetViewHistoOffsets,
//      AxisTitleOffset, AxisTitleSize, AxisLabelOffset,
//      AxisLabelSize, AxisTickSize, DeeOffsetX, DeeNameOffsetX,
//      SetViewGraphOffsets
//
//===========================================================================
void TEcnaParHistos::SetViewHistoStats(TH1D* histo, const TString& HistoType) {
  // Set stats box for histo view

  Bool_t b_true = kTRUE;
  Bool_t b_false = kFALSE;

  histo->SetStats(b_false);

  if (HistoType == "Global") {
    histo->SetStats(b_false);
  }
  if (HistoType == "Proj" || HistoType == "SampProj") {
    histo->SetStats(b_true);
  }
}

void TEcnaParHistos::SetViewHistoOffsets(TH1D* histo, const TString& HistoType, const TString& opt_plot) {
  // Set offsets of labels, title axis, etc... for histo view

  if (HistoType == "Global") {
    //....................... x axis
    histo->GetXaxis()->SetTitleOffset((Float_t)1.05);
    histo->GetXaxis()->SetTitleSize((Float_t)0.04);

    histo->GetXaxis()->SetLabelOffset((Float_t)0.006);
    histo->GetXaxis()->SetLabelSize((Float_t)0.04);

    histo->GetXaxis()->SetTickLength((Float_t)0.03);
    histo->GetXaxis()->SetNdivisions((Int_t)510);

    //....................... y axis
    histo->GetYaxis()->SetTitleOffset((Float_t)1.5);
    histo->GetYaxis()->SetTitleSize((Float_t)0.04);

    histo->GetYaxis()->SetLabelOffset((Float_t)0.01);
    histo->GetYaxis()->SetLabelSize((Float_t)0.04);

    histo->GetYaxis()->SetTickLength((Float_t)0.03);
    histo->GetYaxis()->SetNdivisions((Int_t)510);
  }

  if (HistoType == "Proj" || HistoType == "SampGlobal" || HistoType == "SampProj") {
    //....................... x axis
    histo->GetXaxis()->SetTitleOffset((Float_t)1.05);
    histo->GetXaxis()->SetTitleSize((Float_t)0.04);

    histo->GetXaxis()->SetLabelOffset((Float_t)0.006);
    histo->GetXaxis()->SetLabelSize((Float_t)0.04);

    histo->GetXaxis()->SetTickLength((Float_t)0.03);
    histo->GetXaxis()->SetNdivisions((Int_t)510);

    //....................... y axis
    histo->GetYaxis()->SetTitleOffset((Float_t)1.75);
    histo->GetYaxis()->SetTitleSize((Float_t)0.04);

    histo->GetYaxis()->SetLabelOffset((Float_t)0.01);
    histo->GetYaxis()->SetLabelSize((Float_t)0.04);

    histo->GetYaxis()->SetTickLength((Float_t)0.03);
    histo->GetYaxis()->SetNdivisions((Int_t)510);
  }

  if (HistoType == "H1Basic" || HistoType == "Evol" ||
      (HistoType == "EvolProj" && !(opt_plot == "SAME" || opt_plot == "SAME n"))) {
    //....................... x axis
    histo->GetXaxis()->SetTitleOffset((Float_t)1.25);
    histo->GetXaxis()->SetTitleSize((Float_t)0.04);

    histo->GetXaxis()->SetLabelOffset((Float_t)0.005);
    histo->GetXaxis()->SetLabelSize((Float_t)0.04);

    histo->GetXaxis()->SetTickLength((Float_t)0.03);
    histo->GetXaxis()->SetNdivisions((Int_t)510);

    //....................... y axis
    histo->GetYaxis()->SetTitleOffset((Float_t)1.75);
    histo->GetYaxis()->SetTitleSize((Float_t)0.04);

    histo->GetYaxis()->SetLabelOffset((Float_t)0.01);
    histo->GetYaxis()->SetLabelSize((Float_t)0.04);

    histo->GetYaxis()->SetTickLength((Float_t)0.03);
    histo->GetYaxis()->SetNdivisions((Int_t)510);
  }

  if (HistoType == "EvolProj" && (opt_plot == "SAME" || opt_plot == "SAME n")) {
    //....................... x axis
    histo->GetXaxis()->SetTitleOffset((Float_t)1.25);
    histo->GetXaxis()->SetTitleSize((Float_t)0.04);

    histo->GetXaxis()->SetLabelOffset((Float_t)0.005);
    histo->GetXaxis()->SetLabelSize((Float_t)0.04);

    histo->GetXaxis()->SetTickLength((Float_t)0.03);
    histo->GetXaxis()->SetNdivisions((Int_t)510);

    //....................... y axis
    histo->GetYaxis()->SetTitleOffset((Float_t)1.25);
    histo->GetYaxis()->SetTitleSize((Float_t)0.04);

    histo->GetYaxis()->SetLabelOffset((Float_t)0.01);
    histo->GetYaxis()->SetLabelSize((Float_t)0.04);

    histo->GetYaxis()->SetTickLength((Float_t)0.03);
    histo->GetYaxis()->SetNdivisions((Int_t)510);
  }

  if (HistoType == "colz") {
    //....................... x axis
    histo->GetXaxis()->SetTitleOffset((Float_t)1.25);
    histo->GetXaxis()->SetTitleSize((Float_t)0.04);

    histo->GetXaxis()->SetLabelOffset((Float_t)0.005);
    histo->GetXaxis()->SetLabelSize((Float_t)0.04);

    histo->GetXaxis()->SetTickLength((Float_t)0.03);
    histo->GetXaxis()->SetNdivisions((Int_t)510);

    //....................... y axis
    histo->GetYaxis()->SetTitleOffset((Float_t)1.45);
    histo->GetYaxis()->SetTitleSize((Float_t)0.04);

    histo->GetYaxis()->SetLabelOffset((Float_t)0.01);
    histo->GetYaxis()->SetLabelSize((Float_t)0.04);

    histo->GetYaxis()->SetTickLength((Float_t)0.03);
    histo->GetYaxis()->SetNdivisions((Int_t)510);
  }

  if (HistoType == "lego" || HistoType == "surf") {
    //....................... x axis
    histo->GetXaxis()->SetTitleOffset((Float_t)1.7);
    histo->GetXaxis()->SetTitleSize((Float_t)0.04);

    histo->GetXaxis()->SetLabelOffset((Float_t)0.005);
    histo->GetXaxis()->SetLabelSize((Float_t)0.04);

    histo->GetXaxis()->SetTickLength((Float_t)0.03);
    histo->GetXaxis()->SetNdivisions((Int_t)510);

    //....................... y axis
    histo->GetYaxis()->SetTitleOffset((Float_t)1.85);
    histo->GetYaxis()->SetTitleSize((Float_t)0.04);

    histo->GetYaxis()->SetLabelOffset((Float_t)0.01);
    histo->GetYaxis()->SetLabelSize((Float_t)0.04);

    histo->GetYaxis()->SetTickLength((Float_t)0.03);
    histo->GetYaxis()->SetNdivisions((Int_t)510);
  }

  if (HistoType == "Stin") {
    //.......... x axis (remove labels and ticks)
    histo->GetXaxis()->SetTitleOffset((Float_t)9999.);
    histo->GetXaxis()->SetTitleSize((Float_t)0.05);

    histo->GetXaxis()->SetLabelOffset((Float_t)9999.);
    histo->GetXaxis()->SetLabelSize((Float_t)0.);

    histo->GetXaxis()->SetNdivisions((Int_t)1);
    histo->GetXaxis()->SetTickLength((Float_t)0.);

    //.......... y axis (remove labels and ticks)
    histo->GetYaxis()->SetTitleOffset((Float_t)9999.);
    histo->GetYaxis()->SetTitleSize((Float_t)0.05);

    histo->GetYaxis()->SetLabelOffset((Float_t)9999.);
    histo->GetYaxis()->SetLabelSize((Float_t)0.);

    histo->GetYaxis()->SetNdivisions((Int_t)1);
    histo->GetYaxis()->SetTickLength((Float_t)0.);
  }

  if (HistoType == "Stex2DEB" || HistoType == "Stex2DEE" || HistoType == "Stex2DEENb" || HistoType == "Stas2DEB" ||
      HistoType == "Stas2DEE") {
    //.......... x axis (remove labels and ticks)
    histo->GetXaxis()->SetTitleOffset((Float_t)9999.);
    histo->GetXaxis()->SetTitleSize((Float_t)0.075);

    histo->GetXaxis()->SetLabelOffset((Float_t)9999.);
    histo->GetXaxis()->SetLabelSize((Float_t)0.);

    histo->GetXaxis()->SetNdivisions((Int_t)1);
    histo->GetXaxis()->SetTickLength((Float_t)0.);

    //.......... y axis (remove labels and ticks)
    histo->GetYaxis()->SetTitleOffset((Float_t)9999.);
    histo->GetYaxis()->SetTitleSize((Float_t)0.075);

    histo->GetYaxis()->SetLabelOffset((Float_t)9999.);
    histo->GetYaxis()->SetLabelSize((Float_t)0.);

    histo->GetYaxis()->SetNdivisions((Int_t)1);
    histo->GetYaxis()->SetTickLength((Float_t)0.);
  }
}

//----------------------------------------------
Float_t TEcnaParHistos::AxisTitleOffset() { return AxisTitleOffset(""); }
Float_t TEcnaParHistos::AxisTitleOffset(const TString& opt) {
  Float_t tit_off = 1.;

  if (opt == "") {
    tit_off = 0.055;
  }
  if (opt == "Towx") {
    tit_off = 1.15;
  }
  if (opt == "Towy") {
    tit_off = 1.15;
  }
  if (opt == "SMx") {
    tit_off = 1.15;
  }
  if (opt == "SMy") {
    tit_off = 0.5;
  }
  if (opt == "SMyInEB") {
    tit_off = 0.7;
  }
  if (opt == "EBy") {
    tit_off = 1.;
  }
  if (opt == "EBx") {
    tit_off = 1.3;
  }

  if (opt == "SCx") {
    tit_off = 1.15;
  }
  if (opt == "SCy") {
    tit_off = 1.15;
  }
  if (opt == "Deex") {
    tit_off = 0.75;
  }
  if (opt == "Deey") {
    tit_off = 1.2;
  }
  if (opt == "EEx") {
    tit_off = 1.2;
  }
  if (opt == "EEy") {
    tit_off = 1.;
  }

  return tit_off;
}
//............................................
Float_t TEcnaParHistos::AxisTitleSize() { return AxisTitleSize(""); }
Float_t TEcnaParHistos::AxisTitleSize(const TString& opt) {
  Float_t tit_siz = 0.045;
  if (opt == "") {
    tit_siz = 0.045;
  }
  return tit_siz;
}
//............................................
Float_t TEcnaParHistos::AxisLabelOffset() { return AxisLabelOffset(""); }
Float_t TEcnaParHistos::AxisLabelOffset(const TString& opt) {
  Float_t lab_off = 0.02;
  if (opt == "") {
    lab_off = 0.02;
  }

  if (opt == "Towx") {
    lab_off = 0.01;
  }
  if (opt == "Towy") {
    lab_off = 0.03;
  }
  if (opt == "SMx") {
    lab_off = 0.01;
  }
  if (opt == "SMy") {
    lab_off = 0.015;
  }
  if (opt == "EBx") {
    lab_off = 0.03;
  }
  if (opt == "EBy") {
    lab_off = 0.015;
  }

  if (opt == "SCx") {
    lab_off = 0.01;
  }
  if (opt == "SCy") {
    lab_off = 0.03;
  }
  if (opt == "Deex") {
    lab_off = 0.002;
  }
  if (opt == "Deey") {
    lab_off = 0.03;
  }
  if (opt == "EEx") {
    lab_off = 0.015;
  }
  if (opt == "EEy") {
    lab_off = 0.02;
  }

  return lab_off;
}
//............................................
Float_t TEcnaParHistos::AxisLabelSize() { return AxisLabelSize(""); }
Float_t TEcnaParHistos::AxisLabelSize(const TString& opt) {
  Float_t lab_siz = 0.035;
  if (opt == "SMx") {
    lab_siz = 0.05;
  }
  if (opt == "SMy") {
    lab_siz = 0.05;
  }
  if (opt == "EBx") {
    lab_siz = 0.04;
  }
  if (opt == "EBy") {
    lab_siz = 0.04;
  }
  return lab_siz;
}
//............................................
Float_t TEcnaParHistos::AxisTickSize() { return AxisTickSize(""); }
Float_t TEcnaParHistos::AxisTickSize(const TString& opt) {
  //.......... works only with option "S" in TGaxis
  Float_t tic_siz = 0.;
  if (opt == "Dee") {
    tic_siz = 0.;
  }
  if (opt == "Deex") {
    tic_siz = 0.01;
  }
  if (opt == "Deey") {
    tic_siz = 0.02;
  }
  if (opt == "SMx") {
    tic_siz = 0.03;
  }
  if (opt == "SMy") {
    tic_siz = 0.0075;
  }
  if (opt == "EEx") {
    tic_siz = 0.06;
  }
  if (opt == "EEy") {
    tic_siz = 0.005;
  }

  return tic_siz;
}
//-----------------------------------------------

void TEcnaParHistos::SetViewGraphOffsets(TGraph* graph, const TString& HistoType) {
  // Set offsets of labels, title axis, etc... for histo view

  if ((HistoType == "H1Basic") || (HistoType == "Evol")) {
    //....................... x axis
    graph->GetXaxis()->SetTitleOffset((Float_t)1.10);
    graph->GetXaxis()->SetTitleSize((Float_t)0.04);

    graph->GetXaxis()->SetLabelOffset((Float_t)0.015);
    graph->GetXaxis()->SetLabelSize((Float_t)0.04);

    graph->GetXaxis()->SetTickLength((Float_t)0.02);
    graph->GetXaxis()->SetNdivisions((Int_t)510);

    //....................... y axis
    graph->GetYaxis()->SetTitleOffset((Float_t)1.25);
    graph->GetYaxis()->SetTitleSize((Float_t)0.04);

    graph->GetYaxis()->SetLabelOffset((Float_t)0.01);
    graph->GetYaxis()->SetLabelSize((Float_t)0.04);

    graph->GetYaxis()->SetTickLength((Float_t)0.03);
    graph->GetYaxis()->SetNdivisions((Int_t)510);
  }
}
//-----------------------------------------------
Float_t TEcnaParHistos::DeeOffsetX(const TString& opt_plot, const Int_t& DeeNumber) {
  Float_t offset = 0;
  if (opt_plot == "Dee") {
    offset = 0;
  }
  if (opt_plot == "EE") {
    Double_t vertic_empty_strip_1 = 1.;
    if (DeeNumber == 1) {
      offset = vertic_empty_strip_1 + fEcal->MaxStinHocoInStex() + 2 * fEcal->MaxStinHocoInStex() + 1.;
    }
    if (DeeNumber == 2) {
      offset = vertic_empty_strip_1 + 2 * fEcal->MaxStinHocoInStex() + 1.;
    }
    if (DeeNumber == 3) {
      offset = vertic_empty_strip_1 + fEcal->MaxStinHocoInStex();
    }
    if (DeeNumber == 4) {
      offset = vertic_empty_strip_1 + 0.;
    }
  }
  return offset;
}

//-----------------------------------------------
Float_t TEcnaParHistos::DeeNameOffsetX(const Int_t& DeeNumber) {
  Float_t offset = 0;

  if (DeeNumber == 1) {
    offset = 8.;
  }
  if (DeeNumber == 2) {
    offset = 0.;
  }
  if (DeeNumber == 3) {
    offset = 7.6;
  }
  if (DeeNumber == 4) {
    offset = -0.5;
  }

  return offset;
}
//-----------------------------------------------
Float_t TEcnaParHistos::DeeNumberOffsetX(const TString& opt_plot, const Int_t& DeeNumber) {
  Float_t offset = 0;

  if (opt_plot == "Dee") {
    if (DeeNumber == 1) {
      offset = 2.5;
    }
    if (DeeNumber == 2) {
      offset = 41.5;
    }
    if (DeeNumber == 3) {
      offset = 2.5;
    }
    if (DeeNumber == 4) {
      offset = 41.5;
    }
  }
  if (opt_plot == "EE") {
    if (DeeNumber == 1) {
      offset = 0.42;
    }
    if (DeeNumber == 2) {
      offset = 8.15;
    }
    if (DeeNumber == 3) {
      offset = 0.42;
    }
    if (DeeNumber == 4) {
      offset = 8.15;
    }
  }
  return offset;
}
//===========================================================================
//
//     SetPaveGeneralComment,
//     SetPaveAnalysisRun, SetPaveNbOfEvts,
//     SetPaveEvolNbOfEvtsAna, SetPaveEvolRuns,
//     SetOptionSamePaveBorder
//
//
//                           W A R N I N G
//
//     ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
//
//     WARNING => Paves for plot option "SEVERAL" and "SAMEONE" are treated
//                in TEcnaHistos
//
//     ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
//
//===========================================================================

TPaveText* TEcnaParHistos::SetPaveGeneralComment(const TString& comment) {
  // General comment

  TPaveText* title_g1;

  if (comment != "") {
    fCnew++;

    Double_t pav_gen_xgauche = BoxLeftX("general_comment");
    Double_t pav_gen_xdroite = BoxRightX("general_comment");
    Double_t pav_gen_ybas = BoxBottomY("general_comment");
    Double_t pav_gen_yhaut = BoxTopY("general_comment");

    title_g1 = new TPaveText(pav_gen_xgauche, pav_gen_ybas, pav_gen_xdroite, pav_gen_yhaut);
    fCnewRoot++;

    Option_t* opt_pav = "arc";
    title_g1->SetOption(opt_pav);  // <= NE MARCHE PAS

    TString tit_gen = comment.Data();

    //<<<<<<< TEcnaParHistos.cc
    //sprintf( f_in, tit_gen.Data());
    //title_g1->AddText(f_in);
    //=======
    title_g1->AddText(tit_gen);
    //>>>>>>> 1.5

    //   1 = left adjusted, 2 = vertically centered
    Int_t cTextPaveAlign = 12;
    title_g1->SetTextAlign(cTextPaveAlign);
    // 10*10 = 10*(ID10 = Courier New) // 10*4  = 10*(ID4  = Arial)
    Int_t cTextPaveFont = 40;
    title_g1->SetTextFont(cTextPaveFont);
    // 0.95 = 95% of the pave size
    Float_t cTextPaveSize = 0.04;
    title_g1->SetTextSize(cTextPaveSize);
    Int_t cTextBorderSize = 0;
    title_g1->SetBorderSize(cTextBorderSize);
    Double_t cTextPaveRadius = 5.;
    title_g1->SetCornerRadius(cTextPaveRadius);  // <= NE MARCHE PAS
    // Int_t cTextPaveShadCol = 0; title_g1->SetShadowColor(cTextPaveShadCol);  // <= methode non reconnue

    fCdelete++;
  } else {
    title_g1 = nullptr;
    fCnewRoot++;
  }
  return title_g1;
}

TPaveText* TEcnaParHistos::SetPaveAnalysisRun(const TString& ana_type,
                                              const Int_t& nb_of_samples,
                                              const Int_t& run_number,
                                              const TString& run_type,
                                              const Int_t& first_evt,
                                              const Int_t& last_evt,
                                              const TString& nb_col) {
  // Analysis name + Nb of samples + run number comment

  char f_in[fgMaxCar];

  //...................... Pave Analysis name/run number (bottom_left_box)
  Double_t pav_bot_left_xgauche = BoxLeftX("bottom_left_box");
  Double_t pav_bot_left_xdroite = BoxRightX("bottom_left_box");
  Double_t pav_bot_left_ybas = BoxBottomY("bottom_left_box");
  Double_t pav_bot_left_yhaut = BoxTopY("bottom_left_box");

  TPaveText* com_bot_left =
      new TPaveText(pav_bot_left_xgauche, pav_bot_left_ybas, pav_bot_left_xdroite, pav_bot_left_yhaut);
  fCnewRoot++;

  // (1 = left adjusted, 2 = centered adjusted, 3 = left adjusted), 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_bot_left->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New) // 10*4  = 10*(ID4  = Arial)
  Int_t cTextPaveFont = 100;
  com_bot_left->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.025;
  com_bot_left->SetTextSize(cTextPaveSize);
  // Int_t   cTextPaveShadCol = 0;     com_bot_left->SetShadowColor(cTextPaveShadCol);
  Int_t cTextBorderSize = 1;
  com_bot_left->SetBorderSize(cTextBorderSize);

  if (nb_col == "TwoCol") {
    cTextPaveSize = 0.035;
    com_bot_left->SetTextSize(cTextPaveSize);
    snprintf(f_in, fgMaxCar, "Run:  %d                  Samples:   1 - %d", run_number, nb_of_samples);
    com_bot_left->AddText(f_in);
    cTextPaveSize = 0.035;
    com_bot_left->SetTextSize(cTextPaveSize);
    snprintf(f_in, fgMaxCar, "Type: %-20s", run_type.Data());
    com_bot_left->AddText(f_in);
    snprintf(f_in, fgMaxCar, "Analysis: %-10s         Evts range: %d - %d ", ana_type.Data(), first_evt, last_evt);
    com_bot_left->AddText(f_in);
  } else {
    cTextPaveSize = 0.0225;
    com_bot_left->SetTextSize(cTextPaveSize);
    snprintf(f_in, fgMaxCar, "Run:  %d ", run_number);
    com_bot_left->AddText(f_in);
    snprintf(f_in, fgMaxCar, "Type: %-20s", run_type.Data());
    com_bot_left->AddText(f_in);
    snprintf(f_in, fgMaxCar, "Analysis: %-10s ", ana_type.Data());
    com_bot_left->AddText(f_in);
    Int_t un = 1;
    snprintf(f_in, fgMaxCar, "Samples:    %d - %d", un, nb_of_samples);
    com_bot_left->AddText(f_in);
    snprintf(f_in, fgMaxCar, "Evts range: %d - %d", first_evt, last_evt);
    com_bot_left->AddText(f_in);
  }

  return com_bot_left;
}

TPaveText* TEcnaParHistos::SetPaveNbOfEvts(const Int_t& nb_of_evts,
                                           const TString& start_date,
                                           const TString& stop_date,
                                           const TString& nb_col) {
  // Number of events box

  char f_in[fgMaxCar];

  //...................... Pave number of events (bottom_right_box)

  Double_t pav_bot_right_xgauche = BoxLeftX("bottom_right_box");
  Double_t pav_bot_right_xdroite = BoxRightX("bottom_right_box");
  Double_t pav_bot_right_ybas = BoxBottomY("bottom_right_box");
  Double_t pav_bot_right_yhaut = BoxTopY("bottom_right_box");
  TPaveText* com_bot_right =
      new TPaveText(pav_bot_right_xgauche, pav_bot_right_ybas, pav_bot_right_xdroite, pav_bot_right_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_bot_right->SetTextAlign(cTextPaveAlign);
  // 10*4 = 10*(ID4 = Arial)   // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_bot_right->SetTextFont(cTextPaveFont);
  // 0.05 = 5% of the pave size
  Float_t cTextPaveSize = 0.025;
  com_bot_right->SetTextSize(cTextPaveSize);
  //Int_t   cTextPaveShadCol = 0;     com_bot_right->SetShadowColor(cTextPaveShadCol);
  Int_t cTextBorderSize = 1;
  com_bot_right->SetBorderSize(cTextBorderSize);

  if (nb_col == "TwoCol") {
    cTextPaveSize = 0.0325;
    com_bot_right->SetTextSize(cTextPaveSize);
    snprintf(f_in, fgMaxCar, "First evt: %s              %8d events ", start_date.Data(), nb_of_evts);
    com_bot_right->AddText(f_in);
    snprintf(f_in, fgMaxCar, "Last  evt: %s ", stop_date.Data());
    com_bot_right->AddText(f_in);
  } else {
    cTextPaveSize = 0.0225;
    com_bot_right->SetTextSize(cTextPaveSize);
    snprintf(f_in, fgMaxCar, "%d events", nb_of_evts);
    com_bot_right->AddText(f_in);
    snprintf(f_in, fgMaxCar, "First evt: %s ", start_date.Data());
    com_bot_right->AddText(f_in);
    snprintf(f_in, fgMaxCar, "Last  evt: %s ", stop_date.Data());
    com_bot_right->AddText(f_in);
  }

  return com_bot_right;
}

TPaveText* TEcnaParHistos::SetPaveEvolNbOfEvtsAna(const TString& ana_type,
                                                  const Int_t& nb_of_samples,
                                                  const Int_t& first_req_evt,
                                                  const Int_t& last_req_evt,
                                                  const TString& HistoType) {
  // Analysis name + run number comment

  char f_in[fgMaxCar];

  //...................... Pave Analysis name/run number (bottom_left_box)
  Double_t pav_bot_left_xgauche = BoxLeftX("bottom_left_box");
  Double_t pav_bot_left_xdroite = BoxRightX("bottom_left_box");
  Double_t pav_bot_left_ybas = BoxBottomY("bottom_left_box");
  Double_t pav_bot_left_yhaut = BoxTopY("bottom_left_box");

  if (HistoType == "EvolProj") {
    pav_bot_left_xgauche = BoxLeftX("bottom_left_box_evol");
    pav_bot_left_xdroite = BoxRightX("bottom_left_box_evol");
    pav_bot_left_ybas = BoxBottomY("bottom_left_box_evol");
    pav_bot_left_yhaut = BoxTopY("bottom_left_box_evol");
  }

  TPaveText* com_bot_left =
      new TPaveText(pav_bot_left_xgauche, pav_bot_left_ybas, pav_bot_left_xdroite, pav_bot_left_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_bot_left->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)    // 10*4 = 10*(ID4 = Arial)
  Int_t cTextPaveFont = 100;
  com_bot_left->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.03;
  com_bot_left->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_bot_left->SetBorderSize(cTextBorderSize);

  TString analysis_name = ana_type.Data();

  snprintf(f_in, fgMaxCar, "Analysis:   %s", analysis_name.Data());
  com_bot_left->AddText(f_in);
  snprintf(f_in, fgMaxCar, "Samples:    1 - %d", nb_of_samples);
  com_bot_left->AddText(f_in);
  snprintf(f_in, fgMaxCar, "Evts range: %d - %d ", first_req_evt, last_req_evt);
  com_bot_left->AddText(f_in);

  return com_bot_left;
}

TPaveText* TEcnaParHistos::SetPaveEvolRuns(const Int_t& start_evol_run,
                                           const TString& start_evol_date,
                                           const Int_t& stop_evol_run,
                                           const TString& stop_evol_date,
                                           const TString& opt_plot,
                                           const TString& HistoType) {
  // First and last run of the list of runs

  char f_in[fgMaxCar];

  //...................... Pave first and last runs (bottom_right_box)
  Double_t pav_border_xgauche = BoxLeftX("bottom_right_box_evol");
  Double_t pav_border_xdroite = BoxRightX("bottom_right_box_evol");
  Double_t pav_border_ybas = BoxBottomY("bottom_right_box_evol");
  Double_t pav_border_yhaut = BoxTopY("bottom_right_box_evol");

  if (opt_plot == "SAME n") {
    pav_border_xgauche = BoxLeftX("bottom_right_box_evpr");
    pav_border_xdroite = BoxRightX("bottom_right_box_evpr");
    pav_border_ybas = BoxBottomY("top_right_box_EB");
    pav_border_yhaut = BoxTopY("top_right_box_EB");
  }

  TPaveText* pav_evol_runs = new TPaveText(pav_border_xgauche, pav_border_ybas, pav_border_xdroite, pav_border_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  pav_evol_runs->SetTextAlign(cTextPaveAlign);
  // 10*4 = 10*(ID4 = Courier helvetica-medium-r-normal = Arial)
  // 10*10 = 10*(ID10 = Courier bold-r-normal = Courier New)
  Int_t cTextPaveFont = 100;
  pav_evol_runs->SetTextFont(cTextPaveFont);
  // 0.03 = 3% of the pave height
  Float_t cTextPaveSize = 0.025;
  if (HistoType == "Evol" || HistoType == "EvolProj") {
    cTextPaveSize = 0.0225;
  }

  pav_evol_runs->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  pav_evol_runs->SetBorderSize(cTextBorderSize);

  if (!((HistoType == "Evol" && opt_plot == "SAME n") || (HistoType == "EvolProj" && opt_plot == "SAME n"))) {
    snprintf(f_in, fgMaxCar, "First run: %d", start_evol_run);
    pav_evol_runs->AddText(f_in);
    snprintf(f_in, fgMaxCar, "(%s) ", start_evol_date.Data());
    pav_evol_runs->AddText(f_in);
    snprintf(f_in, fgMaxCar, "Last run:  %d", stop_evol_run);
    pav_evol_runs->AddText(f_in);
    snprintf(f_in, fgMaxCar, "(%s) ", stop_evol_date.Data());
    pav_evol_runs->AddText(f_in);
  }

  if ((HistoType == "Evol" && opt_plot == "SAME n") || (HistoType == "EvolProj" && opt_plot == "SAME n")) {
    snprintf(f_in, fgMaxCar, "First run: %d (%s) ", start_evol_run, start_evol_date.Data());
    pav_evol_runs->AddText(f_in);
    snprintf(f_in, fgMaxCar, "Last run:  %d (%s)", stop_evol_run, stop_evol_date.Data());
    pav_evol_runs->AddText(f_in);
  }

  return pav_evol_runs;
}

TPaveText* TEcnaParHistos::SetOptionSamePaveBorder(const TString& chopt, const TString& HistoType) {
  // Pave for plots with option SAME and SAME n.
  // Gives just the size/border and return the pointer to the Pave. No text.
  // The Pave text is drawn in TEcnaHistos.cc

  //.................................. DEFAULT OPTION: "several"

  Double_t pav_left_xgauche = BoxLeftX("several_plots_box");
  Double_t pav_left_xdroite = BoxRightX("several_plots_box");
  Double_t pav_left_ybas = BoxBottomY("several_plots_box");
  Double_t pav_left_yhaut = BoxTopY("several_plots_box");

  if (chopt == "sevevol") {
    pav_left_xgauche = BoxLeftX("several_evol_box");
    pav_left_xdroite = BoxRightX("several_evol_box");
    pav_left_ybas = BoxBottomY("several_evol_box");
    pav_left_yhaut = BoxTopY("several_evol_box");

    if (HistoType == "EvolProj") {
      pav_left_xgauche = BoxLeftX("several_evpr_box");
      pav_left_xdroite = BoxRightX("several_evpr_box");
      pav_left_ybas = BoxBottomY("several_evpr_box");
      pav_left_yhaut = BoxTopY("several_evpr_box");
    }
  }

  TPaveText* com_several = new TPaveText(pav_left_xgauche, pav_left_ybas, pav_left_xdroite, pav_left_yhaut);
  fCnewRoot++;

  return com_several;
}
//.... end of SetOptionSamePaveBorder
//===========================================================================
//
//     SetPaveSM, SetPaveTower, SetPaveTowersXY,
//     SetPaveEBCrystal, SetPaveEBCrystalSample,
//     SetPaveLVRB, SetColorsForNumbers
//
//===========================================================================
TPaveText* TEcnaParHistos::SetPaveStas() {
  char f_in[fgMaxCar];
  //.................................. DEFAULT OPTION: "standard"
  Double_t pav_top_left_xgauche = BoxLeftX("top_left_box_SM");
  Double_t pav_top_left_xdroite = BoxRightX("top_left_box_SM");
  Double_t pav_top_left_ybas = BoxBottomY("top_left_box_SM");
  Double_t pav_top_left_yhaut = BoxTopY("top_left_box_SM");

  TPaveText* com_top_left =
      new TPaveText(pav_top_left_xgauche, pav_top_left_ybas, pav_top_left_xdroite, pav_top_left_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_top_left->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_top_left->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.04;
  com_top_left->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_top_left->SetBorderSize(cTextBorderSize);

  if (fFlagSubDet == "EB") {
    snprintf(f_in, fgMaxCar, "EB");
  }
  if (fFlagSubDet == "EE") {
    snprintf(f_in, fgMaxCar, "EE");
  }

  com_top_left->AddText(f_in);

  return com_top_left;
}

TPaveText* TEcnaParHistos::SetPaveSM(const TString& chopt, const Int_t& SM_number, const TString& EB_type) {
  // Pave for Super-module plots

  char f_in[fgMaxCar];

  //.................................. DEFAULT OPTION: "standard"
  Double_t pav_top_left_xgauche = BoxLeftX("top_left_box_SM");
  Double_t pav_top_left_xdroite = BoxRightX("top_left_box_SM");
  Double_t pav_top_left_ybas = BoxBottomY("top_left_box_SM");
  Double_t pav_top_left_yhaut = BoxTopY("top_left_box_SM");

  if (chopt == "standard" || (chopt == "standGH" && EB_type == "EB-")) {
    pav_top_left_xgauche = BoxLeftX("top_left_box_EB");
    pav_top_left_xdroite = BoxRightX("top_left_box_EB");
    pav_top_left_ybas = BoxBottomY("top_left_box_EB");
    pav_top_left_yhaut = BoxTopY("top_left_box_EB");
  }

  if (chopt == "standSM" || chopt == "standStex" || (chopt == "standGH" && EB_type == "EB+")) {
    pav_top_left_xgauche = BoxLeftX("top_left_box_SM");
    pav_top_left_xdroite = BoxRightX("top_left_box_SM");
    pav_top_left_ybas = BoxBottomY("top_left_box_SM");
    pav_top_left_yhaut = BoxTopY("top_left_box_SM");
  }

  if (chopt == "several") {
    pav_top_left_xgauche = BoxLeftX("several_plots_box");
    pav_top_left_xdroite = BoxRightX("several_plots_box");
    pav_top_left_ybas = BoxBottomY("several_plots_box");
    pav_top_left_yhaut = BoxTopY("several_plots_box");
  }

  if (chopt == "sevevol") {
    pav_top_left_xgauche = BoxLeftX("several_evol_box");
    pav_top_left_xdroite = BoxRightX("several_evol_box");
    pav_top_left_ybas = BoxBottomY("several_evol_box");
    pav_top_left_yhaut = BoxTopY("several_evol_box");
  }

  TPaveText* com_top_left =
      new TPaveText(pav_top_left_xgauche, pav_top_left_ybas, pav_top_left_xdroite, pav_top_left_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_top_left->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_top_left->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.04;
  com_top_left->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_top_left->SetBorderSize(cTextBorderSize);

  if (chopt == "standard" || chopt == "standSM" || chopt == "standStex" || chopt == "standGH") {
    Int_t sm_nb = SM_number;
    if (EB_type == "EB+") {
      snprintf(f_in, fgMaxCar, "EB+%d", sm_nb);
    }
    if (EB_type == "EB-") {
      sm_nb = -SM_number + fEcal->MaxSMInEB() / 2;
      snprintf(f_in, fgMaxCar, "EB%d (SM%d)", sm_nb, SM_number);
    }
    com_top_left->AddText(f_in);
  }

  return com_top_left;
}

TPaveText* TEcnaParHistos::SetPaveTower(const Int_t& SMtower_X) {
  // Tower comment

  char f_in[fgMaxCar];
  //...................... Pave tower/crystal(channel)/sample (top_right_box)
  Double_t pav_top_mid_xgauche = BoxLeftX("top_mid_box_EB");
  Double_t pav_top_mid_xdroite = BoxRightX("top_mid_box_EB");
  Double_t pav_top_mid_ybas = BoxBottomY("top_mid_box_EB");
  Double_t pav_top_mid_yhaut = BoxTopY("top_mid_box_EB");
  TPaveText* com_top_mid = new TPaveText(pav_top_mid_xgauche, pav_top_mid_ybas, pav_top_mid_xdroite, pav_top_mid_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_top_mid->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_top_mid->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.03;
  com_top_mid->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_top_mid->SetBorderSize(cTextBorderSize);

  snprintf(f_in, fgMaxCar, " Tower: %d ", SMtower_X);
  com_top_mid->AddText(f_in);

  return com_top_mid;
}

TPaveText* TEcnaParHistos::SetPaveTowersXY(const Int_t& SMtower_X, const Int_t& SMtower_Y) {
  // Towers X and Y for (TowEcha,TowEcha) cov or cor matrix

  char f_in[fgMaxCar];
  //...................... Pave tower/TowEcha(channel)/sample (top_right_box)
  Double_t pav_top_mid_xgauche = BoxLeftX("top_mid_box_EB");
  Double_t pav_top_mid_xdroite = BoxRightX("top_mid_box_EB");
  Double_t pav_top_mid_ybas = BoxBottomY("top_mid_box_EB");
  Double_t pav_top_mid_yhaut = BoxTopY("top_mid_box_EB");
  TPaveText* com_top_mid = new TPaveText(pav_top_mid_xgauche, pav_top_mid_ybas, pav_top_mid_xdroite, pav_top_mid_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_top_mid->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_top_mid->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.03;
  com_top_mid->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_top_mid->SetBorderSize(cTextBorderSize);

  snprintf(f_in, fgMaxCar, " Tower X: %d ", SMtower_X);
  com_top_mid->AddText(f_in);
  snprintf(f_in, fgMaxCar, " Tower Y: %d ", SMtower_Y);
  com_top_mid->AddText(f_in);

  return com_top_mid;
}

TPaveText* TEcnaParHistos::SetPaveCrystal(const Int_t& StexCrys, const Int_t& StexStinA, const Int_t& StinEcha) {
  Int_t arg_AlreadyRead = 0;
  Int_t flag_all_samples = 0;
  return SetPaveCrystal(StexCrys, StexStinA, StinEcha, arg_AlreadyRead, flag_all_samples);
}

TPaveText* TEcnaParHistos::SetPaveCrystal(const Int_t& StexCrys,
                                          const Int_t& StexStinA,
                                          const Int_t& StinEcha,
                                          const Int_t& arg_AlreadyRead,
                                          const Int_t& flag_all_samples) {
  // Tower + StinEcha comment. StexCrys range: [1,max]

  char f_in[fgMaxCar];
  //...................... Pave tower/StinEcha(channel)/sample (top_right_box)

  Double_t pav_top_right_xgauche = BoxLeftX("top_right_box_EB");
  Double_t pav_top_right_xdroite = BoxRightX("top_right_box_EB");
  Double_t pav_top_right_ybas = BoxBottomY("top_right_box_EB");
  Double_t pav_top_right_yhaut = BoxTopY("top_right_box_EB");
  if (fFlagSubDet == "EE") {
    pav_top_right_xgauche = BoxLeftX("top_right_box_EE");
    pav_top_right_xdroite = BoxRightX("top_right_box_EE");
    pav_top_right_ybas = BoxBottomY("top_right_box_EE");
    pav_top_right_yhaut = BoxTopY("top_right_box_EE");
  }

  TPaveText* com_top_right =
      new TPaveText(pav_top_right_xgauche, pav_top_right_ybas, pav_top_right_xdroite, pav_top_right_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_top_right->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_top_right->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.03;
  com_top_right->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_top_right->SetBorderSize(cTextBorderSize);

  if (fFlagSubDet == "EB") {
    if (arg_AlreadyRead == 0 || (arg_AlreadyRead == 1 && flag_all_samples == 0)) {
      snprintf(f_in, fgMaxCar, "Channel: %d ", StinEcha);
    }  // EB => range = [0,24]
    if (arg_AlreadyRead == 1 && flag_all_samples == 1) {
      snprintf(f_in, fgMaxCar, "Channel: 0 to %d", fEcal->MaxCrysInStin() - 1);
    }
    com_top_right->AddText(f_in);
    if (arg_AlreadyRead == 0 || (arg_AlreadyRead == 1 && flag_all_samples == 0)) {
      snprintf(f_in, fgMaxCar, "Crystal in SM: %d ", StexCrys);
      com_top_right->AddText(f_in);
    }
  }

  if (fFlagSubDet == "EE") {
    Int_t StinEchap = StinEcha + 1;
    if (arg_AlreadyRead == 0 || (arg_AlreadyRead == 1 && flag_all_samples == 0)) {
      snprintf(f_in, fgMaxCar, "Xtal in SC: %d ", StinEchap);
    }  // EE => range = [1,25]
    if (arg_AlreadyRead == 1 && flag_all_samples == 1) {
      snprintf(f_in, fgMaxCar, "Xtal in SC: 1 to %d", fEcal->MaxCrysInStin());
    }
    com_top_right->AddText(f_in);
    if (arg_AlreadyRead == 0 || (arg_AlreadyRead == 1 && flag_all_samples == 0)) {
      Int_t IX_Dee_crys = StexCrys / fEcal->MaxCrysIYInDee() + 1;
      Int_t IY_Dee_crys = StexCrys % fEcal->MaxCrysIYInDee();
      if (IY_Dee_crys == 0) {
        IX_Dee_crys--;
        IY_Dee_crys = fEcal->MaxCrysIYInDee();
      }
      snprintf(f_in, fgMaxCar, "(IX,IY)[Xtal]=(%d,%d)", IX_Dee_crys, IY_Dee_crys);
      com_top_right->AddText(f_in);
    }
  }

  return com_top_right;
}

TPaveText* TEcnaParHistos::SetPaveCrystalSample(const Int_t& StexCrys,
                                                const Int_t& StexStinA,
                                                const Int_t& StinEcha,
                                                const Int_t& iSample) {
  // Tower + StinEcha + sample comment

  char f_in[fgMaxCar];
  //...................... Pave tower/StinEcha(channel)/sample (top_right_box)
  Double_t pav_top_right_xgauche = BoxLeftX("top_right_box_EB");
  Double_t pav_top_right_xdroite = BoxRightX("top_right_box_EB");
  Double_t pav_top_right_ybas = BoxBottomY("top_right_box_EB");
  Double_t pav_top_right_yhaut = BoxTopY("top_right_box_EB");
  if (fFlagSubDet == "EE") {
    pav_top_right_xgauche = BoxLeftX("top_right_box_EE");
    pav_top_right_xdroite = BoxRightX("top_right_box_EE");
    pav_top_right_ybas = BoxBottomY("top_right_box_EE");
    pav_top_right_yhaut = BoxTopY("top_right_box_EE");
  }

  TPaveText* com_top_right =
      new TPaveText(pav_top_right_xgauche, pav_top_right_ybas, pav_top_right_xdroite, pav_top_right_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_top_right->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_top_right->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.03;
  com_top_right->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_top_right->SetBorderSize(cTextBorderSize);

  if (fFlagSubDet == "EB") {
    snprintf(f_in, fgMaxCar, " Channel: %d ", StinEcha);
    com_top_right->AddText(f_in);
    snprintf(f_in, fgMaxCar, " Crystal in SM: %d ", StexCrys);
    com_top_right->AddText(f_in);
  }

  if (fFlagSubDet == "EE") {
    Int_t StinEchap = StinEcha + 1;
    snprintf(f_in, fgMaxCar, " Channel: %d ", StinEchap);  // EE => range = [1,25]
    com_top_right->AddText(f_in);
    Int_t IX_Dee_crys = StexCrys / fEcal->MaxCrysIYInDee() + 1;
    Int_t IY_Dee_crys = StexCrys % fEcal->MaxCrysIYInDee();
    if (IY_Dee_crys == 0) {
      IX_Dee_crys--;
      IY_Dee_crys = fEcal->MaxCrysIYInDee();
    }
    snprintf(f_in, fgMaxCar, "(IX,IY)[Xtal]=(%d,%d)", IX_Dee_crys, IY_Dee_crys);
    com_top_right->AddText(f_in);
  }

  Int_t iSample_p = iSample + 1;
  snprintf(f_in, fgMaxCar, " Sample: %d ", iSample_p);
  com_top_right->AddText(f_in);

  return com_top_right;
}

TPaveText* TEcnaParHistos::SetPaveLVRB(const Int_t& SMNumber, const Int_t& SMtower) {
  // LVRB at the top or at the bottom comment

  //....................... GRAND pave "LVRB"
  Double_t pav_bot_xgauche = BoxLeftX("bottom_left_box");
  Double_t pav_bot_xdroite = BoxRightX("bottom_right_box");
  Double_t pav_bot_ybas = BoxBottomY("bottom_left_box");
  Double_t pav_bot_yhaut = BoxTopY("bottom_left_box");
  TPaveText* com_bot_mid = new TPaveText(pav_bot_xgauche, pav_bot_ybas, pav_bot_xdroite, pav_bot_yhaut);
  fCnewRoot++;

  Color_t couleur_noir = ColorDefinition("noir");
  Color_t couleur_rouge = SetColorsForNumbers("lvrb_top");
  Color_t couleur_bleu_fonce = SetColorsForNumbers("lvrb_bottom");

  if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") {
    TText* t1 = com_bot_mid->AddText("   <= IP (#eta = 0)       (#eta = +85) =>   ");
    t1->SetTextColor(couleur_noir);
  }

  if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") {
    TText* t2 = com_bot_mid->AddText("   <= (#eta = -85)       IP (#eta = 0) =>   ");
    t2->SetTextColor(couleur_noir);
  }

  if (fEcalNumbering->GetTowerLvrbType(SMtower) == "top") {
    TText* t3 = nullptr;
    if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") {
      t3 = com_bot_mid->AddText("       <=== LVRB       ");
    } else if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") {
      t3 = com_bot_mid->AddText("       LVRB ===>       ");
    }
    if (t3 != nullptr) {
      t3->SetTextColor(couleur_rouge);
    }
  }

  if (fEcalNumbering->GetTowerLvrbType(SMtower) == "bottom") {
    TText* t4 = nullptr;
    if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB+") {
      t4 = com_bot_mid->AddText("        LVRB ===>       ");
    } else if (fEcalNumbering->GetSMHalfBarrel(SMNumber) == "EB-") {
      t4 = com_bot_mid->AddText("        <=== LVRB       ");
    }
    if (t4 != nullptr) {
      t4->SetTextColor(couleur_bleu_fonce);
    }
  }
  return com_bot_mid;

}  //  end of SetPaveLVRB

Color_t TEcnaParHistos::SetColorsForNumbers(const TString& chtype_number) {
  //Set color of the numbers for SuperModule- or Tower-  numbering plots

  Color_t couleur = ColorDefinition("noir");  // default = "noir"

  if (chtype_number == "crystal") {
    couleur = ColorDefinition("noir");
  }
  if (chtype_number == "lvrb_top") {
    couleur = ColorDefinition("rouge");
  }
  if (chtype_number == "lvrb_bottom") {
    couleur = ColorDefinition("bleu_fonce");
  }

  return couleur;
}

//===========================================================================
//
//     SetPaveDee, SetPaveSC, SetPaveSCsXY,
//     SetPaveEECrystal
//
//===========================================================================

TPaveText* TEcnaParHistos::SetPaveDee(const TString& chopt, const Int_t& DeeNumber, const TString& DeeType) {
  // Dee pav. Called only once.

  char f_in[fgMaxCar];

  //.................................. DEFAULT OPTION: "standard"
  Double_t pav_top_left_xgauche = BoxLeftX("top_left_box_EE");
  Double_t pav_top_left_xdroite = BoxRightX("top_left_box_EE");
  Double_t pav_top_left_ybas = BoxBottomY("top_left_box_EE");
  Double_t pav_top_left_yhaut = BoxTopY("top_left_box_EE");

  if (chopt == "standard" || chopt == "standGH") {
    pav_top_left_xgauche = BoxLeftX("top_left_box_EE");
    pav_top_left_xdroite = BoxRightX("top_left_box_EE");
    pav_top_left_ybas = BoxBottomY("top_left_box_EE");
    pav_top_left_yhaut = BoxTopY("top_left_box_EE");
  }

  if (chopt == "standDee" || chopt == "standStex") {
    pav_top_left_xgauche = BoxLeftX("top_left_box_Dee");
    pav_top_left_xdroite = BoxRightX("top_left_box_Dee");
    pav_top_left_ybas = BoxBottomY("top_left_box_Dee");
    pav_top_left_yhaut = BoxTopY("top_left_box_Dee");
  }

  if (chopt == "several") {
    pav_top_left_xgauche = BoxLeftX("several_plots_box");
    pav_top_left_xdroite = BoxRightX("several_plots_box");
    pav_top_left_ybas = BoxBottomY("several_plots_box");
    pav_top_left_yhaut = BoxTopY("several_plots_box");
  }
  if (chopt == "sevevol") {
    pav_top_left_xgauche = BoxLeftX("several_evol_box");
    pav_top_left_xdroite = BoxRightX("several_evol_box");
    pav_top_left_ybas = BoxBottomY("several_evol_box");
    pav_top_left_yhaut = BoxTopY("several_evol_box");
  }

  TPaveText* com_top_left =
      new TPaveText(pav_top_left_xgauche, pav_top_left_ybas, pav_top_left_xdroite, pav_top_left_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_top_left->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_top_left->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.04;
  com_top_left->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_top_left->SetBorderSize(cTextBorderSize);

  if (chopt == "standard") {
    snprintf(f_in, fgMaxCar, " Dee: %d", DeeNumber);
    com_top_left->AddText(f_in);
    snprintf(f_in, fgMaxCar, " (%s)", DeeType.Data());
    com_top_left->AddText(f_in);
  }

  if (chopt == "standDee" || chopt == "standStex" || chopt == "standGH") {
    snprintf(f_in, fgMaxCar, " Dee: %d  (%s) ", DeeNumber, DeeType.Data());
    com_top_left->AddText(f_in);
  }

  return com_top_left;
}

TPaveText* TEcnaParHistos::SetPaveSC(const Int_t& DeeSC_X, const Int_t& DeeNumber) {
  // SC comment

  char f_in[fgMaxCar];
  //...................... Pave SC/crystal(channel)/sample (top_right_box)
  Double_t pav_top_mid_xgauche = BoxLeftX("top_mid_box_EE");
  Double_t pav_top_mid_xdroite = BoxRightX("top_mid_box_EE");
  Double_t pav_top_mid_ybas = BoxBottomY("top_mid_box_EE");
  Double_t pav_top_mid_yhaut = BoxTopY("top_mid_box_EE");
  TPaveText* com_top_mid = new TPaveText(pav_top_mid_xgauche, pav_top_mid_ybas, pav_top_mid_xdroite, pav_top_mid_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_top_mid->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_top_mid->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.03;
  com_top_mid->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_top_mid->SetBorderSize(cTextBorderSize);

  snprintf(f_in,
           fgMaxCar,
           "Sector: S%d, SC: %d",
           fEcalNumbering->GetDSFrom1DeeSCEcna(DeeNumber, DeeSC_X),
           fEcalNumbering->GetDSSCFrom1DeeSCEcna(DeeNumber, DeeSC_X));
  com_top_mid->AddText(f_in);
  snprintf(f_in, fgMaxCar, "SC for const.: %d", fEcalNumbering->GetDeeSCConsFrom1DeeSCEcna(DeeNumber, DeeSC_X));
  com_top_mid->AddText(f_in);
  snprintf(f_in, fgMaxCar, "Quadrant: %s", fEcalNumbering->GetSCQuadFrom1DeeSCEcna(DeeSC_X).Data());
  com_top_mid->AddText(f_in);

  return com_top_mid;
}

TPaveText* TEcnaParHistos::SetPaveSCsXY(const Int_t& DeeSC_X, const Int_t& DeeSC_Y) {
  // SCs X and Y for (SCEcha,SCEcha) cov or cor matrix

  char f_in[fgMaxCar];
  //...................... Pave SC/SCEcha(channel)/sample (top_right_box)
  Double_t pav_top_mid_xgauche = BoxLeftX("top_mid_box_EE");
  Double_t pav_top_mid_xdroite = BoxRightX("top_mid_box_EE");
  Double_t pav_top_mid_ybas = BoxBottomY("top_mid_box_EE");
  Double_t pav_top_mid_yhaut = BoxTopY("top_mid_box_EE");
  TPaveText* com_top_mid = new TPaveText(pav_top_mid_xgauche, pav_top_mid_ybas, pav_top_mid_xdroite, pav_top_mid_yhaut);
  fCnewRoot++;

  // 1 = left adjusted, 2 = vertically centered
  Int_t cTextPaveAlign = 12;
  com_top_mid->SetTextAlign(cTextPaveAlign);
  // 10*10 = 10*(ID10 = Courier New)
  Int_t cTextPaveFont = 100;
  com_top_mid->SetTextFont(cTextPaveFont);
  // 0.95 = 95% of the pave size
  Float_t cTextPaveSize = 0.03;
  com_top_mid->SetTextSize(cTextPaveSize);
  Int_t cTextBorderSize = 1;
  com_top_mid->SetBorderSize(cTextBorderSize);

  snprintf(f_in, fgMaxCar, "SC X: %d", DeeSC_X);
  com_top_mid->AddText(f_in);
  snprintf(f_in, fgMaxCar, "SC Y: %d", DeeSC_Y);
  com_top_mid->AddText(f_in);

  return com_top_mid;
}

TPaveText* TEcnaParHistos::SetPaveCxyz(const Int_t& DeeNumber) {
  // Cxyz at the top or at the bottom comment

  //....................... GRAND pave "Cxyz"
  Double_t pav_bot_xgauche = BoxRightX("bottom_mid_box");
  Double_t pav_bot_xdroite = BoxLeftX("bottom_mid_box");
  Double_t pav_bot_ybas = BoxBottomY("bottom_left_box");
  Double_t pav_bot_yhaut = BoxTopY("bottom_left_box");
  TPaveText* com_bot_mid = new TPaveText(pav_bot_xgauche, pav_bot_ybas, pav_bot_xdroite, pav_bot_yhaut);
  fCnewRoot++;

  //com_bot_mid->SetOption("arc");
  //com_bot_mid->SetCornerRadius((Double_t)0.5);
  //Int_t   cTextPaveFont  = 100;  com_bot_mid->SetTextFont(cTextPaveFont);

  com_bot_mid->SetTextSize(0.0325);
  //........................................... (SetPaveCxyz)
  if (DeeNumber == 1) {
    com_bot_mid->AddText("        y ");
    com_bot_mid->AddText("        #uparrow ");
    com_bot_mid->AddText(" (Near)    x #leftarrow #otimes z     (Far) ");
  }
  if (DeeNumber == 2) {
    com_bot_mid->AddText("        y ");
    com_bot_mid->AddText("        #uparrow ");
    com_bot_mid->AddText(" (Near)    x #leftarrow #otimes z     (Far) ");
  }
  if (DeeNumber == 3) {
    com_bot_mid->AddText(" y           ");
    com_bot_mid->AddText(" #uparrow          ");
    com_bot_mid->AddText(" (Far)      z (#bullet) #rightarrow x     (Near) ");
  }
  if (DeeNumber == 4) {
    com_bot_mid->AddText(" y           ");
    com_bot_mid->AddText(" #uparrow          ");
    com_bot_mid->AddText(" (Far)      z (#bullet) #rightarrow x     (Near) ");
  }

  // com_bot_mid->AddText(" (from IP) " );
  return com_bot_mid;
}
//===========================================================================
//
//            SetPaveStex,  SetPaveStin
//
//===========================================================================

TPaveText* TEcnaParHistos::SetPaveStex(const TString& chopt, const Int_t& StexNumber) {
  TPaveText* pav_text = nullptr;

  if (StexNumber > 0) {
    if (fFlagSubDet == "EB") {
      TString EB_type = fEcalNumbering->GetSMHalfBarrel(StexNumber);
      pav_text = SetPaveSM(chopt, StexNumber, EB_type);
    }
    if (fFlagSubDet == "EE") {
      TString dee_type = fEcalNumbering->GetEEDeeType(StexNumber);
      pav_text = SetPaveDee(chopt, StexNumber, dee_type);
    }
  }
  if (StexNumber == 0) {
    pav_text = SetPaveStas();
  }

  return pav_text;
}

TPaveText* TEcnaParHistos::SetPaveStin(const Int_t& StinNumber, const Int_t& StexNumber) {
  TPaveText* pav_text = nullptr;
  if (fFlagSubDet == "EB") {
    pav_text = SetPaveTower(StinNumber);
  }
  if (fFlagSubDet == "EE") {
    pav_text = SetPaveSC(StinNumber, StexNumber);
  }
  return pav_text;
}

TPaveText* TEcnaParHistos::SetPaveStinsXY(const Int_t& StexStin_X, const Int_t& StexStin_Y) {
  TPaveText* pav_text = nullptr;
  if (fFlagSubDet == "EB") {
    pav_text = SetPaveTowersXY(StexStin_X, StexStin_Y);
  }
  if (fFlagSubDet == "EE") {
    pav_text = SetPaveSCsXY(StexStin_X, StexStin_Y);
  }
  return pav_text;
}

//===========================================================================
//
//               GetHistoType, GetQuantityName
//
//===========================================================================
TString TEcnaParHistos::GetHistoType(const TString& HistoCode) {
  // Type of the quantity as a function of the quantity code
  // Histo type <=> Variable in X coordinate

  TString HistoType;
  Int_t MaxCar = fgMaxCar;
  HistoType.Resize(MaxCar);
  HistoType = "(no quantity type info)";

  //.(1a)............................ Global
  if (HistoCode == "D_NOE_ChNb" || HistoCode == "D_Ped_ChNb" || HistoCode == "D_TNo_ChNb" ||
      HistoCode == "D_LFN_ChNb" || HistoCode == "D_HFN_ChNb" || HistoCode == "D_MCs_ChNb" ||
      HistoCode == "D_SCs_ChNb") {
    HistoType = "Global";
  }  // X coordinate = Xtals for SM or Dee
  //                Tower for EB
  //                SC    for EE
  //.(1b)............................ Proj
  if (HistoCode == "D_NOE_ChDs" || HistoCode == "D_Ped_ChDs" || HistoCode == "D_TNo_ChDs" ||
      HistoCode == "D_LFN_ChDs" || HistoCode == "D_HFN_ChDs" || HistoCode == "D_MCs_ChDs" ||
      HistoCode == "D_SCs_ChDs") {
    HistoType = "Proj";
  }  // X coordinate = bin number

  //.(2)............................ H1Basic
  if (HistoCode == "D_MSp_SpNb" || HistoCode == "D_SSp_SpNb") {
    HistoType = "H1Basic";
  }  // X coordinate = sample number

  //.(2)............................ H1BasicProj
  if (HistoCode == "D_MSp_SpDs" || HistoCode == "D_SSp_SpDs") {
    HistoType = "H1BasicProj";
  }  // X coordinate = total noise

  //.(3a)............................ SampGlobal
  if (HistoCode == "D_Adc_EvNb") {
    HistoType = "SampGlobal";
  }  // X coordinate = event number
  //.(3b)............................ SampProj
  if (HistoCode == "D_Adc_EvDs") {
    HistoType = "SampProj";
  }  // X coordinate = bin number

  //.(4a)............................ Evol
  if (HistoCode == "H_Ped_Date" || HistoCode == "H_TNo_Date" || HistoCode == "H_MCs_Date" ||
      HistoCode == "H_LFN_Date" || HistoCode == "H_HFN_Date" || HistoCode == "H_SCs_Date") {
    HistoType = "Evol";
  }  // X coordinate = date

  //.(4b)............................ EvolProj
  if (HistoCode == "H_Ped_RuDs" || HistoCode == "H_TNo_RuDs" || HistoCode == "H_MCs_RuDs" ||
      HistoCode == "H_LFN_RuDs" || HistoCode == "H_HFN_RuDs" || HistoCode == "H_SCs_RuDs") {
    HistoType = "EvolProj";
  }  // X coordinate = bin number

  return HistoType;
}  // end of GetHistoType(...)

TString TEcnaParHistos::GetXVarHisto(const TString& HistoCode, const TString& SubDet, const Int_t& StexNumber) {
  // Type of the quantity as a function of the quantity code
  // Histo type <=> Variable in X coordinate

  TString HistoType = GetHistoType(HistoCode.Data());

  TString XVarHisto;
  Int_t MaxCar = fgMaxCar;
  XVarHisto.Resize(MaxCar);
  XVarHisto = "(no X variable info)";

  if (HistoType == "Global") {
    if (StexNumber == 0 && SubDet == "EB") {
      XVarHisto = "Tower number";
    }
    if (StexNumber == 0 && SubDet == "EE") {
      XVarHisto = "SC number";
    }
    if (StexNumber != 0) {
      XVarHisto = "Xtal number";
    }
  }
  if (HistoType == "Proj") {
    XVarHisto = "Bin number";
  }

  if (HistoType == "H1Basic") {
    XVarHisto = "Sample number";
  }
  if (HistoType == "H1BasicProj") {
    XVarHisto = "Total noise";
  }

  if (HistoType == "SampGlobal") {
    XVarHisto = "Event number";
  }

  if (HistoType == "SampProj") {
    XVarHisto = "ADC count";
  }

  if (HistoType == "Evol") {
    XVarHisto = "Date";
  }

  if (HistoType == "EvolProj") {
    XVarHisto = "Bin number";
  }

  return XVarHisto;

}  // end of GetXVarHisto(...)

TString TEcnaParHistos::GetYVarHisto(const TString& HistoCode, const TString& SubDet, const Int_t& StexNumber) {
  // Type of the quantity as a function of the quantity code
  // Histo type <=> Variable in Y coordinate

  TString HistoType = GetHistoType(HistoCode.Data());

  TString YVarHisto;
  Int_t MaxCar = fgMaxCar;
  YVarHisto.Resize(MaxCar);
  YVarHisto = "(no Y variable info)";

  if (HistoType == "Global") {
    if (HistoCode == "D_NOE_ChNb") {
      YVarHisto = "Nb of events";
    }
    if (HistoCode == "D_Ped_ChNb") {
      YVarHisto = "Pedestal";
    }
    if (HistoCode == "D_TNo_ChNb") {
      YVarHisto = "Total Noise";
    }
    if (HistoCode == "D_MCs_ChNb") {
      YVarHisto = "Mean Cor(s,s')";
    }
    if (HistoCode == "D_LFN_ChNb") {
      YVarHisto = "Low Freq. Noise";
    }
    if (HistoCode == "D_HFN_ChNb") {
      YVarHisto = "High Freq. Noise";
    }
    if (HistoCode == "D_SCs_ChNb") {
      YVarHisto = "Sigma Cor(s,s')";
    }
  }

  if (HistoType == "Proj") {
    if (StexNumber == 0 && SubDet == "EB") {
      YVarHisto = "Number of towers";
    }
    if (StexNumber == 0 && SubDet == "EE") {
      YVarHisto = "Number of SCs";
    }
    if (StexNumber != 0) {
      YVarHisto = "Number of Xtals";
    }
  }

  if (HistoType == "H1Basic") {
    YVarHisto = "ADC count";
  }
  if (HistoType == "H1BasicProj") {
    YVarHisto = "Number of samples";
  }

  if (HistoType == "SampGlobal") {
    YVarHisto = "ADC count";
  }

  if (HistoType == "SampProj") {
    YVarHisto = "Number of events";
  }

  if (HistoType == "EvolProj") {
    YVarHisto = "Number of runs";
  }

  if (HistoType == "Evol") {
    if (HistoCode == "H_Ped_Date") {
      YVarHisto = "Pedestal";
    }
    if (HistoCode == "H_TNo_Date") {
      YVarHisto = "Total Noise";
    }
    if (HistoCode == "H_MCs_Date") {
      YVarHisto = "Mean Cor(s,s')";
    }
    if (HistoCode == "H_LFN_Date") {
      YVarHisto = "Low Freq. Noise";
    }
    if (HistoCode == "H_HFN_Date") {
      YVarHisto = "High Freq. Noise";
    }
    if (HistoCode == "H_SCs_Date") {
      YVarHisto = "Sigma Cor(s,s')";
    }
  }

  //  std::cout << std::endl << "*TEcnaParHistos::GetYVarHisto(...)> HistoType = " << HistoType
  //       << ", HistoCode = " << HistoCode
  //       << ", StexNumber = " << StexNumber
  //       << ", YVarHisto = " << YVarHisto << std::endl;

  return YVarHisto;

}  // end of GetYVarHisto(...)

TString TEcnaParHistos::GetQuantityName(const TString& chqcode) {
  // Name of the quantity as a function of the histo code

  TString chqname;
  Int_t MaxCar = fgMaxCar;
  chqname.Resize(MaxCar);
  chqname = "(no quantity name info)";

  if (chqcode == "D_NOE_ChNb") {
    chqname = "Number of events";
  }
  if (chqcode == "D_NOE_ChDs") {
    chqname = "Nb of events";
  }
  if (chqcode == "D_Ped_ChNb") {
    chqname = "Pedestal";
  }
  if (chqcode == "D_Ped_ChDs") {
    chqname = "Pedestal";
  }
  if (chqcode == "D_TNo_ChNb") {
    chqname = "Total Noise";
  }
  if (chqcode == "D_TNo_ChDs") {
    chqname = "Total Noise";
  }
  if (chqcode == "D_MCs_ChNb") {
    chqname = "Mean Cor(s,s')";
  }
  if (chqcode == "D_MCs_ChDs") {
    chqname = "Mean Cor(s,s')";
  }
  if (chqcode == "D_LFN_ChNb") {
    chqname = "Low Freq. Noise";
  }
  if (chqcode == "D_LFN_ChDs") {
    chqname = "Low Freq. Noise";
  }
  if (chqcode == "D_HFN_ChNb") {
    chqname = "High Freq. Noise";
  }
  if (chqcode == "D_HFN_ChDs") {
    chqname = "High Freq. Noise";
  }
  if (chqcode == "D_SCs_ChNb") {
    chqname = "Sigma Cor(s,s')";
  }
  if (chqcode == "D_SCs_ChDs") {
    chqname = "Sigma Cor(s,s')";
  }
  if (chqcode == "D_MSp_SpNb") {
    chqname = "Sample means";
  }
  if (chqcode == "D_MSp_SpDs") {
    chqname = "Sample means";
  }
  if (chqcode == "D_SSp_SpNb") {
    chqname = "Sample sigmas";
  }
  if (chqcode == "D_SSp_SpDs") {
    chqname = "Sample sigmas";
  }
  if (chqcode == "D_Adc_EvNb") {
    chqname = "Sample ADC";
  }
  if (chqcode == "D_Adc_EvDs") {
    chqname = "Sample ADC distribution";
  }
  if (chqcode == "H_Ped_Date") {
    chqname = "Pedestal";
  }
  if (chqcode == "H_TNo_Date") {
    chqname = "Total Noise";
  }
  if (chqcode == "H_MCs_Date") {
    chqname = "Mean Cor(s,s')";
  }
  if (chqcode == "H_LFN_Date") {
    chqname = "Low Freq. Noise";
  }
  if (chqcode == "H_HFN_Date") {
    chqname = "High Freq. Noise";
  }
  if (chqcode == "H_SCs_Date") {
    chqname = "Sigma Cor(s,s')";
  }
  if (chqcode == "H_Ped_RuDs") {
    chqname = "Pedestal";
  }
  if (chqcode == "H_TNo_RuDs") {
    chqname = "Total Noise";
  }
  if (chqcode == "H_MCs_RuDs") {
    chqname = "Mean Cor(s,s')";
  }
  if (chqcode == "H_LFN_RuDs") {
    chqname = "Low Freq. Noise";
  }
  if (chqcode == "H_HFN_RuDs") {
    chqname = "High Freq. Noise";
  }
  if (chqcode == "H_SCs_RuDs") {
    chqname = "Sigma Cor(s,s')";
  }
  return chqname;
}

Double_t TEcnaParHistos::GetYminDefaultValue(const TString& chqcode) {
  Double_t vmin = (Double_t)0.;

  if (chqcode == "H2LFccMosMatrix") {
    vmin = (Double_t)-1.;
  }
  if (chqcode == "H2HFccMosMatrix") {
    vmin = (Double_t)-1.;
  }
  if (chqcode == "H2CorccInStins") {
    vmin = (Double_t)-1.;
  }

  if (chqcode == "D_NOE_ChNb") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "D_Ped_ChNb") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "D_TNo_ChNb") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "D_MCs_ChNb") {
    vmin = (Double_t)-1.;
  }
  if (chqcode == "D_LFN_ChNb") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "D_HFN_ChNb") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "D_SCs_ChNb") {
    vmin = (Double_t)-1.;
  }

  if (chqcode == "D_NOE_ChDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "D_Ped_ChDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "D_TNo_ChDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "D_MCs_ChDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "D_LFN_ChDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "D_HFN_ChDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "D_SCs_ChDs") {
    vmin = (Double_t)0.1;
  }

  if (chqcode == "D_MSp_SpNb") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "D_MSp_SpDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "D_SSp_SpNb") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "D_SSp_SpDs") {
    vmin = (Double_t)0.1;
  }

  if (chqcode == "D_Adc_EvNb") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "D_Adc_EvDs") {
    vmin = (Double_t)0.1;
  }

  if (chqcode == "H_Ped_Date") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "H_TNo_Date") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "H_MCs_Date") {
    vmin = (Double_t)-1.;
  }
  if (chqcode == "H_LFN_Date") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "H_HFN_Date") {
    vmin = (Double_t)0.;
  }
  if (chqcode == "H_SCs_Date") {
    vmin = (Double_t)0.;
  }

  if (chqcode == "H_Ped_RuDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "H_TNo_RuDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "H_MCs_RuDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "H_LFN_RuDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "H_HFN_RuDs") {
    vmin = (Double_t)0.1;
  }
  if (chqcode == "H_SCs_RuDs") {
    vmin = (Double_t)0.1;
  }

  return vmin;
}

Double_t TEcnaParHistos::GetYmaxDefaultValue(const TString& chqcode) {
  Double_t vmax = (Double_t)0.;

  if (fFlagSubDet == "EB") {
    if (chqcode == "H2LFccMosMatrix") {
      vmax = (Double_t)1.;
    }
    if (chqcode == "H2HFccMosMatrix") {
      vmax = (Double_t)1.;
    }
    if (chqcode == "H2CorccInStins") {
      vmax = (Double_t)1.;
    }

    if (chqcode == "D_NOE_ChNb") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "D_Ped_ChNb") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "D_TNo_ChNb") {
      vmax = (Double_t)2.5;
    }
    if (chqcode == "D_LFN_ChNb") {
      vmax = (Double_t)2.5;
    }
    if (chqcode == "D_HFN_ChNb") {
      vmax = (Double_t)2.5;
    }
    if (chqcode == "D_MCs_ChNb") {
      vmax = (Double_t)1.;
    }
    if (chqcode == "D_SCs_ChNb") {
      vmax = (Double_t)1.5;
    }

    if (chqcode == "D_NOE_ChDs") {
      vmax = (Double_t)5000.;
    }
    if (chqcode == "D_Ped_ChDs") {
      vmax = (Double_t)5000.;
    }
    if (chqcode == "D_TNo_ChDs") {
      vmax = (Double_t)5000.;
    }
    if (chqcode == "D_LFN_ChDs") {
      vmax = (Double_t)5000.;
    }
    if (chqcode == "D_HFN_ChDs") {
      vmax = (Double_t)5000.;
    }
    if (chqcode == "D_MCs_ChDs") {
      vmax = (Double_t)5000.;
    }
    if (chqcode == "D_SCs_ChDs") {
      vmax = (Double_t)5000.;
    }

    if (chqcode == "D_MSp_SpNb") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "D_MSp_SpDs") {
      vmax = (Double_t)10.;
    }
    if (chqcode == "D_SSp_SpNb") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "D_SSp_SpDs") {
      vmax = (Double_t)10.;
    }

    if (chqcode == "D_Adc_EvNb") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "D_Adc_EvDs") {
      vmax = (Double_t)150.;
    }

    if (chqcode == "H_Ped_Date") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "H_TNo_Date") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "H_LFN_Date") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "H_HFN_Date") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "H_MCs_Date") {
      vmax = (Double_t)1.;
    }
    if (chqcode == "H_SCs_Date") {
      vmax = (Double_t)0.5;
    }

    if (chqcode == "H_Ped_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_TNo_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_LFN_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_HFN_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_MCs_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_SCs_RuDs") {
      vmax = (Double_t)1000.;
    }
  }

  if (fFlagSubDet == "EE") {
    if (chqcode == "H2LFccMosMatrix") {
      vmax = (Double_t)1.;
    }
    if (chqcode == "H2HFccMosMatrix") {
      vmax = (Double_t)1.;
    }
    if (chqcode == "H2CorccInStins") {
      vmax = (Double_t)0.05;
    }

    if (chqcode == "D_NOE_ChNb") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "D_Ped_ChNb") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "D_TNo_ChNb") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "D_LFN_ChNb") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "D_HFN_ChNb") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "D_MCs_ChNb") {
      vmax = (Double_t)1.;
    }
    if (chqcode == "D_SCs_ChNb") {
      vmax = (Double_t)2.5;
    }

    if (chqcode == "D_NOE_ChDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "D_Ped_ChDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "D_TNo_ChDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "D_LFN_ChDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "D_HFN_ChDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "D_MCs_ChDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "D_SCs_ChDs") {
      vmax = (Double_t)1000.;
    }

    if (chqcode == "D_MSp_SpNb") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "D_MSp_SpDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "D_SSp_SpNb") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "D_SSp_SpDs") {
      vmax = (Double_t)100.;
    }

    if (chqcode == "D_Adc_EvNb") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "D_Adc_EvDs") {
      vmax = (Double_t)1000.;
    }

    if (chqcode == "H_Ped_Date") {
      vmax = (Double_t)500.;
    }
    if (chqcode == "H_TNo_Date") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "H_LFN_Date") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "H_HFN_Date") {
      vmax = (Double_t)5.;
    }
    if (chqcode == "H_MCs_Date") {
      vmax = (Double_t)1.;
    }
    if (chqcode == "H_SCs_Date") {
      vmax = (Double_t)0.5;
    }

    if (chqcode == "H_Ped_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_TNo_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_LFN_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_HFN_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_MCs_RuDs") {
      vmax = (Double_t)1000.;
    }
    if (chqcode == "H_SCs_RuDs") {
      vmax = (Double_t)1000.;
    }
  }
  return vmax;
}

//---------------------------------------------------------------------------------------
//
//             BuildStandardDetectorCode, BuildStandardPlotOption,
//             BuildStandard1DHistoCodeX, BuildStandard1DHistoCodeY,
//             BuildStandardCovOrCorCode, BuildStandardBetweenWhatCode,
//
//---------------------------------------------------------------------------------------
//----------------------- BuildStandardDetectorCode
TString TEcnaParHistos::BuildStandardDetectorCode(const TString& UserDetector) {
  TString StandardDetectorCode = "?";

  if (UserDetector == "Super-module" || UserDetector == "SuperModule" || UserDetector == "super-module" ||
      UserDetector == "SM" || UserDetector == " " || UserDetector == "")  // (default)
  {
    StandardDetectorCode = "SM";
  }

  if (UserDetector == "DEE" || UserDetector == "Dee") {
    StandardDetectorCode = "Dee";
  }

  if (UserDetector == "Ecal barrel" || UserDetector == "EcalBarrel" || UserDetector == "ecal barrel" ||
      UserDetector == "Barrel" || UserDetector == "barrel" || UserDetector == "EB") {
    StandardDetectorCode = "EB";
  }

  if (UserDetector == "Ecal endcap" || UserDetector == "EcalEndcap" || UserDetector == "ecal endcap" ||
      UserDetector == "Endcap" || UserDetector == "endcap" || UserDetector == "EE") {
    StandardDetectorCode = "EE";
  }

  if (StandardDetectorCode == "?") {
    std::cout << "*TEcnaParHistos::BuildStandardDetectorCode(...)> UserDetector = " << UserDetector
              << " : code not found." << fTTBELL << std::endl;

    ListOfStandardCodes("DetectorCode");
  }
  return StandardDetectorCode;
}

//----------------------- BuildStandardPlotOption
TString TEcnaParHistos::BuildStandardPlotOption(const TString& CallingMethod, const TString& UserPlotOption) {
  TString StandardPlotOption = "?";

  if (CallingMethod == "1D" || CallingMethod == "2DS" || CallingMethod == "Time") {
    if (UserPlotOption == "ONLY ONE" || UserPlotOption == "only one" || UserPlotOption == "onlyone" ||
        UserPlotOption == "Only one" || UserPlotOption == "OnlyOne" || UserPlotOption == "ONLYONE" ||
        UserPlotOption == fOnlyOnePlot || UserPlotOption == " " || UserPlotOption == "")  // (default)
    {
      StandardPlotOption = fOnlyOnePlot;
    }

    if (UserPlotOption == "SAME" || UserPlotOption == "Same" || UserPlotOption == fSeveralPlot) {
      StandardPlotOption = fSeveralPlot;
    }

    if (UserPlotOption == "SAME n" || UserPlotOption == "Same n" || UserPlotOption == fSameOnePlot) {
      StandardPlotOption = fSameOnePlot;
    }

    if (UserPlotOption == fAllXtalsInStinPlot)  // called with 1D after call with 1DX (special case "SAME in Stin")
    {
      StandardPlotOption = fAllXtalsInStinPlot;
    }
  }

  if (CallingMethod == "1DX") {
    if (UserPlotOption == "ALL XTALS IN TOWER" || UserPlotOption == "ALL CHANNELS IN TOWER" ||
        UserPlotOption == "AllXtalsInTower" || UserPlotOption == "AllChannelsInTower" ||
        UserPlotOption == "ALL XTALS IN TOW" || UserPlotOption == "ALL CHANNELS IN TOW" ||
        UserPlotOption == "AllXtalsInTow" || UserPlotOption == "AllChannelsInTow" ||
        UserPlotOption == "ALL XTALS IN SC" || UserPlotOption == "ALL CHANNELS IN SC" ||
        UserPlotOption == "AllXtalsInSC" || UserPlotOption == "AllChannelsInSC" || UserPlotOption == "SAME IN TOWER" ||
        UserPlotOption == "SameInTower" || UserPlotOption == "SAME IN TOW" || UserPlotOption == "SameInTow" ||
        UserPlotOption == "SAME IN SC" || UserPlotOption == "SameInSC" || UserPlotOption == "Same in tower" ||
        UserPlotOption == "Same in tow" || UserPlotOption == "Same in SC" || UserPlotOption == "SameInSC" ||
        UserPlotOption == fAllXtalsInStinPlot || UserPlotOption == " " || UserPlotOption == "")  // (default)
    {
      StandardPlotOption = fAllXtalsInStinPlot;
    }
  }

  if (CallingMethod == "2D") {
    if (UserPlotOption == "COLZ" || UserPlotOption == " " || UserPlotOption == "")  // (default)
    {
      StandardPlotOption = "COLZ";
    }
    if (UserPlotOption == "BOX") {
      StandardPlotOption = "BOX";
    }
    if (UserPlotOption == "TEXT") {
      StandardPlotOption = "TEXT";
    }
    if (UserPlotOption == "CONTZ") {
      StandardPlotOption = "CONTZ";
    }
    if (UserPlotOption == "LEGO2Z") {
      StandardPlotOption = "LEGO2Z";
    }
    if (UserPlotOption == "SURF1Z") {
      StandardPlotOption = "SURF1Z";
    }
    if (UserPlotOption == "SURF2Z") {
      StandardPlotOption = "SURF2Z";
    }
    if (UserPlotOption == "SURF3Z") {
      StandardPlotOption = "SURF3Z";
    }
    if (UserPlotOption == "SURF4") {
      StandardPlotOption = "SURF4";
    }
    if (UserPlotOption == "ASCII") {
      StandardPlotOption = "ASCII";
    }
  }

  //...................................................
  if (StandardPlotOption == "?") {
    std::cout << "*TEcnaParHistos::BuildStandardPlotOption(...)> UserPlotOption = " << UserPlotOption
              << " : code not found." << fTTBELL << std::endl;

    ListOfStandardCodes("PlotOption");
  }
  return StandardPlotOption;
}

//----------------------- BuildStandard1DHistoCodeX
TString TEcnaParHistos::BuildStandard1DHistoCodeX(const TString& CallingMethod, const TString& UserHistoCode) {
  //........................... user code -> standard code
  TString StandardHistoCode = "?";
  if (CallingMethod == "1D" || CallingMethod == "2DS" || CallingMethod == "Time") {
    //======================================== Only X Quantity for 1D Histos
    if (UserHistoCode == "Tower" || UserHistoCode == "tower" || UserHistoCode == "tow" ||
        UserHistoCode == "Tower number" || UserHistoCode == "tower number" || UserHistoCode == "tow nb" ||
        UserHistoCode == "Tower#" || UserHistoCode == "tower#" || UserHistoCode == "tow#" || UserHistoCode == "Tow#" ||
        UserHistoCode == "Tow") {
      StandardHistoCode = "Tow";
    }

    if (UserHistoCode == "Super crystal" || UserHistoCode == "SuperCrystal" || UserHistoCode == "SuperXtal" ||
        UserHistoCode == "Super crystal number" || UserHistoCode == "SuperCrystalNumber" ||
        UserHistoCode == "SuperXtalNumber" || UserHistoCode == "Super crystal nb" || UserHistoCode == "SuperCrystal#" ||
        UserHistoCode == "SuperXtal#" || UserHistoCode == "SC#" || UserHistoCode == "SC") {
      StandardHistoCode = "SC";
    }

    if (UserHistoCode == "Crystal" || UserHistoCode == "crystal" || UserHistoCode == "Xtal" ||
        UserHistoCode == "Crystal number" || UserHistoCode == "crystal number" || UserHistoCode == "Xtal number" ||
        UserHistoCode == "Crystal#" || UserHistoCode == "crystal#" || UserHistoCode == "Xtal#" ||
        UserHistoCode == "Xtal") {
      StandardHistoCode = "Xtal";
    }

    if (StandardHistoCode == "Tow" || StandardHistoCode == "SC" || StandardHistoCode == "Xtal") {
      StandardHistoCode = "XtalORStin";
    }  // management by means of fFapStexNumber ( >0 => Xtal ; =0 => Tow .OR. SC )

    if (UserHistoCode == "Sample number" || UserHistoCode == "SampleNumber" || UserHistoCode == "Sample#" ||
        UserHistoCode == "Samp#" || UserHistoCode == "Sample" || UserHistoCode == "sample" || UserHistoCode == "Smp") {
      StandardHistoCode = "Smp";
    }

    if (UserHistoCode == "Event" || UserHistoCode == "event" || UserHistoCode == "Event number" ||
        UserHistoCode == "event number" || UserHistoCode == "EventNumber" || UserHistoCode == "Event#" ||
        UserHistoCode == "EvtNumber" || UserHistoCode == "Evt#" || UserHistoCode == "Evt number" ||
        UserHistoCode == "evt number" || UserHistoCode == "Evt") {
      StandardHistoCode = "Evt";
    }

    //======================================== X or Y Quantity for 1D Histos
    if (StandardHistoCode == "?") {
      StandardHistoCode = BuildStandard1DHistoCodeXY(UserHistoCode);
    }
  }

  //---------------------------------------------
  if (StandardHistoCode == "?") {
    std::cout << "*TEcnaParHistos::BuildStandard1DHistoCodeX(...)> UserHistoCode = " << UserHistoCode
              << " : code not found." << fTTBELL << std::endl;

    ListOfStandardCodes("1DHistoCodeX");
  }
  return StandardHistoCode;
}

//----------------------- BuildStandard1DHistoCodeY
TString TEcnaParHistos::BuildStandard1DHistoCodeY(const TString& CallingMethod, const TString& UserHistoCode) {
  //........................... user code -> standard code
  TString StandardHistoCode = "?";

  if (CallingMethod == "1D" || CallingMethod == "2DS" || CallingMethod == "Time") {
    //======================================== Only Y Quantity for 1D Histos
    if (UserHistoCode == "Number of crystals" || UserHistoCode == "NumberOfCrystals" ||
        UserHistoCode == "Nb of crystals" || UserHistoCode == "NbOfCrystals" || UserHistoCode == "Number of xtals" ||
        UserHistoCode == "NumberOfXtals" || UserHistoCode == "Nb of xtals" || UserHistoCode == "NbOfXtals" ||
        UserHistoCode == "nox" || UserHistoCode == "NOX") {
      StandardHistoCode = "NOX";
    }

    if (UserHistoCode == "Number of samples" || UserHistoCode == "NumberOfSamples" ||
        UserHistoCode == "Nb of samples" || UserHistoCode == "NbOfSamples" || UserHistoCode == "nos" ||
        UserHistoCode == "NOS") {
      StandardHistoCode = "NOS";
    }

    if (UserHistoCode == "Number of runs" || UserHistoCode == "NumberOfRuns" || UserHistoCode == "Nb of runs" ||
        UserHistoCode == "NbOfRuns" || UserHistoCode == "nor" || UserHistoCode == "NOR") {
      StandardHistoCode = "NOR";
    }

    //======================================== X or Y Quantity for 1D Histos
    if (StandardHistoCode == "?") {
      StandardHistoCode = BuildStandard1DHistoCodeXY(UserHistoCode);
    }
  }
  //---------------------------------------------
  if (StandardHistoCode == "?") {
    std::cout << "*TEcnaParHistos::BuildStandard1DHistoCodeY(...)> UserHistoCode = " << UserHistoCode
              << " : code not found." << fTTBELL << std::endl;

    ListOfStandardCodes("1DHistoCodeY");
  }
  return StandardHistoCode;
}

//----------------------- BuildStandard1DHistoCodeXY
TString TEcnaParHistos::BuildStandard1DHistoCodeXY(const TString& UserHistoCode) {
  //........................... user code -> standard code
  TString StandardHistoCode = "?";

  //======================================== X or Y Quantity for 1D Histos
  if (UserHistoCode == "Number of events" || UserHistoCode == "Nb of evts" || UserHistoCode == "NumberbOfEvents" ||
      UserHistoCode == "NbOfEvts" || UserHistoCode == "number of events" || UserHistoCode == "noe" ||
      UserHistoCode == "NOE" || UserHistoCode == " " || UserHistoCode == "")  // (default)
  {
    StandardHistoCode = "NOE";
  }

  if (UserHistoCode == "Pedestals" || UserHistoCode == "Pedestal" || UserHistoCode == "pedestals" ||
      UserHistoCode == "pedestal" || UserHistoCode == "ped" || UserHistoCode == "Ped") {
    StandardHistoCode = "Ped";
  }

  if (UserHistoCode == "Total noise" || UserHistoCode == "TotalNoise" || UserHistoCode == "total noise" ||
      UserHistoCode == "TN" || UserHistoCode == "tn" || UserHistoCode == "TNo") {
    StandardHistoCode = "TNo";
  }

  if (UserHistoCode == "Low frequency noise" || UserHistoCode == "LowFrequencyNoise" || UserHistoCode == "LF noise" ||
      UserHistoCode == "LFNoise" || UserHistoCode == "low frequency noise" || UserHistoCode == "lfn" ||
      UserHistoCode == "LFN") {
    StandardHistoCode = "LFN";
  }

  if (UserHistoCode == "High frequency noise" || UserHistoCode == "HighFrequencyNoise" || UserHistoCode == "HF noise" ||
      UserHistoCode == "HFNoise" || UserHistoCode == "high frequency noise" || UserHistoCode == "hfn" ||
      UserHistoCode == "HFN") {
    StandardHistoCode = "HFN";
  }

  if (UserHistoCode == "Mean correlations between samples" || UserHistoCode == "MeanCorrelationsBetweenSamples" ||
      UserHistoCode == "Correlations between samples" || UserHistoCode == "CorrelationsBetweenSamples" ||
      UserHistoCode == "Mean corss" || UserHistoCode == "MeanCorss" || UserHistoCode == "Corss" ||
      UserHistoCode == "corss" || UserHistoCode == "Css" || UserHistoCode == "css" ||
      UserHistoCode == "mean correlations between samples" || UserHistoCode == "mcs" || UserHistoCode == "MCs") {
    StandardHistoCode = "MCs";
  }

  if (UserHistoCode == "Sigma of correlations between samples" ||
      UserHistoCode == "SigmaOfCorrelationsBetweenSamples" || UserHistoCode == "Sigma corss" ||
      UserHistoCode == "SigmaCorss" || UserHistoCode == "SigCorss" || UserHistoCode == "sigcorss" ||
      UserHistoCode == "SCss" || UserHistoCode == "scss" || UserHistoCode == "sigma of correlations between samples" ||
      UserHistoCode == "scs" || UserHistoCode == "SCs") {
    StandardHistoCode = "SCs";
  }

  if (UserHistoCode == "Sample mean" || UserHistoCode == "SampleMean" || UserHistoCode == "Sample average" ||
      UserHistoCode == "SampleAverage" || UserHistoCode == "SampMean" || UserHistoCode == "SampAverage" ||
      UserHistoCode == "MSp") {
    StandardHistoCode = "MSp";
  }

  if (UserHistoCode == "Sample sigma" || UserHistoCode == "SampleSigma" || UserHistoCode == "Sigma of samples" ||
      UserHistoCode == "SigmaOfSamples" || UserHistoCode == "SampSigma" || UserHistoCode == "SSp") {
    StandardHistoCode = "SSp";
  }

  if (UserHistoCode == "date" || UserHistoCode == "Date" || UserHistoCode == "time" || UserHistoCode == "Time") {
    StandardHistoCode = "Time";
  }

  if (UserHistoCode == "ADC value" || UserHistoCode == "ADCValue" || UserHistoCode == "Adc value" ||
      UserHistoCode == "AdcValue" || UserHistoCode == "Sample ADC" || UserHistoCode == "SampleAdc" ||
      UserHistoCode == "ADC" || UserHistoCode == "Adc") {
    StandardHistoCode = "Adc";
  }

  //---------------------------------------------
  if (StandardHistoCode == "?") {
    std::cout << "*TEcnaParHistos::BuildStandard1DHistoCodeXY(...)> UserHistoCode = " << UserHistoCode
              << " : code not found." << fTTBELL << std::endl;

    ListOfStandardCodes("1DHistoCodeXY");
  }
  return StandardHistoCode;
}

//----------------------- BuildStandardCovOrCorCode
TString TEcnaParHistos::BuildStandardCovOrCorCode(const TString& CallingMethod, const TString& UserHistoCode) {
  //........................... user code -> standard code
  TString StandardHistoCode = "?";
  if (CallingMethod == "2D") {
    //======================================== Correlation or covariance (CorOrCov)
    if (UserHistoCode == "Correlation" || UserHistoCode == "Correlations" || UserHistoCode == "correlation" ||
        UserHistoCode == "correlations" || UserHistoCode == "Correl" || UserHistoCode == "correl" ||
        UserHistoCode == "cor" || UserHistoCode == "Cor" || UserHistoCode == " " || UserHistoCode == "")  // (default)
    {
      StandardHistoCode = "Cor";
    }

    if (UserHistoCode == "Covariance" || UserHistoCode == "Covariances" || UserHistoCode == "covariance" ||
        UserHistoCode == "covariances" || UserHistoCode == "Covar" || UserHistoCode == "covar" ||
        UserHistoCode == "cov" || UserHistoCode == "Cov") {
      StandardHistoCode = "Cov";
    }
  }
  //---------------------------------------------
  if (StandardHistoCode == "?") {
    std::cout << "*TEcnaParHistos::BuildStandardCovOrCorCode(...)> UserHistoCode = " << UserHistoCode
              << " : code not found." << fTTBELL << std::endl;

    ListOfStandardCodes("CovOrCorCode");
  }
  return StandardHistoCode;
}

//----------------------- BuildStandardBetweenWhatCode
TString TEcnaParHistos::BuildStandardBetweenWhatCode(const TString& CallingMethod, const TString& UserHistoCode) {
  //........................... user code -> standard code
  TString StandardHistoCode = "?";
  if (CallingMethod == "2D") {
    //======================================== Quantity for correlations (BetweenWhat)
    if (UserHistoCode == "Samples" || UserHistoCode == "Between samples" || UserHistoCode == "samples" ||
        UserHistoCode == "between samples" || UserHistoCode == "BetweenSamples" || UserHistoCode == "Samp" ||
        UserHistoCode == "samp" || UserHistoCode == "ss" || UserHistoCode == "Mss") {
      StandardHistoCode = "Mss";
    }

    if (UserHistoCode == "LF channels" || UserHistoCode == "LF between channels" || UserHistoCode == "LFChannels" ||
        UserHistoCode == "LFBetweenChannels" || UserHistoCode == "LFChan" || UserHistoCode == "lfchan" ||
        UserHistoCode == "LFcc" || UserHistoCode == "lfcc" || UserHistoCode == "MccLF") {
      StandardHistoCode = "MccLF";
    }

    if (UserHistoCode == "HF channels" || UserHistoCode == "HF between channels" || UserHistoCode == "HFChannels" ||
        UserHistoCode == "HFBetweenChannels" || UserHistoCode == "HFChan" || UserHistoCode == "hfchan" ||
        UserHistoCode == "HFcc" || UserHistoCode == "hfcc" || UserHistoCode == "MccHF") {
      StandardHistoCode = "MccHF";
    }

    if (UserHistoCode == "LF towers" || UserHistoCode == "LF between towers" || UserHistoCode == "LFTowers" ||
        UserHistoCode == "LFBetweenTowers" || UserHistoCode == "LFTow" || UserHistoCode == "lftow" ||
        UserHistoCode == "LFtt" || UserHistoCode == "lftt" || UserHistoCode == "LF SCs" ||
        UserHistoCode == "LF between SCs" || UserHistoCode == "LFSCs" || UserHistoCode == "LFBetweenSCs" ||
        UserHistoCode == "LFSuperXtals" || UserHistoCode == "lfsc" || UserHistoCode == "LFSC" ||
        UserHistoCode == "lfsx" || UserHistoCode == "MttLF") {
      StandardHistoCode = "MttLF";
    }

    if (UserHistoCode == "HF towers" || UserHistoCode == "HF between towers" || UserHistoCode == "HFTowers" ||
        UserHistoCode == "HFBetweenTowers" || UserHistoCode == "HFTow" || UserHistoCode == "hftow" ||
        UserHistoCode == "HFtt" || UserHistoCode == "hftt" || UserHistoCode == "HF SCs" ||
        UserHistoCode == "HF between SCs" || UserHistoCode == "HFSCs" || UserHistoCode == "HFBetweenSCs" ||
        UserHistoCode == "HFSuperXtals" || UserHistoCode == "hfsc" || UserHistoCode == "HFSC" ||
        UserHistoCode == "hfsx" || UserHistoCode == "MttHF") {
      StandardHistoCode = "MttHF";
    }
  }

  //---------------------------------------------
  if (StandardHistoCode == "?") {
    std::cout << "*TEcnaParHistos::BuildStandardBetweenWhatCode(...)> UserHistoCode = " << UserHistoCode
              << " : code not found." << fTTBELL << std::endl;

    ListOfStandardCodes("BetweenWhatCode");
  }
  return StandardHistoCode;
}

//========================== ListOfStandardCodes ==========================

void TEcnaParHistos::ListOfStandardCodes(const TString& TypeOfCode) {
  //------ Lists of Standard codes for Plot Histos methods

  if (TypeOfCode == "DetectorCode") {
    std::cout << "*--------------------------------------- Standard detector codes:" << std::endl;
    std::cout << "    EB   (ECAL Barrel) " << std::endl;
    std::cout << "    EE   (ECAL Endcap) " << std::endl;
    std::cout << "    SM   (Barrel Super Module) " << std::endl;
    std::cout << "    Dee  (Encap Dee) " << std::endl;
    std::cout << " Other codes are available" << std::endl;
    std::cout << " See source file: TEcnaParHistos::BuildStandardDetectorCode(...)." << std::endl;
    std::cout << "*----------------------------------------------------------------" << std::endl;
  }

  if (TypeOfCode == "PlotOption") {
    std::cout << "*--------------------------------------- Standard plot options:" << std::endl;
    std::cout << "    All ROOT DRAW options and: " << std::endl;
    std::cout << "   (nothing) " << std::endl;
    std::cout << "    SAME n   " << std::endl;
    std::cout << "    ASCII    " << std::endl;
    std::cout << " Other codes are available" << std::endl;
    std::cout << " See source file: TEcnaParHistos::BuildStandardPlotOption(...)." << std::endl;
    std::cout << "*--------------------------------------------------------------" << std::endl;
  }

  if (TypeOfCode == "1DHistoCodeX") {
    std::cout << "*---------------------- Standard 1D histo codes for X coordinate:" << std::endl;
    std::cout << "    Tow  (SM tower) " << std::endl;
    std::cout << "    SC   (Dee super crystal) " << std::endl;
    std::cout << "    Xtal (crystal) " << std::endl;
    std::cout << "    Smp  (Adc sample) " << std::endl;
    std::cout << "    Evt  (event) " << std::endl;
    std::cout << " Other codes are available" << std::endl;
    std::cout << " See source file: TEcnaParHistos::BuildStandard1DHistoCodeX(...)." << std::endl;
    std::cout << "*----------------------------------------------------------------" << std::endl;
  }

  if (TypeOfCode == "1DHistoCodeY") {
    std::cout << "*---------------------- Standard 1D histo codes for Y coordinate;" << std::endl;
    std::cout << "    NOX  (number of crystals) " << std::endl;
    std::cout << "    NOS  (number of samples) " << std::endl;
    std::cout << "    NOR  (number of runs) " << std::endl;
    std::cout << " Other codes are available" << std::endl;
    std::cout << " See source file: TEcnaParHistos::BuildStandard1DHistoCodeY(...)." << std::endl;
    std::cout << "*----------------------------------------------------------------" << std::endl;
  }

  if (TypeOfCode == "1DHistoCodeXY") {
    std::cout << "*------------------ Standard 1D histo codes for X or Y coordinate;" << std::endl;
    std::cout << "    NOE  (number of events) " << std::endl;
    std::cout << "    Ped  (pedestal) " << std::endl;
    std::cout << "    TNo  (total noise) " << std::endl;
    std::cout << "    LFN  (low frequency noise) " << std::endl;
    std::cout << "    HFN  (high frequency noise) " << std::endl;
    std::cout << "    MCs  (mean correlation between samples) " << std::endl;
    std::cout << "    SCs  (sigma of correlations between samples) " << std::endl;
    std::cout << "    MSp  (sample mean) " << std::endl;
    std::cout << "    SSp  (sample sigma) " << std::endl;
    std::cout << "    Time (time, date) " << std::endl;
    std::cout << "    Adc  (ADC sample value) " << std::endl;
    std::cout << " Other codes are available" << std::endl;
    std::cout << " See source file: TEcnaParHistos::BuildStandard1DHistoCodeXY(...)." << std::endl;
    std::cout << "*-----------------------------------------------------------------" << std::endl;
  }

  if (TypeOfCode == "CovOrCorCode") {
    std::cout << "*-------- Standard codes for matrix type (correlation or covariance);" << std::endl;
    std::cout << "    Cor  (correlation) " << std::endl;
    std::cout << "    cov  (covariance) " << std::endl;
    std::cout << " Other codes are available" << std::endl;
    std::cout << " See source file: TEcnaParHistos::BuildStandardCovOrCorCode(...)." << std::endl;
    std::cout << "*--------------------------------------------------------------------" << std::endl;
  }

  if (TypeOfCode == "BetweenWhatCode") {
    std::cout << "*-------- Standard codes for quantities in correlation or covariance;" << std::endl;
    std::cout << "    Mss    (between samples) " << std::endl;
    std::cout << "    MccLF  (low  frequency between channels) " << std::endl;
    std::cout << "    MccHF  (high frequency between channels) " << std::endl;
    std::cout << "    MttLF  (low  frequency between towers [if EB] or SC [if EE]) " << std::endl;
    std::cout << "    MttLF  (high frequency between towers [if EB] or SC [if EE]) " << std::endl;
    std::cout << " Other codes are available" << std::endl;
    std::cout << " See source file: TEcnaParHistos::BuildStandardBetweenWhatCode(...)." << std::endl;
    std::cout << "*--------------------------------------------------------------------" << std::endl;
  }
}

//========================== GetTechHistoCode ==========================

TString TEcnaParHistos::GetTechHistoCode(const TString& StandardHistoCode) {
  TString TechHistoCode = "?";

  //.................... standard code -> technical code for ViewMatrix, ViewStex, ViewStas
  if (StandardHistoCode == "NOE") {
    TechHistoCode = "D_NOE_ChNb";
  }
  if (StandardHistoCode == "Ped") {
    TechHistoCode = "D_Ped_ChNb";
  }
  if (StandardHistoCode == "TNo") {
    TechHistoCode = "D_TNo_ChNb";
  }
  if (StandardHistoCode == "LFN") {
    TechHistoCode = "D_LFN_ChNb";
  }
  if (StandardHistoCode == "HFN") {
    TechHistoCode = "D_HFN_ChNb";
  }
  if (StandardHistoCode == "MCs") {
    TechHistoCode = "D_MCs_ChNb";
  }
  if (StandardHistoCode == "SCs") {
    TechHistoCode = "D_SCs_ChNb";
  }

  if (TechHistoCode == "?") {
    std::cout << "*TEcnaParHistos::GetTechHistoCode(...)> StandardHistoCode = " << StandardHistoCode
              << " : code not found " << fTTBELL << std::endl;
  }
  return TechHistoCode;
}
//.......................................................................................................
TString TEcnaParHistos::GetTechHistoCode(const TString& X_Quantity, const TString& Y_Quantity) {
  //........................... (X,Y) standard codes -> technical code
  TString TechHistoCode = "?";

  //........................... Matrix or Histo type
  if (X_Quantity == "XtalORStin" && Y_Quantity == "NOE") {
    TechHistoCode = "D_NOE_ChNb";
  }
  if (X_Quantity == "XtalORStin" && Y_Quantity == "Ped") {
    TechHistoCode = "D_Ped_ChNb";
  }
  if (X_Quantity == "XtalORStin" && Y_Quantity == "TNo") {
    TechHistoCode = "D_TNo_ChNb";
  }
  if (X_Quantity == "XtalORStin" && Y_Quantity == "LFN") {
    TechHistoCode = "D_LFN_ChNb";
  }
  if (X_Quantity == "XtalORStin" && Y_Quantity == "HFN") {
    TechHistoCode = "D_HFN_ChNb";
  }
  if (X_Quantity == "XtalORStin" && Y_Quantity == "MCs") {
    TechHistoCode = "D_MCs_ChNb";
  }
  if (X_Quantity == "XtalORStin" && Y_Quantity == "SCs") {
    TechHistoCode = "D_SCs_ChNb";
  }

  if (X_Quantity == "NOE" && Y_Quantity == "NOX") {
    TechHistoCode = "D_NOE_ChDs";
  }
  if (X_Quantity == "Ped" && Y_Quantity == "NOX") {
    TechHistoCode = "D_Ped_ChDs";
  }
  if (X_Quantity == "TNo" && Y_Quantity == "NOX") {
    TechHistoCode = "D_TNo_ChDs";
  }
  if (X_Quantity == "LFN" && Y_Quantity == "NOX") {
    TechHistoCode = "D_LFN_ChDs";
  }
  if (X_Quantity == "HFN" && Y_Quantity == "NOX") {
    TechHistoCode = "D_HFN_ChDs";
  }
  if (X_Quantity == "MCs" && Y_Quantity == "NOX") {
    TechHistoCode = "D_MCs_ChDs";
  }
  if (X_Quantity == "SCs" && Y_Quantity == "NOX") {
    TechHistoCode = "D_SCs_ChDs";
  }

  if (X_Quantity == "Smp" && Y_Quantity == "MSp") {
    TechHistoCode = "D_MSp_SpNb";
  }
  if (X_Quantity == "MSp" && Y_Quantity == "NOS") {
    TechHistoCode = "D_MSp_SpDs";
  }
  if (X_Quantity == "Smp" && Y_Quantity == "SSp") {
    TechHistoCode = "D_SSp_SpNb";
  }
  if (X_Quantity == "SSp" && Y_Quantity == "NOS") {
    TechHistoCode = "D_SSp_SpDs";
  }

  if (X_Quantity == "Evt" && Y_Quantity == "Adc") {
    TechHistoCode = "D_Adc_EvNb";
  }
  if (X_Quantity == "Adc" && Y_Quantity == "NOE") {
    TechHistoCode = "D_Adc_EvDs";
  }

  //................................ Histime type
  if (X_Quantity == "Time" && Y_Quantity == "Ped") {
    TechHistoCode = "H_Ped_Date";
  }
  if (X_Quantity == "Ped" && Y_Quantity == "NOR") {
    TechHistoCode = "H_Ped_RuDs";
  }

  if (X_Quantity == "Time" && Y_Quantity == "TNo") {
    TechHistoCode = "H_TNo_Date";
  }
  if (X_Quantity == "TNo" && Y_Quantity == "NOR") {
    TechHistoCode = "H_TNo_RuDs";
  }

  if (X_Quantity == "Time" && Y_Quantity == "LFN") {
    TechHistoCode = "H_LFN_Date";
  }
  if (X_Quantity == "LFN" && Y_Quantity == "NOR") {
    TechHistoCode = "H_LFN_RuDs";
  }

  if (X_Quantity == "Time" && Y_Quantity == "HFN") {
    TechHistoCode = "H_HFN_Date";
  }
  if (X_Quantity == "HFN" && Y_Quantity == "NOR") {
    TechHistoCode = "H_HFN_RuDs";
  }

  if (X_Quantity == "Time" && Y_Quantity == "MCs") {
    TechHistoCode = "H_MCs_Date";
  }
  if (X_Quantity == "MCs" && Y_Quantity == "NOR") {
    TechHistoCode = "H_MCs_RuDs";
  }

  if (X_Quantity == "Time" && Y_Quantity == "SCs") {
    TechHistoCode = "H_SCs_Date";
  }
  if (X_Quantity == "SCs" && Y_Quantity == "NOR") {
    TechHistoCode = "H_SCs_RuDs";
  }

  if (TechHistoCode == "?") {
    std::cout << "TEcnaParHistos::GetTechHistoCode(...)> HistoCode not found. X_Quantity = " << X_Quantity
              << ", Y_Quantity = " << Y_Quantity << std::endl;
  }
  return TechHistoCode;
}

TString TEcnaParHistos::GetCodeOnlyOnePlot() { return fOnlyOnePlot; }
TString TEcnaParHistos::GetCodeSeveralPlot() { return fSeveralPlot; }
TString TEcnaParHistos::GetCodeSameOnePlot() { return fSameOnePlot; }
TString TEcnaParHistos::GetCodeAllXtalsInStinPlot() { return fAllXtalsInStinPlot; }
Int_t TEcnaParHistos::GetCodePlotAllXtalsInStin() { return fPlotAllXtalsInStin; }

//================== End of TEcnaParHistos.cc ========================