ProcessGtlLEPBCalculate.cc
3.93 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
* ProcessGtlLEPBCalculate.cc
*
* Created on: Oct 14, 2016
* Author: elena
*/
#include <stdlib.h>
#include <string>
#include <boost/lexical_cast.hpp>
#include "DicError.hh"
#include "AMDA_exception.hh"
#include "Operation.hh"
#include "ParameterManager.hh"
#include "ProcessGtlLEPBCalculate.hh"
#include "GtlLEPBCalculateCreator.hh"
#include "ParamMgr.hh"
#include "ParameterCreatorFromExpression.hh"
using namespace std;
using namespace boost;
using namespace log4cxx;
namespace AMDA {
namespace Parameters {
double LEPB_DIR[4][2] = {
{135.00, 225.00},// tailward
{225.00, 315}, // dawnward
{-45.00, 45.00}, // sunward
{45.00, 135.00} // duskward
};
ProcessGtlLEPBCalculate::ProcessGtlLEPBCalculate(Parameter ¶meter) : MultiParamProcess_CRTP(parameter),
_isAnisotropy(false), _valueMin(0.), _valueMax(0.) {
}
ProcessGtlLEPBCalculate::ProcessGtlLEPBCalculate(const ProcessGtlLEPBCalculate& pProcess, Parameter ¶meter)
: MultiParamProcess_CRTP(pProcess,parameter), _isAnisotropy(pProcess._isAnisotropy), _inputParamName(pProcess._inputParamName),
_azimuthParamName(pProcess._azimuthParamName), _valueMin(pProcess._valueMin), _valueMax(pProcess._valueMax) {
}
ProcessGtlLEPBCalculate::~ProcessGtlLEPBCalculate() {
}
void ProcessGtlLEPBCalculate::parse() {
ParameterCreatorFromExpression creator(_parameter.getParameterManager());
ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression, isUserProcess());
_paramNameList[lParameter->getId()].first = lParameter;
_inputParamName = lParameter->getId();
if (_attributList.size() < 3) {
BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessGtlLEPBCalculate::parse require at least 3 attributes'")));
}
if (_attributList[0] != _expression) {
lParameter = creator.getOneParameterFromExpression(_parameter,_attributList[0], isUserProcess());
_paramNameList[lParameter->getId()].first = lParameter;
_azimuthParamName = lParameter->getId();
}
else {
_azimuthParamName = lParameter->getId();
}
if (_attributList[1] != _expression) {
lParameter = creator.getOneParameterFromExpression(_parameter,_attributList[1], isUserProcess());
_paramNameList[lParameter->getId()].first = lParameter;
_energyParamName = lParameter->getId();
}
else {
_energyParamName = lParameter->getId();
}
if (!_isAnisotropy && (_attributList.size() == 3)) {
int dirIndex = atoi(_attributList[2].c_str());
if (dirIndex < 0 || dirIndex > 3) {
BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessGtlLEPBCalculate::parse outside available sectors'")));
}
_valueMin = LEPB_DIR[dirIndex][0];
_valueMax = LEPB_DIR[dirIndex][1];
}
else {
_valueMin = atof(_attributList[2].c_str());
_valueMax = atof(_attributList[3].c_str());
}
}
void ProcessGtlLEPBCalculate::establishConnection() {
parse();
MultiParamProcess::establishConnection();
}
TimeStamp ProcessGtlLEPBCalculate::init() {
TimeStamp timeStamp = MultiParamProcess::init();
ParamData* lmainParamInput = _paramNameList[_inputParamName].first->getParamData(this).get();
ParamData* lazimuthParamInput = _paramNameList[_azimuthParamName].first->getParamData(this).get();
ParamData* lenergyParamInput = _paramNameList[_energyParamName].first->getParamData(this).get();
GtlLEPBCalculateCreator lGtlLEPBCalculateCreator(*this, *lmainParamInput, *lazimuthParamInput, *lenergyParamInput,
_valueMin, _valueMax, _isAnisotropy);
_operation = lGtlLEPBCalculateCreator.getOperation();
_paramData = ParamDataSPtr(_operation->getParamOutput());
_paramData->setMinSampling(lmainParamInput->getMinSampling());
return timeStamp;
}
ProcessGtlLEPBAnisotropyCalculate::ProcessGtlLEPBAnisotropyCalculate(Parameter ¶meter) : ProcessGtlLEPBCalculate(parameter) {
_isAnisotropy = true;
}
} /* namespace Parameters */
} /* namespace AMDA */