-
Notifications
You must be signed in to change notification settings - Fork 2
/
PCalSimple.cxx
70 lines (62 loc) · 1.36 KB
/
PCalSimple.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// File: PCalSimple.cxx
//
// Created: 09/13/00 - P. Harvey
//
// Description: Simple calibration object (with or without Q vs T walk correction)
//
#include <stdio.h>
#include <stdlib.h>
#include "PCalSimple.h"
#include "CUtils.h"
#include "calibrate.h"
PCalSimple::PCalSimple()
{
mDBase = 0;
mDoWalk = 1;
}
PCalSimple::~PCalSimple()
{
Free();
}
void PCalSimple::Init(char *filename, char *path)
{
Free(); // free old database if it existed
// load calibration constants
mDBase = newCalibrationDatabase(filename, path);
if (mDBase) {
Printf("%d PMT's with valid calibrations\n",(int)mDBase->nvalid);
Printf("Validity range of calibration constants: %d to %d\n",
(int)mDBase->validity[0], (int)mDBase->validity[2]);
mStatus = 0;
} else {
mStatus = -1;
}
}
void PCalSimple::Free()
{
if (mDBase) {
free(mDBase);
mDBase = 0;
}
mStatus = -1;
}
void PCalSimple::Calibrate(int calFlags)
{
if (mStatus >= 0) {
if (calFlags & kCalTac) {
mCalTac = getCalibratedTac(mDBase, mRawTac, mCell, mIndex, mDoWalk ? mRawQhs : -1);
}
if (calFlags & kCalQhs) {
mCalQhs = getCalibratedQhs(mDBase, mRawQhs, mCell, mIndex);
}
if (calFlags & kCalQhl) {
mCalQhl = getCalibratedQhl(mDBase, mRawQhl, mCell, mIndex);
}
if (calFlags & kCalQlx) {
mCalQlx = getCalibratedQlx(mDBase, mRawQlx, mCell, mIndex);
}
} else {
PCal::Calibrate(calFlags);
}
}