9 #include <tracking/modules/spacePointCreator/SpacePointCreatorTestModule.h>
11 #include <framework/dataobjects/EventMetaData.h>
13 #include <framework/logging/Logger.h>
15 #include <genfit/Track.h>
16 #include <genfit/AbsTrackRep.h>
17 #include <genfit/RKTrackRep.h>
29 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!");
31 vector<string> containerSpacePointsName = {
"SVDSpacePoints",
"PXDSpacePoints" };
34 addParam(
"PXDClusters", m_pxdClustersName,
35 "PXDCluster collection name",
string(
""));
36 addParam(
"SVDClusters", m_svdClustersName,
37 "SVDCluster collection name",
string(
""));
38 addParam(
"AllSpacePointContainers", m_containerSpacePointsName,
39 "SpacePoints collection name", containerSpacePointsName);
42 addParam(
"NameOfInstance", m_nameOfInstance,
43 "allows the user to set an identifier for this module. Usefull if one wants to use several instances of that module",
string(
""));
48 void SpacePointCreatorTestModule::initialize()
51 m_pxdClusters.isOptional(m_pxdClustersName);
52 m_svdClusters.isOptional(m_svdClustersName);
55 for (
auto aName : m_containerSpacePointsName) {
60 if (m_pxdClusters.isOptional() ==
true) {
62 m_pxdClustersName = m_pxdClusters.getName();
66 if (m_svdClusters.isOptional() ==
true) {
68 m_svdClustersName = m_svdClusters.getName();
72 B2INFO(
"SpacePointCreatorTestModule(" << m_nameOfInstance <<
")::initialize: names found for containers:\n" <<
73 "pxdClusters: " << m_pxdClustersName <<
74 "\nsvdClusters: " << m_svdClustersName);
76 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!");
81 void SpacePointCreatorTestModule::event()
84 DataStore::c_Event)->getEvent() <<
")): got " << m_pxdClusters.getEntries() <<
"/" << m_svdClusters.getEntries() <<
85 " pxd/SVDClusters in this event");
89 B2DEBUG(1,
" Entering storeArray<SpacePoint> " << aStoreArrayInterface.getName() <<
" with " << aStoreArrayInterface.getEntries() <<
92 for (
unsigned int i = 0; i < uint(aStoreArrayInterface.getEntries()); ++i) {
93 B2DEBUG(2,
" Executing SpacePoint " << i);
94 const SpacePoint* sp = aStoreArrayInterface[i];
97 string clusterContainer =
"";
99 if (sp->
getType() == VXD::SensorInfoBase::SensorType::SVD) {
100 B2DEBUG(2,
" SpacePoint " << i <<
" is attached to SVDCluster(s) of StoreArray " << sp->
getArrayName());
103 indices.push_back(aCluster.getArrayIndex());
104 clusterContainer = aCluster.getArrayName();
106 B2DEBUG(2,
" SpacePoint " << i <<
107 " got pointer to SVDCluster with index " << aCluster.getArrayIndex() <<
108 " stored in Array " << aCluster.getArrayName());
110 }
else if (sp->
getType() == VXD::SensorInfoBase::SensorType::PXD) {
111 B2DEBUG(2,
" SpacePoint " << i <<
" is attached to PXDCluster of StoreArray " << sp->
getArrayName());
115 indices.push_back(aCluster.getArrayIndex());
117 clusterContainer = aCluster.getArrayName();
119 B2DEBUG(2,
" SpacePoint " << i <<
120 " got pointer to PXDCluster with index " << aCluster.getArrayIndex() <<
121 " stored in Array " << aCluster.getArrayName());
124 }
else { B2ERROR(
" SpacePoint is of unknown type " << sp->
getType()); }
127 B2DEBUG(1,
"SpacePoint " << i <<
128 " got sensorType: " << sp->
getType() <<
130 ", storeName for Cluster(says SpacePoint): " << sp->
getArrayName() <<
131 ", storeName for Cluster(says Cluster): " << clusterContainer);
134 B2DEBUG(1,
"testGenfitCompatibility: feed the track with spacePoints ported to genfit compatible stuff");
140 std::vector< std::pair<VXD::SensorInfoBase::SensorType, genfit::AbsMeasurement*> > hitOutput;
142 for (
auto& aSP : aStoreArrayInterface) {
143 std::vector<genfit::PlanarMeasurement> tempMeasurements = aSP.getGenfitCompatible();
146 hitOutput.push_back({aSP.getType(), measurement.clone()});
150 for (
unsigned i = 0; i < hitOutput.size(); i++) {
151 track.insertMeasurement(hitOutput[i].second);
154 B2DEBUG(2,
" executing AbsMeasurement " << i <<
" with detectorID(PXD = 0,SVD=1,TEL=2,VXD=-1) : " << hitOutput[i].first <<
":\n");
156 B2DEBUG(2,
" converted absMeasurement is of detID: " << rawPoint->getDetId() <<
", hitID: " << rawPoint->getHitId());
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Tester module for the validity of the SpacePointCreatorModule.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
VxdID getVxdID() const
Return the VxdID of the sensor on which the the cluster of the SpacePoint lives.
Belle2::VXD::SensorInfoBase::SensorType getType() const
Return SensorType (PXD, SVD, ...) on which the SpacePoint lives.
Type-safe access to single objects in the data store.
Class to uniquely identify a any structure of the PXD and SVD.
Contains the measurement and covariance in raw detector coordinates.
Abstract base class for a track representation.
Measurement class implementing a planar hit geometry (1 or 2D).
AbsTrackRep with 5D track parameterization in plane coordinates: (q/p, u', v', u, v)
Object containing AbsMeasurement and AbsFitterInfo objects.
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
ExpRunEvt getPosition(const std::vector< Evt > &events, double tEdge)
Get the exp-run-evt number from the event time [hours].
Abstract base class for different kinds of events.