Changeset 8139 for trunk/MagicSoft


Ignore:
Timestamp:
10/20/06 15:15:26 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8136 r8139  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2006/10/20 Daniela Dorner
     21
     22   * datacenter/tools/fillobjects.php, datacenter/tools/fillobjects2.C:
     23     - added (macro to fill information about objects in optical DB)
     24
     25   * datacenter/macros/filloptical.C:
     26     - added check to avoid filling invalid data
     27     - added zd (retrieve ra,dec from table Object and fill zd into
     28       table OpticalData)
     29
     30
    2031
    2132 2006/10/19 Thomas Bretz
  • trunk/MagicSoft/Mars/datacenter/macros/filloptical.C

    r8138 r8139  
    4242#include <fstream>
    4343
     44#include <TVector3.h>
     45
    4446#include <TEnv.h>
    4547#include <TRegexp.h>
     
    5153#include "MSQLServer.h"
    5254#include "MSQLMagic.h"
     55
     56#include "MTime.h"
     57#include "MObservatory.h"
     58#include "MAstroSky2Local.h"
    5359
    5460using namespace std;
     
    8288    TString status;
    8389    TString query;
     90    TString select;
    8491    Int_t statuskey;
    8592    Int_t objectkey;
    8693    Int_t fitsfilekey;
     94    Double_t ra=0;
     95    Double_t dec=0;
     96    Double_t zd=0;
     97    MTime t;
     98    MObservatory obs(MObservatory::kMagic1);
     99    TVector3 v;
     100
    87101    while (1)
    88102    {
     
    108122            exposure   = (*arr)[2]->GetName();
    109123            fitsfile = (*arr)[3]->GetName();
     124            t.SetSqlDateTime(timestamp.Data());
    110125            continue;
    111126        }
     
    118133            }
    119134
    120             numstars+=1;
     135            if (numstars==0)
     136            {
     137                select="SELECT fRightAscension, fDeclination FROM Object WHERE ";
     138                select+=Form("fObjectName='%s/BL'", (*arr)[0]->GetName());
     139
     140                TSQLResult *res = serv.Query(select);
     141                if (!res)
     142                    return 2;
     143
     144                TSQLRow *row=res->Next();
     145                ra=(*row)[0]?atof((*row)[0]):0;
     146                dec=(*row)[1]?atof((*row)[1]):0;
     147                delete res;
     148
     149                v.SetMagThetaPhi(1, TMath::Pi()/2-(dec*TMath::DegToRad()), ra*TMath::DegToRad()*15);
     150                v *= MAstroSky2Local(t, obs);
     151
     152                zd = v.Theta()*TMath::RadToDeg();
     153
     154            }
     155
    121156            object= Form("%s/%s", (*arr)[0]->GetName(),(*arr)[1]->GetName());
    122157            skylevel   = (*arr)[2]->GetName();
     
    134169                magerr="NULL";
    135170            status = (*arr)[7]->GetName();
     171            numstars+=1;
    136172        }
    137173        delete arr;
     
    157193                       "fObjectKEY=%d, fSkyLevel=%s, fFWHM=%s, "
    158194                       "fApertureRadius=%s, fInstrumentalMag=%s, "
    159                        "fInstrumentalMagErr=%s, fStatusKEY=%d ",
     195                       "fInstrumentalMagErr=%s, fStatusKEY=%d, fZenithDistance=",
    160196                       timestamp.Data(), exposure.Data(), fitsfilekey,
    161197                       objectkey, skylevel.Data(), fwhm.Data(),
    162198                       aperturer.Data(), mag.Data(), magerr.Data(),
    163199                       statuskey);
     200
     201            if (ra==0 || dec==0)
     202                query+="NULL";
     203            else
     204                query+=Form("%.1f", zd);
    164205
    165206            if (serv.Insert("OpticalData", query)==kFALSE)
  • trunk/MagicSoft/Mars/datacenter/tools/fillobjects2.C

    r8138 r8139  
    116116        object=Form("%s/BL", object.Data());
    117117
    118         query=Form("fRightAscension=%f, fDeclination=%f, fEpoche=2000",
     118        query=Form("fRightAscension=%.7f, fDeclination=%.7f, fEpoche=2000",
    119119                   ra, dec);
    120120
Note: See TracChangeset for help on using the changeset viewer.