Changeset 778 for trunk/MagicSoft
- Timestamp:
- 05/03/01 18:39:16 (24 years ago)
- Location:
- trunk/MagicSoft/Simulation/Corsika/GuiSimone
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.cxx
r446 r778 1 1 // 2 // 3 // 4 #define START_DIRECTORY "." 2 //////////////////////////////////////////////////////////////////////////// 3 // 4 // GuiSimone 5 // 6 // Graphic User Interface for Simone (SIMultaed ONe Event) 7 // 8 // Modification May 2001 by C.Domingo over the existing program: 9 // The header file MainFrameSimone.hxx has been changed: the ifsteam fCerFile 10 // and the string variable fCerFileName are now global 11 // Some procedures in MainFrameSimone have been adapted to the "one 12 // file per run" Mmcs output 13 // 14 // GuiSimone reads Mmcs output files (one file per run version) and 15 // displays several histograms for each run and/or each event. Selection 16 // of files is made through a window (frame) and graphics are displayed 17 // in other windows (subframes) 18 // 19 // The ROOT package is needed 20 // 21 //////////////////////////////////////////////////////////////////////////// 22 // 23 // 24 25 #define START_DIRECTORY "/dat1" 5 26 #define S_ISDIR(m) (((m)&(0170000)) == (0040000)) 6 27 #define PI 3.1415926 … … 10 31 11 32 #include "MainFrameSimone.hxx" 12 13 33 14 34 char NtupName[5][20] = {"WaveLen", "PosY:PosX", "Height", "Time", "DireY:DireX" } ; … … 57 77 fMenuBar = new TGMenuBar ( this, 1, 1, kHorizontalFrame ) ; 58 78 fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem ) ; 59 79 60 80 AddFrame(fMenuBar, fLayMenuBar ) ; 61 81 … … 114 134 115 135 fSelectButton = new TGTextButton(fTabF1b, "Select", M_BUTTON_SELECT ); 116 fSelectButton->SetToolTipText("To select a path with Mmcs data files!");136 fSelectButton->SetToolTipText("To select a Cerenkov data output file from Mmcs!"); 117 137 fSelectButton->SetState(kButtonDisabled); 118 138 fSelectButton->Associate(this) ; … … 493 513 // ====================================================================== 494 514 // ====================================================================== 515 // 516 //////////////////////////////////////////////////////////////////////////// 517 // 518 // Modification by C.Domingo May 2001 519 // 520 // Procedure CerFileExist NOT used at present 521 // 522 //////////////////////////////////////////////////////////////////////////// 523 // 495 524 496 525 Bool_t MainFrameSimone::CerFileExist(Char_t *dir) … … 583 612 // ====================================================================== 584 613 // ====================================================================== 614 // 615 //////////////////////////////////////////////////////////////////////////// 616 // 617 // Modification by C.Domingo May 2001 618 // 619 // The fNtupFile is now the cerenkov FILE (not the directory where the 620 // Cerenkov files are stored) which contains the information of a 621 // complete RUN 622 // 623 //////////////////////////////////////////////////////////////////////////// 624 // 585 625 586 626 Bool_t MainFrameSimone::CheckNtup() … … 593 633 new TGMsgBox(fClient->GetRoot(), this, 594 634 "Warning", 595 "No Input Pathspecified\n Do this before!!",635 "No Cerenkov Input File specified\n Do this before!!", 596 636 kMBIconExclamation, buttons, &retval); 597 637 … … 600 640 601 641 602 if ( ! strcmp ( f InputPath, fNtupPath) ) {642 if ( ! strcmp ( fCerFileName, fNtupFile ) ) { 603 643 return (kTRUE) ; 604 644 } … … 615 655 // ====================================================================== 616 656 // ====================================================================== 617 657 // 658 //////////////////////////////////////////////////////////////////////////// 659 // 660 // Modification by C.Domingo May 2001 661 // 662 // Major changes to procedure ReadDataToNtup 663 // One simone.root file per each RUN file is generated now 664 // One cerenkov file is read instead of all cerenkov files in a given directory 665 // All events in the cerenkov file selected are read, and all the photons of these 666 // events are skipped to proceed to next event 667 // 668 // 669 //////////////////////////////////////////////////////////////////////////// 670 // 618 671 Bool_t MainFrameSimone::ReadDataToNtup() 619 672 { 620 673 FILE *unit ; 621 674 Char_t rootfile[256] ; 622 Char_t cername[256] ;623 675 Char_t datname[256] ; 624 676 625 ifstream cerfile ; 626 627 COREventHeader Event ; 677 Float_t lambda ; 678 Float_t energyofevent ; 679 Int_t iPhotonInShower ; 680 681 COREventHeader Event ; 682 CORParticle Photon ; 683 684 Int_t buttons = 4, retval ; 628 685 629 686 fNtup->Reset() ; 630 687 631 sprintf (rootfile, "%s/simone .root", fInputPath) ;632 633 // 634 // check if there is a file simone .root in the directory fInputPath688 sprintf (rootfile, "%s/simone%s.root", fInputPath, fRunSuffix ) ; 689 690 // 691 // check if there is a file simone######.root in the directory fInputPath 635 692 // 636 693 // if the file is there open it an read the ntuple in, 637 // else open all cerenkov filesand fill the histograms and store638 // the ntuple as simone .root in the directory fInputPath694 // else open the selected cerenkov file and fill the histograms and store 695 // the ntuple as simone######.root in the directory fInputPath 639 696 // 640 697 … … 663 720 664 721 //delete hfile ; 665 666 667 722 668 723 fNumEvents = (Int_t) fNtup->GetEntries() ; … … 683 738 684 739 685 for (int i_cer = 1; i_cer <= 100000; i_cer++ ) { 686 687 // inform about progress 688 689 if (!( i_cer %1000) ) 690 { 691 cout << i_cer << endl ; 692 sprintf ( datname, "%d", fNumEvents ) ; 740 fNumEvents = 0 ; 741 742 fCerFile.open( fCerFileName ); 743 744 if ( fCerFile.bad() ) { 745 new TGMsgBox(fClient->GetRoot(), this, 746 "Warning", 747 "Could not open Cerenkov file\n file = bad (sataus)", 748 kMBIconExclamation, buttons, &retval); 749 return (kFALSE) ; 750 } 751 752 // Dirty trick to read run header, as by chance it has the same structure 753 // of an event header 754 755 Event.read(fCerFile) ; 756 757 // Now reading the events truly 758 759 while ( ! (fCerFile.eof() || fCerFile.bad() ) ) { 760 761 Event.read( fCerFile ); 762 energyofevent = Event.get_energy() ; 763 if (energyofevent == 0) break ; 764 fNumEvents++ ; 765 766 // 767 // Inform about progress 768 // 769 770 if (!( fNumEvents %1000) ) { 771 sprintf ( datname, "%d", fNumEvents ) ; 693 772 694 fDirNum->RemoveEntry(1) ; 695 fDirNum->AddEntry(datname,1) ; 696 fDirNum->MapSubwindows() ; 697 fDirNum->Layout() ; 698 } 699 700 701 // create the file names 702 703 sprintf ( cername, "%s/cer%06d", fInputPath, i_cer ) ; 704 sprintf ( datname, "%s/dat%06d", fInputPath, i_cer ) ; 705 706 // try to open the files 707 708 cerfile.open( cername ); 709 710 if ( cerfile.bad() ) { 711 712 fNumEvents = i_cer -1 ; 713 714 sprintf ( datname, "%d", fNumEvents ) ; 715 716 fDirNum->RemoveEntry(1) ; 717 fDirNum->AddEntry(datname,1) ; 718 fDirNum->MapSubwindows() ; 719 fDirNum->Layout() ; 720 721 break ; 722 } 723 724 Event.read( cerfile ); 773 fDirNum->RemoveEntry(1) ; 774 fDirNum->AddEntry(datname,1) ; 775 fDirNum->MapSubwindows() ; 776 fDirNum->Layout() ; 777 } 725 778 726 779 // … … 729 782 730 783 fNtup->Fill( Event.get_primary() , 731 Event.get_energy() , 732 Event.get_coreX(), 733 Event.get_coreY(), 734 Event.get_theta(), 735 Event.get_phi(), 736 Event.get_firstInt() ) ; 737 738 739 cerfile.close(); 740 784 Event.get_energy() , 785 Event.get_coreX(), 786 Event.get_coreY(), 787 Event.get_theta(), 788 Event.get_phi(), 789 Event.get_firstInt() ) ; 790 791 // 792 // loop over the particles (cerenkov photons) in 793 // the file 794 // 795 796 iPhotonInShower = 0 ; 797 798 while( ! (fCerFile.eof() || fCerFile.bad() )) { 799 800 // 801 // read in the particles 802 // 803 804 Photon.read ( fCerFile ) ; 805 806 // 807 // only if the wavelength lambda is greater than 808 // 1.0 it is a real cerenkov photon 809 // 810 lambda = Photon.get_wl() ; 811 812 // Photon.print() ; 813 814 if ( lambda < 1.0 ) { 815 // here we got to the next event reading in all the ZERO 816 // from the file 817 while ( lambda < 1. && ! (fCerFile.eof() || fCerFile.bad() ) ) { 818 819 Photon.read ( fCerFile ) ; 820 lambda = Photon.get_wl() ; 821 // cout << lambda << endl ; 822 } 823 824 // go back in the file, because when the zeroes have finished 825 // the following record has already been read as it were 826 // a cerenkov foton. The pointer should be repositioned to 827 // read the event end record 828 829 fCerFile.seekg( -28, ios::cur ) ; 830 831 // read in the event end record. Again, it has the same structure (by 832 // chance) thant the event header 833 834 Event.read( fCerFile ); 835 836 break ; 837 } 838 839 iPhotonInShower++ ; 840 841 } 842 843 // cout << " Event " << fNumEvents << ": Photons " << iPhotonInShower << endl ; 844 741 845 } 742 846 847 fCerFile.close(); 848 849 // 850 // Refresh information on the screen window 851 // 852 853 sprintf ( datname, "%d", fNumEvents ) ; 854 855 fDirNum->RemoveEntry(1) ; 856 fDirNum->AddEntry(datname,1) ; 857 fDirNum->MapSubwindows() ; 858 fDirNum->Layout() ; 859 743 860 // 744 861 // write Ntuple to the file 745 862 // 863 746 864 fNtup->Write() ; 747 865 … … 749 867 // write the root file 750 868 // 869 751 870 hfile->Write(); 752 871 … … 754 873 } 755 874 756 757 875 // 758 876 // set some value of this class 759 877 // 760 sprintf ( fNtupPath, "%s", fInputPath) ; 878 879 sprintf ( fNtupFile, "%s", fCerFileName) ; 761 880 762 881 return (kTRUE) ; … … 766 885 // ====================================================================== 767 886 // ====================================================================== 887 // 888 //////////////////////////////////////////////////////////////////////////// 889 // 890 // Modification by C.Domingo May 2001 891 // 892 // Major changes to procedure ReadInEvt 893 // Reads the photons from inside the selected cerenkov file (which contains 894 // generated for a given run) instead of opening one file per event 895 // Checks if it must read the first event of a file, in such a case the 896 // file is open 897 // 898 //////////////////////////////////////////////////////////////////////////// 899 // 768 900 769 901 Bool_t MainFrameSimone::ReadinEvt() … … 773 905 Char_t wort[256] ; 774 906 FILE *unit ; 775 Char_t filename[256] ; 776 777 ifstream cerfile ; 778 907 779 908 COREventHeader Event ; 780 909 CORParticle Photon ; … … 791 920 new TGMsgBox(fClient->GetRoot(), this, 792 921 "Warning", 793 "No Input Pathspecified\n Do this before!!",922 "No Cerenkov Input File specified\n Do this before!!", 794 923 kMBIconExclamation, buttons, &retval); 795 924 … … 802 931 } 803 932 804 sprintf ( filename, "%s/cer%06d", fInputPath, fEvtNb ) ;805 806 933 fNtupEvt->Reset() ; 807 934 808 935 // 809 // open the file 810 // 811 812 cerfile.open( filename ); 813 814 if ( cerfile.bad() ) { 815 936 // if first event, open the file and read run header 937 // 938 939 if ( fEvtNb == 1) { 940 fCerFile.open( fCerFileName ); 941 if ( fCerFile.bad() ) { 942 943 new TGMsgBox(fClient->GetRoot(), this, 944 "ERROR", 945 "Can't open the cer file!!", 946 kMBIconExclamation, buttons, &retval); 947 948 return (kFALSE) ; 949 } 950 951 // Dirty trick to read run header (see comment in RaedDataToNtup for 952 // further details) 953 954 Event.read(fCerFile) ; 955 956 } 957 958 // 959 // For all events, read in event header 960 // 961 962 Event.read( fCerFile ); 963 964 // 965 // Check for RUN end (an ENDRUN record will return a 0 value of the energy) 966 // 967 968 if (Event.get_energy() == 0) { 816 969 new TGMsgBox(fClient->GetRoot(), this, 817 "ERROR", 818 "Can't open the cer file!!", 819 kMBIconExclamation, buttons, &retval); 820 821 return (kFALSE) ; 822 } 823 824 // 825 // read in the header 826 // 827 828 Event.read( cerfile ); 829 970 "Information", 971 "End of file detected", 972 kMBIconAsterisk, buttons, &retval); 973 fCerFile.close () ; 974 return (kFALSE) ; 975 } 830 976 831 977 // … … 860 1006 // loop over the particles 861 1007 // 862 863 1008 864 1009 iPhotonInShower = 0 ; 865 866 while( ! ( cerfile.eof() || cerfile.bad() )) {867 1010 1011 while( ! (fCerFile.eof() || fCerFile.bad() )) { 1012 868 1013 // 869 1014 // read in the particles 870 1015 // 871 1016 872 Photon.read ( cerfile ) ; 873 // 1017 Photon.read ( fCerFile ) ; 1018 1019 // 874 1020 // only if the wavelength lambda is greater than 875 1021 // 1.0 it is a real cerenkov photon 876 //877 1022 878 1023 lambda = Photon.get_wl() ; 879 880 if ( lambda < 1.0 ) 881 break ; 882 883 iPhotonInShower++ ; 884 885 fNtupEvt->Fill(Photon.get_wl(), 886 Photon.get_x(), 887 Photon.get_y(), 888 Photon.get_h(), 889 Photon.get_t(), 890 Photon.get_u(), 891 Photon.get_v() ) ; 892 1024 1025 if ( lambda >= 1.0 ) { 1026 iPhotonInShower++ ; 1027 fNtupEvt->Fill(Photon.get_wl(), 1028 Photon.get_x(), 1029 Photon.get_y(), 1030 Photon.get_h(), 1031 Photon.get_t(), 1032 Photon.get_u(), 1033 Photon.get_v() ) ; 893 1034 } 894 895 1035 1036 // here we got to the next event reading in all the ZERO 1037 // from the file 1038 1039 else { 1040 while ( lambda < 1. && ! (fCerFile.eof() || fCerFile.bad() ) ) { 1041 Photon.read ( fCerFile ) ; 1042 lambda = Photon.get_wl() ; 1043 } 1044 1045 // go back in the file, because when the zeroes have finished 1046 // the following record has already been read as it were 1047 // a cerenkov foton. The pointer should be repositioned to 1048 // read the event end record 1049 1050 fCerFile.seekg( -28, ios::cur ) ; 1051 1052 // read in the event end record. Again, it has the same structure (by 1053 // chance) thant the event header 1054 1055 Event.read( fCerFile ); 1056 break ; 1057 } 1058 1059 } 1060 896 1061 // 897 1062 // close the file 898 1063 // 899 900 cerfile.close(); 901 1064 902 1065 sprintf( wort," %10d", iPhotonInShower ) ; 903 fInfoNbPhot->SetText( wort ) ; 904 1066 fInfoNbPhot->SetText( wort ) ; 1067 1068 // fCerFile.close(); 1069 1070 // sprintf( wort," %10d", iPhotonInShower ) ; 1071 // fInfoNbPhot->SetText( wort ) ; 1072 905 1073 return (kTRUE) ; 906 907 1074 } 1075 1076 908 1077 // ====================================================================== 909 1078 // ====================================================================== 1079 // 1080 //////////////////////////////////////////////////////////////////////////// 1081 // 1082 // Modification by C.Domingo May 2001 1083 // 1084 // Minor changes to procedure ProcessMessage 1085 // case M_BUTTON_SELECT takes into account that we no longer select 1086 // directories, but files. 1087 // case M_BUTTON_PREV functionality has (temporarily) been removed 1088 // case kCT_ITEMDBLCLICK takes into account that we deal with are going to 1089 // select cerenkov files, not directories containing them. Test for detection 1090 // of possible cerenkov files is added. 1091 // 1092 //////////////////////////////////////////////////////////////////////////// 1093 // 910 1094 911 1095 Bool_t MainFrameSimone::ProcessMessage(Long_t msg, Long_t parm1, Long_t) … … 916 1100 Char_t testfile[100] ; 917 1101 Char_t extens[5] ; 1102 Char_t idcer[5] ; 918 1103 Char_t command[110] ; 919 1104 … … 985 1170 // 986 1171 item = (TGFileItem *) fFileCont->GetNextSelected(&np) ; 987 988 if ( S_ISDIR(item->GetType()) ) { // file is directory 989 990 sprintf (fInputPath, "%s/%s", 991 gSystem->WorkingDirectory(), 992 item->GetItemName()->GetString()) ; 993 994 fDir2->RemoveEntry(1) ; 995 fDir2->AddEntry(fInputPath,1) ; 996 fDir2->MapSubwindows() ; 997 fDir2->Layout() ; 1172 1173 // cout << "fCerFileName =" << fCerFileName ; 1174 1175 // 1176 // Check if fCerFile is already declared and open 1177 // If so, close it before selecting next file 1178 // 1179 1180 if (fCerFileName != "\0" && fCerFile ) 1181 fCerFile.close(); 1182 1183 // 1184 // Compose the InputPath name and the Cerenkov filename 1185 // 1186 1187 sprintf (fInputPath, "%s", 1188 gSystem->WorkingDirectory() ) ; 1189 1190 sprintf (fCerFileName, "%s/%s" , 1191 gSystem->WorkingDirectory(), 1192 item->GetItemName()->GetString()) ; 1193 1194 //cout << fInputPath << endl; 1195 //cout << fCerFileName << endl ; 1196 1197 // 1198 // Refresh values in the frames 1199 // 1200 1201 fDir2->RemoveEntry(1) ; 1202 fDir2->AddEntry(fCerFileName,1) ; 1203 fDir2->MapSubwindows() ; 1204 fDir2->Layout() ; 998 1205 999 fDir3->RemoveEntry(1) ; 1000 fDir3->AddEntry(fInputPath,1) ; 1001 fDir3->MapSubwindows() ; 1002 fDir3->Layout() ; 1003 1004 fEvtNb = 0 ; 1005 sprintf (wort2, "%d", fEvtNb ) ; 1006 fDirEvtNb->RemoveEntry(1) ; 1007 fDirEvtNb->AddEntry( wort2, 1 ) ; 1008 fDirEvtNb->MapSubwindows() ; 1009 fDirEvtNb->Layout() ; 1010 1011 } 1206 fDir3->RemoveEntry(1) ; 1207 fDir3->AddEntry(fCerFileName,1) ; 1208 fDir3->MapSubwindows() ; 1209 fDir3->Layout() ; 1210 1211 fEvtNb = 0 ; 1212 sprintf (wort2, "%d", fEvtNb ) ; 1213 fDirEvtNb->RemoveEntry(1) ; 1214 fDirEvtNb->AddEntry( wort2, 1 ) ; 1215 fDirEvtNb->MapSubwindows() ; 1216 fDirEvtNb->Layout() ; 1217 1012 1218 } 1013 1219 break; … … 1044 1250 1045 1251 1046 1047 1252 case M_BUTTON_PREV: 1048 fEvtNb-- ;1049 1253 // fEvtNb-- ; 1254 // 1050 1255 if (fEvtNb < 1 ) { 1051 1256 fEvtNb++ ; 1052 1257 1053 1258 } 1054 1055 sprintf (wort2, "%d", fEvtNb ) ; 1056 fDirEvtNb->RemoveEntry(1) ; 1057 fDirEvtNb->AddEntry( wort2, 1 ) ; 1058 fDirEvtNb->MapSubwindows() ; 1059 fDirEvtNb->Layout() ; 1060 1061 ReadinEvt() ; 1062 1063 DrawEvtParam() ; 1064 1259 // 1260 // sprintf (wort2, "%d", fEvtNb ) ; 1261 // fDirEvtNb->RemoveEntry(1) ; 1262 // fDirEvtNb->AddEntry( wort2, 1 ) ; 1263 // fDirEvtNb->MapSubwindows() ; 1264 // fDirEvtNb->Layout() ; 1265 // 1266 // ReadinEvt() ; 1267 // 1268 // DrawEvtParam() ; 1269 // 1270 // 1271 // Do nothing !! 1272 // 1273 new TGMsgBox(fClient->GetRoot(), this, 1274 "Warning", 1275 "This button is not operational at present!!", 1276 kMBIconExclamation, buttons, &retval); 1277 1065 1278 break; 1066 1067 1279 // 1280 // 1068 1281 case M_BUTTON_NEXT: 1069 1282 fEvtNb++ ; … … 1080 1293 1081 1294 break; 1082 1083 1084 1295 1085 1296 case M_CTRL_EXIT: … … 1153 1364 sprintf (wort, "%s", item->GetItemName()->GetString()) ; 1154 1365 1366 sprintf (fInputPath,"\0") ; 1367 fSelectButton->SetState(kButtonDisabled) ; 1368 fDir2->RemoveEntry(1) ; 1369 fDir2->AddEntry(fInputPath,1) ; 1370 fDir2->MapSubwindows() ; 1371 fDir2->Layout() ; 1372 1373 fDir3->RemoveEntry(1) ; 1374 fDir3->AddEntry(fInputPath,1) ; 1375 fDir3->MapSubwindows() ; 1376 fDir3->Layout() ; 1377 1378 sprintf (wort2, "\0" ) ; 1379 fDirEvtNb->RemoveEntry(1) ; 1380 fDirEvtNb->AddEntry( wort2, 1 ) ; 1381 fDirEvtNb->MapSubwindows() ; 1382 fDirEvtNb->Layout() ; 1383 1384 // 1385 // goto directory 1155 1386 // 1156 // check if in this directory the file cer000001 exits 1157 // if it exists, do not open the stuff 1158 // 1159 1160 if ( CerFileExist( wort ) ) { 1161 1162 fSelectButton->SetState(kButtonUp) ; 1387 fFileCont->ChangeDirectory ( wort ) ; 1388 gSystem->ChangeDirectory( wort ) ; 1163 1389 1164 new TGMsgBox(fClient->GetRoot(), this, 1165 "Information", 1166 "This is a directory containing cer files\n click on select to chose it!", 1167 kMBIconAsterisk, buttons, &retval); 1168 1169 } 1170 else { 1171 sprintf (fInputPath,"\0") ; 1172 fSelectButton->SetState(kButtonDisabled) ; 1173 fDir2->RemoveEntry(1) ; 1174 fDir2->AddEntry(fInputPath,1) ; 1175 fDir2->MapSubwindows() ; 1176 fDir2->Layout() ; 1177 1178 fDir3->RemoveEntry(1) ; 1179 fDir3->AddEntry(fInputPath,1) ; 1180 fDir3->MapSubwindows() ; 1181 fDir3->Layout() ; 1182 1183 sprintf (wort2, "\0" ) ; 1184 fDirEvtNb->RemoveEntry(1) ; 1185 fDirEvtNb->AddEntry( wort2, 1 ) ; 1186 fDirEvtNb->MapSubwindows() ; 1187 fDirEvtNb->Layout() ; 1188 1189 // 1190 // goto directory 1191 // 1192 fFileCont->ChangeDirectory ( wort ) ; 1193 gSystem->ChangeDirectory( wort ) ; 1194 1195 sprintf (wort, "%s", gSystem->WorkingDirectory() ) ; 1196 fDir->RemoveEntry(1) ; 1197 fDir->AddEntry( wort, 1 ) ; 1198 fDir->MapSubwindows() ; 1199 fDir->Layout() ; 1200 } 1390 sprintf (wort, "%s", gSystem->WorkingDirectory() ) ; 1391 fDir->RemoveEntry(1) ; 1392 fDir->AddEntry( wort, 1 ) ; 1393 fDir->MapSubwindows() ; 1394 fDir->Layout() ; 1201 1395 1202 1396 } … … 1204 1398 sprintf (testfile, "%s", item->GetItemName()->GetString() ) ; 1205 1399 1206 // 1207 // determine the file type by extensions 1208 // 1400 // 1401 // Is it a Cerenkov file? 1402 // 1403 1404 for (Int_t i = 0 ; i<5; i++) 1405 idcer[i] = '\0' ; 1406 for (Int_t i = 0 ; i<10; i++) 1407 fRunSuffix[i]= '\0' ; 1408 1409 strncpy (idcer, &testfile[0], 3 ) ; 1410 if ( ! strcmp (idcer , "cer" ) ) { 1411 for ( Int_t i=3; 15; i++) { 1412 if ( testfile[i] == '\0') { 1413 strncpy (fRunSuffix, &testfile[3], i-3 ) ; 1414 break ; 1415 } 1416 } 1417 1418 // cout << "fRunSuffix = "<< fRunSuffix << endl ; 1419 1420 fSelectButton->SetState(kButtonUp) ; 1421 1422 new TGMsgBox(fClient->GetRoot(), this, 1423 "Information", 1424 "This file probably contains CERENKOV events\n click on the SELECT button to chose it!", 1425 kMBIconAsterisk, buttons, &retval); 1426 } 1427 1428 else { 1429 1430 fSelectButton->SetState(kButtonDisabled) ; 1431 1432 // 1433 // determine the file type by extensions 1434 // 1209 1435 1210 for (Int_t i = 0 ; i<5; i++)1211 extens[i] = '\0' ;1436 for (Int_t i = 0 ; i<5; i++) 1437 extens[i] = '\0' ; 1212 1438 1213 for ( Int_t i=0; testfile[i] != '\0'; i++) { 1214 if ( testfile[i] == '.') { 1215 strncpy (extens, &testfile[i+1], 4 ) ; 1216 break ; 1439 for ( Int_t i=0; testfile[i] != '\0'; i++) { 1440 if ( testfile[i] == '.') { 1441 strncpy (extens, &testfile[i+1], 4 ) ; 1442 break ; 1443 } 1217 1444 } 1218 } 1219 1220 // 1221 // postscript file 1222 // 1445 1446 // 1447 // postscript file 1448 // 1223 1449 1224 if ( ! strcmp(extens, "ps") ) {1225 sprintf ( command, "gv %s/%s &",1226 gSystem->WorkingDirectory(),1227 testfile ) ;1228 gSystem->Exec(command) ;1229 break ;1230 }1450 if ( ! strcmp(extens, "ps") ) { 1451 sprintf ( command, "gv %s/%s &", 1452 gSystem->WorkingDirectory(), 1453 testfile ) ; 1454 gSystem->Exec(command) ; 1455 break ; 1456 } 1231 1457 1232 1458 } 1233 1459 1234 1460 … … 1248 1474 default: 1249 1475 break; 1250 } 1476 1477 } 1478 1251 1479 return kTRUE; 1480 1252 1481 } 1253 1482 -
trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.hxx
r429 r778 56 56 Char_t fInputPath[200] ; 57 57 Int_t fNumEvents ; 58 Char_t fNtupPath[200] ; 58 // Char_t fNtupPath[200] ; 59 Char_t fNtupFile[256] ; 60 Char_t fCerFileName[256] ; 61 Char_t fRunSuffix[10] ; 59 62 63 ifstream fCerFile ; 60 64 Int_t fEvtNb ; 61 65
Note:
See TracChangeset
for help on using the changeset viewer.