44 if (writeHandleDetElCont.
isValid()) {
46 <<
". In theory this should not be called, but may happen"
47 <<
" if multiple concurrent events are being processed out of order.");
48 return StatusCode::SUCCESS;
51 std::unique_ptr<SG::WriteCondHandle<GeoAlignmentStore>> writeHandleAlignStore{};
53 writeHandleAlignStore = std::make_unique<SG::WriteCondHandle<GeoAlignmentStore>>(
m_writeKeyAlignStore, ctx);
54 if (writeHandleAlignStore->isValid()) {
55 ATH_MSG_DEBUG(
"CondHandle " << writeHandleAlignStore->fullKey() <<
" is already valid."
56 <<
". In theory this should not be called, but may happen"
57 <<
" if multiple concurrent events are being processed out of order.");
58 return StatusCode::SUCCESS;
63 std::unique_ptr<GeoAlignmentStore> writeCdoAlignStore{std::make_unique<GeoAlignmentStore>()};
70 if (unAlignedColl==
nullptr) {
71 ATH_MSG_FATAL(
"Null pointer is returned by getDetectorElementCollection()");
72 return StatusCode::FAILURE;
82 if(readCdoDynamicGlobal==
nullptr) {
83 ATH_MSG_ERROR(
"Null pointer to the read conditions object: Dynamic Global");
84 return StatusCode::FAILURE;
88 if (writeHandleAlignStore) writeHandleAlignStore->addDependency(readHandleDynamicGlobal);
95 if(readCdoDynamicRegular==
nullptr) {
96 ATH_MSG_ERROR(
"Null pointer to the read conditions object: Dynamic Regular");
97 return StatusCode::FAILURE;
101 if (writeHandleAlignStore) writeHandleAlignStore->addDependency(readHandleDynamicRegular);
102 writeHandleDetElCont.
addDependency(readHandleDynamicRegular);
109 if(readCdoRegular==
nullptr) {
110 ATH_MSG_ERROR(
"Null pointer to the read conditions object: Regular");
111 return StatusCode::FAILURE;
115 if (writeHandleAlignStore) writeHandleAlignStore->addDependency(readHandleRegular);
124 if(!readCdoSpecial) {
125 ATH_MSG_ERROR(
"Null pointer to the read conditions object: Special");
126 return StatusCode::FAILURE;
130 if (writeHandleAlignStore) writeHandleAlignStore->addDependency(readHandleSpecial);
135 if(
m_detManager->align(readCdoContainer, writeCdoAlignStore.get()).isFailure()) {
137 return StatusCode::FAILURE;
141 if (alignedColl==
nullptr) {
142 ATH_MSG_FATAL(
"Null pointer is returned by getDetectorElementCollection()");
143 return StatusCode::FAILURE;
147 std::unique_ptr<InDetDD::TRT_DetElementContainer> writeCdoDetElCont{std::make_unique<InDetDD::TRT_DetElementContainer>()};
150 std::map<const InDetDD::TRT_EndcapElement*, InDetDD::TRT_EndcapElement*> oldToNewECMap;
151 std::map<const InDetDD::TRT_BarrelElement*, InDetDD::TRT_BarrelElement*> oldToNewBAMap;
153 oldToNewECMap[
nullptr] =
nullptr;
154 oldToNewBAMap[
nullptr] =
nullptr;
164 oldToNewECMap[oldEl_Endcap] = newEl;
165 writeCdoDetElCont->addEndcapElement(newEl);
170 oldToNewBAMap[oldEl_Barrel] = newEl;
171 writeCdoDetElCont->addBarrelElement(newEl);
174 return StatusCode::FAILURE;
179 for (
auto pairOfEl : oldToNewECMap) {
180 if (!pairOfEl.first)
continue;
181 pairOfEl.second->setNextInZ(oldToNewECMap[pairOfEl.first->nextInZ()]);
182 pairOfEl.second->setPreviousInZ(oldToNewECMap[pairOfEl.first->previousInZ()]);
184 for (
auto pairOfEl : oldToNewBAMap) {
185 if (!pairOfEl.first)
continue;
186 pairOfEl.second->setNextInR(oldToNewBAMap[pairOfEl.first->nextInR()]);
187 pairOfEl.second->setPreviousInR(oldToNewBAMap[pairOfEl.first->previousInR()]);
188 pairOfEl.second->setNextInPhi(oldToNewBAMap[pairOfEl.first->nextInPhi()]);
189 pairOfEl.second->setPreviousInPhi(oldToNewBAMap[pairOfEl.first->previousInPhi()]);
194 newEl->updateAllCaches(writeCdoAlignStore.get());
198 const std::size_t writeHandleDetElContSize{writeCdoDetElCont->getElements()->size()};
200 writeCdoDetElCont->setNumerology(
m_detManager->getNumerology());
203 if (writeHandleAlignStore !=
nullptr) {
204 if(writeHandleAlignStore->record(std::move(writeCdoAlignStore)).isFailure()) {
205 ATH_MSG_ERROR(
"Could not record GeoAlignmentStore " << writeHandleAlignStore->key()
206 <<
" with EventRange " << writeHandleAlignStore->getRange()
207 <<
" into Conditions Store");
208 return StatusCode::FAILURE;
210 ATH_MSG_INFO(
"recorded new CDO " << writeHandleAlignStore->key() <<
" with range "
211 << writeHandleAlignStore->getRange() <<
" into Conditions Store");
214 if (writeHandleDetElCont.
record(std::move(writeCdoDetElCont)).isFailure()) {
216 <<
" with EventRange " << writeHandleDetElCont.
getRange()
217 <<
" into Conditions Store");
218 return StatusCode::FAILURE;
220 ATH_MSG_INFO(
"recorded new CDO " << writeHandleDetElCont.
key() <<
" with range "
221 << writeHandleDetElCont.
getRange() <<
" with size of " << writeHandleDetElContSize <<
" into Conditions Store");
223 return StatusCode::SUCCESS;