Changeset 721


Ignore:
Timestamp:
04/04/01 15:56:32 (23 years ago)
Author:
domingo
Message:
small changes to adapt Simone on single file version of Mmcs. Not ready
yet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx

    r418 r721  
    66//
    77#include <stdlib.h>
     8#include <stdio.h>
    89
    910#include "COREventHeader.hxx"
     
    4344  }
    4445
    45   sprintf (path , "%s", argv[1] ) ;
     46  // copy the argument to filename
     47
     48  sprintf (cername , "%s", argv[1] ) ;
     49
    4650   
    47   for (int i_cer = 1; i_cer <= 100; i_cer++ ) {
     51  cout << cername  << endl ;
     52     
     53  //
     54  //   try to open the files
     55  //
     56   
     57  cerfile.open( cername );
     58   
     59  if ( cerfile.bad() ) {
     60    cout << "Cannot open input file:  " << cername << endl ;
     61    exit (1) ;
     62  }
     63   
     64  //   
     65  //    cout << " Read event " << endl ;
     66  //
     67 
     68  //   tricky stuff. We read in the RunHeader which has by chance the
     69  //   same sice than the EventHeader
     70  Event.read( cerfile );
     71
     72  //    now we read in the event
     73 
     74  Event.read( cerfile );
     75 
     76  Event.Print() ;
     77 
     78  //
     79  //   loop over the particles (cerenkov photons) in
     80  //   the file
     81  //
     82 
     83  iPhotonInShower = 0 ;
     84 
     85  while( ! (cerfile.eof() || cerfile.bad() )) {
     86   
     87    cout << "   testit " ;
    4888    //
    49     //   create the file names
     89    //   read in the particles
    5090    //
    51     sprintf ( cername, "%s/cer%06d", path, i_cer ) ;
    52     sprintf ( datname, "%s/dat%06d", path, i_cer ) ;
    5391   
    54     //      cout << cername  << endl ;
    55     //      cout << datname  << endl ;
     92    Photon.read ( cerfile ) ;
    5693   
    5794    //
    58     //   try to open the files
    59     //
     95    //   only if the wavelength lambda is greater than
     96    //   1.0 it is a real cerenkov photon
     97    //
     98    lambda = Photon.get_wl() ;
     99
     100    Photon.print() ;
    60101   
    61     cerfile.open( cername );
    62    
    63     if ( cerfile.bad() ) {
    64       cout << "Cannot open input file:  " << cername << endl ;
    65       continue ;
    66     }
    67    
    68     //   
    69     //    cout << " Read event " << endl ;
    70     //
    71    
    72     Event.read( cerfile );
    73  
    74     Event.Print() ;
     102    if ( lambda < 1.0 ) {
     103      // here we got to the next event reading in all the ZERO
     104      // from the file
     105      while ( lambda < 1.) {
     106        Photon.read ( cerfile ) ;
     107        lambda = Photon.get_wl() ;     
     108      }
    75109
    76     //
    77     //   loop over the particles (cerenkov photons) in
    78     //   the file
    79     //
    80    
    81     iPhotonInShower = 0 ;
    82    
    83     while( ! (cerfile.eof() || cerfile.bad() )) {
     110      //      sprintf (" size of Photon: %d \n", (int) sizeof( CORParticle )) ;
     111      fseek ( cerfile, -sizeof(CORParticle), SEEK_CUR(1) );
     112
     113      cout << sizeof ( CORParticle ) ;
     114      cout << sizeof ( int ) ;
     115
     116      break ;
    84117     
    85       //
    86       //   read in the particles
    87       //
    88118     
    89       Photon.read ( cerfile ) ;
    90119     
    91       //
    92       //   only if the wavelength lambda is greater than
    93       //   1.0 it is a real cerenkov photon
    94       //
    95       lambda = Photon.get_wl() ;
    96120     
    97       if ( lambda < 1.0 )
    98         break ;
    99      
    100       iPhotonInShower++ ;
    101      
    102       Photon.print() ;
    103     }
    104    
    105     //
    106     //   close the file
    107     //
    108    
    109     cerfile.close();
     121    }
    110122   
    111123   
     124    iPhotonInShower++ ;
    112125   
    113   }
     126  }
     127 
     128  //
     129  //   close the file
     130  //
     131 
     132  cerfile.close();
     133 
     134 
    114135 
    115136}
Note: See TracChangeset for help on using the changeset viewer.