Ignore:
Timestamp:
03/05/01 16:20:45 (24 years ago)
Author:
harald
Message:
Changes of Ciro and Dennis to write all events of one run in only
one file. Be careful, from now on you need also a new reflector.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Corsika/Mmcs/jcio.c

    r286 r687  
    11/*----------------------------------------------------------------------
    2   jcio.c :
    3 
    4 Rutinas para la gestion de ficheros en CORSIKA 5.20 Las posibilidades
    5 que contempla son:
     2  jcio.c :   
     3
     4Rutinas para la gestion de ficheros en CORSIKA 5.20
     5Author J.C.Gonzalez
     6
     7Las posibilidades que contempla son:
    68
    79- Creacion de un fichero de inicio de run: run######
     
    1416- La grabacion se realiza en C, por lo que no existen marcas de inicio
    1517  ni final de bloque en los ficheros.
     18
     19Modified by C.Bigongiari 2000 Dec 19.
     20No more RUN###### and END###### files created.
     21Three files, CER######, DAT###### and STA###### files, per run instead
     22of three files per shower.
     23Now ###### is the RUN NUMBER not the shower number !!!
    1624----------------------------------------------------------------------*/
    1725
     
    3038FILE *patape;
    3139FILE *sttape;
     40/* CBC
    3241FILE *runtape;
    3342FILE *endtape;
     43CBC*/
    3444char tpl[100];
    3545char certpl[100];
    3646char dattpl[100];
    37 char statpl[100];
     47/* CBC char statpl[100]; */
    3848char cerfile[100];
    3949char datfile[100];
     50/* CBC
    4051char stafile[100];
    4152char runfile[100];
    4253char endfile[100];
    43 
    44 /*--------------------------------------------------
    45   jcinitio:
    46   graba un bloque al fichero de particulas
     54CBC */
     55
     56/*--------------------------------------------------
     57  jcinitio: 
     58
     59Define file names
    4760--------------------------------------------------*/
    4861#ifdef JC_UNDERSCORES
     
    6578  strcpy (dattpl, tpl);
    6679  strcat (dattpl, "dat%06d");
     80  /* CBC
    6781  strcpy (statpl, tpl);
    6882  strcat (statpl, "sta%06d");
    69 
     83  */
     84  /* CBC
    7085  sprintf (runfile, "%srun%06d", tpl, *runnum);
    7186  sprintf (endfile, "%send%06d", tpl, *runnum);
     87  CBC */
     88
     89  sprintf (cerfile, certpl,  *runnum);         /* Added by CB */
     90  sprintf (datfile, dattpl,  *runnum);         /* Added by CB */
    7291}
    7392
     
    107126  jcstartrun:
    108127  abre el fichero run###### y graba el contenido
    109 --------------------------------------------------*/
    110 #ifdef JC_UNDERSCORES
    111 void
    112 jcstartrun_ (float *runh)
    113 #else /* JC_NO_UNDERSCORES */
    114 void
    115 jcstartrun (float *runh)
    116 #endif /* JC_UNDERSCORES */
    117 {
     128
     129NOW open CER and DAT files 
     130--------------------------------------------------*/
     131#ifdef JC_UNDERSCORES
     132void
     133jcstartrun_ (void)
     134#else /* JC_NO_UNDERSCORES */
     135void
     136jcstartrun (void)
     137#endif /* JC_UNDERSCORES */
     138{
     139  /* CBC
     140
    118141  if ((runtape = fopen (runfile, "wb")) == NULL) {
    119142    printf ("JCIO:: Cannot open RUN file %s. Exiting.\n", runfile);
    120143    exit (1);
    121144  }
     145  CBC */
     146
    122147  /* puts("JCIO:: saving runheader buffer..."); */
     148
     149  /* CBC
    123150  fwrite (runh, sizeof (float) * MAXBUF, 1, runtape);
    124 }
    125 
    126 /*--------------------------------------------------
    127   jcendrun:
    128   abre el fichero run###### y graba el contenido
    129 --------------------------------------------------*/
    130 #ifdef JC_UNDERSCORES
    131 void
    132 jcendrun_ (float *rune)
    133 #else /* JC_NO_UNDERSCORES */
    134 void
    135 jcendrun (float *rune)
    136 #endif /* JC_UNDERSCORES */
    137 {
    138   fwrite (rune, sizeof (float) * MAXBUF, 1, runtape);
    139   fclose (runtape);
    140 }
    141 
    142 /*--------------------------------------------------
    143   jcnewcerfile:
    144   abre un nuevo fichero Cherenkov
    145 --------------------------------------------------*/
    146 #ifdef JC_UNDERSCORES
    147 void
    148 jcnewcerfile_ ()
    149 #else /* JC_NO_UNDERSCORES */
    150 void
    151 jcnewcerfile ()
    152 #endif /* JC_UNDERSCORES */
    153 {
    154   sprintf (cerfile, certpl, nshow);
     151
     152  CBC */
     153
     154    /* Following lines up to CBC added by CB */
     155
     156
    155157  if ((cetape = fopen (cerfile, "wb")) == NULL) {
    156158    printf ("JCIO:: Cannot open CER file %s. Exiting.\n", cerfile);
    157159    exit (1);
    158160  }
    159   timefirst = 9.0e10;
    160   timelast = -9.0e10;
    161 }
    162 
    163 /*--------------------------------------------------
    164   jcnewdatfile:
    165   abre un nuevo fichero de particulas
    166 --------------------------------------------------*/
    167 #ifdef JC_UNDERSCORES
    168 void
    169 jcnewdatfile_ (void)
    170 #else /* JC_NO_UNDERSCORES */
    171 void
    172 jcnewdatfile (void)
    173 #endif /* JC_UNDERSCORES */
    174 {
    175   sprintf (datfile, dattpl, nshow);
    176161  if ((patape = fopen (datfile, "wb")) == NULL) {
    177162    printf ("JCIO:: Cannot open DAT file %s. Exiting.\n", datfile);
    178163    exit (1);
    179164  }
    180 }
    181 
    182 /*--------------------------------------------------
    183   jcnewstafile:
    184   abre un nuevo fichero de estadisticas
    185 --------------------------------------------------*/
    186 #ifdef JC_UNDERSCORES
    187 void
    188 jcnewstafile_ (void)
    189 #else /* JC_NO_UNDERSCORES */
    190 void
    191 jcnewstafile (void)
    192 #endif /* JC_UNDERSCORES */
    193 {
    194   sprintf (stafile, statpl, nshow);
    195   if ((sttape = fopen (stafile, "wb")) == NULL) {
    196     printf ("JCIO:: Cannot open STA file %s. Exiting.\n", stafile);
    197     exit (1);
    198   }
    199 }
    200 
    201 /*--------------------------------------------------
    202   jcnewshower:
    203   abre nuevos ficheros para la nueva cascada
    204 --------------------------------------------------*/
    205 #ifdef JC_UNDERSCORES
    206 void
    207 jcnewshower_ (void)
    208 #else /* JC_NO_UNDERSCORES */
    209 void
    210 jcnewshower (void)
    211 #endif /* JC_UNDERSCORES */
    212 {
    213   if (nshow > 0) {
    214     fclose (patape);
    215     fclose (cetape);
    216     fclose (sttape);
    217   }
    218 
    219   nshow++;
    220 #ifdef JC_UNDERSCORES
    221   jcnewdatfile_ ();
    222   jcnewcerfile_ ();
    223   jcnewstafile_ ();
    224 #else /* JC_NO_UNDERSCORES */
    225   jcnewdatfile ();
    226   jcnewcerfile ();
    227   jcnewstafile ();
    228 #endif /* JC_UNDERSCORES */
    229 }
    230 
    231 /*--------------------------------------------------
    232   jcenddata:
    233   abre el fichero run###### y graba el contenido
    234 --------------------------------------------------*/
    235 #ifdef JC_UNDERSCORES
    236 void
    237 jcenddata_ (float *runh, float *rune)
    238 #else /* JC_NO_UNDERSCORES */
    239 void
    240 jcenddata (float *runh, float *rune)
    241 #endif /* JC_UNDERSCORES */
    242 {
    243   if ((endtape = fopen (endfile, "wb")) == NULL) {
    244     printf ("JCIO:: Cannot open END file %s. Exiting.\n", endfile);
    245     exit (1);
    246   }
    247   fwrite (runh, sizeof (float) * MAXBUF, 1, endtape);
    248   fwrite (rune, sizeof (float) * MAXBUF, 1, endtape);
    249   fclose (endtape);
    250 }
     165
     166  /* CBC */
     167}
     168
     169/* WHAT FOLLOWS IS NO MORE USED !!!!!! CB */
     170
     171/*--------------------------------------------------
     172  jcstartshower:
     173 
     174Function added by CB 
     175Sets timefirst and timelast variables to their initial value at the beginnng
     176of new shower   
     177--------------------------------------------------*/
     178#ifdef JC_UNDERSCORES
     179void
     180jcstartshower_ (float *evth)
     181#else /* JC_NO_UNDERSCORES */
     182void
     183jcstartshower (float *evth)
     184#endif /* JC_UNDERSCORES */
     185{
     186  timefirst = 9.0e10;
     187  timelast = -9.0e10;
     188}
     189
    251190
    252191/*--------------------------------------------------
     
    357296
    358297}
     298
     299/*--------------------------------------------------
     300  jcendrun:
     301 
     302  Closes STA file
     303--------------------------------------------------*/
     304#ifdef JC_UNDERSCORES
     305void
     306jcendrun_ (float *rune)
     307#else /* JC_NO_UNDERSCORES */
     308void
     309jcendrun (float *rune)
     310#endif /* JC_UNDERSCORES */
     311{
     312  /* fwrite (rune, sizeof (float) * MAXBUF, 1, sttape); */
     313  fclose (sttape);
     314}
Note: See TracChangeset for help on using the changeset viewer.