File indexing completed on 2025-01-30 09:17:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "AlignmentExampleObjects.h"
0016 #include "DD4hep/AlignmentsPrinter.h"
0017 #include "DD4hep/DD4hepUnits.h"
0018 #include "DD4hep/Objects.h"
0019
0020 using namespace std;
0021 using namespace dd4hep;
0022 using namespace dd4hep::AlignmentExamples;
0023
0024
0025 ConditionsManager dd4hep::AlignmentExamples::installManager(Detector& description) {
0026
0027 description.apply("DD4hep_ConditionsManagerInstaller",0,(char**)0);
0028 ConditionsManager manager = ConditionsManager::from(description);
0029 manager["PoolType"] = "DD4hep_ConditionsLinearPool";
0030 manager["UserPoolType"] = "DD4hep_ConditionsMapUserPool";
0031 manager["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool";
0032 manager.initialize();
0033 return manager;
0034 }
0035
0036
0037 int AlignmentDataAccess::operator()(DetElement de, int) const {
0038 vector<Alignment> alignments;
0039 alignmentsCollector(mapping,alignments)(de);
0040
0041
0042 for(const auto& align : alignments ) {
0043 const Delta& delta = align.data().delta;
0044 if ( delta.hasTranslation() || delta.hasPivot() || delta.hasRotation() ) {}
0045 }
0046
0047
0048 align::printElementPlacement(printLevel,"Example",de,mapping);
0049 return 1;
0050 }
0051
0052
0053 int AlignmentCreator::operator()(DetElement de, int) const {
0054 if ( de.ptr() != de.world().ptr() ) {
0055 Condition cond(de.path()+"#"+align::Keys::deltaName,align::Keys::deltaName);
0056 Delta& delta = cond.bind<Delta>();
0057 cond->hash = ConditionKey(de.key(),align::Keys::deltaKey).hash;
0058 cond->setFlag(Condition::ACTIVE|Condition::ALIGNMENT_DELTA);
0059
0060 delta.translation.SetZ(delta.translation.Z()+0.1*dd4hep::cm);
0061 delta.rotation = RotationZYX(0.999,1.001,0.999);
0062 delta.flags |= Delta::HAVE_TRANSLATION|Delta::HAVE_ROTATION;
0063 if ( !manager.registerUnlocked(pool, cond) ) {
0064 printout(WARNING,"Example","++ Failed to register condition %s.",cond.name());
0065 }
0066 printout(printLevel,"Example","++ Adding manually alignments for %s",cond.name());
0067 }
0068 return 1;
0069 }