9#include <alignment/Hierarchy.h>
10#include <alignment/Manager.h>
11#include <alignment/PedeResult.h>
12#include <framework/database/EventDependency.h>
13#include <vxd/dataobjects/VxdID.h>
15#include <gtest/gtest.h>
21using namespace alignment;
25 class TestTopLevelDBObj {
27 static unsigned short getGlobalUniqueID() {
return 10; }
31 class TestLevelDBObj {
33 static unsigned short getGlobalUniqueID() {
return 20; }
37 class HierarchyTest :
public ::testing::Test {
39 unsigned short topElement {1};
40 unsigned short element1 = {1};
41 unsigned short element2 = {2};
46 auto& hierarchy = GlobalCalibrationManager::getInstance().getAlignmentHierarchy();
48 G4Transform3D unitTrafo;
49 hierarchy.insertG4Transform<TestLevelDBObj, TestTopLevelDBObj>(element1, topElement, unitTrafo);
50 hierarchy.insertG4Transform<TestLevelDBObj, TestTopLevelDBObj>(element2, topElement, unitTrafo);
54 virtual void TearDown()
62 TEST_F(HierarchyTest, HierarchyDerivatives)
64 auto& hierarchy = GlobalCalibrationManager::getInstance().getAlignmentHierarchy();
66 auto sop =
new genfit::StateOnPlane(
nullptr);
76 EXPECT_EQ(hierarchy.getGlobalDerivatives<TestLevelDBObj>(element1, sop).second(0, 0), 1.);
81 TEST_F(HierarchyTest, HierarchyConstraints)
83 auto& hierarchy = GlobalCalibrationManager::getInstance().getAlignmentHierarchy();
85 Constraints constraints;
86 hierarchy.buildConstraints(constraints);
89 EXPECT_EQ(constraints.size(), 6);
93 for (
auto checksum_constraint : constraints) {
94 auto& constraint = checksum_constraint.second;
95 EXPECT_EQ(constraint.size(), 2);
97 EXPECT_EQ(fabs(constraint[0].second), 1.);
Abstract base class for different kinds of events.