33 return StatusCode::SUCCESS;
45 std::unique_ptr<SG::WriteCondHandle<TRTCond::StrawStatusSummary>> strawStatusHTSummaryHandle{};
50 bool alreadyPresent = strawStatusHandle.isValid();
51 alreadyPresent &= strawStatusPermHandle.isValid();
52 alreadyPresent &= strawStatusSummaryHandle.isValid();
53 alreadyPresent &= strawStatusHTHandle.isValid();
54 if (strawStatusHTSummaryHandle !=
nullptr) {
55 alreadyPresent &= strawStatusHTSummaryHandle->isValid();
59 return StatusCode::SUCCESS;
63 auto outputStrawStatusSummary = std::make_unique<TRTCond::StrawStatusSummary>(
m_trtId->
straw_hash_max());
66 std::unique_ptr<TRTCond::StrawStatusSummary> outputStrawStatusHTSummary{};
68 outputStrawStatusHTSummary = std::make_unique<TRTCond::StrawStatusSummary>(
m_trtId->
straw_hash_max());
72 if (!strawReadHandle.isValid()) {
73 ATH_MSG_FATAL(
"No access to conditions " << strawReadHandle.key());
74 return StatusCode::FAILURE;
77 if (!strawReadHandle.range(
range)) {
78 ATH_MSG_ERROR(
"Failed to get validity range of " << strawReadHandle.key());
79 return StatusCode::FAILURE;
84 if (!strawPermReadHandle.isValid()) {
85 ATH_MSG_FATAL(
"No access to conditions " << strawPermReadHandle.key());
86 return StatusCode::FAILURE;
88 EventIDRange rangePerm;
89 if (!strawPermReadHandle.range(rangePerm)) {
90 ATH_MSG_ERROR(
"Failed to get validity range of " << strawPermReadHandle.key());
91 return StatusCode::FAILURE;
93 ATH_MSG_DEBUG(
"Retrieved " << strawPermReadHandle.key() <<
" with validity " << rangePerm);
96 if (!strawHTReadHandle.isValid()) {
97 ATH_MSG_FATAL(
"No access to conditions " << strawHTReadHandle.key());
98 return StatusCode::FAILURE;
100 EventIDRange rangeHT;
101 if (!strawHTReadHandle.range(rangeHT)) {
102 ATH_MSG_ERROR(
"Failed to get validity range of " << strawHTReadHandle.key());
103 return StatusCode::FAILURE;
105 ATH_MSG_DEBUG(
"Retrieved " << strawHTReadHandle.key() <<
" with validity " << rangeHT);
110 return StatusCode::FAILURE;
113 if(statPermC==
nullptr) {
114 ATH_MSG_ERROR(
"Null pointer to the straw permanent status container");
115 return StatusCode::FAILURE;
118 if(statHTC==
nullptr) {
119 ATH_MSG_ERROR(
"Null pointer to the straw HT status container");
120 return StatusCode::FAILURE;
127 unsigned int nstraws = 0;
132 for (
unsigned int i=0;
i<nstraws ;
i++) {
141 unsigned int status = statC->
get(expID).getstatus();
143 outputStrawStatus->setStatus(hashId,
status);
145 unsigned int statusPerm = statPermC->
get(expID).getstatus();
146 outputStrawStatusPerm->setStatus(hashId, statusPerm);
148 unsigned int statusHT = statHTC->
get(expID).getstatus();
149 outputStrawStatusHT->setStatus(hashId, statusHT);
151 if (
status or statusPerm) {
155 constexpr
unsigned int statusBitmask = 1 << 8;
156 bool statusBool{}, statusPermBool{}, statusHTBool{};
157 if (
status == 1) statusBool =
true;
158 else if (
status == 0) statusBool =
false;
159 else statusBool =
static_cast<bool>((
status & statusBitmask) >> 8);
161 if (statusPerm == 1) statusPermBool =
true;
162 else if (statusPerm == 0) statusPermBool =
false;
163 else statusPermBool =
static_cast<bool>((statusPerm & statusBitmask) >> 8);
165 if (statusHT == 1) statusHTBool =
true;
166 else if (statusHT==0) statusHTBool =
false;
167 else statusHTBool =
static_cast<bool>((statusHT & statusBitmask) >> 8);
169 outputStrawStatusSummary->setStatus(hashId, statusBool || statusPermBool);
170 if (outputStrawStatusHTSummary !=
nullptr) {
171 outputStrawStatusHTSummary->setStatus(hashId, statusHTBool);
177 if (strawStatusHandle.record(
range, std::move(outputStrawStatus)).isFailure()) {
179 <<
" with EventRange " <<
range
180 <<
" into Conditions Store");
181 return StatusCode::FAILURE;
184 if (strawStatusPermHandle.record(rangePerm, std::move(outputStrawStatusPerm)).isFailure()) {
186 <<
" with EventRange " << rangePerm
187 <<
" into Conditions Store");
188 return StatusCode::FAILURE;
191 if (strawStatusHTHandle.record(rangeHT, std::move(outputStrawStatusHT)).isFailure()) {
193 <<
" with EventRange " << rangeHT
194 <<
" into Conditions Store");
195 return StatusCode::FAILURE;
199 if (strawStatusSummaryHandle.record(rangeCombined, std::move(outputStrawStatusSummary)).isFailure()) {
201 <<
" with EventRange " << rangeCombined
202 <<
" into Conditions Store");
203 return StatusCode::FAILURE;
206 if (strawStatusHTSummaryHandle !=
nullptr && strawStatusHTSummaryHandle->record(rangeHT, std::move(outputStrawStatusHTSummary)).isFailure()) {
208 <<
" with EventRange " << rangeHT
209 <<
" into Conditions Store");
210 return StatusCode::FAILURE;
213 return StatusCode::SUCCESS;