#include #include #include "IHandle.hxx" #include "IReconState.hxx" #include "ICorrValues.hxx" #include "IClusterState.hxx" #include "IShowerState.hxx" #include "ITrackState.hxx" #include "IPIDState.hxx" #include "IVertexState.hxx" namespace tut { struct baseTReconState { baseTReconState() { // Run before each test. } ~baseTReconState() { // Run after each test. } }; // Declare the test typedef test_group::object testTReconState; test_group groupTReconState("IReconState"); // Test the default constructor and destructor. template<> template<> void testTReconState::test<1> () { COMET::IClusterState v; } // Test the IClusterState projection operator. template<> template<> void testTReconState::test<2> () { COMET::IHandle s(new COMET::IClusterState); ensure_greaterthan("IClusterState dimensionality",s->GetDimensions(),4); for (int i = 0; iGetDimensions(); ++i) { s->SetCovarianceValue(i,i,double(i+1)); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Expected cluster state covariance", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } COMET::ICorrValues v = COMET::IClusterState::ProjectState(s); for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Cluster state covariance after projection", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Projected cluster state covariance", v.GetCovarianceValue(i,i), double(i+1), 0.0001); } } // Test the IShowerState projection operator. template<> template<> void testTReconState::test<3> () { COMET::IHandle s(new COMET::IShowerState); ensure_greaterthan("IShowerState dimensionality",s->GetDimensions(),4); for (int i = 0; iGetDimensions(); ++i) { s->SetCovarianceValue(i,i,double(i+1)); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Expected shower state covariance", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } COMET::ICorrValues v = COMET::IShowerState::ProjectState(s); for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Shower state covariance after projection", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Projected shower state covariance", v.GetCovarianceValue(i,i), double(i+1), 0.0001); } } /* // Test the ITrackState projection operator. template<> template<> void testTReconState::test<4> () { COMET::IHandle s(new COMET::ITrackState); ensure_greaterthan("ITrackState dimensionality",s->GetDimensions(),4); for (int i = 0; iGetDimensions(); ++i) { s->SetCovarianceValue(i,i,double(i+1)); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Expected track state covariance", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } COMET::ICorrValues v = COMET::ITrackState::ProjectState(s); for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Track state covariance after projection", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Projected track state covariance", v.GetCovarianceValue(i,i), double(i+1), 0.0001); } } */ // Test the IVertexState projection operator. template<> template<> void testTReconState::test<5> () { COMET::IHandle s(new COMET::IVertexState); ensure_greaterthan("IVertexState dimensionality",s->GetDimensions(),3); for (int i = 0; iGetDimensions(); ++i) { s->SetCovarianceValue(i,i,double(i+1)); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Expected vertex state covariance", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } COMET::ICorrValues v = COMET::IVertexState::ProjectState(s); for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Vertex state covariance after projection", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Projected vertex state covariance", v.GetCovarianceValue(i,i), double(i+1), 0.0001); } } // Test the IPIDState projection operator. template<> template<> void testTReconState::test<6> () { COMET::IHandle s(new COMET::IPIDState); ensure_greaterthan("IPIDState dimensionality",s->GetDimensions(),4); for (int i = 0; iGetDimensions(); ++i) { s->SetCovarianceValue(i,i,double(i+1)); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Expected PID state covariance", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } COMET::ICorrValues v = COMET::IPIDState::ProjectState(s); for (int i = 0; iGetDimensions(); ++i) { ensure_distance("PID state covariance after projection", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Projected PID state covariance", v.GetCovarianceValue(i,i), double(i+1), 0.0001); } } // Test the IVertexState projection operator. template<> template<> void testTReconState::test<7> () { COMET::IHandle s(new COMET::IVertexState); ensure_greaterthan("IVertexState dimensionality",s->GetDimensions(),3); for (int i = 0; iGetDimensions(); ++i) { s->SetCovarianceValue(i,i,double(i+1)); } for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Expected vertex state covariance", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } COMET::ICorrValues v = COMET::ITrackState::ProjectState(s); for (int i = 0; iGetDimensions(); ++i) { ensure_distance("Vertex state covariance after projection", s->GetCovarianceValue(i,i), double(i+1), 0.0001); } ensure("Vertex as Track -- EDeposit",v.IsFree(0)); ensure("Vertex as Track -- X",!v.IsFree(1)); ensure("Vertex as Track -- Y",!v.IsFree(2)); ensure("Vertex as Track -- Z",!v.IsFree(3)); ensure("Vertex as Track -- T",!v.IsFree(4)); ensure("Vertex as Track -- DX",v.IsFree(5)); ensure("Vertex as Track -- DY",v.IsFree(6)); ensure("Vertex as Track -- DZ",v.IsFree(7)); ensure("Vertex as Track -- Curvature",v.IsFree(8)); ensure("Vertex as Track -- Width 1",v.IsFree(9)); ensure("Vertex as Track -- Width 2",v.IsFree(10)); } };