Commit 5de46af4 authored by Pedro Widniczck's avatar Pedro Widniczck

Upload New File

parent b4765a59
Pipeline #13 canceled with stages
#include<stdio.h>
#include<stdlib.h>
int main(){
FILE *summary, *events;
int Ntracks = 5, Nevents = 5;
int numeros[Ntracks*Nevents][2], num[Ntracks*Nevents][2];
float p[Ntracks*Nevents][3], mass[Ntracks*Nevents], charge[Ntracks*Nevents];
float v[Ntracks*Nevents][3], B[Ntracks*Nevents];
int i = 0, j = 0, k = 0;
events = fopen("events_detail.txt","r");
summary = fopen("events_summary.txt","r");
for(i=0;i<Ntracks*Nevents;i++){ // inicializa as variaveis
numeros[i][0] = 0;
numeros[i][1] = 0;
num[i][0] = 0;
num[i][1] = 0;
p[i][0] = 0;
p[i][1] = 0;
p[i][2] = 0;
v[i][0] = 0;
v[i][1] = 0;
v[i][2] = 0;
mass[i] = 0;
charge[i] = 0;
B[i] = 0;
}
i = 0;
if(summary == NULL){
printf("deu erro em 1!!!\n\n");
return EXIT_FAILURE;
}
do{
if(numeros[i][0] < Nevents){
printf("chegou aqui!!! 1 \n\n");
fscanf(summary, "%d %d %f %f %f %f", &num[i][0], &num[i][1], v[i][0], v[i][1], v[i][2], B[i]);
}
i++;
}while(!feof(summary));
if(events == NULL){
printf("deu pau em 2!!!");
return EXIT_FAILURE;
}
do{
if(numeros[k][0] < Nevents){
j = 0;
printf("sera que chega até aqui??? 2 \n\n");
if(numeros[i][1] < num[i][1]){
fscanf(events, "%d %d %f %f %f %f %f", &numeros[j][0], &numeros[j][0], &p[j][0], &p[j][1], &p[j][2], &mass[j], &charge[j]);
j++;
}
k++;
}
}while(!feof(events));
fclose(events);
fclose(summary);
for(i=0;i<Nevents;i++){
while(num[i,0] == numeros[i,0]){
printf(" %d %d %f %f %f %f %f %f %f %f %f \n ", numeros[j][0], numeros[j][1], v[i][0], v[i][1], v[i][2], p[j][0], p[j][1], p[j][2], mass[j], charge[j], B[i]);
j++;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment