Changeset 870 for trunk/MagicSoft
- Timestamp:
- 07/18/01 09:37:32 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/ReflectorII/reflector.c
r725 r870 33 33 static long writep = 0L; /* write ptr (on rflfile) */ 34 34 35 36 35 extern CerHeader *cheadp; /* var inited in header.c */ 37 36 extern RflHeader *rheadp; /* var inited in header.c */ … … 43 42 static int ProcessEvent(CerHeader *cheadp, FILE *cerfile, FILE *rflfile); 44 43 44 FILE *chkf = NULL; /**********************/ 45 long myloop; /**********************/ 46 45 47 void main(void) 46 48 { long event = 0L; /* event counter */ … … 48 50 /* Read init & geometry parms, init files and vars */ 49 51 init(NULL); 52 chkf = fopen("check", "w"); /**********************/ 50 53 51 54 /* Processing loop */ … … 61 64 Log(RFLF_CLOSE_LOG); 62 65 fclose(rflfile); 66 fclose(chkf); /**********************/ 63 67 64 68 /* Clean memory and exit */ … … 78 82 extern void makeOmegaI(float theta, float phi); 79 83 84 80 85 /* Various counters: phs = absphs + refphs[0..3] + cphs */ 81 86 long phs, /* Number of incoming photons */ … … 134 139 1.f - Photons[ph].u*Photons[ph].u 135 140 - Photons[ph].v*Photons[ph].v)); 141 136 142 /* Check absorption */ 137 138 143 if (absorption(wlen, Photons[ph].h, theta)) 139 144 absphs++; … … 141 146 /* Check reflection */ 142 147 else if (0 != (ref_type = 143 ph2cph(&Photons[ph], &CPhotons[cphs]))) 148 ph2cph(&Photons[ph], &CPhotons[cphs]))) 144 149 refphs[ref_type-1]++; 145 146 150 else /* Photon passed */ 147 151 { 152 Debug("Ph %d\t%f\t%f\t%f\t%f\t%f\n",ph, 153 Photons[ph].x,Photons[ph].y, 154 Photons[ph].u,Photons[ph].v,theta); 155 Debug("CPh %d\t%d\t%f\t%f\n\n",cphs,ph,CPhotons[cphs].x, 156 CPhotons[cphs].y); 157 158 148 159 /* Update first/last arrival times */ 149 160 if (first > CPhotons[cphs].t) first = CPhotons[cphs].t; … … 166 177 167 178 } /* if overflow */ 168 } /* else (=Photon passed) */179 } /* else (=Photon passed) */ 169 180 } /* end of loop inside datablock */ 170 181 } /* end of loop on datablocks */ … … 191 202 rheadp->CPhotons = (long) overflow * NR_OF_CPHOTONS + cphs; 192 203 fwrite(rheadp, sizeof(RflHeader), 1, rflfile); 204 for (myloop=0; myloop<sizeof(RflHeader)/4; myloop++) 205 fprintf(chkf, "%e ", *((float *)rheadp+myloop)); 206 fputc('\n', chkf); 193 207 194 208 /* If there was an overflow, append data from tempfile */ … … 252 266 /* Ok: set found at TRUE and exit loop */ 253 267 if (strncmp(cheadp->EVTH, "EVTH", 4) == 0 254 && first_Event <= cheadp->EvtNumber255 && cheadp->EvtNumber <= last_Event268 && first_Event <= (long)cheadp->EvtNumber 269 && (long)cheadp->EvtNumber <= last_Event 256 270 && low_Ecut <= cheadp->Etotal 257 271 && cheadp->Etotal <= high_Ecut)
Note:
See TracChangeset
for help on using the changeset viewer.