- Timestamp:
- 10/09/02 19:15:28 (22 years ago)
- Location:
- trunk/MagicSoft/Simulation/Detector/ReflectorII
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/ReflectorII/Makefile
r1431 r1535 19 19 # 20 20 # $RCSfile: Makefile,v $ 21 # $Revision: 1. 3$21 # $Revision: 1.4 $ 22 22 # $Author: bigongia $ 23 # $Date: 2002- 07-24 14:35:45$23 # $Date: 2002-10-09 18:15:27 $ 24 24 # 25 25 ################################################################## … … 55 55 #CXXFLAGS = -D__${SYSTEM}__ ${INCLUDES} ${OPTIM} ${DEBUG} 56 56 CXXFLAGS = -D__${SYSTEM}__ ${INCLUDES} ${OPTIM} 57 #CXXFLAGS = -D__${SYSTEM}__ ${INCLUDES} ${DEBUG} 58 57 59 CFLAGS = ${CXXFLAGS} 58 60 FFLAGS = ${CXXFLAGS} … … 74 76 ph2cph.c \ 75 77 header.c \ 78 attach.c \ 76 79 reflector.c 77 80 … … 95 98 ph2cph.o \ 96 99 header.o \ 100 attach.o \ 97 101 reflector.o 98 102 … … 173 177 # DO NOT DELETE THIS LINE -- make depend depends on it. 174 178 175 diag.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h 176 diag.o: /usr/include/gnu/stubs.h 177 diag.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h 178 diag.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h 179 diag.o: /usr/include/bits/types.h /usr/include/libio.h 180 diag.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h 181 diag.o: /usr/include/stdlib.h version.h diag.h 182 init.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h 183 init.o: /usr/include/gnu/stubs.h 184 init.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h 185 init.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h 186 init.o: /usr/include/bits/types.h /usr/include/libio.h 187 init.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h 188 init.o: /usr/include/string.h /usr/include/stdlib.h /usr/include/math.h 189 init.o: /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h 190 init.o: /usr/include/bits/mathcalls.h version.h diag.h init.h 191 parms.o: /usr/include/stdio.h /usr/include/features.h 192 parms.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h 193 parms.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h 194 parms.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h 195 parms.o: /usr/include/bits/types.h /usr/include/libio.h 196 parms.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h 197 parms.o: /usr/include/string.h /usr/include/stdlib.h /usr/include/math.h 198 parms.o: /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h 199 parms.o: /usr/include/bits/mathcalls.h diag.h parms.h init.h 200 geometry.o: /usr/include/stdio.h /usr/include/features.h 201 geometry.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h 202 geometry.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h 203 geometry.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h 204 geometry.o: /usr/include/bits/types.h /usr/include/libio.h 205 geometry.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h 206 geometry.o: /usr/include/string.h /usr/include/stdlib.h /usr/include/math.h 207 geometry.o: /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h 208 geometry.o: /usr/include/bits/mathcalls.h diag.h geometry.h init.h 209 atm.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h 210 atm.o: /usr/include/gnu/stubs.h 211 atm.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h 212 atm.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h 213 atm.o: /usr/include/bits/types.h /usr/include/libio.h 214 atm.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h 215 atm.o: /usr/include/string.h /usr/include/math.h /usr/include/bits/huge_val.h 216 atm.o: /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h diag.h atm.h 217 atm.o: init.h 218 ph2cph.o: /usr/include/stdio.h /usr/include/features.h 219 ph2cph.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h 220 ph2cph.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h 221 ph2cph.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h 222 ph2cph.o: /usr/include/bits/types.h /usr/include/libio.h 223 ph2cph.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h 224 ph2cph.o: /usr/include/math.h /usr/include/bits/huge_val.h 225 ph2cph.o: /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h diag.h 226 ph2cph.o: init.h lagrange.h 227 header.o: /usr/include/string.h /usr/include/features.h 228 header.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h 229 header.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h 230 header.o: header.h 231 reflector.o: /usr/include/stdio.h /usr/include/features.h 232 reflector.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h 233 reflector.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h 234 reflector.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h 235 reflector.o: /usr/include/bits/types.h /usr/include/libio.h 236 reflector.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h 237 reflector.o: /usr/include/stdlib.h /usr/include/string.h /usr/include/math.h 238 reflector.o: /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h 239 reflector.o: /usr/include/bits/mathcalls.h version.h diag.h init.h header.h 179 diag.o: /usr/include/stdio.h /usr/include/standards.h /usr/include/sys/seek.h 180 diag.o: /usr/include/va_list.h /usr/include/sys/types.h 181 diag.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h 182 diag.o: /usr/include/getopt.h /usr/include/sys/limits.h 183 diag.o: /usr/include/sys/machine/machlimits.h /usr/include/sys/syslimits.h 184 diag.o: /usr/include/sys/machine/machtime.h /usr/include/sys/rt_limits.h 185 diag.o: /usr/include/stdlib.h /usr/include/stdarg.h version.h diag.h 186 init.o: /usr/include/stdio.h /usr/include/standards.h /usr/include/sys/seek.h 187 init.o: /usr/include/va_list.h /usr/include/sys/types.h 188 init.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h 189 init.o: /usr/include/getopt.h /usr/include/sys/limits.h 190 init.o: /usr/include/sys/machine/machlimits.h /usr/include/sys/syslimits.h 191 init.o: /usr/include/sys/machine/machtime.h /usr/include/sys/rt_limits.h 192 init.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdlib.h 193 init.o: /usr/include/math.h version.h diag.h init.h 194 parms.o: /usr/include/stdio.h /usr/include/standards.h 195 parms.o: /usr/include/sys/seek.h /usr/include/va_list.h 196 parms.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h 197 parms.o: /usr/include/sys/select.h /usr/include/getopt.h 198 parms.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h 199 parms.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h 200 parms.o: /usr/include/sys/rt_limits.h /usr/include/string.h 201 parms.o: /usr/include/strings.h /usr/include/stdlib.h /usr/include/math.h 202 parms.o: diag.h parms.h init.h 203 geometry.o: /usr/include/stdio.h /usr/include/standards.h 204 geometry.o: /usr/include/sys/seek.h /usr/include/va_list.h 205 geometry.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h 206 geometry.o: /usr/include/sys/select.h /usr/include/getopt.h 207 geometry.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h 208 geometry.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h 209 geometry.o: /usr/include/sys/rt_limits.h /usr/include/string.h 210 geometry.o: /usr/include/strings.h /usr/include/stdlib.h /usr/include/math.h 211 geometry.o: diag.h geometry.h init.h 212 atm.o: /usr/include/stdio.h /usr/include/standards.h /usr/include/sys/seek.h 213 atm.o: /usr/include/va_list.h /usr/include/sys/types.h 214 atm.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h 215 atm.o: /usr/include/getopt.h /usr/include/sys/limits.h 216 atm.o: /usr/include/sys/machine/machlimits.h /usr/include/sys/syslimits.h 217 atm.o: /usr/include/sys/machine/machtime.h /usr/include/sys/rt_limits.h 218 atm.o: /usr/include/string.h /usr/include/strings.h /usr/include/math.h 219 atm.o: /usr/include/stdlib.h diag.h atm.h init.h 220 ph2cph.o: /usr/include/stdio.h /usr/include/standards.h 221 ph2cph.o: /usr/include/sys/seek.h /usr/include/va_list.h 222 ph2cph.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h 223 ph2cph.o: /usr/include/sys/select.h /usr/include/getopt.h 224 ph2cph.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h 225 ph2cph.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h 226 ph2cph.o: /usr/include/sys/rt_limits.h /usr/include/math.h 227 ph2cph.o: /usr/include/stdlib.h diag.h init.h lagrange.h 228 header.o: /usr/include/string.h /usr/include/standards.h 229 header.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h 230 header.o: /usr/include/sys/select.h /usr/include/strings.h header.h 231 attach.o: /usr/include/string.h /usr/include/standards.h 232 attach.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h 233 attach.o: /usr/include/sys/select.h /usr/include/strings.h 234 reflector.o: /usr/include/stdio.h /usr/include/standards.h 235 reflector.o: /usr/include/sys/seek.h /usr/include/va_list.h 236 reflector.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h 237 reflector.o: /usr/include/sys/select.h /usr/include/getopt.h 238 reflector.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h 239 reflector.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h 240 reflector.o: /usr/include/sys/rt_limits.h /usr/include/stdlib.h 241 reflector.o: /usr/include/string.h /usr/include/strings.h /usr/include/math.h 242 reflector.o: version.h diag.h init.h header.h -
trunk/MagicSoft/Simulation/Detector/ReflectorII/config.mk.linux
r1432 r1535 18 18 #--------------------------------------------------------------- 19 19 # $RCSfile: config.mk.linux,v $ 20 # $Revision: 1. 1$20 # $Revision: 1.2 $ 21 21 # $Author: bigongia $ 22 # $Date: 2002- 07-24 14:43:34$22 # $Date: 2002-10-09 18:15:27 $ 23 23 ################################################################## 24 24 # @maintitle -
trunk/MagicSoft/Simulation/Detector/ReflectorII/geometry.c
r1431 r1535 9 9 extern char line[]; /* parsing buf. (init) */ 10 10 extern char axisdev_filename[256], reflectivity_filename[256]; 11 12 float mean_refl; /* Mirror mean reflectivity 270-610 nm.13 * AM June 2002.14 */15 11 16 12 float ct_Focal_mean; /* focal dist. (mean) (cm) */ … … 24 20 25 21 mirror *ct_data=NULL; /* ptr to mirror data */ 26 FILE *ct_BinaryData=NULL; /* binary data for mirrors */27 char ct_BinaryName[128]; /* binary data filename */28 22 29 23 int nReflectivity=0; /* elements in refl. table */ … … 66 60 FILE *datfile = fopen(datname, "r"); 67 61 int current = 0; 68 69 mean_refl = 0.;70 62 71 63 if (datfile == NULL) … … 93 85 &Reflectivity[1][current])) 94 86 { 95 // Added June 2002, AM:96 mean_refl += Reflectivity[1][current];97 87 current++; 98 88 if (current >= nReflectivity) break; … … 102 92 103 93 nReflectivity = current; 104 if (current > 0)105 mean_refl /= (float) current;106 94 107 95 } /* end of ReadReflectivity */ -
trunk/MagicSoft/Simulation/Detector/ReflectorII/header.c
r1431 r1535 2 2 #include "header.h" 3 3 4 /* Need to be defined the procedures to set the values in 5 float TimeFirst; 6 float TimeLast; */ 7 8 static RflHeader rhead; RflHeader *rheadp = &rhead; 9 static CerHeader chead; CerHeader *cheadp = &chead; 4 static RflEventHeader rhead; RflEventHeader *rheadp = &rhead; 5 static CerEventHeader chead; CerEventHeader *cheadp = &chead; 10 6 11 7 extern float fixed_Phi, fixed_Theta; 12 extern int ct_NMirrors; 13 extern float mean_refl; 8 extern int is_Fixed_Target; 14 9 15 void TranslateHeader(Rfl Header *r, CerHeader *c)10 void TranslateHeader(RflEventHeader *r, CerEventHeader *c) 16 11 { 17 r->EvtNumber = c->EvtNumber; 18 r->PrimaryID = c->PrimaryID; 19 r->Etotal = c->Etotal; 20 r->Thick0 = c->Thick0; 21 r->FirstTarget = c->FirstTarget; 22 r->zFirstInt = c->zFirstInt; 23 r->Theta = c->Theta; 24 r->Phi = c->Phi; 25 r->NumRndSeq = c->NumRndSeq; 26 r->RunNumber = c->RunNumber; 27 r->DateRun = c->DateRun; 28 r->Corsika_version= c->Corsika_version; 29 r->NumObsLev = c->NumObsLev; 30 r->HeightLev = c->HeightLev[0]; 12 memcpy(r,c,154*sizeof(float)); 31 13 32 33 r->SlopeSpec = c->SlopeSpec; 34 r->ELowLim = c->ELowLim; 35 r->EUppLim = c->EUppLim; 36 r->ThetaMin = c->ThetaMin; 37 r->ThetaMax = c->ThetaMax; 38 r->PhiMin = c->PhiMin; 39 r->PhiMax = c->PhiMax; 40 r->CWaveLower = c->CWaveLower; 41 r->CWaveUpper = c->CWaveUpper; 42 43 memcpy(r->p, c->p, 3*sizeof(float)); 44 memcpy(r->RndData, c->RndData, 30*sizeof(float)); 45 memcpy(r->CorePos, c->CorePos, 40*sizeof(float)); 46 47 /* Next 4 variables added in June 2002, AM */ 48 r->telescopePhi = fixed_Phi; 49 r->telescopeTheta = fixed_Theta; 50 r->num_mirrors = ct_NMirrors; 51 r->mean_reflectivity = mean_refl; 52 53 if (c->Corsika_version >= 6.) /* Viewcone option implemented only in c6xx */ 14 if (is_Fixed_Target) // <- Added in September 2002, AM 54 15 { 55 if (c->viewcone_angles[0] > 0.) 56 { 57 printf ("ERROR: Input cer file was run using Corsika option\n"); 58 printf (" VIEWCONE VUECON(1) VUECON(2) with VUECON(1) > 0\n"); 59 printf (" The reflector program only supports VUECON(1) = 0\n\n"); 60 exit(-1); 61 } 62 else 63 r->ViewConeRadius = c->viewcone_angles[1]; /* degrees */ 16 /* Next 2 variables added in June 2002, AM */ 17 r->telescopePhi = fixed_Phi; 18 r->telescopeTheta = fixed_Theta; 64 19 } 20 // If no fixed target, telescope always points towards shower. AM Sep 2002 65 21 else 66 r->ViewConeRadius = 0.; 67 22 { 23 r->telescopePhi = cheadp->Phi; 24 r->telescopeTheta = cheadp->Theta; 25 } 68 26 } /* end of TranslateHeader */ 69 27 -
trunk/MagicSoft/Simulation/Detector/ReflectorII/header.h
r1431 r1535 2 2 #define __RFL_HEADER__ 3 3 4 typedef struct /* EVTH from cerfile */ 4 /* RUNH from cerfile. See CORSIKA manual for explanations */ 5 typedef struct 6 { char RUNH[4]; 7 float RunNumber; 8 float date; 9 float Corsika_version; 10 float NumObsLev; 11 float HeightLev[10]; 12 float SlopeSpec; /* Slope of primaries' energy spectrum */ 13 float ELowLim; 14 float EUppLim; /* Limits of energy range for generation */ 15 float EGS4_flag; 16 float NKG_flag; 17 float Ecutoffh; 18 float Ecutoffm; 19 float Ecutoffe; 20 float Ecutoffg; 21 /* Physical constants and interaction flags (see CORSIKA manual): */ 22 float C[50]; 23 float dummy1[20]; /* not used */ 24 float CKA[40]; 25 float CETA[5]; 26 float CSTRBA[11]; 27 float dummy2[104]; /* not used */ 28 float AATM[5]; 29 float BATM[5]; 30 float CATM[5]; 31 float NFL[4]; 32 } CerRunHeader; 33 34 35 /* EVTH from cerfile. See CORSIKA manual for explanations */ 36 typedef struct 5 37 { char EVTH[4]; 6 38 float EvtNumber; … … 71 103 float Multipl; 72 104 float CorePos[2][20]; 73 74 float dmmy1[14]; 105 float SIBYLL[2]; 106 float QGSJET[2]; 107 float DPMJET[2]; 108 float VENUS_cross; 109 float mu_mult_scat; 110 float NKG_range; 111 float EFRCTHN[2]; 112 float WMAX[2]; 113 float rthin_rmax; 114 75 115 float viewcone_angles[2]; /* (degrees) Inner and outer angles in 76 116 * Corsika's VIEWCONE option 77 117 */ 78 118 float dmmy2[119]; 79 } CerHeader; 80 81 typedef struct /* EVTH from rflfile */ 82 { float EvtNumber; 119 } CerEventHeader; 120 121 /* EVTH from rflfile. We include first all the information from the 122 Corsika event header (except empty bytes) */ 123 124 typedef struct 125 { char EVTH[4]; 126 float EvtNumber; 83 127 float PrimaryID; 84 128 float Etotal; … … 97 141 float Corsika_version; 98 142 99 float NumObsLev; /* Should be 1 for MAGIC simulation */ 100 float HeightLev; /* Observation Level */ 101 102 /* Changed meaning of next 9 variables. June 2002, A.Moralejo: */ 103 float num_mirrors; 104 float mean_reflectivity; 143 float NumObsLev; 144 float HeightLev[10]; 145 146 float SlopeSpec; 147 float ELowLim; 148 float EUppLim; 149 150 float Ecutoffh; 151 float Ecutoffm; 152 float Ecutoffe; 153 float Ecutoffg; 154 155 float NFLAIN; 156 float NFLDIF; 157 float NFLPI0; 158 float NFLPIF; 159 float NFLCHE; 160 float NFRAGM; 161 162 float Bx; 163 float By; 164 165 float EGS4yn; 166 float NKGyn; 167 float GHEISHAyn; 168 float VENUSyn; 169 float CERENKOVyn; 170 float NEUTRINOyn; 171 float HORIZONTyn; 172 float COMPUTER; 173 174 float ThetaMin; 175 float ThetaMax; 176 float PhiMin; 177 float PhiMax; 178 179 float CBunchSize; 180 float CDetInX,CDetInY; 181 float CSpacInX,CSpacInY; 182 float CLenInX,CLenInY; 183 float COutput; 184 185 float AngleNorthX; 186 float MuonInfo; 187 188 float StepLength; 189 float CWaveLower; 190 float CWaveUpper; 191 float Multipl; 192 float CorePos[2][20]; 193 float SIBYLL[2]; 194 float QGSJET[2]; 195 float DPMJET[2]; 196 float VENUS_cross; 197 float mu_mult_scat; 198 float NKG_range; 199 float EFRCTHN[2]; 200 float WMAX[2]; 201 float rthin_rmax; 202 203 float viewcone_angles[2]; 204 /* (degrees) Inner and outer angles in 205 * Corsika's VIEWCONE option. This is 206 * only possible with Corsika>6 versions. In 207 * that case, PhiMin=PhiMax and 208 * ThetaMin=ThetaMax (also in this header) 209 * indicate the axis of this cone. 210 */ 211 212 /* ^^^ Up to here, the info from the CORSIKA event header. */ 213 214 /* Telescope orientation: */ 215 float telescopePhi; /* rad */ 216 float telescopeTheta; /* rad */ 217 218 /* Time of first and last photon: */ 219 float TimeFirst; 220 float TimeLast; 221 222 /* 6 parameters and chi2 of the NKG fit to the longitudinal 223 * particle distribution (see CORSIKA manual for explanation): 224 */ 105 225 float longi_Nmax; 106 226 float longi_t0; … … 111 231 float longi_chi2; 112 232 113 float SlopeSpec; 114 float ELowLim; 115 float EUppLim; 116 117 float ThetaMin; 118 float ThetaMax; 119 float PhiMin; 120 float PhiMax; 121 122 float CWaveLower; 123 float CWaveUpper; 124 float CorePos[2][20]; 125 float TimeFirst; 126 float TimeLast; 127 128 /* AM, 23/05/2002: Changed meaning of following 129 * three variables (which were unused before): 130 */ 131 float telescopePhi; /* rad */ 132 float telescopeTheta; /* rad */ 133 134 float ViewConeRadius; /* Degrees. 135 * Radius of "view cone" when the primaries' 136 * directions generated by Corsika lie within 137 * a cone around a fixed direction. This is 138 * only possible with Corsika>6 versions. In 139 * that case, PhiMin=PhiMax and 140 * ThetaMin=ThetaMax (also in this header) 141 * indicate the axis of this cone. 142 * If ViewConeRadius==0, it means that 143 * the VIEWCONE option was not used. 144 */ 145 146 233 /* Now the photon statistics of the event: */ 147 234 float CORSIKAPhs; /* Original photons written by Corsika */ 148 235 float AtmAbsPhs; /* Photons absorbed by the atmosphere */ … … 152 239 float OutOfChamPhs; /* Photons outside the camera */ 153 240 float CPhotons; /* Photons reaching the camera */ 154 } RflHeader; 241 242 float dummy[10]; /* not used */ 243 } RflEventHeader; 155 244 156 245 … … 168 257 } Event_end; 169 258 170 void TranslateHeader(Rfl Header *r, CerHeader *c);259 void TranslateHeader(RflEventHeader *r, CerEventHeader *c); 171 260 172 261 #endif -
trunk/MagicSoft/Simulation/Detector/ReflectorII/init.h
r1431 r1535 48 48 extern long Seeds[2]; /* random seeds */ 49 49 50 extern FILE *ct_BinaryData; /* binary data for mirrors */51 extern char ct_BinaryName[]; /* binary data filename */52 50 extern float ct_Focal_mean; /* focal dist. (mean) (cm) */ 53 51 extern float ct_PSpread_mean; /* pt. spread fn. (mean) (cm) */ … … 102 100 " Single file version\n" \ 103 101 " - D. Bastieri & C. Bigongiari - Jan 2000\n" \ 102 " Version 0.6\n" \ 103 " - A. Moralejo - October 2002\n" \ 104 104 " ################################################\n\n" 105 105 #define SIGN_ERROR_FTL /* program, version */ \ -
trunk/MagicSoft/Simulation/Detector/ReflectorII/parms.c
r1431 r1535 11 11 12 12 char axisdev_filename[256], reflectivity_filename[256]; 13 char geo_filename[256]; 13 14 14 15 /* Prototypes */ … … 82 83 if ((geofile=fopen(value_ptr, "r")) == NULL) 83 84 FatalError(GEOF_ERROR_FTL, value_ptr); 85 else 86 strcpy(geo_filename, value_ptr); 84 87 Message(GEOF_OPEN__MSG, value_ptr); 85 strcat(strcpy(ct_BinaryName, value_ptr), ".mirr");86 ct_BinaryData = fopen(ct_BinaryName, "r");87 88 break; 88 89 case axisdev_file: -
trunk/MagicSoft/Simulation/Detector/ReflectorII/ph2cph.c
r1431 r1535 94 94 float sx, sy; 95 95 float t1, t2; 96 float dummy = 0.; 97 96 98 97 99 void makeOmega(float theta, float phi); … … 255 257 256 258 } else { 257 258 d = (float) sqrt( b*b - 4.0*a*c ); 259 259 260 /* Introduce positiveness check, AM 3/7/2002 */ 261 262 dummy = b*b - 4.0*a*c; 263 264 if (dummy < 0.) /* No intersection */ 265 return 2; 266 267 d = (float) sqrt(dummy); 268 260 269 /* two possible values for z */ 261 270 … … 276 285 xcut[0] = xCT[0] + rCT[0]/rCT[2]*(xcut[2]-xCT[2]); 277 286 xcut[1] = xCT[1] + rCT[1]/rCT[2]*(xcut[2]-xCT[2]); 287 278 288 279 289 /* CBC */ … … 285 295 sx = Lin2Curv( xcut[0] ); 286 296 sy = Lin2Curv( xcut[1] ); 287 297 288 298 /* CBC */ 289 299 Debug("@4 sx sy %f %f\n", sx, sy); … … 310 320 if (distmirr2 < distmirr) { 311 321 i_mirror = i; 312 distmirr = distmirr2;322 distmirr = distmirr2; 313 323 } 314 324 } -
trunk/MagicSoft/Simulation/Detector/ReflectorII/reflector.c
r1431 r1535 13 13 * 14 14 * ---------------------------------------------------------------------- 15 * 16 * Modified: October 2002 17 * Author: Abelardo Moralejo 18 * Version 0.6: introduced a run header and changed event header to keep 19 * all information from CORSIKA. In addition, now the magic.def, axisdev.dat 20 * and reflectivity.dat are attached at the end of the reflector output file 21 * to keep also all the parameters with which the program is run. 22 * 23 * ---------------------------------------------------------------------- 15 24 */ 16 25 … … 36 45 static long writep = 0L; /* write ptr (on rflfile) */ 37 46 38 extern Cer Header *cheadp; /* var inited in header.c */39 extern Rfl Header *rheadp; /* var inited in header.c */47 extern CerEventHeader *cheadp; /* var inited in header.c */ 48 extern RflEventHeader *rheadp; /* var inited in header.c */ 40 49 41 50 /* Prototypes */ … … 43 52 FILE *GetNextFile(char *cername); 44 53 static int GetEvent(void); 45 static int ProcessEvent(CerHeader *cheadp, FILE *cerfile, FILE *rflfile); 54 static int ProcessEvent(CerEventHeader *cheadp, FILE *cerfile, FILE *rflfile); 55 void attach(FILE *f1, FILE *f2); 56 46 57 47 58 FILE *chkf = NULL; … … 51 62 52 63 main(void) 53 { long event = 0L; /* event counter */ 64 { 65 extern char axisdev_filename[256], reflectivity_filename[256]; 66 extern char geo_filename[256]; 67 FILE *dummy; 68 long event = 0L; /* event counter */ 54 69 55 70 /* Read init & geometry parms, init files and vars */ … … 71 86 fwrite(FLAG_END_OF_FILE, SIZE_OF_FLAGS, 1, rflfile); 72 87 73 /* Close file */ 88 /* Attach parameter files used for running the program: */ 89 dummy = fopen (geo_filename,"r"); 90 attach (rflfile, dummy); 91 fclose(dummy); 92 93 dummy = fopen (axisdev_filename,"r"); 94 attach (rflfile, dummy); 95 fclose(dummy); 96 97 dummy = fopen (reflectivity_filename,"r"); 98 attach (rflfile, dummy); 99 fclose(dummy); 100 101 /* Close reflector output file */ 74 102 Log(RFLF_CLOSE_LOG); 75 103 fclose(rflfile); … … 82 110 } /* end of main */ 83 111 84 static int ProcessEvent(Cer Header *cheadp, FILE *cerfile, FILE *rflfile)112 static int ProcessEvent(CerEventHeader *cheadp, FILE *cerfile, FILE *rflfile) 85 113 { extern int absorption(float wlen, float height, float theta); 86 114 extern int ph2cph(photon *ph, cphoton *cph); … … 92 120 extern void makeOmegaI(float theta, float phi); 93 121 94 char pp[256];95 122 96 123 /* Various counters: phs = absphs + refphs[0..3] + cphs */ … … 172 199 for (ph=0; ph<PH_IN_DATABLOCK; ph++) 173 200 { 174 if (Photons[ph].w <= 0.) break; 201 /* Added July 2002, AM: check integrity of photon info: 202 Sometimes we found NaN values inside cerXXXXX file. 203 */ 204 if (isnan(Photons[ph].w) || isnan(Photons[ph].x) || 205 isnan(Photons[ph].y) || isnan(Photons[ph].u) || 206 isnan(Photons[ph].v) || isnan(Photons[ph].t) || 207 isnan(Photons[ph].h)) 208 { 209 printf("Warning: skipped one photon because its data contained Not-a-Number!\n"); 210 continue; 211 } 212 213 if (! (Photons[ph].w > 0.) ) break; 175 214 176 215 CPhotons[cphs].w = Photons[ph].w; 177 216 Photons[ph].w = wlen = (float) fmod(Photons[ph].w, 1000.); 178 217 179 /* TEMPORARY FIX,AM Nov 2001: we found that sometimes the value218 /* AM Nov 2001: we found that sometimes the value 180 219 stored in Photons[ph].w is not correct, and can result in a 181 220 wavelength beyond 600 nm, which makes the program crash later. 182 Now we force wlen to its expected range: 183 */ 184 185 wlen = MIN(MAX(290.,wlen),600.); 186 221 222 AM July 2002: we now simply skip the photon if the wavelength 223 is not in the expected range, which we now take from the corsika 224 event header (just in case we would change it in the future). 225 */ 226 227 if (wlen < cheadp->CWaveLower || wlen > cheadp->CWaveUpper) 228 { 229 printf("Warning: skipped one photon with strange wavelength: %f nm\n", wlen); 230 continue; 231 } 187 232 188 233 /* ADDED AM May 2002: now we take into account the telescope … … 215 260 ph2cph(&Photons[ph], &CPhotons[cphs]))) 216 261 refphs[ref_type-1]++; 262 217 263 else /* Photon passed */ 218 264 { … … 260 306 rheadp->TimeLast = last; 261 307 262 /* Update Rfl Header with info on ph/cph nrs and write it */308 /* Update RflEventHeader with info on ph/cph nrs and write it */ 263 309 rheadp->CORSIKAPhs = phs; 264 310 rheadp->AtmAbsPhs = absphs; … … 268 314 rheadp->OutOfChamPhs = refphs[3]; 269 315 rheadp->CPhotons = (long) overflow * NR_OF_CPHOTONS + cphs; 270 fwrite(rheadp, sizeof(Rfl Header), 1, rflfile);271 272 /* for (myloop=0; myloop<sizeof(Rfl Header)/4; myloop++)316 fwrite(rheadp, sizeof(RflEventHeader), 1, rflfile); 317 318 /* for (myloop=0; myloop<sizeof(RflEventHeader)/4; myloop++) 273 319 * fprintf(chkf, "%e ", *((float *)rheadp+myloop)); 274 320 * fputc('\n', chkf); … … 284 330 fseek(tmpf, 0L, SEEK_SET); /* Start from the beginning */ 285 331 while (overflow--) 286 { fread (CPhotons, sizeof(cphoton), NR_OF_CPHOTONS, tmpf); 287 fwrite(CPhotons, sizeof(cphoton), NR_OF_CPHOTONS, rflfile); } 332 { 333 fread (CPhotons, sizeof(cphoton), NR_OF_CPHOTONS, tmpf); 334 fwrite(CPhotons, sizeof(cphoton), NR_OF_CPHOTONS, rflfile); 335 } 288 336 289 337 /* Reload data in CPhotons */ … … 291 339 292 340 /* Close (and delete) temp file */ 293 fclose(tmpf); } 341 fclose(tmpf); 342 } 294 343 295 344 /* Write (remaining) cphotons */ 345 296 346 fwrite(CPhotons, sizeof(cphoton), cphs, rflfile); 297 347 … … 308 358 309 359 static int GetEvent(void) 310 { int found = FALSE, /* event found */ 311 isWrong = FALSE; /* cerfile is wrong */ 312 static int newFile = TRUE; /* if TRUE, check if cerfile is valid */ 313 314 do 315 { /* In case the just-opened file is a valid cerfile, 316 starting with a RUNH, loop until a valid event is found: 317 id est with: first_Event <= EvtNumber <= last_Event 318 and low_Ecut <= Etotal <= high_Ecut 319 If the search was successful, "found" is set to TRUE. 320 If there are reading errors, "isWrong" is set to TRUE. */ 360 { 361 int found = FALSE, /* event found */ 362 isWrong = FALSE; /* cerfile is wrong */ 363 static int newFile = TRUE; /* if TRUE, check if cerfile is valid */ 364 365 CerRunHeader cRunHead; 366 367 do 368 { 369 /* In case the just-opened file is a valid cerfile, 370 starting with a RUNH, loop until a valid event is found: 371 id est with: first_Event <= EvtNumber <= last_Event 372 and low_Ecut <= Etotal <= high_Ecut 373 If the search was successful, "found" is set to TRUE. 374 If there are reading errors, "isWrong" is set to TRUE. */ 321 375 322 376 if (newFile 323 && (1 != fread(cheadp, sizeof(Cer Header), 1, cerfile)377 && (1 != fread(cheadp, sizeof(CerEventHeader), 1, cerfile) 324 378 || strncmp(cheadp->EVTH, "RUNH", 4))) 325 379 { isWrong = TRUE; } 326 380 327 381 else do 328 { /* Push fileptr in case it is a "EVTH" */ 329 readp = ftell(cerfile); 330 331 /* Error: exit loop */ 332 if (1 != fread(cheadp, sizeof(CerHeader), 1, cerfile)) 382 { 383 if (newFile) 384 { 385 /* Write Reflector "run header" (one per cer file!): */ 386 memcpy(&cRunHead, cheadp, sizeof(CerEventHeader)); 387 fwrite(&cRunHead, sizeof(CerRunHeader), 1, rflfile); 388 } 389 390 /* Push fileptr in case it is a "EVTH" */ 391 readp = ftell(cerfile); 392 393 /* Error: exit loop */ 394 if (1 != fread(cheadp, sizeof(CerEventHeader), 1, cerfile)) 333 395 { isWrong = TRUE; break; } 334 396 335 336 337 && first_Event <= (long)cheadp->EvtNumber338 && (long)cheadp->EvtNumber <= last_Event339 && low_Ecut <= cheadp->Etotal340 && cheadp->Etotal <= high_Ecut)397 /* Ok: set found at TRUE and exit loop */ 398 if (strncmp(cheadp->EVTH, "EVTH", 4) == 0 399 && first_Event <= (long)cheadp->EvtNumber 400 && (long)cheadp->EvtNumber <= last_Event 401 && low_Ecut <= cheadp->Etotal 402 && cheadp->Etotal <= high_Ecut) 341 403 { found = TRUE; } 342 404 343 344 345 405 /* File is finished: exit loop */ 406 else if (strncmp(cheadp->EVTH, "RUNE", 4) == 0) 407 break; 346 408 347 409 } while(found == FALSE); -
trunk/MagicSoft/Simulation/Detector/ReflectorII/version.h
r1431 r1535 6 6 7 7 #define PROGRAM reflector 8 #define VERSION 0. 58 #define VERSION 0.6 9 9 10 10 #endif
Note:
See TracChangeset
for help on using the changeset viewer.