Changeset 1559


Ignore:
Timestamp:
10/29/02 17:15:27 (22 years ago)
Author:
blanch
Message:
Reading several reflector versions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx

    r1550 r1559  
    2121//
    2222// $RCSfile: camera.cxx,v $
    23 // $Revision: 1.44 $
     23// $Revision: 1.45 $
    2424// $Author: blanch $
    25 // $Date: 2002-10-18 16:53:03 $
     25// $Date: 2002-10-29 17:15:27 $
    2626//
    2727////////////////////////////////////////////////////////////////////////
     
    409409  char flag[SIZE_OF_FLAGS + 1];  //@< flags in the .rfl file
    410410
     411  int reflector_file_version;  //@< vrsion of he reflector file
     412
    411413  FILE *inputfile;            //@< stream for the input file
    412414  ofstream datafile;          //@< stream for the data file
    413415
    414416  MCEventHeader mcevth;       //@< Event Header class (MC)
     417  MCEventHeader_2 mcevth_2;   //@< Event Header class (MC) for reflector > 0.6
    415418  MCCphoton cphoton;          //@< Cherenkov Photon class (MC)
    416419
     
    11741177  // get signature, and check it
    11751178
    1176   if(check_reflector_file( inputfile )==FALSE){
     1179  if((reflector_file_version=check_reflector_file( inputfile ))==FALSE){
    11771180    exit(1);
    11781181  }
     
    12411244       
    12421245        // get MCEventHeader
    1243         fread( (char*)&mcevth, mcevth.mysize(), 1, inputfile );
     1246        if (reflector_file_version<6)
     1247          fread( (char*)&mcevth, mcevth.mysize(), 1, inputfile );
     1248        else
     1249          fread( (char*)&mcevth_2, mcevth_2.mysize(), 1, inputfile );
     1250         
    12441251
    12451252        // calculate impact parameter (shortest distance betwee the original
     
    12731280        // read the direction of the incoming shower
    12741281       
    1275         thetashw = mcevth.get_theta();
    1276         phishw = mcevth.get_phi();
     1282        if (reflector_file_version<6){
     1283          thetashw = mcevth.get_theta();
     1284          phishw = mcevth.get_phi();
     1285        }
     1286        else{
     1287          thetashw = mcevth_2.get_theta();
     1288          phishw = mcevth_2.get_phi();
     1289        }
    12771290       
    12781291        // calculate vector for shower
     
    12841297        // read the deviation of the telescope with respect to the shower
    12851298       
    1286         mcevth.get_deviations ( &thetaCT, &phiCT );
     1299        if (reflector_file_version<6)
     1300          mcevth.get_deviations ( &thetaCT, &phiCT );
     1301        else
     1302          mcevth_2.get_deviations ( &thetaCT, &phiCT );
    12871303
    12881304        if ( (thetaCT == 0.) && (phiCT == 0.) ) {
     
    12921308          // between the CT axis and the core position
    12931309
    1294           mcevth.get_core(&coreX, &coreY);
    1295                
     1310          if (reflector_file_version<6)
     1311            mcevth.get_core(&coreX, &coreY);
     1312          else
     1313            mcevth_2.get_core(&coreX, &coreY);
     1314
    12961315          impactD = dist_r_P( 0., 0., 0., l1, m1, n1, coreX, coreY, 0. );
    12971316         
     
    13241343       
    13251344        if ( Select_Energy ) {
    1326           if (( mcevth.get_energy() < Select_Energy_le ) ||
    1327               ( mcevth.get_energy() > Select_Energy_ue )) {
    1328             log(SIGNATURE, "select_energy: shower rejected.\n");
    1329             continue;
    1330           }
     1345          if (reflector_file_version<6)
     1346            if (( mcevth.get_energy() < Select_Energy_le ) ||
     1347                ( mcevth.get_energy() > Select_Energy_ue )) {
     1348              log(SIGNATURE, "select_energy: shower rejected.\n");
     1349              continue;
     1350            }
     1351          else
     1352            if (( mcevth_2.get_energy() < Select_Energy_le ) ||
     1353                ( mcevth_2.get_energy() > Select_Energy_ue )) {
     1354              log(SIGNATURE, "select_energy: shower rejected.\n");
     1355              continue;
     1356            }
    13311357        }
    13321358
    13331359        // Read first and last time and put inumphe to 0
    13341360
    1335         mcevth.get_times(&arrtmin_ns,&arrtmax_ns);
     1361        if (reflector_file_version<6)
     1362          mcevth.get_times(&arrtmin_ns,&arrtmax_ns);
     1363        else
     1364          mcevth_2.get_times(&arrtmin_ns,&arrtmax_ns);
     1365
    13361366        inumphe=0;
    13371367
     
    16571687              //
    16581688             
    1659               EvtHeader[0]->FillHeader ( (UShort_t) (ntshow + nshow) ,  20 ) ;
     1689              EvtHeader[0]->FillHeader ( (UInt_t) (ntshow + nshow) ,  20 ) ;
    16601690             
    16611691              //   fill pixel information
     
    17801810            // get signature of the next part and check it.
    17811811
    1782             if(check_reflector_file( inputfile )==FALSE){
     1812            if((reflector_file_version=check_reflector_file( inputfile ))==FALSE){
    17831813              exit(1);
    17841814            }
     
    33403370  static MCEventHeader evth; // the event header
    33413371  static float nphe[iMAXNUMPIX];    // the number of photoelectrons in each pixel
     3372  int reflector_file_version;
    33423373  int itnphe;   // total number of produced photoelectrons
    33433374  int itotnphe;   // total number of produced photoelectrons after averaging
     
    33663397  // get signature, and check it
    33673398 
    3368   if(check_reflector_file(infile)==FALSE){
     3399  if((reflector_file_version=check_reflector_file( infile ))==FALSE){
    33693400    exit(1);
    33703401  }
     
    36063637//
    36073638// $Log: not supported by cvs2svn $
     3639// Revision 1.44  2002/10/18 16:53:03  blanch
     3640// Modification to read several reflector files.
     3641//
    36083642// Revision 1.43  2002/09/13 10:53:39  blanch
    36093643// Minor change to remove some undisired comments.
     
    37393773//
    37403774// $Log: not supported by cvs2svn $
     3775// Revision 1.44  2002/10/18 16:53:03  blanch
     3776// Modification to read several reflector files.
     3777//
    37413778// Revision 1.43  2002/09/13 10:53:39  blanch
    37423779// Minor change to remove some undisired comments.
Note: See TracChangeset for help on using the changeset viewer.