1 ////////////////////////////////////////////////////////////////////////////////
3 // Author: Artur Szostak
4 // Email: artur@alice.phy.uct.ac.za | artursz@iafrica.com
6 ////////////////////////////////////////////////////////////////////////////////
8 #include "../src/Cluster.hpp"
11 // Formated printing of floating point numbers.
12 void Print(float value)
15 char* str = &buffer[0];
16 sprintf(str, "%f", value);
17 int length = strlen(str);
21 for (int i = length; i < 15; i++)
27 for (int i = length+1; i < 15; i++)
33 // TODO: fix the endian encoding of the data format.
35 /* Reads the contents of a file generated with MakeClusterPointFiles.C
36 and prints the contents to screen.
38 void DumpClusterPointFile(const char* filename)
40 FILE* file = fopen(filename, "r");
43 Error("DumpClusterPointFile", "Could not open file: %s", filename);
47 // Read the first 32 bits which is the size of the data structure in
48 // the file in 32bit words.
50 fread(&size, sizeof(size), 1, file);
53 Error("DumpClusterPointFile", "Could not read from file: %s", filename);
56 cout << "Size of structure: " << size << " (4 byte) words." << endl;
58 cout << " X Y" << endl;
60 // Go through all the records and dump them to screen.
61 UInt_t recordcount = size / (sizeof(dHLT::ClusterPoint) / 4);
62 for (UInt_t i = 0; i < recordcount; i++)
64 dHLT::ClusterPoint point;
65 fread(&point, sizeof(point), 1, file);
68 Error("DumpClusterPointFile", "Could not read from file: %s", filename);