Changeset 687 for trunk/MagicSoft/Simulation/Corsika/Mmcs/jcio.c
- Timestamp:
- 03/05/01 16:20:45 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Corsika/Mmcs/jcio.c
r286 r687 1 1 /*---------------------------------------------------------------------- 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 4 Rutinas para la gestion de ficheros en CORSIKA 5.20 5 Author J.C.Gonzalez 6 7 Las posibilidades que contempla son: 6 8 7 9 - Creacion de un fichero de inicio de run: run###### … … 14 16 - La grabacion se realiza en C, por lo que no existen marcas de inicio 15 17 ni final de bloque en los ficheros. 18 19 Modified by C.Bigongiari 2000 Dec 19. 20 No more RUN###### and END###### files created. 21 Three files, CER######, DAT###### and STA###### files, per run instead 22 of three files per shower. 23 Now ###### is the RUN NUMBER not the shower number !!! 16 24 ----------------------------------------------------------------------*/ 17 25 … … 30 38 FILE *patape; 31 39 FILE *sttape; 40 /* CBC 32 41 FILE *runtape; 33 42 FILE *endtape; 43 CBC*/ 34 44 char tpl[100]; 35 45 char certpl[100]; 36 46 char dattpl[100]; 37 char statpl[100]; 47 /* CBC char statpl[100]; */ 38 48 char cerfile[100]; 39 49 char datfile[100]; 50 /* CBC 40 51 char stafile[100]; 41 52 char runfile[100]; 42 53 char endfile[100]; 43 44 /*-------------------------------------------------- 45 jcinitio: 46 graba un bloque al fichero de particulas 54 CBC */ 55 56 /*-------------------------------------------------- 57 jcinitio: 58 59 Define file names 47 60 --------------------------------------------------*/ 48 61 #ifdef JC_UNDERSCORES … … 65 78 strcpy (dattpl, tpl); 66 79 strcat (dattpl, "dat%06d"); 80 /* CBC 67 81 strcpy (statpl, tpl); 68 82 strcat (statpl, "sta%06d"); 69 83 */ 84 /* CBC 70 85 sprintf (runfile, "%srun%06d", tpl, *runnum); 71 86 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 */ 72 91 } 73 92 … … 107 126 jcstartrun: 108 127 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 129 NOW open CER and DAT files 130 --------------------------------------------------*/ 131 #ifdef JC_UNDERSCORES 132 void 133 jcstartrun_ (void) 134 #else /* JC_NO_UNDERSCORES */ 135 void 136 jcstartrun (void) 137 #endif /* JC_UNDERSCORES */ 138 { 139 /* CBC 140 118 141 if ((runtape = fopen (runfile, "wb")) == NULL) { 119 142 printf ("JCIO:: Cannot open RUN file %s. Exiting.\n", runfile); 120 143 exit (1); 121 144 } 145 CBC */ 146 122 147 /* puts("JCIO:: saving runheader buffer..."); */ 148 149 /* CBC 123 150 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 155 157 if ((cetape = fopen (cerfile, "wb")) == NULL) { 156 158 printf ("JCIO:: Cannot open CER file %s. Exiting.\n", cerfile); 157 159 exit (1); 158 160 } 159 timefirst = 9.0e10;160 timelast = -9.0e10;161 }162 163 /*--------------------------------------------------164 jcnewdatfile:165 abre un nuevo fichero de particulas166 --------------------------------------------------*/167 #ifdef JC_UNDERSCORES168 void169 jcnewdatfile_ (void)170 #else /* JC_NO_UNDERSCORES */171 void172 jcnewdatfile (void)173 #endif /* JC_UNDERSCORES */174 {175 sprintf (datfile, dattpl, nshow);176 161 if ((patape = fopen (datfile, "wb")) == NULL) { 177 162 printf ("JCIO:: Cannot open DAT file %s. Exiting.\n", datfile); 178 163 exit (1); 179 164 } 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 174 Function added by CB 175 Sets timefirst and timelast variables to their initial value at the beginnng 176 of new shower 177 --------------------------------------------------*/ 178 #ifdef JC_UNDERSCORES 179 void 180 jcstartshower_ (float *evth) 181 #else /* JC_NO_UNDERSCORES */ 182 void 183 jcstartshower (float *evth) 184 #endif /* JC_UNDERSCORES */ 185 { 186 timefirst = 9.0e10; 187 timelast = -9.0e10; 188 } 189 251 190 252 191 /*-------------------------------------------------- … … 357 296 358 297 } 298 299 /*-------------------------------------------------- 300 jcendrun: 301 302 Closes STA file 303 --------------------------------------------------*/ 304 #ifdef JC_UNDERSCORES 305 void 306 jcendrun_ (float *rune) 307 #else /* JC_NO_UNDERSCORES */ 308 void 309 jcendrun (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.