GenerateDenseArray.cc
Go to the documentation of this file.
1 #include <sstream>
2 #include <fstream>
3 #include <math.h>
4 
5 #include <utl/Reader.h>
6 
7 using namespace std;
8 using namespace utl;
9 
10 //
11 // Simple stand-alone dense array generator.
12 // ----------------------------------------
13 // T. Paul
14 // 13 Jan 2006
15 //
16 // This program writes out an XML file
17 // defining a so-called "dense" array. In this
18 // case, the dense array has a ring of stations
19 // placed at some distance from the shower core.
20 // This distance and the number of stations
21 // is defined in the conf.xml file.
22 // The format used is that expected by the
23 // SDetenseStationListXMLManager.
24 //
25 
26 int
28 {
29  Reader theReader("conf.xml", Reader::eSCHEMA);
30 
31  double radius;
32  theReader.GetTopBranch().GetChild("radius").GetData(radius);
33  int numStations;
34  theReader.GetTopBranch().GetChild("numberStations").GetData(numStations);
35 
36  ofstream outp("SDenseStationRingAt1000.xml", ios::out);
37 
38  // Leading XML boilerplate
39  //
40  outp <<
41  "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
42  "<SDenseStationList\n"
43  " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
44  " xsi:noNamespaceSchemaLocation=\""
45  SCHEMALOCATION
46  "/SDenseStationList.xsd\">\n\n";
47 
48  outp <<
49  "<!--\n"
50  " deltaPhi = polar angle measured in the shower frame\n"
51  " r = distance from the shower core in plane perpindicular to shower axis\n"
52  " z = height above the core position\n"
53  " -->\n\n"
54  "<UTMInfo>\n"
55  " <ellipsoid> WGS84 </ellipsoid>\n"
56  " <zone> 19 </zone>\n"
57  " <band> H </band>\n"
58  "</UTMInfo>\n\n";
59 
60  // Create list of "dense" stations situated on a ring with
61  // radius specified in conf file
62  //
63  const int firstStation = 90000; // dense station id's have to be > 90000
64  for (int i = 0; i < numStations; ++i) {
65  const double deltaPhi = i*2*M_PI/numStations;
66 
67  outp <<
68  "<denseStation id=\"" << firstStation+i << "\">\n"
69  " <deltaPhi unit=\"radian\"> " << deltaPhi << " </deltaPhi>\n"
70  " <r unit=\"meter\"> " << radius << "</r>\n"
71  "</denseStation>\n";
72  }
73 
74  // Trailing XML boilerplate
75  //
76  outp << "</SDenseStationList>\n";
77 
78  outp.close();
79 
80  return EXIT_SUCCESS;
81 }
vector< t2list > out
output of the algorithm: a list of clusters
Definition: XbAlgo.cc:32
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
Branch GetTopBranch() const
Get the top Branch (represents same entity as document node)
Definition: Reader.h:45
Utility for parsing XML files.
Definition: Reader.h:25
int main(int argc, char *argv[])
Definition: DBSync.cc:58
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644

, generated on Tue Sep 26 2023.