source: fact/tools/rootmacros/FOpenCalibFile.c@ 12198

Last change on this file since 12198 was 12166, checked in by neise, 13 years ago
initial commit
File size: 1.5 KB
Line 
1#include <cstdio>
2int FOpenCalibFile(const char *drsname, vector<float> &drs_basemean, vector<float> &drs_gainmean, vector<float> &drs_triggeroffsetmean, size_t &drs_n)
3{
4//-------------------------------------------
5//Open the file
6//-------------------------------------------
7 fits drsfile(drsname);
8
9 if (!drsfile)
10 {
11 cout << "Couldn't properly open the drsfile." << endl;
12 return 1;
13 }
14
15//-------------------------------------------
16//Print the header
17//-------------------------------------------
18 cout << "----------------- DRS Calib Header -----------------" << endl;
19 drsfile.PrintKeys();
20 cout << "---------------- DRS Calib Columns -----------------" << endl;
21 drsfile.PrintColumns();
22
23//-------------------------------------------
24//Get the sizes of the data column
25//-------------------------------------------
26 drs_n = drsfile.GetN("BaselineMean");
27
28//-------------------------------------------
29//Set the sizes of the DRS data vectors
30//-------------------------------------------
31 drs_basemean.resize(drs_n,0);
32 drs_gainmean.resize(drs_n,0);
33 drs_triggeroffsetmean.resize(drs_n,0);
34
35//-------------------------------------------
36//Link the data to variables
37//-------------------------------------------
38 drsfile.SetVecAddress("BaselineMean", drs_basemean);
39 drsfile.SetVecAddress("GainMean", drs_gainmean);
40 drsfile.SetVecAddress("TriggerOffsetMean", drs_triggeroffsetmean);
41 drsfile.GetRow(0); //Read the calibration data
42
43 cout << "Reading calibration file successful..." << endl;
44 return 0;
45}
Note: See TracBrowser for help on using the repository browser.