Changeset 19528 for trunk/FACT++
- Timestamp:
- 05/29/19 11:04:59 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/gcn.cc
r19515 r19528 82 82 83 83 const string role = root.attribute("role", "").toStdString(); 84 const string name= root.tagName().toStdString();84 const string trn = root.tagName().toStdString(); 85 85 86 86 // A full description can be found at http://voevent.dc3.com/schema/default.html 87 87 88 if ( name=="trn:Transport")88 if (trn=="trn:Transport") 89 89 { 90 90 if (role=="iamalive") … … 99 99 if (fIsVerbose) 100 100 { 101 Out() << Time().GetAsStr() << " ----- " << name<< " [" << role << "] -----" << endl;101 Out() << Time().GetAsStr() << " ----- " << trn << " [" << role << "] -----" << endl; 102 102 Out() << " " << time.tagName().toStdString() << " = " << fLastKeepAlive.GetAsStr() << '\n'; 103 103 Out() << " " << orig.tagName().toStdString() << " = " << orig.text().toStdString() << '\n'; … … 114 114 fout << "------------------------------------------------------------------------------\n" << fRxData.data() << endl; 115 115 116 if ( name=="voe:VOEvent")116 if (trn=="voe:VOEvent") 117 117 { 118 118 // WHAT: http://gcn.gsfc.nasa.gov/tech_describe.html … … 150 150 const auto &id = ptype->first; 151 151 152 // Gravitational wave event 152 153 const bool is_gw = id==150 || id==151 || id==152 || id==153 || id==164; 153 154 155 // Required keywords 154 156 vector<string> missing; 155 157 if (date.isNull()) … … 238 240 */ 239 241 242 // ----------------------------- Create Name ---------------------- 243 240 244 const auto &paket = ptype->second; 241 245 246 string name; 247 bool prefix = true; 248 249 switch (id) 250 { 251 case 60: 252 case 61: 253 case 62: 254 255 case 110: 256 case 111: 257 case 112: 258 case 115: 259 name = GetParamValue(what, "TRIGGER_NUM").toStdString(); 260 break; 261 262 case 123: 263 name = GetParamValue(what, "REF_NUM").toStdString(); 264 break; 265 266 case 125: 267 name = GetParamValue(what, "SourceName").toStdString(); 268 prefix = false; 269 break; 270 271 case 157: 272 case 158: 273 { 274 const string event_id = GetParamValue(what, "event_id").toStdString(); 275 const string run_id = GetParamValue(what, "run_id").toStdString(); 276 name = event_id+"_"+run_id; 277 break; 278 } 279 280 // Missing ID 281 // case 51: 282 // case 83: 283 // case 119: 284 // case 129: 285 default: 286 name = GetParamValue(what, "TrigID").toStdString(); 287 } 288 289 if (name.empty() || name=="0") 290 { 291 Warn("Missing ID... cannot create default source name... using date instead."); 292 name = Time().GetAsStr("%Y%m%d_%H%M%S"); 293 prefix = true; 294 } 295 296 if (prefix) 297 name.insert(0, paket.instrument+"#"); 298 299 // ---------------------------------------------------------------- 300 242 301 const string unit = pos2d.attribute("unit").toStdString(); 243 302 244 const uint32_t trig = GetParamValue(what, "TrigID").toUInt(); 245 const double ra = c1.text().toDouble(); 246 const double dec = c2.text().toDouble(); 247 const double err = errad.text().toDouble(); 303 const double ra = c1.text().toDouble(); 304 const double dec = c2.text().toDouble(); 305 const double err = errad.text().toDouble(); 248 306 249 307 const string n1 = name1.text().toStdString(); 250 308 const string n2 = name2.text().toStdString(); 309 310 const bool has_coordinates = n1=="RA" && n2=="Dec" && unit=="deg"; 311 312 const std::set<int16_t> typelist = 313 { 314 51, // INTEGRAL_POINTDIR 315 316 53, // INTEGRAL_WAKEUP 317 54, // INTEGRAL_REFINED 318 55, // INTEGRAL_OFFLINE 319 320 // 56, // INTEGRAL_WEAK 321 // 59, // KONUS_LC 322 323 60, // SWIFT_BAT_GRB_ALERT 324 61, // SWIFT_BAT_GRB_POS_ACK 325 62, // SWIFT_BAT_GRB_POS_NACK 326 327 83, // SWIFT_POINTDIR 328 329 97, // SWIFT_BAT_QL_POS 330 331 100, // AGILE_GRB_WAKEUP 332 101, // AGILE_GRB_GROUND 333 102, // AGILE_GRB_REFINED 334 335 110, // FERMI_GBM_FLT_POS 336 111, // FERMI_GBM_GND_POS 337 112, // FERMI_GBM_LC 338 115, // FERMI_GBM_TRANS 339 340 123, // FERMI_LAT_TRANS 341 125, // FERMI_LAT_MONITOR 342 343 // 134, // MAXI_UNKNOWN 344 // 135, // MAXI_KNOWN 345 // 136, // MAXI_TEST 346 347 157, // AMON_ICECUBE_COINC 348 158, // AMON_ICECUBE_HESE 349 350 169, // AMON_ICECUBE_EHE 351 171, // HAWC_BURST_MONITOR 352 173, // ICECUBE_GOLD 353 174, // ICECUBE_BRONZE 354 }; 355 356 const bool integral_test = role=="test" && id>=53 && id<=56; 357 358 const bool valid_id = typelist.find(id)!=typelist.end(); 359 360 if (valid_id && has_coordinates && !integral_test) 361 { 362 const ToO::DataGRB data = 363 { 364 .type = id, 365 .ra = ra, 366 .dec = dec, 367 .err = err, 368 }; 369 370 vector<char> dim(sizeof(ToO::DataGRB) + name.size() + 1); 371 372 memcpy(dim.data(), &data, sizeof(ToO::DataGRB)); 373 memcpy(dim.data()+sizeof(ToO::DataGRB), name.c_str(), name.size()); 374 375 Dim::SendCommandNB("SCHEDULER/GCN", dim); 376 Info("Sent ToO '"+name+"' ["+role+"]"); 377 } 251 378 252 379 Out() << Time(date.text().toStdString()).GetAsStr() << " ----- " << sname.text().toStdString() << " [" << role << "]\n"; 253 380 if (!desc.isNull()) 254 381 Out() << "[" << desc.text().toStdString() << "]\n"; 255 Out() << paket.name << "[" << id << "]: " << paket.description << endl;382 Out() << name << ": " << paket.name << "[" << id << "]: " << paket.description << endl; 256 383 Out() << left; 257 384 Out() << " " << setw(5) << "TIME" << "= " << Time(time.text().toStdString()).GetAsStr() << '\n'; … … 259 386 Out() << " " << setw(5) << n2 << "= " << dec << unit << '\n'; 260 387 Out() << " " << setw(5) << "ERR" << "= " << err << unit << '\n'; 261 262 const bool has_coordinates = n1=="RA" && n2=="Dec" && unit=="deg";263 264 const std::set<int16_t> typelist =265 {266 51, // INTEGRAL_POINTDIR267 268 53, // INTEGRAL_WAKEUP269 54, // INTEGRAL_REFINED270 55, // INTEGRAL_OFFLINE271 272 // 56, // INTEGRAL_WEAK273 // 59, // KONUS_LC274 275 60, // SWIFT_BAT_GRB_ALERT276 61, // SWIFT_BAT_GRB_POS_ACK277 62, // SWIFT_BAT_GRB_POS_NACK278 279 83, // SWIFT_POINTDIR280 281 97, // SWIFT_BAT_QL_POS282 283 100, // AGILE_GRB_WAKEUP284 101, // AGILE_GRB_GROUND285 102, // AGILE_GRB_REFINED286 287 110, // FERMI_GBM_FLT_POS288 111, // FERMI_GBM_GND_POS289 112, // FERMI_GBM_LC290 115, // FERMI_GBM_TRANS291 292 123, // FERMI_LAT_TRANS293 125, // FERMI_LAT_MONITOR294 295 // 134, // MAXI_UNKNOWN296 // 135, // MAXI_KNOWN297 // 136, // MAXI_TEST298 299 157, // AMON_ICECUBE_COINC300 158, // AMON_ICECUBE_HESE301 302 169, // AMON_ICECUBE_EHE303 171, // HAWC_BURST_MONITOR304 173, // ICECUBE_GOLD305 174, // ICECUBE_BRONZE306 };307 308 const bool valid = typelist.find(id)!=typelist.end();309 310 if (valid && has_coordinates)311 {312 const ToO::DataGRB data =313 {314 .type = id,315 .trigid = trig,316 .ra = ra,317 .dec = dec,318 .err = err,319 };320 321 Info("Sending ToO #"+to_string(trig)+" ["+role+"]");322 Dim::SendCommandNB("SCHEDULER/GCN", data);323 324 /*325 const double jd = Time().JD();326 327 Nova::EquPosn equ;328 equ.ra = ra;329 equ.dec = dec;330 331 const Nova::ZdAzPosn pos = Nova::GetHrzFromEqu(equ, jd);332 const Nova::EquPosn moon = Nova::GetLunarEquCoords(jd);333 const Nova::ZdAzPosn sun = Nova::GetHrzFromEqu(Nova::GetSolarEquCoords(jd), jd);334 335 const double disk = Nova::GetLunarDisk(jd);336 const double dist = Nova::GetAngularSeparation(equ, moon);337 338 Out() << " " << setw(5) << "ZD" << "= " << pos.zd << "deg\n";339 Out() << " " << setw(5) << "Az" << "= " << pos.az << "deg\n";340 341 Out() << " " << setw(5) << "MOON" << "= " << int(disk*100) << "%\n";342 Out() << " " << setw(5) << "DIST" << "= " << dist << "deg\n";343 344 if (dist>10 && dist<170 && pos.zd<80 && sun.zd>108)345 {346 Out() << " visible ";347 if (pos.zd<70)348 Out() << '+';349 if (pos.zd<60)350 Out() << '+';351 if (pos.zd<45)352 Out() << '+';353 Out() << '\n';354 }355 */356 }357 358 388 Out() << endl; 359 389 … … 381 411 } 382 412 383 Out() << Time().GetAsStr() << " ----- " << name<< " [" << role << "] -----" << endl;413 Out() << Time().GetAsStr() << " ----- " << trn << " [" << role << "] -----" << endl; 384 414 385 415 return false;
Note:
See TracChangeset
for help on using the changeset viewer.