MTP  1.0
 All Classes Files Functions Variables Macros Pages
calibrator.cc
Go to the documentation of this file.
1 #include "calibrator.h"
2 
3 using namespace std;
4 
5 Calibrator::Calibrator(vector<float> cnd0, vector<float> gof, vector<float> gec1, vector<float> gec2)
6 {
7  _CND0 = cnd0;
8  _GOF = gof;
9  _GEC1 = gec1;
10  _GEC2 = gec2;
11 
12  for (int i=0; i<NUM_CHANNELS; i++) _Gain.push_back(0.0);
13 
14  float _AA = -244.3364635;
15  float _Bb = 0.462418;
16  float _cC = 0.0000588;
17  float _DD = -0.000000013;
18  float _Wtg = 0.1;
19 
20  return;
21 }
22 
23 std::vector<float> Calibrator::Calibrate(std::vector<int> ScanCounts, std::vector<int> PltWireCnts)
24 {
25  std::vector<float> Gnd;
26  std::vector<float> Geqn;
27  for (int i=0; i<NUM_CHANNELS; i++)
28  {
29  Gnd.push_back(0.0);
30  Geqn.push_back(0.0);
31  }
32 
33  int TargIndx = 10; // Index into ScanCounts for the target w/ND on
34  int TargNDIndx = 11; // Index into ScanCounts for the target w/ND off
35  for (int i=0; i<NUM_CHANNELS; i++)
36  {
37  Gnd[i] = ScanCounts[TargIndx]-ScanCounts[TargNDIndx]/_CND0[i];
38  TargIndx = TargIndx+12;
39  TargNDIndx = TargNDIndx+12;
40  }
41 
42  // Temperature of the mixer
43  float TMix;
44  int TMC = PltWireCnts[4]; // Counts for Tmix
45 
46  TMix = _AA + _Bb*TMC + _cC*TMC*TMC + _DD*TMC*TMC*TMC;
47 
48  // Initialize the gain
49  for (int i=0; i<NUM_CHANNELS; i++)
50  {
51  if (_Gain[i] == 0.0) {
52  _Gain[i] = TMix*_GEC2[i];
53  } else {
54  _Gain[i] = (_Gain[i] + Gnd[i] * _Wtg)/ (1+_Wtg);
55  }
56  }
57 }
58 
#define NUM_CHANNELS
number of frequencies used by the MTP
Definition: mtp.h:16
This class encapsulates the calibration of the MTP scans.
Calibrator(std::vector< float >, std::vector< float >, std::vector< float >, std::vector< float >)
Definition: calibrator.cc:5
std::vector< float > Calibrate(std::vector< int >, std::vector< int >)
Definition: calibrator.cc:23