Commit e8fa18b6a7ebe88a950bac2f17523d87ef3d06a7
1 parent
f5c53312
Exists in
master
and in
100 other branches
Add the possibility to defined a calibration info manually in the parameter file
Showing
8 changed files
with
226 additions
and
6 deletions
Show diff stats
config/DataBaseParameters/local_ascii_cassini_CAPS_manual_energy.xml
0 → 100644
... | ... | @@ -0,0 +1,91 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<param xml:id="local_ascii_cassini_CAPS_manual_energy"> | |
3 | + <info> | |
4 | + <name>CAPS ELS Anode 5</name> | |
5 | + <short_name>CAPS ELS Anode 5</short_name> | |
6 | + <components></components> | |
7 | + <units>counts.s-1</units> | |
8 | + <coordinates_system></coordinates_system> | |
9 | + <tensor_order>1</tensor_order> | |
10 | + <si_conversion></si_conversion> | |
11 | + <table> | |
12 | + <boundsTable name="Energy" boundsName="Energy" units="eV"/> | |
13 | + </table> | |
14 | + <fill_value></fill_value> | |
15 | + <ucd>phys.count;phys.electron;arith.rate</ucd> | |
16 | + <dataset_id></dataset_id> | |
17 | + </info> | |
18 | + <clbManual name="Energy"> | |
19 | + <value>26040</value> | |
20 | + <value>24133.5</value> | |
21 | + <value>20609</value> | |
22 | + <value>17623.5</value> | |
23 | + <value>15066</value> | |
24 | + <value>12871.5</value> | |
25 | + <value>11005</value> | |
26 | + <value>9408.5</value> | |
27 | + <value>8044.5</value> | |
28 | + <value>6875.5</value> | |
29 | + <value>5876</value> | |
30 | + <value>5023</value> | |
31 | + <value>4293</value> | |
32 | + <value>3669.5</value> | |
33 | + <value>3136.5</value> | |
34 | + <value>2680.5</value> | |
35 | + <value>2291.5</value> | |
36 | + <value>1958.5</value> | |
37 | + <value>1674.5</value> | |
38 | + <value>1431.5</value> | |
39 | + <value>1223.5</value> | |
40 | + <value>1046.05</value> | |
41 | + <value>894.05</value> | |
42 | + <value>764.15</value> | |
43 | + <value>653.05</value> | |
44 | + <value>558.3</value> | |
45 | + <value>477.1</value> | |
46 | + <value>407.65</value> | |
47 | + <value>348.7</value> | |
48 | + <value>298.15</value> | |
49 | + <value>254.9</value> | |
50 | + <value>217.95</value> | |
51 | + <value>186.3</value> | |
52 | + <value>159.3</value> | |
53 | + <value>136</value> | |
54 | + <value>116.25</value> | |
55 | + <value>99.58</value> | |
56 | + <value>84.97</value> | |
57 | + <value>72.665</value> | |
58 | + <value>62.3</value> | |
59 | + <value>53.225</value> | |
60 | + <value>45.405</value> | |
61 | + <value>38.825</value> | |
62 | + <value>33.165</value> | |
63 | + <value>28.415</value> | |
64 | + <value>24.275</value> | |
65 | + <value>20.735</value> | |
66 | + <value>17.795</value> | |
67 | + <value>15.155</value> | |
68 | + <value>12.81</value> | |
69 | + <value>10.765</value> | |
70 | + <value>9.305</value> | |
71 | + <value>8.14</value> | |
72 | + <value>6.975</value> | |
73 | + <value>5.81</value> | |
74 | + <value>4.935</value> | |
75 | + <value>4.35</value> | |
76 | + <value>3.77</value> | |
77 | + <value>3.19</value> | |
78 | + <value>2.61</value> | |
79 | + <value>2.03</value> | |
80 | + <value>1.45</value> | |
81 | + <value>0.87</value> | |
82 | + <value>0.58</value> | |
83 | + </clbManual> | |
84 | + <get> | |
85 | + <localvi id="11"> | |
86 | + <param id="1" minSampling="4" maxSampling="32" type="double" size="63" timeFormat="ISO"/> | |
87 | + </localvi> | |
88 | + </get> | |
89 | + <process/> | |
90 | + <output/> | |
91 | +</param> | ... | ... |
config/DataBaseParameters/xsd/parameter/getlocalfile.xsd
... | ... | @@ -3,13 +3,13 @@ |
3 | 3 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
4 | 4 | <xs:include schemaLocation="parameter.xsd" /> |
5 | 5 | |
6 | - <xs:complexType name="clb-type"> | |
6 | + <xs:complexType name="clb-local-type"> | |
7 | 7 | <xs:attribute name="name" type="xs:string" /> |
8 | 8 | </xs:complexType> |
9 | 9 | |
10 | 10 | <xs:complexType name="localFileParamType"> |
11 | 11 | <xs:sequence> |
12 | - <xs:element name="clb" type="clb-type" minOccurs="0" | |
12 | + <xs:element name="clb" type="clb-local-type" minOccurs="0" | |
13 | 13 | maxOccurs="unbounded" /> |
14 | 14 | </xs:sequence> |
15 | 15 | <xs:attribute name="id" type="xs:string" use="required" /> | ... | ... |
config/DataBaseParameters/xsd/parameter/parameter.xsd
... | ... | @@ -4,6 +4,13 @@ |
4 | 4 | <xs:complexType name="GetterType"> |
5 | 5 | <xs:attribute name="name" type="xs:string" /> |
6 | 6 | </xs:complexType> |
7 | + | |
8 | + <xs:complexType name="clbManualType"> | |
9 | + <xs:sequence> | |
10 | + <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="unbounded"/> | |
11 | + </xs:sequence> | |
12 | + <xs:attribute name="name" type="xs:string" /> | |
13 | + </xs:complexType> | |
7 | 14 | |
8 | 15 | <xs:element name="Getter" type="GetterType" abstract="true" /> |
9 | 16 | |
... | ... | @@ -15,6 +22,7 @@ |
15 | 22 | minOccurs="0" maxOccurs="1" /> |
16 | 23 | <xs:element name="gap_threshold" type="xs:integer" |
17 | 24 | minOccurs="0" maxOccurs="1" /> |
25 | + <xs:element name="clbManual" type="clbManualType" minOccurs="0" maxOccurs="unbounded"></xs:element> | |
18 | 26 | <xs:element name="get"> |
19 | 27 | <xs:complexType> |
20 | 28 | <xs:sequence> | ... | ... |
src/Info/ParamTable.cc
... | ... | @@ -81,7 +81,6 @@ t_TableBound ParamBoundsTable::getBound(ParameterManager *parameterManager, unsi |
81 | 81 | |
82 | 82 | t_TableBound bound; |
83 | 83 | bound.index = index; |
84 | - | |
85 | 84 | if (tmpParam == nullptr) |
86 | 85 | { |
87 | 86 | LOG4CXX_ERROR(_logger, "Associated parameter not reachable!"); |
... | ... | @@ -91,10 +90,8 @@ t_TableBound ParamBoundsTable::getBound(ParameterManager *parameterManager, unsi |
91 | 90 | } |
92 | 91 | |
93 | 92 | //get table info from parameter info list |
94 | - | |
95 | 93 | AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList(); |
96 | 94 | AMDA::Parameters::Parameter::InfoValuesSPtr pTableInfo = lInfoList[_boundsName]; |
97 | - | |
98 | 95 | if (index >= pTableInfo->size() - 1) |
99 | 96 | { |
100 | 97 | LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" ); |
... | ... | @@ -102,7 +99,6 @@ t_TableBound ParamBoundsTable::getBound(ParameterManager *parameterManager, unsi |
102 | 99 | bound.max = index+1; |
103 | 100 | return bound; |
104 | 101 | } |
105 | - | |
106 | 102 | bound.min = std::min((*pTableInfo)[index], (*pTableInfo)[index+1]); |
107 | 103 | bound.max = std::max((*pTableInfo)[index], (*pTableInfo)[index+1]); |
108 | 104 | ... | ... |
src/Parameters/ParameterManager.cc
... | ... | @@ -79,6 +79,8 @@ bool ParameterManager::addParameter(Parameter* pParentParameter, |
79 | 79 | if (pParentParameter) { |
80 | 80 | pParentParameter->addParameter(pParamResult); |
81 | 81 | pParamResult->setGapThreshold(pParentParameter->getGapThreshold()); |
82 | + for (auto info : pParentParameter->getInfoList()) | |
83 | + pParamResult->setInfoValues(info.first,info.second); | |
82 | 84 | } |
83 | 85 | return result; |
84 | 86 | } |
... | ... | @@ -133,6 +135,8 @@ ParameterSPtr ParameterManager::getSampledParameter(const std::string& pIDParam, |
133 | 135 | // create Parameter with ProcessRempling on $pIDParam |
134 | 136 | LOG4CXX_DEBUG(_logger, "Resampled Parameter: " << lIdent.str() << " creation"); |
135 | 137 | lParameter = ParameterSPtr(new Parameter(*this, lIdent.str())); |
138 | + for (auto info : getParameter(pIDParam)->getInfoList()) | |
139 | + lParameter->setInfoValues(info.first,info.second); | |
136 | 140 | //lParameter->setXmlId(getParameter(pIDParam)->getXmlId()); |
137 | 141 | Process* lProcess = NULL; |
138 | 142 | if (samplingMode == "classic") { |
... | ... | @@ -190,6 +194,8 @@ ParameterSPtr ParameterManager::getSampledParameterUnderRefParam(const std::stri |
190 | 194 | // create Parameter with ProcessRempling on $pIDParam |
191 | 195 | LOG4CXX_DEBUG(_logger, "Resampled Parameter under reference parameter : " << lIdent.str() << " creation"); |
192 | 196 | lParameter = ParameterSPtr(new Parameter(*this, lIdent.str())); |
197 | + for (auto info : lrefParameter->getInfoList()) | |
198 | + lParameter->setInfoValues(info.first,info.second); | |
193 | 199 | //lParameter->setXmlId(getParameter(pIDParam)->getXmlId()); |
194 | 200 | Process* lProcess = NULL; |
195 | 201 | lProcess = ServicesServer::getInstance()->getProcess("sampling_under_refparam",*lParameter.get()); | ... | ... |
... | ... | @@ -0,0 +1,79 @@ |
1 | +/* | |
2 | + * ManualCalibrationNode.cc | |
3 | + * | |
4 | + * Created on: Jun 15, 2015 | |
5 | + * Author: AKKA | |
6 | + */ | |
7 | + | |
8 | +#include "Parameter.hh" | |
9 | +#include "ManualCalibrationNode.hh" | |
10 | + | |
11 | +#include <cstdlib> | |
12 | + | |
13 | +#include "Config.hh" | |
14 | +#include "Constant.hh" | |
15 | +#include "AMDA_exception.hh" | |
16 | + | |
17 | +using namespace AMDA::Parameters; | |
18 | + | |
19 | +namespace AMDA { | |
20 | +namespace XMLParameterConfigurator { | |
21 | + | |
22 | + ManualCalibrationValueNode::ManualCalibrationValueNode() : NodeCfg() { | |
23 | + } | |
24 | + | |
25 | + ManualCalibrationValueNode::~ManualCalibrationValueNode() { | |
26 | + } | |
27 | + | |
28 | + void ManualCalibrationValueNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { | |
29 | + Parameter::InfoValues* lInfoValue = pContext.get<Parameter::InfoValues*>(); | |
30 | + | |
31 | + try { | |
32 | + if (pNode->children && pNode->children->content && pNode->children->content[0] != '\0') { | |
33 | + double value = atof((const char*)pNode->children->content); | |
34 | + LOG4CXX_DEBUG(gLogger, "ManualCalibrationValueNode::proceed - " << value); | |
35 | + lInfoValue->push_back(value); | |
36 | + } | |
37 | + } catch (...) { | |
38 | + throw; | |
39 | + } | |
40 | + } | |
41 | + | |
42 | + ManualCalibrationNode::ManualCalibrationNode() : NodeGrpCfg() { | |
43 | + LOG4CXX_DEBUG(gLogger, "ManualCalibrationNode Constructor"); | |
44 | + getChildList()["value"]=AMDA::XMLConfigurator::NodeCfgSPtr(new ManualCalibrationValueNode); | |
45 | + } | |
46 | + | |
47 | + ManualCalibrationNode::~ManualCalibrationNode() { | |
48 | + LOG4CXX_DEBUG(gLogger, "~ManualCalibrationNode"); | |
49 | + } | |
50 | + | |
51 | + void ManualCalibrationNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { | |
52 | + LOG4CXX_DEBUG(gLogger, "ManualCalibrationNode::proceed"); | |
53 | + | |
54 | + xmlChar* lClbName = NULL; | |
55 | + | |
56 | + try { | |
57 | + Parameter* lParameter = pContext.get<Parameter*>(); | |
58 | + | |
59 | + if (!(lClbName = xmlGetProp(pNode, (const xmlChar *) "name"))) { | |
60 | + ERROR_EXCEPTION(AMDA::XMLConfigurator::ERROR_MANDATORY_ATTRIBUTE_MISSING << pNode->name << "@name") | |
61 | + } | |
62 | + LOG4CXX_DEBUG(gLogger, "ManualCalibrationNode::proceed - create " << (const char*)lClbName << " for " << lParameter->getId()); | |
63 | + Parameter::InfoValuesSPtr pInfoValues(new Parameter::InfoValues); | |
64 | + lParameter->setInfoValues( std::string((const char*)lClbName), pInfoValues); | |
65 | + AMDA::Parameters::CfgContext lContext(pContext); | |
66 | + lContext.push<Parameter::InfoValues*>(pInfoValues.get()); | |
67 | + NodeGrpCfg::proceed(pNode, lContext); | |
68 | + } catch (...) { | |
69 | + if (lClbName) { | |
70 | + xmlFree(lClbName); | |
71 | + } | |
72 | + throw; | |
73 | + } | |
74 | + if (lClbName) { | |
75 | + xmlFree(lClbName); | |
76 | + } | |
77 | + } | |
78 | +} /* namespace XMLParameterConfigurator */ | |
79 | +} /* namespace AMDA */ | ... | ... |
... | ... | @@ -0,0 +1,38 @@ |
1 | +/* | |
2 | + * ManualCalibrationNode.hh | |
3 | + * | |
4 | + * Created on: Jun 15, 2015 | |
5 | + * Author: AKKA | |
6 | + */ | |
7 | + | |
8 | +#ifndef MANUALCALIBRATIONNODE_HH_ | |
9 | +#define MANUALCALIBRATIONNODE_HH_ | |
10 | + | |
11 | +#include "NodeCfg.hh" | |
12 | + | |
13 | +namespace AMDA { | |
14 | +namespace XMLParameterConfigurator { | |
15 | + | |
16 | +class ManualCalibrationValueNode : public AMDA::XMLConfigurator::NodeCfg { | |
17 | +public: | |
18 | + ManualCalibrationValueNode(); | |
19 | + virtual ~ManualCalibrationValueNode(); | |
20 | + /** | |
21 | + * Parse process XML File node. | |
22 | + */ | |
23 | + virtual void proceed(xmlNodePtr,const AMDA::Parameters::CfgContext& context); | |
24 | +}; | |
25 | + | |
26 | +class ManualCalibrationNode : public AMDA::XMLConfigurator::NodeGrpCfg { | |
27 | +public: | |
28 | + ManualCalibrationNode(); | |
29 | + virtual ~ManualCalibrationNode(); | |
30 | + /** | |
31 | + * Parse process XML File node. | |
32 | + */ | |
33 | + virtual void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext); | |
34 | +}; | |
35 | + | |
36 | +} /* namespace XMLParameterConfigurator */ | |
37 | +} /* namespace AMDA */ | |
38 | +#endif /* MANUALCALIBRATIONNODE_HH_ */ | ... | ... |
src/XMLParameterConfigurator/ParamNode.cc
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | #include "ParamNode.hh" |
21 | 21 | #include "ProcessNode.hh" |
22 | 22 | #include "CalibrationNode.hh" |
23 | +#include "ManualCalibrationNode.hh" | |
23 | 24 | #include "GetAMDAParamNode.hh" |
24 | 25 | #include "Constant.hh" |
25 | 26 | |
... | ... | @@ -62,6 +63,7 @@ namespace AMDA { |
62 | 63 | getChildList()["time_resolution"]=NodeCfgSPtr(new NodeTimeResolution); |
63 | 64 | getChildList()["gap_threshold"]=NodeCfgSPtr(new NodeGapThreshold); |
64 | 65 | getChildList()["process"]=NodeCfgSPtr(new ProcessNode()); |
66 | + getChildList()["clbManual"]=NodeCfgSPtr(new ManualCalibrationNode()); | |
65 | 67 | getChildList()["clbProcess"]=NodeCfgSPtr(new CalibrationNode()); |
66 | 68 | NodeCfgSPtr getNode = NodeCfgSPtr(new NodeGrpCfg); |
67 | 69 | getChildList()["get"]=getNode; | ... | ... |