FACT++  1.0
int ConnectionGCN::ProcessXml ( const QDomElement &  root)
inlineprivate

Definition at line 67 of file gcn.cc.

References Nova::ZdAzPosn::az, GCN::PaketType_t::description, Nova::GetAngularSeparation(), Time::GetAsStr(), Nova::GetHrzFromEqu(), Nova::GetLunarDisk(), Nova::GetLunarEquCoords(), Nova::GetSolarEquCoords(), Time::JD(), GCN::PaketType_t::name, time, GCN::PaketType_t::type, and Nova::ZdAzPosn::zd.

68  {
69  if (root.isNull())
70  return -1;
71 
72  const string role = root.attribute("role", "").toStdString();
73  const string name = root.tagName().toStdString();
74 
75  // A full description can be found at http://voevent.dc3.com/schema/default.html
76 
77  if (name=="trn:Transport")
78  {
79  if (role=="iamalive")
80  {
81  const QDomElement orig = root.firstChildElement("Origin");
82  const QDomElement time = root.firstChildElement("TimeStamp");
83  if (orig.isNull() || time.isNull())
84  return -1;
85 
86  fLastKeepAlive = Time(time.text().toStdString());
87 
88  if (fIsVerbose)
89  {
90  Out() << Time().GetAsStr() << " ----- " << name << " [" << role << "] -----" << endl;
91  Out() << " " << time.tagName().toStdString() << " = " << fLastKeepAlive.GetAsStr() << '\n';
92  Out() << " " << orig.tagName().toStdString() << " = " << orig.text().toStdString() << '\n';
93  Out() << endl;
94  }
95 
96  return true;
97  }
98 
99  return false;
100  }
101 
102  ofstream fout("gcn.stream", ios::app);
103  fout << "------------------------------------------------------------------------------\n" << fRxData.data() << endl;
104 
105  if (name=="voe:VOEvent")
106  {
107  // WHAT: http://gcn.gsfc.nasa.gov/tech_describe.html
108  const QDomElement who = root.firstChildElement("Who");
109  const QDomElement what = root.firstChildElement("What");
110  const QDomElement when = root.firstChildElement("WhereWhen");
111  //const QDomElement how = root.firstChildElement("How");
112  //const QDomElement why = root.firstChildElement("Why");
113  //const QDomElement cite = root.firstChildElement("Citations");
114  //const QDomElement desc = root.firstChildElement("Description");
115  //const QDomElement ref = root.firstChildElement("Reference");
116  if (who.isNull() || what.isNull() || when.isNull())
117  return -1;
118 
119  const QDomElement date = who.firstChildElement("Date");
120  const QDomElement author = who.firstChildElement("Author");
121  const QDomElement sname = author.firstChildElement("shortName");
122  const QDomElement desc = what.firstChildElement("Description");
123 
124  const QDomElement obsdat = when.firstChildElement("ObsDataLocation");
125  const QDomElement obsloc = obsdat.firstChildElement("ObservationLocation");
126  const QDomElement coord = obsloc.firstChildElement("AstroCoords");
127 
128  const QDomElement time = coord.firstChildElement("Time").firstChildElement("TimeInstant").firstChildElement("ISOTime");
129  const QDomElement pos2d = coord.firstChildElement("Position2D");
130  const QDomElement name1 = pos2d.firstChildElement("Name1");
131  const QDomElement name2 = pos2d.firstChildElement("Name2");
132  const QDomElement val2 = pos2d.firstChildElement("Value2");
133  const QDomElement c1 = val2.firstChildElement("C1");
134  const QDomElement c2 = val2.firstChildElement("C2");
135  const QDomElement errad = pos2d.firstChildElement("Error2Radius");
136 
137  if (date.isNull() || author.isNull() || sname.isNull() || desc.isNull() ||
138  obsdat.isNull() || obsloc.isNull() || coord.isNull() || time.isNull() ||
139  pos2d.isNull() || name1.isNull() || name2.isNull() || val2.isNull() ||
140  c1.isNull() || c2.isNull() || errad.isNull())
141  return -1;
142 
143  const GCN::PaketType_t ptype = GetType(what);
144 
145  // 59/31: Konus LC / IPN raw [observation]
146  // 110: Fermi GBM (ART) [observation] (Initial) // Stop data taking
147  // 111: Fermi GBM (FLT) [observation] (after ~2s) // Start pointing/run
148  // 112: Fermi GBM (GND) [observation] (after 2-20s) // Refine pointing
149  // 115: Fermi GBM position [observation] (final ~hours)
150  //
151  // 51: Intergal pointdir [utility]
152  // 83: Swift pointdir [utility]
153  // 129: Fermi pointdir [utility]
154  //
155  // 2: Test coord ( 1) [test]
156  // 44: HETE test ( 41- 43) [test]
157  // 52: Integral SPIACS [test]
158  // 53: Integral Wakeup [test]
159  // 54: Integral refined [test]
160  // 55: Integral Offline [test]
161  // 56: Integral Weak [test]
162  // 82: BAT GRB pos test ( 61) [test]
163  // 109: AGILE GRB pos test (100-103) [test]
164  // 119: Fermi GRB pos test (111-113) [test]
165  // 124: Fermi LAT pos upd test (120-122) [test]
166  // 136: MAXI coord test ( 134) [test]
167  //
168  // Integral: RA=1.2343, Dec=2.3456
169  //
170 
171  /*
172  54
173  ==
174  <Group name="Test_mpos" >
175  <Param name="Test_Notice" value="true" />
176  </Group>
177 
178 
179  82
180  ==
181  <Group name="Solution_Status" >
182  <Param name="Test_Submission" value="false" />
183  </Group>
184 
185 
186  115
187  ===
188  2013-07-20 19:04:13: TIME = 2013-07-20 02:46:40
189 
190  <Group name="Trigger_ID" >
191  <Param name="Test_Submission" value="false" />
192  </Group>
193  */
194 
195  const string unit = pos2d.attribute("unit").toStdString();
196 
197  const double ra = c1.text().toDouble();
198  const double dec = c2.text().toDouble();
199  const double err = errad.text().toDouble();
200 
201  const string n1 = name1.text().toStdString();
202  const string n2 = name2.text().toStdString();
203 
204  Out() << Time(date.text().toStdString()).GetAsStr() << " ----- " << sname.text().toStdString() << " [" << role << "]\n";
205  Out() << "[" << desc.text().toStdString() << "]\n";
206  Out() << ptype.name << "[" << ptype.type << "]: " << ptype.description << endl;
207  Out() << left;
208  Out() << " " << setw(5) << "TIME" << "= " << Time(time.text().toStdString()).GetAsStr() << '\n';
209  Out() << " " << setw(5) << n1 << "= " << ra << unit << '\n';
210  Out() << " " << setw(5) << n2 << "= " << dec << unit << '\n';
211  Out() << " " << setw(5) << "ERR" << "= " << err << unit << '\n';
212 
213  if (n1=="RA" && n2=="Dec" && unit=="deg")
214  {
215  const double jd = Time().JD();
216 
217  Nova::EquPosn equ;
218  equ.ra = ra;
219  equ.dec = dec;
220 
221  const Nova::ZdAzPosn pos = Nova::GetHrzFromEqu(equ, jd);
222  const Nova::EquPosn moon = Nova::GetLunarEquCoords(jd);
224 
225  const double disk = Nova::GetLunarDisk(jd);
226  const double dist = Nova::GetAngularSeparation(equ, moon);
227 
228  Out() << " " << setw(5) << "ZD" << "= " << pos.zd << "deg\n";
229  Out() << " " << setw(5) << "Az" << "= " << pos.az << "deg\n";
230 
231  Out() << " " << setw(5) << "MOON" << "= " << int(disk*100) << "%\n";
232  Out() << " " << setw(5) << "DIST" << "= " << dist << "deg\n";
233 
234  if (dist>10 && dist<170 && pos.zd<80 && sun.zd>108)
235  {
236  Out() << " visible ";
237  if (pos.zd<70)
238  Out() << '+';
239  if (pos.zd<60)
240  Out() << '+';
241  if (pos.zd<45)
242  Out() << '+';
243  Out() << '\n';
244  }
245  }
246 
247  Out() << endl;
248 
249  if (role=="observation")
250  {
251  return true;
252  }
253 
254  if (role=="test")
255  {
256  return true;
257  }
258 
259  if (role=="retraction")
260  {
261  return true;
262  }
263 
264  if (role=="utility")
265  {
266  return true;
267  }
268 
269  return false;
270  }
271 
272  Out() << Time().GetAsStr() << " ----- " << name << " [" << role << "] -----" << endl;
273 
274  return false;
275  }
string description
Definition: HeadersGCN.h:21
EquPosn GetLunarEquCoords(double jd, double precision=0)
Definition: nova.h:136
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
double GetLunarDisk(double jd)
Definition: nova.h:121
GCN::PaketType_t GetType(const QDomElement &what)
Definition: gcn.cc:46
double zd
Definition: nova.h:30
double JD() const
Definition: Time.h:87
vector< char > fRxData
Definition: gcn.cc:42
bool fIsVerbose
Definition: gcn.cc:38
Time fLastKeepAlive
Definition: gcn.cc:44
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Definition: smartfact.txt:92
HrzPosn GetHrzFromEqu(const EquPosn &equ, const LnLatPosn &obs, double jd)
Definition: nova.h:75
double az
Definition: nova.h:31
double GetAngularSeparation(const EquPosn &p1, const EquPosn &p2)
Definition: nova.h:148
std::string GetAsStr(const char *fmt="%Y-%m-%d %H:%M:%S") const
Definition: Time.cc:240
EquPosn GetSolarEquCoords(double jd)
Definition: nova.h:114

+ Here is the call graph for this function: