Changeset 778 for trunk


Ignore:
Timestamp:
05/03/01 18:39:16 (23 years ago)
Author:
domingo
Message:
Version of GuiSimone for a "single file per run" output of Mmcs.
The "previous" event command is not operational at present. May need some
further thinking...
Location:
trunk/MagicSoft/Simulation/Corsika/GuiSimone
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.cxx

    r446 r778  
    11//
    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"
    526#define S_ISDIR(m) (((m)&(0170000)) == (0040000)) 
    627#define PI 3.1415926
     
    1031
    1132#include "MainFrameSimone.hxx"
    12 
    1333
    1434char NtupName[5][20] = {"WaveLen", "PosY:PosX", "Height", "Time", "DireY:DireX" } ; 
     
    5777  fMenuBar = new TGMenuBar ( this, 1, 1, kHorizontalFrame ) ;
    5878  fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem ) ;
    59  
     79   
    6080  AddFrame(fMenuBar, fLayMenuBar ) ;
    6181
     
    114134 
    115135  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!");
    117137  fSelectButton->SetState(kButtonDisabled);
    118138  fSelectButton->Associate(this) ;
     
    493513// ======================================================================
    494514// ======================================================================
     515//
     516////////////////////////////////////////////////////////////////////////////
     517//
     518// Modification by C.Domingo May 2001
     519//
     520// Procedure CerFileExist NOT used at present
     521//
     522////////////////////////////////////////////////////////////////////////////
     523//
    495524
    496525Bool_t MainFrameSimone::CerFileExist(Char_t *dir)
     
    583612// ======================================================================
    584613// ======================================================================       
     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//
    585625
    586626Bool_t MainFrameSimone::CheckNtup()
     
    593633    new TGMsgBox(fClient->GetRoot(), this,
    594634                 "Warning",
    595                  "No Input Path specified\n Do this before!!",
     635                 "No Cerenkov Input File specified\n Do this before!!",
    596636                 kMBIconExclamation, buttons, &retval);
    597637   
     
    600640 
    601641
    602   if ( ! strcmp ( fInputPath, fNtupPath ) ) {
     642  if ( ! strcmp ( fCerFileName, fNtupFile ) ) {
    603643    return (kTRUE) ;
    604644  }
     
    615655// ======================================================================
    616656// ======================================================================
    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//
    618671Bool_t MainFrameSimone::ReadDataToNtup()
    619672{
    620673  FILE  *unit ;
    621674  Char_t  rootfile[256] ;
    622   Char_t  cername[256] ;
    623675  Char_t  datname[256] ;
    624676 
    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 ;
    628685 
    629686  fNtup->Reset() ;
    630687
    631   sprintf (rootfile, "%s/simone.root", fInputPath ) ;
    632 
    633   //
    634   //   check if there is a file simone.root in the directory fInputPath
     688  sprintf (rootfile, "%s/simone%s.root", fInputPath, fRunSuffix ) ;
     689
     690  //
     691  //   check if there is a file simone######.root in the directory fInputPath
    635692  //
    636693  //   if the file is there open it an read the ntuple in,
    637   //   else open all cerenkov files and fill the histograms and store
    638   //   the ntuple as simone.root in the directory fInputPath
     694  //   else open the selected cerenkov file and fill the histograms and store
     695  //   the ntuple as simone######.root in the directory fInputPath
    639696  //
    640697
     
    663720
    664721    //delete hfile ;
    665 
    666    
    667722
    668723    fNumEvents = (Int_t) fNtup->GetEntries()  ;
     
    683738
    684739   
    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 ) ;
    693772         
    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      }
    725778
    726779      //
     
    729782     
    730783      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
    741845    }
    742846
     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
    743860    //
    744861    //  write Ntuple to the file
    745862    //
     863 
    746864    fNtup->Write() ;
    747865
     
    749867    //  write the root file
    750868    //
     869 
    751870    hfile->Write();
    752871   
     
    754873  }
    755874
    756 
    757875  //
    758876  //    set some value of this class
    759877  //
    760   sprintf ( fNtupPath, "%s", fInputPath) ;
     878
     879  sprintf ( fNtupFile, "%s", fCerFileName) ;
    761880 
    762881  return (kTRUE) ;
     
    766885// ======================================================================
    767886// ======================================================================
     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//
    768900
    769901Bool_t MainFrameSimone::ReadinEvt()
     
    773905  Char_t  wort[256] ;
    774906  FILE  *unit ;
    775   Char_t  filename[256] ;
    776 
    777   ifstream   cerfile ;
    778  
     907
    779908  COREventHeader Event ;   
    780909  CORParticle    Photon ;
     
    791920    new TGMsgBox(fClient->GetRoot(), this,
    792921                 "Warning",
    793                  "No Input Path specified\n Do this before!!",
     922                 "No Cerenkov Input File specified\n Do this before!!",
    794923                 kMBIconExclamation, buttons, &retval);
    795924   
     
    802931  }
    803932
    804   sprintf ( filename, "%s/cer%06d", fInputPath, fEvtNb ) ;
    805 
    806933  fNtupEvt->Reset() ;
    807934 
    808935  //
    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) {
    816969    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  }
    830976
    831977  //
     
    8601006  //   loop over the particles
    8611007  //
    862  
    8631008   
    8641009  iPhotonInShower = 0 ;
    865    
    866   while( ! (cerfile.eof() || cerfile.bad() )) {
    867      
     1010     
     1011  while( ! (fCerFile.eof() || fCerFile.bad() )) {
     1012
    8681013    //
    8691014    //   read in the particles
    8701015    //
    8711016     
    872     Photon.read ( cerfile ) ;
    873           //
     1017    Photon.read ( fCerFile ) ;
     1018     
     1019    //
    8741020    //   only if the wavelength lambda is greater than
    8751021    //   1.0 it is a real cerenkov photon
    876     //
    8771022   
    8781023    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()  ) ;     
    8931034    }
    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   
    8961061  //
    8971062  //   close the file
    8981063  //
    899    
    900   cerfile.close();
    901  
     1064
    9021065  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 
    9051073  return (kTRUE) ;
    906 
    9071074}
     1075
     1076
    9081077// ======================================================================
    9091078// ======================================================================
     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//
    9101094
    9111095Bool_t MainFrameSimone::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
     
    9161100  Char_t  testfile[100] ;
    9171101  Char_t  extens[5] ;
     1102  Char_t  idcer[5] ;
    9181103  Char_t  command[110] ;
    9191104 
     
    9851170          //     
    9861171          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() ;   
    9981205             
    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
    10121218        }
    10131219        break;
     
    10441250
    10451251
    1046 
    10471252      case M_BUTTON_PREV:
    1048         fEvtNb-- ;
    1049        
     1253//      fEvtNb-- ;
     1254//     
    10501255        if (fEvtNb < 1 ) {
    10511256          fEvtNb++ ;
    10521257         
    10531258        }
    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 
    10651278        break; 
    1066 
    1067 
     1279//
     1280//
    10681281      case M_BUTTON_NEXT:
    10691282        fEvtNb++ ;
     
    10801293
    10811294        break; 
    1082 
    1083 
    10841295
    10851296      case M_CTRL_EXIT:
     
    11531364            sprintf (wort, "%s", item->GetItemName()->GetString()) ;
    11541365           
     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
    11551386            //
    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 ) ;
    11631389             
    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() ;
    12011395           
    12021396          }
     
    12041398            sprintf (testfile, "%s", item->GetItemName()->GetString() ) ;
    12051399           
    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              //
    12091435           
    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' ;
    12121438           
    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                }
    12171444              }
    1218             }
    1219 
    1220             //
    1221             //     postscript file
    1222             //
     1445
     1446              //
     1447              //     postscript file
     1448              //
    12231449           
    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              }
    12311457           
    1232                
     1458            }   
    12331459           
    12341460             
     
    12481474  default:
    12491475    break;
    1250   }
     1476
     1477  }
     1478
    12511479  return kTRUE;
     1480
    12521481}
    12531482
  • trunk/MagicSoft/Simulation/Corsika/GuiSimone/MainFrameSimone.hxx

    r429 r778  
    5656  Char_t            fInputPath[200] ;
    5757  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] ;
    5962
     63  ifstream          fCerFile ;
    6064  Int_t             fEvtNb ;
    6165
Note: See TracChangeset for help on using the changeset viewer.