Ignore:
Timestamp:
09/17/04 18:36:25 (20 years ago)
Author:
moralejo
Message:
 Commited to CVS all changes to adapt headers to current C++ syntaxis
Location:
trunk/MagicSoft/Simulation/Detector/Starfield
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/Starfield/Makefile

    r432 r5110  
    33## Starfield Generator Makefile
    44##
    5 ## $Id: Makefile,v 1.3 2000-09-21 10:31:36 harald Exp $
     5## $Id: Makefile,v 1.4 2004-09-17 17:36:25 moralejo Exp $
    66##   
    77##################################################################
     
    1616CXX      = g++
    1717
     18
    1819INCLUDES = -I${INCLUDE} \
    19            -I${INCLUDE_COR}
     20           -I${INCLUDE_COR} \
     21           -I${ROOTSYS}/include
    2022
    2123WARNINGS = -Wall
    2224
    23 CXXFLAGS =  ${WARNINGS} ${INCLUDES} -ansi
     25CXXFLAGS =  ${WARNINGS} ${INCLUDES}
    2426
    25 LIBS     = -L${RANLIBDIR} -L/usr/local/lib -L/usr/lib  -lm 
     27LIBS     = -L${RANLIBDIR} -L/usr/local/lib -L/usr/lib  -lm
    2628
    2729
     
    111113
    112114# DO NOT DELETE THIS LINE -- make depend depends on it.
    113 
    114 starfield.o: starfield.h /usr/include/stdlib.h /usr/include/standards.h
    115 starfield.o: /usr/include/getopt.h /usr/include/sys/types.h
    116 starfield.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
    117 starfield.o: /usr/include/string.h /usr/include/strings.h /usr/include/math.h
    118 starfield.o: /usr/include/dirent.h /usr/include/unistd.h
    119 starfield.o: /usr/include/sys/access.h /usr/include/sys/seek.h
    120 starfield.o: convertcorsika.h photon.hxx star.hxx /usr/include/stdio.h
    121 starfield.o: /usr/include/va_list.h /usr/include/sys/limits.h
    122 starfield.o: /usr/include/sys/machine/machlimits.h
    123 starfield.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
    124 starfield.o: /usr/include/sys/rt_limits.h parameters.h
    125 star.o: star.hxx /usr/include/math.h /usr/include/standards.h
    126 star.o: /usr/include/stdlib.h /usr/include/getopt.h /usr/include/sys/types.h
    127 star.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
    128 star.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdio.h
    129 star.o: /usr/include/sys/seek.h /usr/include/va_list.h
    130 star.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
    131 star.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
    132 star.o: /usr/include/sys/rt_limits.h
    133 photon.o: photon.hxx /usr/include/math.h /usr/include/standards.h
    134 photon.o: /usr/include/stdlib.h /usr/include/getopt.h
    135 photon.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
    136 photon.o: /usr/include/sys/select.h
    137 convertcorsika.o: convertcorsika.h /usr/include/string.h
    138 convertcorsika.o: /usr/include/standards.h /usr/include/sys/types.h
    139 convertcorsika.o: /usr/include/mach/machine/vm_types.h
    140 convertcorsika.o: /usr/include/sys/select.h /usr/include/strings.h photon.hxx
    141 convertcorsika.o: /usr/include/math.h /usr/include/stdlib.h
    142 convertcorsika.o: /usr/include/getopt.h
    143 parameters.o: parameters.h /usr/include/stdio.h /usr/include/standards.h
    144 parameters.o: /usr/include/sys/seek.h /usr/include/va_list.h
    145 parameters.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
    146 parameters.o: /usr/include/sys/select.h /usr/include/getopt.h
    147 parameters.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
    148 parameters.o: /usr/include/sys/syslimits.h
    149 parameters.o: /usr/include/sys/machine/machtime.h
    150 parameters.o: /usr/include/sys/rt_limits.h
    151 ../include-CORSIKA/COREventHeader.o: ../include-CORSIKA/COREventHeader.hxx
    152 ../include-CORSIKA/COREventHeader.o: /usr/include/stdlib.h
    153 ../include-CORSIKA/COREventHeader.o: /usr/include/standards.h
    154 ../include-CORSIKA/COREventHeader.o: /usr/include/getopt.h
    155 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/types.h
    156 ../include-CORSIKA/COREventHeader.o: /usr/include/mach/machine/vm_types.h
    157 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/select.h
    158 ../include-CORSIKA/COREventHeader.o: /usr/include/math.h
    159 ../include-CORSIKA/CORParticle.o: ../include-CORSIKA/CORParticle.hxx
    160 ../include-CORSIKA/CORParticle.o: /usr/include/stdlib.h
    161 ../include-CORSIKA/CORParticle.o: /usr/include/standards.h
    162 ../include-CORSIKA/CORParticle.o: /usr/include/getopt.h
    163 ../include-CORSIKA/CORParticle.o: /usr/include/sys/types.h
    164 ../include-CORSIKA/CORParticle.o: /usr/include/mach/machine/vm_types.h
    165 ../include-CORSIKA/CORParticle.o: /usr/include/sys/select.h
    166 ../include-CORSIKA/CORParticle.o: /usr/include/math.h
    167 ../include-CORSIKA/CORStatfile.o: ../include-CORSIKA/CORStatfile.hxx
    168 ../include-CORSIKA/CORStatfile.o: /usr/include/stdlib.h
    169 ../include-CORSIKA/CORStatfile.o: /usr/include/standards.h
    170 ../include-CORSIKA/CORStatfile.o: /usr/include/getopt.h
    171 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/types.h
    172 ../include-CORSIKA/CORStatfile.o: /usr/include/mach/machine/vm_types.h
    173 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/select.h
    174 ../include-CORSIKA/CORStatfile.o: /usr/include/math.h
  • trunk/MagicSoft/Simulation/Detector/Starfield/Makefile.osf

    r1708 r5110  
    33## Starfield Generator Makefile
    44##
    5 ## $Id: Makefile.osf,v 1.1 2003-01-14 13:48:38 blanch Exp $
     5## $Id: Makefile.osf,v 1.2 2004-09-17 17:36:25 moralejo Exp $
    66##   
    77##################################################################
     
    110110
    111111# DO NOT DELETE THIS LINE -- make depend depends on it.
    112 
    113 starfield.o: starfield.h /usr/include/stdlib.h /usr/include/standards.h
    114 starfield.o: /usr/include/getopt.h /usr/include/sys/types.h
    115 starfield.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
    116 starfield.o: /usr/include/stdio.h /usr/include/sys/seek.h
    117 starfield.o: /usr/include/va_list.h /usr/include/sys/limits.h
    118 starfield.o: /usr/include/sys/machine/machlimits.h
    119 starfield.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
    120 starfield.o: /usr/include/sys/rt_limits.h /usr/include/string.h
    121 starfield.o: /usr/include/strings.h /usr/include/math.h /usr/include/dirent.h
    122 starfield.o: /usr/include/unistd.h /usr/include/sys/access.h convertcorsika.h
    123 starfield.o: photon.hxx star.hxx parameters.h
    124 star.o: star.hxx /usr/include/math.h /usr/include/standards.h
    125 star.o: /usr/include/stdlib.h /usr/include/getopt.h /usr/include/sys/types.h
    126 star.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
    127 star.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdio.h
    128 star.o: /usr/include/sys/seek.h /usr/include/va_list.h
    129 star.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
    130 star.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
    131 star.o: /usr/include/sys/rt_limits.h
    132 photon.o: photon.hxx /usr/include/math.h /usr/include/standards.h
    133 photon.o: /usr/include/stdlib.h /usr/include/getopt.h
    134 photon.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
    135 photon.o: /usr/include/sys/select.h
    136 convertcorsika.o: convertcorsika.h /usr/include/string.h
    137 convertcorsika.o: /usr/include/standards.h /usr/include/sys/types.h
    138 convertcorsika.o: /usr/include/mach/machine/vm_types.h
    139 convertcorsika.o: /usr/include/sys/select.h /usr/include/strings.h photon.hxx
    140 convertcorsika.o: /usr/include/math.h /usr/include/stdlib.h
    141 convertcorsika.o: /usr/include/getopt.h
    142 parameters.o: parameters.h /usr/include/stdio.h /usr/include/standards.h
    143 parameters.o: /usr/include/sys/seek.h /usr/include/va_list.h
    144 parameters.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
    145 parameters.o: /usr/include/sys/select.h /usr/include/getopt.h
    146 parameters.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
    147 parameters.o: /usr/include/sys/syslimits.h
    148 parameters.o: /usr/include/sys/machine/machtime.h
    149 parameters.o: /usr/include/sys/rt_limits.h
    150 ../include-CORSIKA/COREventHeader.o: ../include-CORSIKA/COREventHeader.hxx
    151 ../include-CORSIKA/COREventHeader.o: /usr/include/stdlib.h
    152 ../include-CORSIKA/COREventHeader.o: /usr/include/standards.h
    153 ../include-CORSIKA/COREventHeader.o: /usr/include/getopt.h
    154 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/types.h
    155 ../include-CORSIKA/COREventHeader.o: /usr/include/mach/machine/vm_types.h
    156 ../include-CORSIKA/COREventHeader.o: /usr/include/sys/select.h
    157 ../include-CORSIKA/COREventHeader.o: /usr/include/math.h
    158 ../include-CORSIKA/CORParticle.o: ../include-CORSIKA/CORParticle.hxx
    159 ../include-CORSIKA/CORParticle.o: /usr/include/stdlib.h
    160 ../include-CORSIKA/CORParticle.o: /usr/include/standards.h
    161 ../include-CORSIKA/CORParticle.o: /usr/include/getopt.h
    162 ../include-CORSIKA/CORParticle.o: /usr/include/sys/types.h
    163 ../include-CORSIKA/CORParticle.o: /usr/include/mach/machine/vm_types.h
    164 ../include-CORSIKA/CORParticle.o: /usr/include/sys/select.h
    165 ../include-CORSIKA/CORParticle.o: /usr/include/math.h
    166 ../include-CORSIKA/CORStatfile.o: ../include-CORSIKA/CORStatfile.hxx
    167 ../include-CORSIKA/CORStatfile.o: /usr/include/stdlib.h
    168 ../include-CORSIKA/CORStatfile.o: /usr/include/standards.h
    169 ../include-CORSIKA/CORStatfile.o: /usr/include/getopt.h
    170 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/types.h
    171 ../include-CORSIKA/CORStatfile.o: /usr/include/mach/machine/vm_types.h
    172 ../include-CORSIKA/CORStatfile.o: /usr/include/sys/select.h
    173 ../include-CORSIKA/CORStatfile.o: /usr/include/math.h
  • trunk/MagicSoft/Simulation/Detector/Starfield/convertcorsika.cxx

    r797 r5110  
    4848    }
    4949 
    50   cerfile.open(cor_dir, ios::out);
     50  cerfile.open(cor_dir, ios::out|ios::binary);
     51
    5152  /*if((cerfilec=fopen(cor_dir,"wb"))==NULL){
    5253    printf("C-style::Cannot create cerenkov file.\n");
     
    128129  strcat(stat_dir, stat_file);
    129130 
    130   cerfile.open (stat_dir);
     131  cerfile.open (stat_dir, ios::out|ios::binary);
    131132 
    132133  cout<<"Writing binary statistics file "<<" "<<stat_dir<<" "<<"..."<<endl;
  • trunk/MagicSoft/Simulation/Detector/Starfield/parameters.cxx

    r431 r5110  
    1818  float dec_arcsec;
    1919  char dummy[160];
    20 
    21   in->ipfx(1); // tell the io system that we are reading formatted
    2220
    2321  in->getline(dummy, sizeof(dummy), '\n');
  • trunk/MagicSoft/Simulation/Detector/Starfield/parameters.h

    r431 r5110  
    22#define _PARAMETERS_H_
    33
    4 #include <iostream.h>
    5 #include <fstream.h>
     4#include <iostream>
     5#include <fstream>
    66#include <stdio.h>
    77
     
    1414#endif
    1515
     16using namespace std;
    1617
    1718class parameters {
  • trunk/MagicSoft/Simulation/Detector/Starfield/photon.hxx

    r341 r5110  
    99
    1010#include <math.h>
    11 #include <iostream.h>
     11#include <iostream>
    1212#include <stdlib.h>
    1313
  • trunk/MagicSoft/Simulation/Detector/Starfield/star.hxx

    r341 r5110  
    44
    55#include <math.h>
    6 #include <string.h>
    76#include <stdio.h>
    8 #include <iostream.h>
    9 #include <fstream.h>
     7#include <iostream>
     8#include <string>
     9#include <fstream>
    1010#include "jcmacros.h"
    1111
     
    6363#endif
    6464
    65 
     65using namespace std;
    6666
    6767class star{
  • trunk/MagicSoft/Simulation/Detector/Starfield/starfield.cxx

    r432 r5110  
    44// (c) 2000 D. Petry
    55//
     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//
    612/////////////////////////////////////////////////////////////////////////
    713
     
    915#include "starfield.h"
    1016
    11 #define PROGRAMID "$Id: starfield.cxx,v 1.3 2000-09-21 10:31:36 harald Exp $"
     17#define PROGRAMID "$Id: starfield.cxx,v 1.4 2004-09-17 17:36:25 moralejo Exp $"
    1218
    1319/////////////////////////////////////////////////////////////////////////
    1420
    15 main(int argc, char **argv)
     21int main(int argc, char **argv)
    1622{
    1723
     
    3238  float lmin_nm[4] = {ULMIN_nm, BLMIN_nm, VLMIN_nm, RLMIN_nm}; // wave band definitions
    3339  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;
    3542  float angdist;
    3643
     
    8895  cout << "<Goddard Space Flight Center, Flight Dynamics Division (1998)>\n";
    8996
    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.);
    9199
    92100  if(angdist > 180.){ // too near to the pole, have to loop over all files
     
    192200    }
    193201   
    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
    201251    // calculate the "zenith angle" theta and "azimuth" phi of the star assuming
    202252    // the telecope points at the zenith
     
    211261      phi_rad = 2.*PI - acos(stars[i].u);
    212262    }
    213    
     263
    214264    // calculate number of photons
    215265   
     
    289339
    290340  convertcorsika(
    291                  ((int)pars.ct_ra_h*10)*1000 + (int)(abs(pars.ct_dec_deg)*10), // the file id
     341                 ((int)pars.ct_ra_h*10)*1000 + (int)(fabs(pars.ct_dec_deg)*10), // the file id
    292342                 totalphotinside, photons, pars.integtime_s, pars.verbose, pars.output_file);
    293343
  • trunk/MagicSoft/Simulation/Detector/Starfield/starfield.h

    r442 r5110  
    44#define _STARFIELD_H_
    55
    6 #include <iostream.h>
    7 #include <fstream.h>
     6#include <iostream>
     7#include <fstream>
    88#include <stdlib.h>
    99#include <stdio.h>
    10 #include <string.h>
    1110#include <math.h>
    1211#include <sys/types.h>
  • trunk/MagicSoft/Simulation/Detector/Starfield/starfield.par

    r431 r5110  
    9910.0
    1010Path inside which the star catalog data can be found:
    11 /usr/users/magicsol/blanch/Data
     11/home/magic/MagicProgs/Simulation/Detector/Starfield/Data
    1212Verbosity level (0 = not verbose, 1 = verbose, 2 = very verbose, 3 = very very ...):
    13130
Note: See TracChangeset for help on using the changeset viewer.