Changeset 5110 for trunk/MagicSoft/Simulation/Detector
- Timestamp:
- 09/17/04 18:36:25 (20 years ago)
- Location:
- trunk/MagicSoft/Simulation/Detector/Starfield
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/Starfield/Makefile
r432 r5110 3 3 ## Starfield Generator Makefile 4 4 ## 5 ## $Id: Makefile,v 1. 3 2000-09-21 10:31:36 haraldExp $5 ## $Id: Makefile,v 1.4 2004-09-17 17:36:25 moralejo Exp $ 6 6 ## 7 7 ################################################################## … … 16 16 CXX = g++ 17 17 18 18 19 INCLUDES = -I${INCLUDE} \ 19 -I${INCLUDE_COR} 20 -I${INCLUDE_COR} \ 21 -I${ROOTSYS}/include 20 22 21 23 WARNINGS = -Wall 22 24 23 CXXFLAGS = ${WARNINGS} ${INCLUDES} -ansi25 CXXFLAGS = ${WARNINGS} ${INCLUDES} 24 26 25 LIBS = -L${RANLIBDIR} -L/usr/local/lib -L/usr/lib -lm 27 LIBS = -L${RANLIBDIR} -L/usr/local/lib -L/usr/lib -lm 26 28 27 29 … … 111 113 112 114 # DO NOT DELETE THIS LINE -- make depend depends on it. 113 114 starfield.o: starfield.h /usr/include/stdlib.h /usr/include/standards.h115 starfield.o: /usr/include/getopt.h /usr/include/sys/types.h116 starfield.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h117 starfield.o: /usr/include/string.h /usr/include/strings.h /usr/include/math.h118 starfield.o: /usr/include/dirent.h /usr/include/unistd.h119 starfield.o: /usr/include/sys/access.h /usr/include/sys/seek.h120 starfield.o: convertcorsika.h photon.hxx star.hxx /usr/include/stdio.h121 starfield.o: /usr/include/va_list.h /usr/include/sys/limits.h122 starfield.o: /usr/include/sys/machine/machlimits.h123 starfield.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h124 starfield.o: /usr/include/sys/rt_limits.h parameters.h125 star.o: star.hxx /usr/include/math.h /usr/include/standards.h126 star.o: /usr/include/stdlib.h /usr/include/getopt.h /usr/include/sys/types.h127 star.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h128 star.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdio.h129 star.o: /usr/include/sys/seek.h /usr/include/va_list.h130 star.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h131 star.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h132 star.o: /usr/include/sys/rt_limits.h133 photon.o: photon.hxx /usr/include/math.h /usr/include/standards.h134 photon.o: /usr/include/stdlib.h /usr/include/getopt.h135 photon.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h136 photon.o: /usr/include/sys/select.h137 convertcorsika.o: convertcorsika.h /usr/include/string.h138 convertcorsika.o: /usr/include/standards.h /usr/include/sys/types.h139 convertcorsika.o: /usr/include/mach/machine/vm_types.h140 convertcorsika.o: /usr/include/sys/select.h /usr/include/strings.h photon.hxx141 convertcorsika.o: /usr/include/math.h /usr/include/stdlib.h142 convertcorsika.o: /usr/include/getopt.h143 parameters.o: parameters.h /usr/include/stdio.h /usr/include/standards.h144 parameters.o: /usr/include/sys/seek.h /usr/include/va_list.h145 parameters.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h146 parameters.o: /usr/include/sys/select.h /usr/include/getopt.h147 parameters.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h148 parameters.o: /usr/include/sys/syslimits.h149 parameters.o: /usr/include/sys/machine/machtime.h150 parameters.o: /usr/include/sys/rt_limits.h151 ../include-CORSIKA/COREventHeader.o: ../include-CORSIKA/COREventHeader.hxx152 ../include-CORSIKA/COREventHeader.o: /usr/include/stdlib.h153 ../include-CORSIKA/COREventHeader.o: /usr/include/standards.h154 ../include-CORSIKA/COREventHeader.o: /usr/include/getopt.h155 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/types.h156 ../include-CORSIKA/COREventHeader.o: /usr/include/mach/machine/vm_types.h157 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/select.h158 ../include-CORSIKA/COREventHeader.o: /usr/include/math.h159 ../include-CORSIKA/CORParticle.o: ../include-CORSIKA/CORParticle.hxx160 ../include-CORSIKA/CORParticle.o: /usr/include/stdlib.h161 ../include-CORSIKA/CORParticle.o: /usr/include/standards.h162 ../include-CORSIKA/CORParticle.o: /usr/include/getopt.h163 ../include-CORSIKA/CORParticle.o: /usr/include/sys/types.h164 ../include-CORSIKA/CORParticle.o: /usr/include/mach/machine/vm_types.h165 ../include-CORSIKA/CORParticle.o: /usr/include/sys/select.h166 ../include-CORSIKA/CORParticle.o: /usr/include/math.h167 ../include-CORSIKA/CORStatfile.o: ../include-CORSIKA/CORStatfile.hxx168 ../include-CORSIKA/CORStatfile.o: /usr/include/stdlib.h169 ../include-CORSIKA/CORStatfile.o: /usr/include/standards.h170 ../include-CORSIKA/CORStatfile.o: /usr/include/getopt.h171 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/types.h172 ../include-CORSIKA/CORStatfile.o: /usr/include/mach/machine/vm_types.h173 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/select.h174 ../include-CORSIKA/CORStatfile.o: /usr/include/math.h -
trunk/MagicSoft/Simulation/Detector/Starfield/Makefile.osf
r1708 r5110 3 3 ## Starfield Generator Makefile 4 4 ## 5 ## $Id: Makefile.osf,v 1. 1 2003-01-14 13:48:38 blanchExp $5 ## $Id: Makefile.osf,v 1.2 2004-09-17 17:36:25 moralejo Exp $ 6 6 ## 7 7 ################################################################## … … 110 110 111 111 # DO NOT DELETE THIS LINE -- make depend depends on it. 112 113 starfield.o: starfield.h /usr/include/stdlib.h /usr/include/standards.h114 starfield.o: /usr/include/getopt.h /usr/include/sys/types.h115 starfield.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h116 starfield.o: /usr/include/stdio.h /usr/include/sys/seek.h117 starfield.o: /usr/include/va_list.h /usr/include/sys/limits.h118 starfield.o: /usr/include/sys/machine/machlimits.h119 starfield.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h120 starfield.o: /usr/include/sys/rt_limits.h /usr/include/string.h121 starfield.o: /usr/include/strings.h /usr/include/math.h /usr/include/dirent.h122 starfield.o: /usr/include/unistd.h /usr/include/sys/access.h convertcorsika.h123 starfield.o: photon.hxx star.hxx parameters.h124 star.o: star.hxx /usr/include/math.h /usr/include/standards.h125 star.o: /usr/include/stdlib.h /usr/include/getopt.h /usr/include/sys/types.h126 star.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h127 star.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdio.h128 star.o: /usr/include/sys/seek.h /usr/include/va_list.h129 star.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h130 star.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h131 star.o: /usr/include/sys/rt_limits.h132 photon.o: photon.hxx /usr/include/math.h /usr/include/standards.h133 photon.o: /usr/include/stdlib.h /usr/include/getopt.h134 photon.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h135 photon.o: /usr/include/sys/select.h136 convertcorsika.o: convertcorsika.h /usr/include/string.h137 convertcorsika.o: /usr/include/standards.h /usr/include/sys/types.h138 convertcorsika.o: /usr/include/mach/machine/vm_types.h139 convertcorsika.o: /usr/include/sys/select.h /usr/include/strings.h photon.hxx140 convertcorsika.o: /usr/include/math.h /usr/include/stdlib.h141 convertcorsika.o: /usr/include/getopt.h142 parameters.o: parameters.h /usr/include/stdio.h /usr/include/standards.h143 parameters.o: /usr/include/sys/seek.h /usr/include/va_list.h144 parameters.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h145 parameters.o: /usr/include/sys/select.h /usr/include/getopt.h146 parameters.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h147 parameters.o: /usr/include/sys/syslimits.h148 parameters.o: /usr/include/sys/machine/machtime.h149 parameters.o: /usr/include/sys/rt_limits.h150 ../include-CORSIKA/COREventHeader.o: ../include-CORSIKA/COREventHeader.hxx151 ../include-CORSIKA/COREventHeader.o: /usr/include/stdlib.h152 ../include-CORSIKA/COREventHeader.o: /usr/include/standards.h153 ../include-CORSIKA/COREventHeader.o: /usr/include/getopt.h154 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/types.h155 ../include-CORSIKA/COREventHeader.o: /usr/include/mach/machine/vm_types.h156 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/select.h157 ../include-CORSIKA/COREventHeader.o: /usr/include/math.h158 ../include-CORSIKA/CORParticle.o: ../include-CORSIKA/CORParticle.hxx159 ../include-CORSIKA/CORParticle.o: /usr/include/stdlib.h160 ../include-CORSIKA/CORParticle.o: /usr/include/standards.h161 ../include-CORSIKA/CORParticle.o: /usr/include/getopt.h162 ../include-CORSIKA/CORParticle.o: /usr/include/sys/types.h163 ../include-CORSIKA/CORParticle.o: /usr/include/mach/machine/vm_types.h164 ../include-CORSIKA/CORParticle.o: /usr/include/sys/select.h165 ../include-CORSIKA/CORParticle.o: /usr/include/math.h166 ../include-CORSIKA/CORStatfile.o: ../include-CORSIKA/CORStatfile.hxx167 ../include-CORSIKA/CORStatfile.o: /usr/include/stdlib.h168 ../include-CORSIKA/CORStatfile.o: /usr/include/standards.h169 ../include-CORSIKA/CORStatfile.o: /usr/include/getopt.h170 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/types.h171 ../include-CORSIKA/CORStatfile.o: /usr/include/mach/machine/vm_types.h172 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/select.h173 ../include-CORSIKA/CORStatfile.o: /usr/include/math.h -
trunk/MagicSoft/Simulation/Detector/Starfield/convertcorsika.cxx
r797 r5110 48 48 } 49 49 50 cerfile.open(cor_dir, ios::out); 50 cerfile.open(cor_dir, ios::out|ios::binary); 51 51 52 /*if((cerfilec=fopen(cor_dir,"wb"))==NULL){ 52 53 printf("C-style::Cannot create cerenkov file.\n"); … … 128 129 strcat(stat_dir, stat_file); 129 130 130 cerfile.open (stat_dir );131 cerfile.open (stat_dir, ios::out|ios::binary); 131 132 132 133 cout<<"Writing binary statistics file "<<" "<<stat_dir<<" "<<"..."<<endl; -
trunk/MagicSoft/Simulation/Detector/Starfield/parameters.cxx
r431 r5110 18 18 float dec_arcsec; 19 19 char dummy[160]; 20 21 in->ipfx(1); // tell the io system that we are reading formatted22 20 23 21 in->getline(dummy, sizeof(dummy), '\n'); -
trunk/MagicSoft/Simulation/Detector/Starfield/parameters.h
r431 r5110 2 2 #define _PARAMETERS_H_ 3 3 4 #include <iostream .h>5 #include <fstream .h>4 #include <iostream> 5 #include <fstream> 6 6 #include <stdio.h> 7 7 … … 14 14 #endif 15 15 16 using namespace std; 16 17 17 18 class parameters { -
trunk/MagicSoft/Simulation/Detector/Starfield/photon.hxx
r341 r5110 9 9 10 10 #include <math.h> 11 #include <iostream .h>11 #include <iostream> 12 12 #include <stdlib.h> 13 13 -
trunk/MagicSoft/Simulation/Detector/Starfield/star.hxx
r341 r5110 4 4 5 5 #include <math.h> 6 #include <string.h>7 6 #include <stdio.h> 8 #include <iostream.h> 9 #include <fstream.h> 7 #include <iostream> 8 #include <string> 9 #include <fstream> 10 10 #include "jcmacros.h" 11 11 … … 63 63 #endif 64 64 65 65 using namespace std; 66 66 67 67 class star{ -
trunk/MagicSoft/Simulation/Detector/Starfield/starfield.cxx
r432 r5110 4 4 // (c) 2000 D. Petry 5 5 // 6 // 15/09/2004, A. Moralejo: 7 // - Adapted to gcc 3.2 under root 3.05.07 8 // - Fixed algorithm to calculate director cosines of incident photons. 9 // Former algorithm resulted in mirrored images on the camera (which we 10 // must not have after reflection on a parabollic dish). 11 // 6 12 ///////////////////////////////////////////////////////////////////////// 7 13 … … 9 15 #include "starfield.h" 10 16 11 #define PROGRAMID "$Id: starfield.cxx,v 1. 3 2000-09-21 10:31:36 haraldExp $"17 #define PROGRAMID "$Id: starfield.cxx,v 1.4 2004-09-17 17:36:25 moralejo Exp $" 12 18 13 19 ///////////////////////////////////////////////////////////////////////// 14 20 15 main(int argc, char **argv)21 int main(int argc, char **argv) 16 22 { 17 23 … … 32 38 float lmin_nm[4] = {ULMIN_nm, BLMIN_nm, VLMIN_nm, RLMIN_nm}; // wave band definitions 33 39 float lmax_nm[4] = {ULMAX_nm, BLMAX_nm, VLMAX_nm, RLMAX_nm}; 34 float theta_rad, costheta, phi_rad, randtime, lambda_nm, xdum_m, ydum_m; 40 float theta_rad, costheta, sintheta, phi_rad, randtime, lambda_nm, xdum_m, ydum_m; 41 float cosa, cosA, sinA; 35 42 float angdist; 36 43 … … 88 95 cout << "<Goddard Space Flight Center, Flight Dynamics Division (1998)>\n"; 89 96 90 angdist = fmod( pars.catalog_fov_deg / cos( pars.ct_dec_rad ), 360.); 97 angdist = fmod( (float) (pars.catalog_fov_deg/cos( pars.ct_dec_rad )), 98 (float) 360.); 91 99 92 100 if(angdist > 180.){ // too near to the pole, have to loop over all files … … 192 200 } 193 201 194 stars[i].u = -1. * cos( stars[i].dec_rad ) * sin( stars[i].ra_rad - pars.ct_ra_rad ) / costheta; 195 196 stars[i].v = -1. * ( sin( pars.ct_dec_rad ) * cos( stars[i].dec_rad ) * 197 cos( stars[i].ra_rad - pars.ct_ra_rad ) - 198 cos( pars.ct_dec_rad ) * sin( stars[i].dec_rad ) 199 ) / costheta; 200 202 sintheta = sqrt(1.-costheta*costheta); 203 204 // 205 // A. Moralejo, 15/09/2004 206 // We want the director cosines of the down-going versors along the photon 207 // incident directions. This is what the Reflector program expects (also from the 208 // normal Corsika output). We have used simple spherical trigonometry to obtain 209 // the formulae. 210 // 211 212 // "cosa" is the cosine of the angle "a" between the star direction and the direction 213 // defined by declination = 0 and right ascension = ct_ra. "a" is one of the sides of 214 // a spherical triangle. It is a quantity needed for the calculations. 215 216 cosa = cos( stars[i].ra_rad - pars.ct_ra_rad ) * cos( stars[i].dec_rad ); 217 218 // cosA is the angle between the great circle of constant right ascension = ct_ra and 219 // the great circle defined by the star direction and the telescope direction. "A" would 220 // be the angle opposite to the side "a" of a spherical triangle (see above) 221 222 cosA = (cosa - costheta*cos(pars.ct_dec_rad)) / (sintheta*sin(pars.ct_dec_rad)); 223 224 // We now want A to be defined in the 0 - 2pi range, so that it becomes the azimuth angle 225 // of the star in a system defined by the telescope direction. "A" will be defined between 226 // 0 and pi if sin (star_ra - ct_ra) > 0, and between pi and 2 pi otherwise. 227 228 sinA = sqrt (1.-cosA*cosA); 229 if ( sin(stars[i].ra_rad - pars.ct_ra_rad ) < 0. ) 230 sinA *= -1.; 231 232 stars[i].u = -1. * sintheta * cosA; 233 stars[i].v = -1. * sintheta * sinA; 234 235 236 // Old implementation, commented out 15/09/2004: 237 // 238 // This produced director cosines which, when fed to reflector, makes on the camera plane 239 // a mirror-inverted image of the FOV (with respect to what one would see "by eye"). That 240 // is NOT what we want! After reflection on the parabollic mirror, the image on the camera 241 // is NOT mirrored, but just rotated by 180 degree. The new implementation above produces 242 // the correct FOV (tested with Reflector 0.6) 243 // 244 // stars[i].u = -1. * cos( stars[i].dec_rad ) * sin( stars[i].ra_rad - pars.ct_ra_rad ) / costheta; 245 // stars[i].v = -1. * ( sin( pars.ct_dec_rad ) * cos( stars[i].dec_rad ) * 246 // cos( stars[i].ra_rad - pars.ct_ra_rad ) - 247 // cos( pars.ct_dec_rad ) * sin( stars[i].dec_rad ) 248 // ) / costheta; 249 250 201 251 // calculate the "zenith angle" theta and "azimuth" phi of the star assuming 202 252 // the telecope points at the zenith … … 211 261 phi_rad = 2.*PI - acos(stars[i].u); 212 262 } 213 263 214 264 // calculate number of photons 215 265 … … 289 339 290 340 convertcorsika( 291 ((int)pars.ct_ra_h*10)*1000 + (int)( abs(pars.ct_dec_deg)*10), // the file id341 ((int)pars.ct_ra_h*10)*1000 + (int)(fabs(pars.ct_dec_deg)*10), // the file id 292 342 totalphotinside, photons, pars.integtime_s, pars.verbose, pars.output_file); 293 343 -
trunk/MagicSoft/Simulation/Detector/Starfield/starfield.h
r442 r5110 4 4 #define _STARFIELD_H_ 5 5 6 #include <iostream .h>7 #include <fstream .h>6 #include <iostream> 7 #include <fstream> 8 8 #include <stdlib.h> 9 9 #include <stdio.h> 10 #include <string.h>11 10 #include <math.h> 12 11 #include <sys/types.h> -
trunk/MagicSoft/Simulation/Detector/Starfield/starfield.par
r431 r5110 9 9 10.0 10 10 Path inside which the star catalog data can be found: 11 / usr/users/magicsol/blanch/Data11 /home/magic/MagicProgs/Simulation/Detector/Starfield/Data 12 12 Verbosity level (0 = not verbose, 1 = verbose, 2 = very verbose, 3 = very very ...): 13 13 0
Note:
See TracChangeset
for help on using the changeset viewer.