File indexing completed on 2025-01-31 09:20:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include "Detector/DeAlignmentCall.h"
0018 #include "Detector/DetectorElement.h"
0019 #include "DD4hep/DetectorTools.h"
0020 #include "DD4hep/DetectorProcessor.h"
0021 #include "DD4hep/AlignmentsProcessor.h"
0022 #include "DD4hep/AlignmentsCalculator.h"
0023 #include "DDCond/ConditionsPool.h"
0024 #include "DDCond/ConditionsManager.h"
0025
0026 using namespace dd4hep;
0027 using namespace dd4hep::cond;
0028 using namespace dd4hep::align;
0029
0030
0031 Condition gaudi::DeAlignmentCall::operator()(const ConditionKey& ,
0032 ConditionUpdateContext& ctxt) {
0033
0034 namespace tools = dd4hep::detail::tools;
0035 Condition cond;
0036 UserPool* conditions = dynamic_cast<UserPool*>(&ctxt.resolver->conditionsMap());
0037 if ( conditions ) {
0038 typedef AlignmentsCalculator::OrderedDeltas Deltas;
0039 ConditionsHashMap slice;
0040 AlignmentsCalculator calc;
0041 const IOV& iov = conditions->validity();
0042 ConditionsManager mgr = ctxt.resolver->manager();
0043 cond = Condition(gaudi::Keys::alignmentsComputedKeyName,"Calculator");
0044 Deltas& deltas = cond.bind<Deltas>();
0045
0046
0047 DetectorScanner().scan(AlignmentsCalculator::Scanner(ctxt,deltas),top);
0048 AlignmentsCalculator::Result ares = calc.compute(deltas, slice);
0049 ConditionsPool* iov_pool = mgr.registerIOV(*iov.iovType,iov.key());
0050 for(auto i=std::begin(slice.data); i != std::end(slice.data); ++i) {
0051 Condition c = (*i).second;
0052 mgr.registerUnlocked(*iov_pool,c);
0053 conditions->insert(c);
0054 }
0055 printout(INFO,"Align","Alignments:(C:%ld,M:%ld,*:%ld) IOV:%s",
0056 ares.computed, ares.missing, ares.multiply, ctxt.iov->str().c_str());
0057 return cond;
0058 }
0059 except("DeAlignmentCall","No conditions slice present!");
0060 return cond;
0061 }