10 #include <tracking/modules/spacePointCreator/SpacePointCreatorTestModule.h>
12 #include <framework/dataobjects/EventMetaData.h>
14 #include <framework/logging/Logger.h>
16 #include <genfit/Track.h>
17 #include <genfit/AbsTrackRep.h>
18 #include <genfit/RKTrackRep.h>
30 setDescription(
"Tester module for the validity of the SpacePointCreatorModule. TODO: at the moment, the genfit-output can only verified visually (by checking, whether the detector types match the number of dimensions stored in the trackPoint)! when full reco chain is working, this testerModule should be extended! -> verification that input cluster(s) is/are converted to genfit-stuff shall be resilient!");
32 vector<string> containerSpacePointsName = {
"SVDSpacePoints",
"PXDSpacePoints" };
35 addParam(
"PXDClusters", m_pxdClustersName,
36 "PXDCluster collection name",
string(
""));
37 addParam(
"SVDClusters", m_svdClustersName,
38 "SVDCluster collection name",
string(
""));
39 addParam(
"AllSpacePointContainers", m_containerSpacePointsName,
40 "SpacePoints collection name", containerSpacePointsName);
43 addParam(
"NameOfInstance", m_nameOfInstance,
44 "allows the user to set an identifier for this module. Usefull if one wants to use several instances of that module",
string(
""));
49 void SpacePointCreatorTestModule::initialize()
52 m_pxdClusters.isOptional(m_pxdClustersName);
53 m_svdClusters.isOptional(m_svdClustersName);
56 for (
auto aName : m_containerSpacePointsName) {
62 if (m_pxdClusters.isOptional() ==
true) {
64 m_pxdClustersName = m_pxdClusters.getName();
68 if (m_svdClusters.isOptional() ==
true) {
70 m_svdClustersName = m_svdClusters.getName();
74 B2INFO(
"SpacePointCreatorTestModule(" << m_nameOfInstance <<
")::initialize: names found for containers:\n" <<
75 "pxdClusters: " << m_pxdClustersName <<
76 "\nsvdClusters: " << m_svdClustersName);
78 B2WARNING(
"TODO: at the moment, the genfit-output can only verified visually (by checking, whether the detector types match the number of dimensions stored in the trackPoint)! when full reco chain is working, this testerModule should be extended! -> verification that input cluster(s) is/are converted to genfit-stuff shall be resilient!");
83 void SpacePointCreatorTestModule::event()
86 DataStore::c_Event)->getEvent() <<
")): got " << m_pxdClusters.getEntries() <<
"/" << m_svdClusters.getEntries() <<
87 " pxd/SVDClusters in this event");
91 B2DEBUG(1,
" Entering storeArray<SpacePoint> " << aStoreArrayInterface.getName() <<
" with " << aStoreArrayInterface.getEntries() <<
94 for (
unsigned int i = 0; i < uint(aStoreArrayInterface.getEntries()); ++i) {
95 B2DEBUG(2,
" Executing SpacePoint " << i);
96 const SpacePoint* sp = aStoreArrayInterface[i];
99 string clusterContainer =
"";
101 if (sp->
getType() == VXD::SensorInfoBase::SensorType::SVD) {
102 B2DEBUG(2,
" SpacePoint " << i <<
" is attached to SVDCluster(s) of StoreArray " << sp->
getArrayName());
105 indices.push_back(aCluster.getArrayIndex());
106 clusterContainer = aCluster.getArrayName();
108 B2DEBUG(2,
" SpacePoint " << i <<
109 " got pointer to SVDCluster with index " << aCluster.getArrayIndex() <<
110 " stored in Array " << aCluster.getArrayName());
112 }
else if (sp->
getType() == VXD::SensorInfoBase::SensorType::PXD) {
113 B2DEBUG(2,
" SpacePoint " << i <<
" is attached to PXDCluster of StoreArray " << sp->
getArrayName());
117 indices.push_back(aCluster.getArrayIndex());
119 clusterContainer = aCluster.getArrayName();
121 B2DEBUG(2,
" SpacePoint " << i <<
122 " got pointer to PXDCluster with index " << aCluster.getArrayIndex() <<
123 " stored in Array " << aCluster.getArrayName());
126 }
else { B2ERROR(
" SpacePoint is of unknown type " << sp->
getType()); }
129 B2DEBUG(1,
"SpacePoint " << i <<
130 " got sensorType: " << sp->
getType() <<
132 ", storeName for Cluster(says SpacePoint): " << sp->
getArrayName() <<
133 ", storeName for Cluster(says Cluster): " << clusterContainer);
136 B2DEBUG(1,
"testGenfitCompatibility: feed the track with spacePoints ported to genfit compatible stuff");
142 std::vector< std::pair<VXD::SensorInfoBase::SensorType, genfit::AbsMeasurement*> > hitOutput;
144 for (
auto& aSP : aStoreArrayInterface) {
145 std::vector<genfit::PlanarMeasurement> tempMeasurements = aSP.getGenfitCompatible();
149 hitOutput.push_back({aSP.getType(), measurement.clone()});
153 for (
unsigned i = 0; i < hitOutput.size(); i++) {
154 track.insertMeasurement(hitOutput[i].second);
157 B2DEBUG(2,
" executing AbsMeasurement " << i <<
" with detectorID(PXD = 0,SVD=1,TEL=2,VXD=-1) : " << hitOutput[i].first <<
":\n");
159 B2DEBUG(2,
" converted absMeasurement is of detID: " << rawPoint->getDetId() <<
", hitID: " << rawPoint->getHitId());