Changeset 19550


Ignore:
Timestamp:
06/05/19 13:22:25 (5 years ago)
Author:
tbretz
Message:
Support also the 0-th telescope.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcorsika/MCorsikaRead.cc

    r19540 r19550  
    208208        const UInt_t  telid = atoi(res->At(3)->GetName());
    209209
    210         *fLog << inf2 << "Run " << runid << " detected to be for the " << telid << "-th telescope." << endl;
    211 
    212         if (fNumTelescopes<telid)
     210        *fLog << inf2 << "Run " << runid << " detected to be for telescope #" << telid << endl;
     211
     212        if (telid>=fNumTelescopes)
    213213        {
    214214            *fLog << err << "Position of telescope " << telid << " not defined." << endl;
     
    217217
    218218        *fLog << inf << "Telescope #" << telid << " [X/Y/Z (R)]: ";
    219         *fLog << fTelescopeX[telid-1] << "/";
    220         *fLog << fTelescopeY[telid-1] << "/";
    221         *fLog << fTelescopeZ[telid-1] << " (R=" << fTelescopeR[telid-1] << ")" << endl;
    222 
    223         fNumTelescope = telid;
     219        *fLog << fTelescopeX[telid] << "/";
     220        *fLog << fTelescopeY[telid] << "/";
     221        *fLog << fTelescopeZ[telid] << " (R=" << fTelescopeR[telid] << ")" << endl;
     222
     223        fNumTelescope = telid+1;
    224224    }
    225225    delete res;
     
    774774{
    775775    Bool_t rc = kFALSE;
    776     if (IsEnvDefined(env, prefix, "TelescopeIndex", print))
     776    if (IsEnvDefined(env, prefix, "TelescopeX", print) || IsEnvDefined(env, prefix, "TelescopeY", print))
    777777    {
    778778        rc = kTRUE;
    779         fNumTelescope = GetEnvValue(env, prefix, "TelescopeIndex", 0);
    780779
    781780        fTelescopeX.Set(1);
     
    828827            {
    829828                const UInt_t idx = atoi(res->At(9)->GetName());
    830                 if (idx==0)
    831                 {
    832                     *fLog << warn << "Telescope with index 0 ignored." << endl;
    833                     delete res;
    834                     continue;
    835                 }
    836829                if (idx>=fNumTelescopes)
    837830                {
    838                     fTelescopeX.Set(idx);
    839                     fTelescopeY.Set(idx);
    840                     fTelescopeZ.Set(idx);
    841                     fTelescopeR.Set(idx);
    842                     fNumTelescopes = idx;
     831                    fNumTelescopes = idx+1;
     832                    fTelescopeX.Set(fNumTelescopes);
     833                    fTelescopeY.Set(fNumTelescopes);
     834                    fTelescopeZ.Set(fNumTelescopes);
     835                    fTelescopeR.Set(fNumTelescopes);
    843836                }
    844837
    845                 fTelescopeX[idx-1] = atof(res->At(1)->GetName());
    846                 fTelescopeY[idx-1] = atof(res->At(3)->GetName());
    847                 fTelescopeZ[idx-1] = atof(res->At(5)->GetName());
    848                 fTelescopeR[idx-1] = atof(res->At(7)->GetName());
     838                fTelescopeX[idx] = atof(res->At(1)->GetName());
     839                fTelescopeY[idx] = atof(res->At(3)->GetName());
     840                fTelescopeZ[idx] = atof(res->At(5)->GetName());
     841                fTelescopeR[idx] = atof(res->At(7)->GetName());
    849842            }
    850843            delete res;
    851844        }
    852845
    853 
    854846        for (int i=0; i<fNumTelescopes; i++)
    855847        {
    856             *fLog << all << "Telescope #" << setw(4) << i+1 << " [X/Y/Z (R)]: ";
     848            *fLog << all << "Telescope #" << setw(4) << i << " [X/Y/Z (R)]: ";
    857849            *fLog << setw(7) << fTelescopeX[i] << "/";
    858850            *fLog << setw(7) << fTelescopeY[i] << "/";
Note: See TracChangeset for help on using the changeset viewer.