Changeset 8404
- Timestamp:
- 04/12/07 21:45:12 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/filloptical.C
r8236 r8404 35 35 // Make sure, that database and password are corretly set. 36 36 // 37 // Returns 0 in case of failure and 1 in case of success. 37 // Returns 1 in case of success. 38 // Returns 2 in case of invalid file or line in file. 39 // Returns 3 in case of a missing object name in the database. 38 40 // 39 41 /////////////////////////////////////////////////////////////////////////// … … 102 104 TVector3 v; 103 105 104 cout << fname << endl; 105 106 if (fname(TRegexp("20[0-9][0-9]_[0-1][0-9]_[0-3][0-9]_.*_R[_]?[12]?[.]instr", kFALSE)).IsNull()) 106 if (fname(TRegexp("20[0-9][0-9]_[0-1][0-9]_[0-3][0-9]_.*_[RV][_]?[12]?[.]instr", kFALSE)).IsNull()) 107 107 { 108 108 cout << "Found not valid file: " << fname << endl; … … 115 115 line.ReadLine(fin); 116 116 if (!fin) 117 { 118 cout << numstars << " objects inserted for this exposure. " << endl; 117 119 break; 120 } 118 121 119 122 if (line.IsNull()) … … 123 126 124 127 if (line=="KVA_Celestron_ST8 KVA_Celestron_R" || 128 line=="KVA_Celestron_ST8 KVA_Celestron_V" || 125 129 line=="Tuorla_ST1001E Tuorla_R") 126 130 { … … 147 151 } 148 152 numexp+=1; 153 if (numstars) 154 cout << numstars << " objects inserted for this exposure. " << endl; 149 155 numstars=0; 150 156 timestamp =Form("%s %s", (*arr)[0]->GetName(),(*arr)[1]->GetName()); … … 164 170 } 165 171 172 //calculation of zd if ra and dec are available 166 173 if (numstars==0) 167 174 { … … 174 181 175 182 TSQLRow *row=res->Next(); 176 177 183 if (!row) 178 184 { 179 cout << "Query failed: " << select << endl; 180 continue; 185 cout << "Couldn't get ZD - Query failed: " << select << endl; 186 cout << "Position of the object is missing in the DB." << endl; 187 return 3; 181 188 } 182 183 ra =(*row)[0]?atof((*row)[0]):0; 184 dec=(*row)[1]?atof((*row)[1]):0; 189 else 190 { 191 ra =atof((*row)[0]); 192 dec=atof((*row)[1]); 193 v.SetMagThetaPhi(1, TMath::Pi()/2-(dec*TMath::DegToRad()), ra*TMath::DegToRad()*15); 194 v *= MAstroSky2Local(t, obs); 195 zd = v.Theta()*TMath::RadToDeg(); 196 } 185 197 delete res; 186 187 v.SetMagThetaPhi(1, TMath::Pi()/2-(dec*TMath::DegToRad()), ra*TMath::DegToRad()*15);188 v *= MAstroSky2Local(t, obs);189 190 zd = v.Theta()*TMath::RadToDeg();191 192 198 } 193 199 194 object= Form("%s/%s", (*arr)[0]->GetName(),(*arr)[1]->GetName()); 195 skylevel = (*arr)[2]->GetName(); 200 object = Form("%s/%s", (*arr)[0]->GetName(),(*arr)[1]->GetName()); 201 skylevel = (*arr)[2]->GetName(); 202 fwhm = (*arr)[3]->GetName(); 203 aperturer = (*arr)[4]->GetName(); 204 mag = (*arr)[5]->GetName(); 205 magerr = (*arr)[6]->GetName(); 206 status = (*arr)[7]->GetName(); 207 //make sure that no nonsense values enter the db 196 208 if (skylevel.Contains("-")) 197 skylevel="NULL"; 198 fwhm = (*arr)[3]->GetName(); 209 skylevel = "NULL"; 199 210 if (fwhm.Contains("-") || !fwhm.IsFloat()) 200 fwhm="NULL"; 201 aperturer = (*arr)[4]->GetName(); 202 mag = (*arr)[5]->GetName(); 211 fwhm = "NULL"; 203 212 if (!mag.IsFloat()) 204 mag="NULL"; 205 magerr = (*arr)[6]->GetName(); 213 mag = "NULL"; 206 214 if (!magerr.IsFloat()) 207 magerr="NULL"; 208 status = (*arr)[7]->GetName(); 215 magerr = "NULL"; 209 216 numstars+=1; 210 217 } … … 238 245 "fInstrumentalMagErr=%s, fStatusKEY=%d, fCCDKEY=%d, " 239 246 "fFilterKEY=%d, fTelescopeKEY=%d, fBandKEY=%d, " 240 "fZenithDistance= ",247 "fZenithDistance=%.1f ", 241 248 timestamp.Data(), exposure.Data(), fitsfilekey, 242 249 objectkey, skylevel.Data(), fwhm.Data(), 243 250 aperturer.Data(), mag.Data(), magerr.Data(), 244 statuskey, ccdkey, filterkey, telkey, bandkey); 245 246 if (ra==0 || dec==0) 251 statuskey, ccdkey, filterkey, telkey, bandkey, zd); 252 253 /* 254 if (ra==0 || dec==0 || zd==0) 247 255 query+="NULL"; 248 256 else 249 257 query+=Form("%.1f", zd); 250 258 */ 251 259 if (serv.Insert("OpticalData", query)==kFALSE) 252 260 return 2; 253 254 } 255 256 } 257 258 cout << fname(TRegexp("20[0-9][0-9]_[0-1][0-9]_[0-3][0-9]_.*_R[_]?[12]?[.]instr", kFALSE)) 259 << ": " << setw(2) << numexp << " exposures, " << setw(2) << numstars << " stars" << endl; 261 } 262 } 263 264 cout << fname(TRegexp("20[0-9][0-9]_[0-1][0-9]_[0-3][0-9]_.*_[RV][_]?[12]?[.]instr", kFALSE)) 265 << ": " << setw(2) << numexp << " exposures." << endl << endl; 260 266 261 267 return 1; -
trunk/MagicSoft/Mars/datacenter/scripts/copyscript
r8215 r8404 245 245 printprocesslog "WARN moving of file $opticalfile didn't work" 246 246 fi 247 247 ;; 248 3) echo " checkfilloptical=$checkfilloptical - Error: position of one object is missing in the database" >> $scriptlog 2>&1 249 printprocesslog "ERROR filloptical.C failed for $opticalfile because the position of one object is missing in the database" 250 continue 248 251 ;; 249 252 *) echo " checkfilloptical=$checkfilloptical - Error -> go on with next file" >> $scriptlog 2>&1
Note:
See TracChangeset
for help on using the changeset viewer.