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

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