22 <<
" There should be exactly one out key for each error scaling type.");
23 return StatusCode::FAILURE;
36 return StatusCode::SUCCESS;
41 if (!
m_attributeMap.insert( std::make_pair(
name, std::make_pair(type_idx,param_idx)) ).second) {
43 message <<
"Failed to add RIO_OnTrackErrorScaling paramter : " <<
name <<
".";
44 throw std::runtime_error(
message.str());
53 catch (std::runtime_error &
err) {
54 std::stringstream types;
56 ATH_MSG_FATAL(
"Invalid ErrorScaling type name : " << type_name <<
". Registered types:" << types.str() );
57 return StatusCode::FAILURE;
60 std::stringstream types;
62 ATH_MSG_FATAL(
"Caught exception: " <<
err.what() <<
" Invalid ErrorScaling type name : " << type_name <<
". Registered types:" << types.str() );
63 return StatusCode::FAILURE;
67 for (
unsigned int param_i=0; param_i<the_kit->
nParametres(); ++param_i) {
71 return StatusCode::SUCCESS;
81 template <
typename T_Obj>
83 std::stringstream
out;
84 std::vector<std::string> keys_out;
85 this->
getCS()->template keys<T_Obj>(keys_out,
true,
false);
86 for(
const std::string &a_key : keys_out) {
97 return StatusCode::FAILURE;
99 assert( *readHandle );
102 ATH_MSG_FATAL(
"Failed to retrieve validity range for " << readHandle.
key());
103 return StatusCode::FAILURE;
106 std::vector<SG::WriteCondHandle<RIO_OnTrackErrorScaling> > write_handles(
m_writeKey.makeHandles());
107 assert( write_handles.size() ==
m_kits.size() );
108 std::vector< std::unique_ptr<RIO_OnTrackErrorScaling> > error_scaling;
109 error_scaling.reserve(
m_kits.size());
111 unsigned int total_params=0;
114 error_scaling.push_back( a_kit->create() );
115 total_params += a_kit->nParametres();
117 assert( write_handles.size() == error_scaling.size());
121 for (
const std::pair<const unsigned int, coral::AttributeList>&
channel : **readHandle ) {
123 unsigned int att_i=0;
128 assert(
idx.first < error_scaling.size());
130 assert(
idx.second < error_scaling[
idx.first]->params().size());
132 const int nvals=
alist[att_i++].data<
int>();
133 std::vector<double> &
params = error_scaling[
idx.first]->params()[
idx.second];
137 for (
int i=0;
i<nvals;++
i, ++att_i){
138 assert( att_i <
alist.size() );
145 catch (std::out_of_range &
err) {
147 return StatusCode::FAILURE;
151 return StatusCode::FAILURE;
154 if (total_params!=0) {
155 ATH_MSG_ERROR(
"Not all parameters of the output conditions data are filled from attribute list. " << total_params <<
" parameters are not filled.");
158 for (
unsigned int key_i=0; key_i<write_handles.size(); ++key_i) {
160 assert( key_i < error_scaling.size());
161 if (!error_scaling[key_i]->postProcess()) {
162 ATH_MSG_ERROR(
"Conditions data for " << write_handles[key_i].
key() <<
" not valid.");
163 return StatusCode::FAILURE;
166 if (write_handles[key_i].record(
range, std::move(error_scaling[key_i])).isFailure()) {
167 ATH_MSG_FATAL(
"Could not record RIO_OnTrackErrorScaling " << write_handles[key_i].
key()
168 <<
" with EventRange " <<
range
169 <<
" into Conditions Store");
170 return StatusCode::FAILURE;
174 catch (coral::Exception&
e) {
175 ATH_MSG_ERROR(
"Problem with AttributeList decoding: " <<
e.what());
176 return StatusCode::FAILURE;
178 return StatusCode::SUCCESS;
183 return StatusCode::SUCCESS;