Changeset 8139 for trunk/MagicSoft/Mars/datacenter/macros
- Timestamp:
- 10/20/06 15:15:26 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/filloptical.C
r8138 r8139 42 42 #include <fstream> 43 43 44 #include <TVector3.h> 45 44 46 #include <TEnv.h> 45 47 #include <TRegexp.h> … … 51 53 #include "MSQLServer.h" 52 54 #include "MSQLMagic.h" 55 56 #include "MTime.h" 57 #include "MObservatory.h" 58 #include "MAstroSky2Local.h" 53 59 54 60 using namespace std; … … 82 88 TString status; 83 89 TString query; 90 TString select; 84 91 Int_t statuskey; 85 92 Int_t objectkey; 86 93 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 87 101 while (1) 88 102 { … … 108 122 exposure = (*arr)[2]->GetName(); 109 123 fitsfile = (*arr)[3]->GetName(); 124 t.SetSqlDateTime(timestamp.Data()); 110 125 continue; 111 126 } … … 118 133 } 119 134 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 121 156 object= Form("%s/%s", (*arr)[0]->GetName(),(*arr)[1]->GetName()); 122 157 skylevel = (*arr)[2]->GetName(); … … 134 169 magerr="NULL"; 135 170 status = (*arr)[7]->GetName(); 171 numstars+=1; 136 172 } 137 173 delete arr; … … 157 193 "fObjectKEY=%d, fSkyLevel=%s, fFWHM=%s, " 158 194 "fApertureRadius=%s, fInstrumentalMag=%s, " 159 "fInstrumentalMagErr=%s, fStatusKEY=%d 195 "fInstrumentalMagErr=%s, fStatusKEY=%d, fZenithDistance=", 160 196 timestamp.Data(), exposure.Data(), fitsfilekey, 161 197 objectkey, skylevel.Data(), fwhm.Data(), 162 198 aperturer.Data(), mag.Data(), magerr.Data(), 163 199 statuskey); 200 201 if (ra==0 || dec==0) 202 query+="NULL"; 203 else 204 query+=Form("%.1f", zd); 164 205 165 206 if (serv.Insert("OpticalData", query)==kFALSE)
Note:
See TracChangeset
for help on using the changeset viewer.