55 #include "AliRawEventHeaderBase.h" 56 #include "AliRawReaderDate.h" 60 #include "Riostream.h" 67 #include "TObjString.h" 68 #include "TPluginManager.h" 70 #include "TStopwatch.h" 72 #include "TTimeStamp.h" 84 const std::vector<int>& timeResolutions,
85 const std::map<int,int>& busPatches)
91 assert(timeResolutions.size()>=1);
92 assert(busPatches.size()==888);
94 TH1* htest = hc.
Histo(Form(
"/BUSPATCH/HITS/%ds/BP%04d",timeResolutions[0],1));
98 TAxis* axis = htest->GetXaxis();
100 Int_t expansionTime(0);
102 if ( timeFromRef < axis->GetXmin() )
104 expansionTime = timeFromRef - axis->GetXmin();
107 if ( timeFromRef > axis->GetXmax() )
109 expansionTime = timeFromRef - axis->GetXmax();
112 if ( TMath::Abs(expansionTime) < timeResolutions[0] )
118 if ( TMath::Abs(expansionTime) > 12*3600 )
120 std::cout <<
DAVERSION <<
" ERROR : Time range expansion bigger than 12 hours. Not doing it." << std::endl;
124 Int_t currentDuration = TMath::Nint(axis->GetXmax()-axis->GetXmin());
126 std::cout << Form(
"%s INFO : I will expand my time range by %10d s (current duration %10d s, new one %10d s)",
127 DAVERSION,expansionTime,currentDuration,currentDuration+TMath::Abs(expansionTime))<< std::endl;
131 for ( std::vector<int>::size_type itr = 0; itr < timeResolutions.size(); ++itr )
133 int timeReso = timeResolutions[itr];
135 std::map<int,int>::const_iterator it;
137 for ( it = busPatches.begin(); it != busPatches.end(); ++it )
139 int busPatchId = it->first;
143 path.Form(
"/BUSPATCH/HITS/%ds/BP%04d",timeReso,busPatchId);
145 TH1* h = hc.
Histo(path.Data());
158 if ( expansionTime < 0 )
162 htest = hc.
Histo(Form(
"/BUSPATCH/HITS/%ds/BP%04d",timeResolutions[0],1));
166 std::cout <<
DAVERSION <<
" INFO : New refTime = " << origin.AsString() << std::endl;
186 buspatches[1236]=992;
188 buspatches[1237]=1184;
236 buspatches[1238]=1024;
237 buspatches[1239]=576;
238 buspatches[1240]=992;
239 buspatches[1241]=1184;
240 buspatches[1242]=512;
241 buspatches[1243]=720;
242 buspatches[1244]=912;
243 buspatches[1245]=480;
244 buspatches[1246]=608;
245 buspatches[1301]=480;
246 buspatches[1303]=720;
247 buspatches[1302]=608;
248 buspatches[1305]=576;
249 buspatches[1304]=912;
250 buspatches[1306]=992;
251 buspatches[1307]=1184;
252 buspatches[1309]=1152;
253 buspatches[1308]=512;
254 buspatches[1310]=992;
255 buspatches[1311]=1184;
256 buspatches[1313]=2176;
257 buspatches[1312]=1024;
258 buspatches[1314]=1264;
259 buspatches[1315]=1456;
260 buspatches[1317]=1664;
261 buspatches[1316]=2176;
262 buspatches[1318]=1184;
263 buspatches[1319]=992;
264 buspatches[1320]=2304;
265 buspatches[1321]=832;
266 buspatches[1322]=1664;
267 buspatches[1323]=992;
268 buspatches[1324]=1184;
269 buspatches[1325]=1600;
270 buspatches[1326]=1664;
271 buspatches[1327]=1184;
272 buspatches[1328]=992;
273 buspatches[1329]=2304;
274 buspatches[1331]=2176;
275 buspatches[1330]=832;
276 buspatches[1332]=1264;
277 buspatches[1333]=1456;
278 buspatches[1335]=1152;
279 buspatches[1334]=2176;
280 buspatches[1336]=992;
281 buspatches[101]=1272;
282 buspatches[1339]=576;
283 buspatches[102]=1336;
284 buspatches[103]=1528;
285 buspatches[104]=1656;
286 buspatches[105]=1592;
287 buspatches[106]=1528;
288 buspatches[107]=1528;
289 buspatches[108]=1152;
293 buspatches[113]=1280;
295 buspatches[114]=1344;
296 buspatches[115]=1536;
297 buspatches[116]=1664;
298 buspatches[117]=1664;
299 buspatches[118]=1536;
300 buspatches[119]=1536;
301 buspatches[120]=1152;
306 buspatches[125]=1272;
307 buspatches[126]=1336;
308 buspatches[127]=1528;
309 buspatches[128]=1656;
310 buspatches[129]=1592;
311 buspatches[130]=1528;
312 buspatches[131]=1528;
313 buspatches[132]=1152;
317 buspatches[137]=1280;
319 buspatches[138]=1344;
320 buspatches[139]=1536;
321 buspatches[140]=1664;
322 buspatches[141]=1664;
323 buspatches[142]=1536;
324 buspatches[143]=1536;
325 buspatches[144]=1152;
330 buspatches[1345]=480;
331 buspatches[1346]=608;
332 buspatches[1343]=720;
333 buspatches[1344]=912;
334 buspatches[1340]=992;
335 buspatches[1341]=1184;
336 buspatches[1342]=512;
337 buspatches[1337]=1184;
338 buspatches[1338]=1024;
339 buspatches[1401]=480;
340 buspatches[1402]=608;
341 buspatches[1403]=720;
342 buspatches[1404]=912;
343 buspatches[1405]=576;
344 buspatches[1406]=992;
345 buspatches[1407]=1184;
346 buspatches[1408]=512;
347 buspatches[1409]=1152;
348 buspatches[1410]=992;
349 buspatches[1411]=1184;
350 buspatches[1412]=1024;
351 buspatches[1413]=2176;
352 buspatches[1414]=1264;
353 buspatches[1415]=1456;
354 buspatches[1416]=2176;
355 buspatches[1417]=1664;
356 buspatches[1418]=1184;
357 buspatches[1419]=992;
358 buspatches[1420]=2304;
359 buspatches[1421]=832;
360 buspatches[1422]=1664;
361 buspatches[1423]=992;
362 buspatches[1424]=1184;
363 buspatches[1425]=1600;
364 buspatches[1426]=1664;
365 buspatches[1427]=1184;
366 buspatches[1428]=992;
367 buspatches[1429]=2304;
368 buspatches[1430]=832;
369 buspatches[1431]=2176;
370 buspatches[1432]=1264;
371 buspatches[1433]=1456;
372 buspatches[1434]=2176;
373 buspatches[1435]=1152;
374 buspatches[1436]=992;
375 buspatches[201]=1272;
376 buspatches[1437]=1184;
377 buspatches[202]=1336;
378 buspatches[203]=1528;
379 buspatches[204]=1656;
380 buspatches[205]=1592;
381 buspatches[206]=1528;
382 buspatches[207]=1528;
383 buspatches[208]=1152;
387 buspatches[213]=1280;
389 buspatches[214]=1344;
390 buspatches[215]=1536;
391 buspatches[216]=1664;
392 buspatches[217]=1664;
393 buspatches[218]=1536;
394 buspatches[219]=1536;
395 buspatches[220]=1152;
400 buspatches[225]=1272;
401 buspatches[226]=1336;
402 buspatches[227]=1528;
403 buspatches[228]=1656;
404 buspatches[229]=1592;
405 buspatches[230]=1528;
406 buspatches[231]=1528;
407 buspatches[232]=1152;
411 buspatches[237]=1280;
413 buspatches[238]=1344;
414 buspatches[239]=1536;
415 buspatches[240]=1664;
416 buspatches[241]=1664;
417 buspatches[242]=1536;
418 buspatches[243]=1536;
419 buspatches[244]=1152;
424 buspatches[1438]=1024;
425 buspatches[1439]=576;
426 buspatches[1440]=992;
427 buspatches[1441]=1184;
428 buspatches[1442]=512;
429 buspatches[1443]=720;
430 buspatches[1444]=912;
431 buspatches[1445]=480;
432 buspatches[1446]=608;
433 buspatches[1501]=480;
434 buspatches[1503]=720;
435 buspatches[1502]=608;
436 buspatches[1505]=576;
437 buspatches[1504]=912;
438 buspatches[1506]=992;
439 buspatches[1507]=1184;
440 buspatches[1509]=1152;
441 buspatches[1508]=512;
442 buspatches[1510]=992;
443 buspatches[1511]=1184;
444 buspatches[1513]=2176;
445 buspatches[1512]=1024;
446 buspatches[1514]=1264;
447 buspatches[1515]=1456;
448 buspatches[1517]=1664;
449 buspatches[1516]=2176;
450 buspatches[1518]=1184;
451 buspatches[1519]=992;
452 buspatches[1520]=2304;
453 buspatches[1521]=832;
454 buspatches[1522]=1664;
455 buspatches[1523]=992;
456 buspatches[1524]=1184;
457 buspatches[1525]=1600;
458 buspatches[1526]=1664;
459 buspatches[1527]=1184;
460 buspatches[1528]=992;
461 buspatches[1529]=2304;
462 buspatches[1531]=2176;
463 buspatches[1530]=832;
464 buspatches[1532]=1264;
465 buspatches[1533]=1456;
466 buspatches[1535]=1152;
467 buspatches[1534]=2176;
468 buspatches[1536]=992;
469 buspatches[301]=1272;
470 buspatches[1539]=576;
471 buspatches[302]=1336;
472 buspatches[303]=1528;
473 buspatches[304]=1656;
474 buspatches[305]=1592;
475 buspatches[306]=1528;
476 buspatches[307]=1528;
477 buspatches[308]=1152;
481 buspatches[313]=1280;
483 buspatches[314]=1344;
484 buspatches[315]=1536;
485 buspatches[316]=1664;
486 buspatches[317]=1664;
487 buspatches[318]=1536;
488 buspatches[319]=1536;
489 buspatches[320]=1152;
494 buspatches[325]=1272;
495 buspatches[326]=1336;
496 buspatches[327]=1528;
497 buspatches[328]=1656;
498 buspatches[329]=1592;
499 buspatches[330]=1528;
500 buspatches[331]=1528;
501 buspatches[332]=1152;
505 buspatches[337]=1280;
507 buspatches[338]=1344;
508 buspatches[339]=1536;
509 buspatches[340]=1664;
510 buspatches[341]=1664;
511 buspatches[342]=1536;
512 buspatches[343]=1536;
513 buspatches[344]=1152;
518 buspatches[1545]=480;
519 buspatches[1546]=608;
520 buspatches[1543]=720;
521 buspatches[1544]=912;
522 buspatches[1540]=992;
523 buspatches[1541]=1184;
524 buspatches[1542]=512;
525 buspatches[1537]=1184;
526 buspatches[1538]=1024;
527 buspatches[1601]=720;
528 buspatches[1602]=912;
529 buspatches[1603]=304;
530 buspatches[1604]=720;
531 buspatches[1605]=912;
532 buspatches[1606]=240;
533 buspatches[1607]=1152;
534 buspatches[1608]=720;
535 buspatches[1609]=912;
536 buspatches[1610]=1024;
537 buspatches[1611]=1728;
538 buspatches[1612]=720;
539 buspatches[1613]=912;
540 buspatches[1614]=1536;
541 buspatches[1615]=2752;
542 buspatches[1616]=992;
543 buspatches[1617]=1184;
544 buspatches[1618]=2688;
545 buspatches[1619]=1664;
546 buspatches[1620]=1184;
547 buspatches[1621]=992;
548 buspatches[1622]=2304;
549 buspatches[1623]=832;
550 buspatches[1624]=1664;
551 buspatches[1625]=992;
552 buspatches[1626]=1184;
553 buspatches[1627]=1600;
554 buspatches[1628]=1664;
555 buspatches[1629]=1184;
556 buspatches[1630]=992;
557 buspatches[1631]=2304;
558 buspatches[1632]=832;
559 buspatches[1633]=2752;
560 buspatches[1634]=992;
561 buspatches[1635]=1184;
562 buspatches[1636]=2688;
563 buspatches[401]=1196;
564 buspatches[1637]=1728;
565 buspatches[402]=1260;
566 buspatches[403]=1446;
567 buspatches[404]=1594;
568 buspatches[405]=1472;
569 buspatches[406]=1404;
570 buspatches[407]=1275;
574 buspatches[411]=1145;
575 buspatches[413]=1200;
577 buspatches[414]=1264;
578 buspatches[415]=1450;
579 buspatches[416]=1594;
580 buspatches[417]=1472;
581 buspatches[418]=1408;
582 buspatches[419]=1265;
586 buspatches[423]=1247;
588 buspatches[425]=1196;
589 buspatches[426]=1260;
590 buspatches[427]=1446;
591 buspatches[428]=1594;
592 buspatches[429]=1472;
593 buspatches[430]=1404;
594 buspatches[431]=1275;
598 buspatches[435]=1145;
599 buspatches[437]=1200;
601 buspatches[438]=1264;
602 buspatches[439]=1450;
603 buspatches[440]=1594;
604 buspatches[441]=1472;
605 buspatches[442]=1408;
606 buspatches[443]=1265;
610 buspatches[447]=1247;
612 buspatches[1638]=720;
613 buspatches[1639]=912;
614 buspatches[1640]=1536;
615 buspatches[1641]=1152;
616 buspatches[1642]=720;
617 buspatches[1643]=912;
618 buspatches[1644]=1024;
619 buspatches[1645]=304;
620 buspatches[1646]=720;
621 buspatches[1647]=912;
622 buspatches[1648]=240;
623 buspatches[1649]=720;
624 buspatches[1650]=912;
625 buspatches[1701]=720;
626 buspatches[1703]=304;
627 buspatches[1702]=912;
628 buspatches[1704]=720;
629 buspatches[1705]=912;
630 buspatches[1707]=1152;
631 buspatches[1706]=240;
632 buspatches[1708]=720;
633 buspatches[1709]=912;
634 buspatches[1711]=1728;
635 buspatches[1710]=1024;
636 buspatches[1712]=720;
637 buspatches[1713]=912;
638 buspatches[1715]=2752;
639 buspatches[1714]=1536;
640 buspatches[1716]=992;
641 buspatches[1717]=1184;
642 buspatches[1719]=1664;
643 buspatches[1718]=2688;
644 buspatches[1720]=1184;
645 buspatches[1721]=992;
646 buspatches[1722]=2304;
647 buspatches[1723]=832;
648 buspatches[1724]=1664;
649 buspatches[1725]=992;
650 buspatches[1726]=1184;
651 buspatches[1727]=1600;
652 buspatches[1728]=1664;
653 buspatches[1729]=1184;
654 buspatches[1730]=992;
655 buspatches[1731]=2304;
656 buspatches[1733]=2752;
657 buspatches[1732]=832;
658 buspatches[1734]=992;
659 buspatches[1735]=1184;
660 buspatches[1737]=1728;
661 buspatches[501]=1196;
662 buspatches[1738]=720;
663 buspatches[502]=1260;
664 buspatches[503]=1446;
665 buspatches[504]=1594;
666 buspatches[505]=1472;
667 buspatches[506]=1404;
668 buspatches[507]=1275;
672 buspatches[511]=1145;
673 buspatches[513]=1200;
675 buspatches[514]=1264;
676 buspatches[515]=1450;
677 buspatches[516]=1594;
678 buspatches[517]=1472;
679 buspatches[518]=1408;
680 buspatches[519]=1265;
684 buspatches[523]=1247;
686 buspatches[525]=1196;
687 buspatches[526]=1260;
688 buspatches[527]=1446;
689 buspatches[528]=1594;
690 buspatches[529]=1472;
691 buspatches[530]=1404;
692 buspatches[531]=1275;
696 buspatches[535]=1145;
697 buspatches[537]=1200;
699 buspatches[538]=1264;
700 buspatches[539]=1450;
701 buspatches[540]=1594;
702 buspatches[541]=1472;
703 buspatches[542]=1408;
704 buspatches[543]=1265;
708 buspatches[547]=1247;
710 buspatches[1749]=720;
711 buspatches[1750]=912;
712 buspatches[1745]=304;
713 buspatches[1746]=720;
714 buspatches[1747]=912;
715 buspatches[1748]=240;
716 buspatches[1741]=1152;
717 buspatches[1742]=720;
718 buspatches[1743]=912;
719 buspatches[1744]=1024;
720 buspatches[1739]=912;
721 buspatches[1740]=1536;
722 buspatches[1736]=2688;
723 buspatches[1801]=720;
724 buspatches[1802]=912;
725 buspatches[1803]=304;
726 buspatches[1804]=720;
727 buspatches[1805]=912;
728 buspatches[1806]=240;
729 buspatches[1807]=1152;
730 buspatches[1808]=720;
731 buspatches[1809]=912;
732 buspatches[1810]=1024;
733 buspatches[1811]=1728;
734 buspatches[1812]=720;
735 buspatches[1813]=912;
736 buspatches[1814]=1536;
737 buspatches[1815]=2752;
738 buspatches[1816]=992;
739 buspatches[1817]=1184;
740 buspatches[1818]=2688;
741 buspatches[1819]=1664;
742 buspatches[1820]=1184;
743 buspatches[1821]=992;
744 buspatches[1822]=2304;
745 buspatches[1823]=832;
746 buspatches[1824]=1664;
747 buspatches[1825]=992;
748 buspatches[1826]=1184;
749 buspatches[1827]=1600;
750 buspatches[1828]=1664;
751 buspatches[1829]=1184;
752 buspatches[1830]=992;
753 buspatches[1831]=2304;
754 buspatches[1832]=832;
755 buspatches[1833]=2752;
756 buspatches[1834]=992;
757 buspatches[1835]=1184;
758 buspatches[1836]=2688;
759 buspatches[601]=1196;
760 buspatches[1837]=1728;
761 buspatches[602]=1260;
762 buspatches[603]=1446;
763 buspatches[604]=1594;
764 buspatches[605]=1472;
765 buspatches[606]=1404;
766 buspatches[607]=1275;
770 buspatches[611]=1145;
771 buspatches[613]=1200;
773 buspatches[614]=1264;
774 buspatches[615]=1450;
775 buspatches[616]=1594;
776 buspatches[617]=1472;
777 buspatches[618]=1408;
778 buspatches[619]=1265;
782 buspatches[623]=1247;
784 buspatches[625]=1196;
785 buspatches[626]=1260;
786 buspatches[627]=1446;
787 buspatches[628]=1594;
788 buspatches[629]=1472;
789 buspatches[630]=1404;
790 buspatches[631]=1275;
794 buspatches[635]=1145;
795 buspatches[637]=1200;
797 buspatches[638]=1264;
798 buspatches[639]=1450;
799 buspatches[640]=1594;
800 buspatches[641]=1472;
801 buspatches[642]=1408;
802 buspatches[643]=1265;
806 buspatches[647]=1247;
808 buspatches[1838]=720;
809 buspatches[1839]=912;
810 buspatches[1840]=1536;
811 buspatches[1841]=1152;
812 buspatches[1842]=720;
813 buspatches[1843]=912;
814 buspatches[1844]=1024;
815 buspatches[1845]=304;
816 buspatches[1846]=720;
817 buspatches[1847]=912;
818 buspatches[1848]=240;
819 buspatches[1849]=720;
820 buspatches[1850]=912;
821 buspatches[1901]=720;
822 buspatches[1903]=304;
823 buspatches[1902]=912;
824 buspatches[1904]=720;
825 buspatches[1905]=912;
826 buspatches[1907]=1152;
827 buspatches[1906]=240;
828 buspatches[1908]=720;
829 buspatches[1909]=912;
830 buspatches[1911]=1728;
831 buspatches[1910]=1024;
832 buspatches[1912]=720;
833 buspatches[1913]=912;
834 buspatches[1915]=2752;
835 buspatches[1914]=1536;
836 buspatches[1916]=992;
837 buspatches[1917]=1184;
838 buspatches[1919]=1664;
839 buspatches[1918]=2688;
840 buspatches[1920]=1184;
841 buspatches[1921]=992;
842 buspatches[1922]=2304;
843 buspatches[1923]=832;
844 buspatches[1924]=1664;
845 buspatches[1925]=992;
846 buspatches[1926]=1184;
847 buspatches[1927]=1600;
848 buspatches[1928]=1664;
849 buspatches[1929]=1184;
850 buspatches[1930]=992;
851 buspatches[1931]=2304;
852 buspatches[1933]=2752;
853 buspatches[1932]=832;
854 buspatches[1934]=992;
855 buspatches[1935]=1184;
856 buspatches[1937]=1728;
857 buspatches[701]=1196;
858 buspatches[1938]=720;
859 buspatches[702]=1260;
860 buspatches[703]=1446;
861 buspatches[704]=1594;
862 buspatches[705]=1472;
863 buspatches[706]=1404;
864 buspatches[707]=1275;
868 buspatches[711]=1145;
869 buspatches[713]=1200;
871 buspatches[714]=1264;
872 buspatches[715]=1450;
873 buspatches[716]=1594;
874 buspatches[717]=1472;
875 buspatches[718]=1408;
876 buspatches[719]=1265;
880 buspatches[723]=1247;
882 buspatches[725]=1196;
883 buspatches[726]=1260;
884 buspatches[727]=1446;
885 buspatches[728]=1594;
886 buspatches[729]=1472;
887 buspatches[730]=1404;
888 buspatches[731]=1275;
892 buspatches[735]=1145;
893 buspatches[737]=1200;
895 buspatches[738]=1264;
896 buspatches[739]=1450;
897 buspatches[740]=1594;
898 buspatches[741]=1472;
899 buspatches[742]=1408;
900 buspatches[743]=1265;
904 buspatches[747]=1247;
906 buspatches[1949]=720;
907 buspatches[1950]=912;
908 buspatches[1945]=304;
909 buspatches[1946]=720;
910 buspatches[1947]=912;
911 buspatches[1948]=240;
912 buspatches[1941]=1152;
913 buspatches[1942]=720;
914 buspatches[1943]=912;
915 buspatches[1944]=1024;
916 buspatches[1939]=912;
917 buspatches[1940]=1536;
918 buspatches[1936]=2688;
919 buspatches[801]=1024;
920 buspatches[802]=1152;
921 buspatches[803]=1536;
922 buspatches[804]=1728;
923 buspatches[805]=1088;
924 buspatches[806]=1472;
925 buspatches[807]=1648;
926 buspatches[808]=1088;
928 buspatches[810]=2160;
929 buspatches[811]=2048;
932 buspatches[814]=1408;
934 buspatches[816]=1072;
935 buspatches[817]=1536;
936 buspatches[818]=1024;
937 buspatches[819]=1152;
938 buspatches[820]=1536;
939 buspatches[821]=1728;
940 buspatches[822]=1088;
941 buspatches[823]=1536;
942 buspatches[824]=1728;
943 buspatches[825]=1088;
945 buspatches[827]=2240;
946 buspatches[828]=2112;
949 buspatches[901]=1024;
950 buspatches[903]=1536;
951 buspatches[902]=1152;
952 buspatches[905]=1088;
953 buspatches[904]=1728;
954 buspatches[906]=1472;
955 buspatches[907]=1648;
957 buspatches[908]=1088;
958 buspatches[910]=2160;
959 buspatches[911]=2048;
962 buspatches[914]=1024;
963 buspatches[915]=1152;
964 buspatches[916]=1536;
965 buspatches[917]=1728;
966 buspatches[918]=1088;
967 buspatches[919]=1536;
968 buspatches[920]=1728;
969 buspatches[921]=1088;
971 buspatches[923]=2240;
972 buspatches[924]=2112;
974 buspatches[927]=1408;
976 buspatches[928]=1024;
977 buspatches[929]=1152;
978 buspatches[930]=1536;
979 buspatches[1001]=448;
980 buspatches[1002]=2160;
981 buspatches[1003]=2048;
982 buspatches[1004]=576;
983 buspatches[1005]=832;
984 buspatches[1006]=1088;
985 buspatches[1007]=1472;
986 buspatches[1008]=1648;
987 buspatches[1009]=1088;
988 buspatches[1010]=1536;
989 buspatches[1011]=1728;
990 buspatches[1012]=1024;
991 buspatches[1013]=1152;
992 buspatches[1014]=1408;
993 buspatches[1015]=1024;
994 buspatches[1016]=1152;
995 buspatches[1017]=1536;
996 buspatches[1018]=448;
997 buspatches[1019]=2240;
998 buspatches[1020]=2112;
999 buspatches[1021]=576;
1000 buspatches[1022]=832;
1001 buspatches[1023]=1088;
1002 buspatches[1024]=1536;
1003 buspatches[1025]=1728;
1004 buspatches[1026]=1088;
1005 buspatches[1027]=1536;
1006 buspatches[1028]=1728;
1007 buspatches[1029]=1024;
1008 buspatches[1030]=1152;
1009 buspatches[1101]=1408;
1010 buspatches[1102]=960;
1011 buspatches[1103]=1072;
1012 buspatches[1104]=1536;
1013 buspatches[1105]=448;
1014 buspatches[1106]=2160;
1015 buspatches[1107]=2048;
1016 buspatches[1108]=576;
1017 buspatches[1109]=832;
1018 buspatches[1110]=1088;
1019 buspatches[1111]=1472;
1020 buspatches[1112]=1648;
1021 buspatches[1113]=1088;
1022 buspatches[1114]=1536;
1023 buspatches[1115]=1728;
1024 buspatches[1116]=1024;
1025 buspatches[1117]=1152;
1026 buspatches[1118]=448;
1027 buspatches[1119]=2240;
1028 buspatches[1120]=2112;
1029 buspatches[1121]=576;
1030 buspatches[1123]=1088;
1031 buspatches[1122]=832;
1032 buspatches[1124]=1536;
1033 buspatches[1125]=1728;
1034 buspatches[1127]=1536;
1035 buspatches[1126]=1088;
1036 buspatches[1129]=1024;
1037 buspatches[1128]=1728;
1038 buspatches[1130]=1152;
1039 buspatches[1201]=480;
1040 buspatches[1202]=608;
1041 buspatches[1203]=720;
1042 buspatches[1204]=912;
1043 buspatches[1205]=576;
1044 buspatches[1206]=992;
1045 buspatches[1207]=1184;
1046 buspatches[1208]=512;
1047 buspatches[1209]=1152;
1048 buspatches[1210]=992;
1049 buspatches[1211]=1184;
1050 buspatches[1212]=1024;
1051 buspatches[1213]=2176;
1052 buspatches[1214]=1264;
1053 buspatches[1215]=1456;
1054 buspatches[1216]=2176;
1055 buspatches[1217]=1664;
1056 buspatches[1218]=1184;
1057 buspatches[1219]=992;
1058 buspatches[1220]=2304;
1059 buspatches[1221]=832;
1060 buspatches[1222]=1664;
1061 buspatches[1223]=992;
1062 buspatches[1224]=1184;
1063 buspatches[1225]=1600;
1064 buspatches[1226]=1664;
1065 buspatches[1227]=1184;
1066 buspatches[1228]=992;
1067 buspatches[1229]=2304;
1068 buspatches[1230]=832;
1069 buspatches[1231]=2176;
1070 buspatches[1232]=1264;
1071 buspatches[1233]=1456;
1072 buspatches[1234]=2176;
1073 buspatches[1235]=1152;
1082 assert(buspatches.size()==888);
1084 TTimeStamp origin(static_cast<time_t>(timeOrigin),0);
1086 std::cout <<
DAVERSION <<
" INFO : Using refTime = " << origin.AsString() << std::endl;
1089 Double_t xmax = xmin + maxDuration*1.0;
1091 int nbins = TMath::Nint((xmax-xmin)/timeResolution);
1095 std::map<int,int>::const_iterator it;
1097 for ( it = buspatches.begin(); it != buspatches.end(); ++it)
1099 int busPatchId = it->first;
1100 int nofPads = it->second;
1102 TH1* h =
new TH1F(Form(
"BP%04d",busPatchId),Form(
"Number of hits in %d s bins",timeResolution),nbins,xmin,xmax);
1104 h->GetXaxis()->SetTimeDisplay(1);
1105 h->GetXaxis()->SetTimeFormat(
"%d/%m/%y %H:%M");
1106 h->GetXaxis()->SetTimeOffset(timeOrigin,
"gmt");
1107 hc.
Adopt(Form(
"/BUSPATCH/HITS/%ds",timeResolution),h);
1112 TH1* h =
new TH1F(Form(
"Nevents%ds",timeResolution),Form(
"Number of events %d s bins",timeResolution),nbins,xmin,xmax);
1114 h->GetXaxis()->SetTimeDisplay(1);
1115 h->GetXaxis()->SetTimeFormat(
"%d/%m/%y %H:%M");
1116 h->GetXaxis()->SetTimeOffset(timeOrigin,
"gmt");
1123 const std::map<int,int>& buspatches,
1126 float occupancyThreshold)
1135 std::map<int,double> faultyBP;
1137 Bool_t ok = bpevo.
GetFaultyBusPatches(timeResolution,requiredEvents,occupancyThreshold,faultyBP);
1141 std::map<int,double>::const_iterator it;
1143 if ( faultyBP.empty() )
return;
1145 std::cout << Form(
"%s WARNING : %3d bus patches above occupancy threshold (of %7.2f %%) : ",
DAVERSION,(
int)faultyBP.size(),occupancyThreshold*100.0);
1147 for ( it = faultyBP.begin(); it != faultyBP.end(); ++it )
1149 int busPatchId = it->first;
1150 std::cout << Form(
"%4d ",busPatchId);
1153 std::cout << std::endl;
1154 std::cout << Form(
"%s INFO : Faulty bus patches occupancies : ",
DAVERSION);
1157 for ( it = faultyBP.begin(); it != faultyBP.end(); ++it )
1159 int busPatchId = it->first;
1160 double busPatchOccupancy = it->second;
1161 std::cout << Form(
"%4d (%7.2f %%) ",busPatchId,busPatchOccupancy*100.0);
1164 std::cout << std::endl;
1172 signal(SIGSEGV,SIG_DFL);
1175 timers.Start(kTRUE);
1177 ios::sync_with_stdio();
1179 std::cout <<
"Running " <<
DAVERSION << std::endl;
1183 std::cout <<
"Wrong number of arguments" << std::endl;
1184 std::cout <<
"Usage : " << argv[0] <<
" datasource" << std::endl;
1188 TString dataSource=argv[1];
1194 gROOT->GetPluginManager()->AddHandler(
"TVirtualStreamerInfo",
1200 Int_t numberOfEvents(0);
1201 Int_t numberOfPhysicsEvent(0);
1202 Int_t numberOfBadEvents(0);
1203 Int_t numberOfUsedEvents(0);
1204 Int_t numberOfIncompleteEvents(0);
1205 Int_t numberOfFlushedEvents(0);
1206 Int_t numberOfEventsWithMCH(0);
1207 Int_t numberOfEventsSinceLastDecision(0);
1211 std::vector<int> timeResolutions;
1212 std::map<int,int> busPatches;
1214 int nofEventsRequiredForDecision;
1215 float occupancyThreshold;
1222 <<
" from DAQ detector database. Will use (hopefully sensible) defaults" << std::endl;
1237 TString tr = env.GetValue(
"timeResolutions",
"");
1241 while ( ( s = static_cast<TObjString*>(next())))
1243 if (s->String().Atoi())
1245 timeResolutions.push_back(s->String().Atoi());
1250 if ( timeResolutions.size() == 0 )
1252 std::cout <<
DAVERSION <<
" WARNING : Configuration file " <<
CONFIG_FILE <<
" contains an incorrect timeResolutions setting. " 1260 TString sbp = env.GetValue(
"bp",
"");
1267 while ( ( s = static_cast<TObjString*>(nextBP())))
1269 TString bpinfo = s->String();
1270 int ix = bpinfo.Index(
':');
1271 if (ix<=0)
continue;
1272 int bpid = TString(bpinfo(0,ix)).Atoi();
1273 int npads = TString(bpinfo(ix+1,bpinfo.Length()-ix)).Atoi();
1275 busPatches[bpid]=npads;
1280 if (busPatches.size() != 888)
1282 std::cout <<
DAVERSION <<
" ERROR : Configuration file is incorrect : wrong number of bus patches : " 1283 <<
" got " << busPatches.size() <<
" but expected 888. Cannot work like that." << std::endl;
1287 if (busPatches.size() > 0 && total != 1064008)
1289 std::cout <<
DAVERSION <<
" ERROR : Configuration file is incorrect : wrong total number of pads ! Got " << total
1290 <<
" but expected 1064008. Cannot work like that." << std::endl;
1294 if ( busPatches.size() == 0 )
1296 std::cout <<
DAVERSION <<
" WARNING : Configuration file " <<
CONFIG_FILE <<
" does not contain the list of buspath ids (and their " 1297 " corresponding number of pads). Using default values instead" 1304 std::sort(timeResolutions.begin(),timeResolutions.end());
1308 AliRawReaderDate* rawReader(0x0);
1311 status=monitorSetDataSource(dataSource.Data());
1314 std::cout <<
DAVERSION <<
" ERROR : monitorSetDataSource() failed: " << monitorDecodeError(status) << endl;
1319 status=monitorDeclareMp(
"MUON_TRK_BPEVO");
1322 std::cout <<
DAVERSION <<
" ERROR : monitorDeclareMp() failed: " << monitorDecodeError(status) << endl;
1328 monitorSetNoWaitNetworkTimeout(1000);
1334 struct eventHeaderStruct *event(0x0);
1335 eventTypeType eventT;
1337 status=monitorGetEventDynamic((
void **)&event);
1340 std::cout <<
DAVERSION <<
" ERROR : " << monitorDecodeError(status) << std::endl;
1346 if (daqDA_checkShutdown())
1348 std::cout <<
DAVERSION <<
" WARNING : I am requested to stop, so I will stop..." << std::endl;
1354 if (event==NULL)
continue;
1358 eventT=
event->eventType;
1360 if ((eventT == END_OF_RUN)||(eventT == END_OF_RUN_FILES))
1366 if (eventT != PHYSICS_EVENT)
1372 if( TEST_SYSTEM_ATTRIBUTE(event->eventTypeAttribute, ATTR_INCOMPLETE_EVENT))
1375 ++numberOfIncompleteEvents;
1379 if( TEST_SYSTEM_ATTRIBUTE(event->eventTypeAttribute, ATTR_FLUSHED_EVENT))
1382 ++numberOfFlushedEvents;
1386 ++numberOfPhysicsEvent;
1388 rawReader =
new AliRawReaderDate((
void*)event);
1390 if ( rawReader->GetRunNumber() !=
runNumber )
1392 if ( runNumber != 0 )
1394 std::cout <<
DAVERSION <<
" ERROR : Uh oh. That's bad... Changing of run number ???" << std::endl;
1400 runNumber = rawReader->GetRunNumber();
1410 Bool_t mchThere(kFALSE);
1415 rawReader->Select(
"MUONTRK",iDDL,iDDL);
1416 if (rawReader->ReadHeader() )
1418 if (rawReader->GetEquipmentSize() ) mchThere = kTRUE;
1424 ++numberOfEventsWithMCH;
1444 UChar_t manuChannel;
1447 std::map<int,int> bpValues;
1449 while ( stream.
Next(buspatchId,manuId,manuChannel,adc,kTRUE) )
1451 bpValues[buspatchId]++;
1454 if ( bpValues.empty() )
1456 static int emptyevent(0);
1460 std::cout <<
DAVERSION <<
" WARNING : Empty event" << emptyevent << std::endl;
1473 refTime = rawReader->GetTimestamp();
1475 for ( std::vector<int>::size_type is = 0; is < timeResolutions.size(); ++is )
1477 FillCollection(*hc, refTime,maxDuration,timeResolutions[is],busPatches);
1483 nofRealloc +=
AssertHistogramsRange(*hc,rawReader->GetTimestamp()-refTime,timeResolutions,busPatches);
1486 ++numberOfUsedEvents;
1488 ++numberOfEventsSinceLastDecision;
1490 if ( numberOfEventsSinceLastDecision > nofEventsRequiredForDecision )
1492 ReportFaultyBusPatches(*hc,busPatches,timeResolutions[timeResolutions.size()-1],nofEventsRequiredForDecision,occupancyThreshold);
1493 numberOfEventsSinceLastDecision=0;
1496 for ( std::map<int,int>::const_iterator it = bpValues.begin(); it != bpValues.end(); ++it )
1498 const int& buspatchId = it->first;
1499 const int& bpvalue = it->second;
1501 TString bpName = Form(
"BP%04d",buspatchId);
1503 for ( std::vector<int>::size_type is = 0; is < timeResolutions.size(); ++is )
1507 hname.Form(
"/BUSPATCH/HITS/%ds/%s",timeResolutions[is],bpName.Data());
1508 TH1* h = hc->Histo(hname.Data());
1512 std::cout <<
DAVERSION <<
" ERROR : histogram " << hname.Data() <<
" not found" << std::endl;
1516 h->Fill(rawReader->GetTimestamp()-refTime,bpvalue);
1520 for ( std::vector<int>::size_type is = 0; is < timeResolutions.size(); ++is )
1524 hname.Form(
"Nevents%ds",timeResolutions[is]);
1525 TH1* h = hc->Histo(hname.Data());
1529 std::cout <<
DAVERSION <<
" ERROR : histogram " << hname.Data() <<
" not found" << std::endl;
1533 h->Fill(rawReader->GetTimestamp()-refTime);
1539 ++numberOfBadEvents;
1548 std::cout <<
DAVERSION << Form(
" INFO : %12d events processed : %12d physics %d used ones %d bad ones [ %d with MCH information ] [ %d incomplet %d flushed ]",
1549 numberOfEvents,numberOfPhysicsEvent,numberOfUsedEvents,numberOfBadEvents,numberOfEventsWithMCH,
1550 numberOfIncompleteEvents,numberOfFlushedEvents) << std::endl;
1552 std::cout <<
DAVERSION <<
" INFO : Number of histogram re-allocation : " << nofRealloc << std::endl;
1562 if (daqDA_FES_storeFile(outputFileName,
"BPEVO"))
return -9;
1566 std::cout <<
DAVERSION << Form(
" INFO : Execution time : R:%7.2fs C:%7.2fs\n", timers.RealTime(), timers.CpuTime()) << std::endl;
A high performance stream decoder for muon tracking DDL streams.
TFile * Open(const char *filename, Long64_t &nevents)
int main(int argc, char **argv)
void ReportFaultyBusPatches(AliMergeableCollection &hc, const std::map< int, int > &buspatches, int timeResolution, int requiredEvents, float occupancyThreshold)
float DEFAULT_OCCUPANCY_THRESHOLD
Bool_t Adopt(TObject *obj)
int DEFAULT_NOF_EVENTS_REQUIRED_FOR_DECISION
TH1 * Histo(const char *fullIdentifier) const
int DEFAULT_TIME_RESOLUTION
void DisableWarnings()
Set warnings flag to disable warnings on data errors.
virtual TObject * Remove(const char *fullIdentifier)
static TH1 * ExpandTimeAxis(const TH1 &h, Int_t expansionTime, Int_t timeResolution=-1)
Bool_t HasPaddingError() const
Whether we got padding errors or not.
Bool_t GetFaultyBusPatches(int timeResolution, int requiredEvents, float occupancyThreshold, std::map< int, double > &faultyBusPatchOccupancies)
void FillBusPatchesMap(std::map< int, int > &buspatches)
Bool_t HasGlitchError() const
Whether we got glitch errors or not.
virtual void First()
Initialize iterator.
Int_t AssertHistogramsRange(AliMergeableCollection &hc, Int_t timeFromRef, const std::vector< int > &timeResolutions, const std::map< int, int > &busPatches)
TString GetIdentifier(const char *fullIdentifier) const
void FillCollection(AliMergeableCollection &hc, UInt_t timeOrigin, int maxDuration, int timeResolution, const std::map< int, int > &buspatches)
Utility class to massage the output of the MCHBPEVO DA.
static Bool_t GetTimeOffset(const TH1 &h, TTimeStamp &origin)
static Int_t NumberOfDdls(const char *detectorName)
Declaration of the high performance decoder for muon trigger chamber raw streams. ...
virtual Bool_t Next(Int_t &busPatchId, UShort_t &manuId, UChar_t &manuChannel, UShort_t &adc)
Advance one step in the iteration. Returns false if finished.