source: fact/tools/rootmacros/FOpenDataFile.c@ 12365

Last change on this file since 12365 was 12166, checked in by neise, 13 years ago
initial commit
File size: 1.3 KB
Line 
1#include <cstdio>
2int FOpenDataFile(fits &datafile, vector<int16_t> &data, vector<int16_t> &data_offset, unsigned int &data_num, size_t &data_n, UInt_t &data_roi, UInt_t &data_px)
3{
4//-------------------------------------------
5//Print the header
6//-------------------------------------------
7/* cout << "-------------------- Data Header -------------------" << endl;
8 datafile.PrintKeys();
9 cout << "------------------- Data Columns -------------------" << endl;
10 datafile.PrintColumns();
11 */
12//-------------------------------------------
13//Get the size of the data column
14//-------------------------------------------
15 data_roi = datafile.GetUInt("NROI"); // Value from header
16 data_px = datafile.GetUInt("NPIX");
17 data_n = datafile.GetN("Data"); //Size of column "Data" = #Pixel x ROI
18
19//-------------------------------------------
20//Set the sizes of the data vectors
21//-------------------------------------------
22 data.resize(data_n,0);
23 data_offset.resize(data_px,0);
24
25//-------------------------------------------
26//Link the data to variables
27//-------------------------------------------
28 datafile.SetRefAddress("EventNum", data_num);
29 datafile.SetVecAddress("Data", data);
30 datafile.SetVecAddress("StartCellData", data_offset);
31 datafile.GetRow(0);
32
33 cout << "Opening data file successful..." << endl;
34 return 0;
35}
Note: See TracBrowser for help on using the repository browser.