- Timestamp:
- 08/31/18 16:27:46 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/calcsource.cc
r19156 r19193 228 228 } 229 229 230 if (!has_radec) 231 { 232 const string query = 233 "SELECT `"+tab_source+"`.fRightAscension, `"+tab_source+"`.fDeclination, `"+tab_source+"`.fSourceName" 234 " FROM `"+tab_runinfo+"`"+ 235 " LEFT JOIN `"+tab_source+"`"+ 236 " USING (fSourceKey)" 237 " WHERE fNight=20"+to_string(file/1000)+ 238 " AND fRunID="+to_string(file%1000); 239 240 if (print_meta) 241 cout << query << endl; 242 243 try 244 { 245 const mysqlpp::StoreQueryResult res = 246 connection.query(query).store(); 247 248 if (res.num_rows()!=1) 249 { 250 cerr << "No coordinates from " << tab_runinfo << " for " << file << endl; 251 return 2; 252 } 253 254 source_ra = res[0][0]; 255 source_dec = res[0][1]; 256 257 if (verbose>0) 258 cout << "Using coordinates " << source_ra << "h / " << source_dec << " deg for '" << res[0][2] << "'" << endl; 259 } 260 catch (const exception &e) 261 { 262 cerr << query << "\n"; 263 cerr << "SQL query failed:\n" << e.what() << endl; 264 return 3; 265 } 266 } 267 else 230 double point_ra = 0; 231 double point_dec = 0; 232 233 const string query = 234 "SELECT " 235 " `"+tab_runinfo+"`.fRightAscension, `"+tab_runinfo+"`.fDeclination, " 236 " `"+tab_source+"`.fRightAscension, `"+tab_source+"`.fDeclination, " 237 " `"+tab_source+"`.fSourceName" 238 " FROM `"+tab_runinfo+"`"+ 239 " LEFT JOIN `"+tab_source+"`"+ 240 " USING (fSourceKey)" 241 " WHERE fNight=20"+to_string(file/1000)+ 242 " AND fRunID="+to_string(file%1000); 243 244 if (print_meta) 245 cout << query << endl; 246 247 try 248 { 249 const mysqlpp::StoreQueryResult res = 250 connection.query(query).store(); 251 252 if (res.num_rows()!=1) 253 { 254 cerr << "No coordinates from " << tab_runinfo << " for " << file << endl; 255 return 2; 256 } 257 258 point_ra = res[0][0]; 259 point_dec = res[0][1]; 260 261 if (!has_radec) 262 { 263 source_ra = res[0][2]; 264 source_dec = res[0][3]; 265 } 266 268 267 if (verbose>0) 269 cout << "Using coordinates " << source_ra << "h / " << source_dec << " deg from resources." << endl; 268 { 269 cout << "Using coordinates " << source_ra << "h / " << source_dec << " deg "; 270 if (has_radec) 271 cout << "for '" << res[0][4] << "'" << endl; 272 else 273 cout << "from resources." << endl; 274 } 275 } 276 catch (const exception &e) 277 { 278 cerr << query << "\n"; 279 cerr << "SQL query failed:\n" << e.what() << endl; 280 return 3; 281 } 270 282 271 283 /* … … 297 309 } 298 310 299 const string query =300 "SELECT `Ra`, `Dec`, MJD, MilliSec, NanoSec, Zd, Az, EvtNumber"311 const string query1 = 312 "SELECT EvtNumber, MJD, MilliSec" 301 313 " FROM `"+tab_events+"`" 302 314 " WHERE FileId="+to_string(file); 303 315 304 316 if (print_meta) 305 cout << query << endl;317 cout << query1 << endl; 306 318 307 319 const mysqlpp::UseQueryResult res1 = 308 connection.query(query).use(); 309 310 Nova::RaDecPosn source(source_ra, source_dec); 311 312 source_ra *= M_PI/12; 313 source_dec *= M_PI/180; 314 315 auto obs = Nova::kORM; 316 317 obs.lng *= M_PI/180; 318 obs.lat *= M_PI/180; 319 320 //const double mm2deg = 1.17193246260285378e-02; 320 connection.query(query1).use(); 321 322 const Nova::RaDecPosn source(source_ra, source_dec); 323 324 //source_ra *= M_PI/12; 325 //source_dec *= M_PI/180; 326 327 const Nova::RaDecPosn point(point_ra, point_dec); 328 329 //point_ra *= M_PI/12; 330 //point_dec *= M_PI/180; 331 332 //const auto obs = Nova::kORM; 333 334 //obs.lng *= M_PI/180; 335 //obs.lat *= M_PI/180; 321 336 322 337 ostringstream ins; … … 328 343 count++; 329 344 330 double point_ra = row[0]; 331 double point_dec = row[1]; 332 uint32_t mjd = row[2]; 333 int64_t millisec = row[3]; 334 //uint32_t nanosec = row[4]; 335 //double zd = row[5]; 336 //double az = row[6]; 337 uint32_t event = row[7]; 338 339 Nova::RaDecPosn point(point_ra, point_dec); 340 341 point_ra *= M_PI/12; 342 point_dec *= M_PI/180; 345 const uint32_t event = row[0]; 346 const uint32_t mjd = row[1]; 347 const int64_t millisec = row[2]; 343 348 344 349 /*
Note:
See TracChangeset
for help on using the changeset viewer.