Commit c0955cd4af5d23987ab9d8b42b16d4ec1d0f2c6b
1 parent
ec26c1a3
Exists in
master
and in
85 other branches
ok for juno jedi
Showing
5 changed files
with
136 additions
and
117 deletions
Show diff stats
src/ExternLib/GetClbInfo/GetClbInfoProcess.cc
... | ... | @@ -54,7 +54,9 @@ TimeStamp GetClbInfoProcess::init() { |
54 | 54 | int i = 0; |
55 | 55 | unsigned int nbHeader = 0; |
56 | 56 | for (auto info : lInfoList){ |
57 | - semiVariableTableElements.tabValues[i] = *info.second; | |
57 | + std::stringstream index; | |
58 | + index << std::setw(3) << std::setfill('0') <<i; | |
59 | + semiVariableTableElements.tabValues[index.str()] = *info.second; | |
58 | 60 | if (nbHeader < (*info.second).size()) |
59 | 61 | nbHeader = (*info.second).size(); |
60 | 62 | i++; | ... | ... |
src/ExternLib/GetJunoJediEnergy/GetJunoJediEnergy.hh
... | ... | @@ -25,109 +25,128 @@ using namespace boost; |
25 | 25 | using namespace AMDA::Parameters; |
26 | 26 | |
27 | 27 | namespace AMDA { |
28 | -namespace JunoJedi { | |
29 | - | |
30 | -namespace Base { | |
31 | -/** | |
32 | - * @class Base::GetJunoJediEnergy | |
33 | - * @brief Compute Juno Jedi energy | |
34 | - */ | |
35 | - class GetJunoJediEnergy : public Operation { | |
36 | - public: | |
37 | - | |
38 | - /** | |
39 | - * @brief Default Constructor. | |
40 | - */ | |
41 | - GetJunoJediEnergy(Process& pProcess) : Operation(pProcess) {} | |
42 | - | |
43 | - /** | |
44 | - * @brief Destructor. | |
45 | - */ | |
46 | - virtual ~GetJunoJediEnergy() {} | |
47 | - | |
48 | - /** | |
49 | - * @brief initialize the operation . | |
50 | - * @detail initialize the operation with information stored in pInput.getInfoList() and pAttribute. | |
51 | - */ | |
52 | - virtual void init(Parameter& input, Process::AttributeList& pAttribute) = 0; | |
53 | - | |
54 | - protected: | |
55 | - }; | |
56 | - } | |
57 | - | |
58 | - | |
59 | -/** | |
60 | - * @class GetJunoJediEnergy | |
61 | - * @brief Compute Juno Jedi energy. | |
62 | - */ | |
63 | -template<class TParamData> | |
64 | -class GetJunoJediEnergy : public Base::GetJunoJediEnergy { | |
65 | -public: | |
66 | - /** | |
67 | - * @brief Constructor. | |
68 | - * @details Create the ParamData type of the input ParamData. | |
69 | - */ | |
70 | - GetJunoJediEnergy(Process& pProcess, TParamData& paramInput, const std::string& energy_band_name) | |
71 | - : Base::GetJunoJediEnergy(pProcess), _paramInput(paramInput), _paramOutput(new ParamDataTab1DFloat()), _energy_band_name(energy_band_name), _look_dir(0) { | |
72 | - _paramDataOutput=_paramOutput; | |
73 | - } | |
74 | - | |
75 | - /** | |
76 | - * | |
77 | - * @overload Base::GetJunoJediEnergy::init() | |
78 | - */ | |
79 | - void init(Parameter& pInput, Process::AttributeList& pAttribute) { | |
80 | - try { | |
81 | - _look_dir = boost::lexical_cast<int>( pAttribute[0] ); | |
82 | - if (_look_dir > 7) { | |
83 | - _look_dir = 0; | |
84 | - } | |
85 | - } catch( boost::bad_lexical_cast const& ) { | |
86 | - _look_dir = 0; | |
87 | - } | |
88 | - | |
89 | - Parameter::InfoList& lInfoList = pInput.getInfoList(); | |
90 | - | |
91 | - for (int mode = 0; mode < 2; ++mode) { | |
92 | - for (int bin = 0; bin < 24; ++bin) { | |
93 | - std::stringstream index_name; | |
94 | - index_name << _energy_band_name; | |
95 | - index_name << "_"; | |
96 | - index_name << (mode * 6 + _look_dir); | |
97 | - _energyList[mode].push_back((*lInfoList[index_name.str()].get())[bin]); | |
98 | - } | |
99 | - } | |
100 | - } | |
101 | - | |
102 | - /** | |
103 | - * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) | |
104 | - */ | |
105 | - void write(ParamDataIndexInfo &pParamDataIndexInfo) { | |
106 | - unsigned int index = pParamDataIndexInfo._startIndex; | |
107 | - for (; index< pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; index++) { | |
108 | - _paramOutput->pushTime(_paramInput.getTime(index)); | |
109 | - _paramOutput->getDataList().push_back((_energyList[(int)floor(_paramInput.getDataList()[index])])); | |
110 | - } | |
111 | - } | |
112 | - | |
113 | -private: | |
114 | - /** | |
115 | - * @brief It is the channel of calibration. | |
116 | - */ | |
117 | - TParamData &_paramInput; | |
118 | - | |
119 | - /** | |
120 | - * @brief It is the channel of the data shifted. | |
121 | - */ | |
122 | - ParamDataTab1DFloat *_paramOutput; | |
123 | - | |
124 | - std::map<unsigned int , std::vector<float> > _energyList; | |
125 | - | |
126 | - std::string _energy_band_name; | |
127 | - | |
128 | - int _look_dir; | |
129 | -}; | |
130 | - | |
131 | -} /* namespace JunoJedi */ | |
28 | + namespace JunoJedi { | |
29 | + | |
30 | + namespace Base { | |
31 | + | |
32 | + /** | |
33 | + * @class Base::GetJunoJediEnergy | |
34 | + * @brief Compute Juno Jedi energy | |
35 | + */ | |
36 | + class GetJunoJediEnergy : public Operation { | |
37 | + public: | |
38 | + | |
39 | + /** | |
40 | + * @brief Default Constructor. | |
41 | + */ | |
42 | + GetJunoJediEnergy(Process& pProcess) : Operation(pProcess) { | |
43 | + } | |
44 | + | |
45 | + /** | |
46 | + * @brief Destructor. | |
47 | + */ | |
48 | + virtual ~GetJunoJediEnergy() { | |
49 | + } | |
50 | + | |
51 | + /** | |
52 | + * @brief initialize the operation . | |
53 | + * @detail initialize the operation with information stored in pInput.getInfoList() and pAttribute. | |
54 | + */ | |
55 | + virtual void init(Parameter& input, Process::AttributeList& pAttribute) = 0; | |
56 | + | |
57 | + protected: | |
58 | + }; | |
59 | + } | |
60 | + | |
61 | + /** | |
62 | + * @class GetJunoJediEnergy | |
63 | + * @brief Compute Juno Jedi energy. | |
64 | + */ | |
65 | + template<class TParamData> | |
66 | + class GetJunoJediEnergy : public Base::GetJunoJediEnergy { | |
67 | + public: | |
68 | + | |
69 | + /** | |
70 | + * @brief Constructor. | |
71 | + * @details Create the ParamData type of the input ParamData. | |
72 | + */ | |
73 | + GetJunoJediEnergy(Process& pProcess, TParamData& paramInput, const std::string& energy_band_name) | |
74 | + : Base::GetJunoJediEnergy(pProcess), _paramInput(paramInput), _paramOutput(new ParamDataTab1DFloat()), _energy_band_name(energy_band_name), _look_dir(0) { | |
75 | + _paramDataOutput = _paramOutput; | |
76 | + } | |
77 | + | |
78 | + /** | |
79 | + * | |
80 | + * @overload Base::GetJunoJediEnergy::init() | |
81 | + */ | |
82 | + void init(Parameter& pInput, Process::AttributeList& pAttribute) { | |
83 | + try { | |
84 | + _look_dir = boost::lexical_cast<int>(pAttribute[0]); | |
85 | + if (_look_dir > 7) { | |
86 | + _look_dir = 0; | |
87 | + } | |
88 | + } catch (boost::bad_lexical_cast const&) { | |
89 | + _look_dir = 0; | |
90 | + } | |
91 | + | |
92 | + Parameter::InfoList& lInfoList = pInput.getInfoList(); | |
93 | + | |
94 | + AMDA::Parameters::SemiVariableTable semiVariableTableElements; | |
95 | + | |
96 | + for (int mode = 0; mode < 2; ++mode) { | |
97 | + for (int bin = 0; bin < 24; ++bin) { | |
98 | + std::stringstream index_name; | |
99 | + index_name << _energy_band_name; | |
100 | + index_name << "_"; | |
101 | + index_name << (mode * 6 + _look_dir); | |
102 | + _energyList[mode].push_back((*lInfoList[index_name.str()].get())[bin]); | |
103 | + if (mode == 0){ | |
104 | + std::string head = "Energy[" + std::to_string(bin) + "]"; | |
105 | + semiVariableTableElements.tabHeader.push_back(head); | |
106 | + } | |
107 | + } | |
108 | + std::vector<double> energyList(_energyList[mode].begin(), _energyList[mode].end()); | |
109 | + std::stringstream index; | |
110 | + index << std::setw(3) << std::setfill('0') << mode; | |
111 | + index<<" "<<_energy_band_name; | |
112 | + semiVariableTableElements.tabValues[index.str()] = energyList; | |
113 | + } | |
114 | + semiVariableTableElements.calculateBounds = false; | |
115 | + _process.setSemiVariableTable(semiVariableTableElements); | |
116 | + if (!semiVariableTableElements.tabValues.empty()) | |
117 | + pInput.setIsTableIndexParam(true); | |
118 | + | |
119 | + } | |
120 | + | |
121 | + /** | |
122 | + * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) | |
123 | + */ | |
124 | + void write(ParamDataIndexInfo &pParamDataIndexInfo) { | |
125 | + unsigned int index = pParamDataIndexInfo._startIndex; | |
126 | + for (; index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; index++) { | |
127 | + _paramOutput->pushTime(_paramInput.getTime(index)); | |
128 | + _paramOutput->getDataList().push_back((_energyList[(int) floor(_paramInput.getDataList()[index])])); | |
129 | + } | |
130 | + } | |
131 | + | |
132 | + private: | |
133 | + /** | |
134 | + * @brief It is the channel of calibration. | |
135 | + */ | |
136 | + TParamData &_paramInput; | |
137 | + | |
138 | + /** | |
139 | + * @brief It is the channel of the data shifted. | |
140 | + */ | |
141 | + ParamDataTab1DFloat *_paramOutput; | |
142 | + | |
143 | + std::map<unsigned int, std::vector<float> > _energyList; | |
144 | + | |
145 | + std::string _energy_band_name; | |
146 | + | |
147 | + int _look_dir; | |
148 | + }; | |
149 | + | |
150 | + } /* namespace JunoJedi */ | |
132 | 151 | } /* namespace AMDA */ |
133 | 152 | #endif /* GetJunoJediEnergy_HH_ */ | ... | ... |
src/ExternLib/GetMavenStaticEnergy/GetMavenStaticEnergy.hh
... | ... | @@ -110,7 +110,7 @@ namespace AMDA { |
110 | 110 | semiVariableTableElements.tabHeader.push_back(head); |
111 | 111 | } |
112 | 112 | } |
113 | - semiVariableTableElements.tabValues[i] = _energyList[i]; | |
113 | + semiVariableTableElements.tabValues[std::to_string(i)] = _energyList[i]; | |
114 | 114 | } else { |
115 | 115 | for (int k = 0; k < nbEnergy; ++k) { |
116 | 116 | std::string infoKey = "energy_"; |
... | ... | @@ -121,15 +121,12 @@ namespace AMDA { |
121 | 121 | semiVariableTableElements.tabHeader.push_back(head); |
122 | 122 | } |
123 | 123 | } |
124 | - | |
125 | - semiVariableTableElements.tabValues[i] = _energyList[i]; | |
124 | + semiVariableTableElements.tabValues[std::to_string(i)] = _energyList[i]; | |
126 | 125 | } |
127 | 126 | } |
128 | 127 | _process.setSemiVariableTable(semiVariableTableElements); |
129 | 128 | if (!semiVariableTableElements.tabValues.empty()) |
130 | 129 | pInput.setIsTableIndexParam(true); |
131 | - | |
132 | - | |
133 | 130 | } |
134 | 131 | |
135 | 132 | /** | ... | ... |
src/Info/ParamTable.cc
... | ... | @@ -200,16 +200,16 @@ namespace AMDA { |
200 | 200 | PUSHINFO(infoMap, "", head.str()); |
201 | 201 | // recuperer les centres |
202 | 202 | bool variableSizes = false; |
203 | - int nModes = semiVariableTable.tabValues.size(); | |
204 | - int nValues = semiVariableTable.tabHeader.size(); | |
203 | + unsigned int nModes = semiVariableTable.tabValues.size(); | |
204 | + unsigned int nValues = semiVariableTable.tabHeader.size(); | |
205 | 205 | for (auto tabValues : semiVariableTable.tabValues) { |
206 | 206 | if (tabValues.second.size() != nValues) |
207 | 207 | variableSizes = true; |
208 | 208 | } |
209 | - if (variableSizes) { | |
209 | + if (variableSizes || !semiVariableTable.calculateBounds) { | |
210 | 210 | std::ostringstream values; |
211 | 211 | for (auto tabValues : semiVariableTable.tabValues) { |
212 | - values << std::to_string(tabValues.first) << " "; | |
212 | + values <<tabValues.first<< " "; | |
213 | 213 | for (unsigned int i = 0; i < nValues; i++) { |
214 | 214 | if (i < tabValues.second.size()) { |
215 | 215 | values << std::to_string(tabValues.second[i]) << " "; |
... | ... | @@ -226,8 +226,8 @@ namespace AMDA { |
226 | 226 | std::map<int, std::vector<double>> semiVariableTableData; |
227 | 227 | for (int i = 0; i < nValues; ++i) { |
228 | 228 | energyVec.clear(); |
229 | - for (int j = 0; j < nModes; ++j) { | |
230 | - energyVec.push_back(semiVariableTable.tabValues[j][i]); | |
229 | + for (unsigned int j = 0; j < nModes; ++j) { | |
230 | + energyVec.push_back(semiVariableTable.tabValues[std::to_string(j)][i]); | |
231 | 231 | } |
232 | 232 | paramsTableData[tabKey] = energyVec; |
233 | 233 | for (int j = 0; j < 2 * nModes; j = j + 2) { | ... | ... |
src/Parameters/Parameter.hh
... | ... | @@ -38,7 +38,8 @@ namespace AMDA { |
38 | 38 | |
39 | 39 | struct SemiVariableTable { |
40 | 40 | std::vector<std::string> tabHeader; |
41 | - std::map<int, std::vector<double>> tabValues; | |
41 | + std::map<std::string, std::vector<double>> tabValues; | |
42 | + bool calculateBounds = true; | |
42 | 43 | }; |
43 | 44 | |
44 | 45 | /** | ... | ... |