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>
27 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!");
29 std::vector<std::string> containerSpacePointsName = {
"SVDSpacePoints",
"PXDSpacePoints" };
33 "PXDCluster collection name", std::string(
""));
35 "SVDCluster collection name", std::string(
""));
37 "SpacePoints collection name", containerSpacePointsName);
41 "allows the user to set an identifier for this module. Useful if one wants to use several instances of that module",
71 B2INFO(
"SpacePointCreatorTestModule(" <<
m_nameOfInstance <<
")::initialize: names found for containers:\n" <<
75 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!");
84 " pxd/SVDClusters in this event");
88 B2DEBUG(20,
" Entering storeArray<SpacePoint> " << aStoreArrayInterface.getName() <<
" with " << aStoreArrayInterface.getEntries()
92 for (
unsigned int i = 0; i < uint(aStoreArrayInterface.getEntries()); ++i) {
93 B2DEBUG(20,
" Executing SpacePoint " << i);
94 const SpacePoint* sp = aStoreArrayInterface[i];
96 std::vector<int> indices;
97 std::string clusterContainer =
"";
100 B2DEBUG(20,
" SpacePoint " << i <<
" is attached to SVDCluster(s) of StoreArray " << sp->
getArrayName());
103 indices.push_back(aCluster.getArrayIndex());
104 clusterContainer = aCluster.getArrayName();
106 B2DEBUG(20,
" SpacePoint " << i <<
107 " got pointer to SVDCluster with index " << aCluster.getArrayIndex() <<
108 " stored in Array " << aCluster.getArrayName());
111 B2DEBUG(20,
" SpacePoint " << i <<
" is attached to PXDCluster of StoreArray " << sp->
getArrayName());
115 indices.push_back(aCluster.getArrayIndex());
117 clusterContainer = aCluster.getArrayName();
119 B2DEBUG(20,
" 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(20,
"SpacePoint " << i <<
128 " got sensorType: " << sp->
getType() <<
130 ", storeName for Cluster(says SpacePoint): " << sp->
getArrayName() <<
131 ", storeName for Cluster(says Cluster): " << clusterContainer);
134 B2DEBUG(20,
"testGenfitCompatibility: feed the track with spacePoints ported to genfit compatible stuff");
135 genfit::AbsTrackRep* trackRep =
new genfit::RKTrackRep(211);
136 genfit::Track track(trackRep, aStoreArrayInterface[0]->
getPosition(), TVector3(23., 42., 5.));
140 std::vector< std::pair<VXD::SensorInfoBase::SensorType, genfit::AbsMeasurement*> > hitOutput;
142 for (
auto& aSP : aStoreArrayInterface) {
143 std::vector<genfit::PlanarMeasurement> tempMeasurements = aSP.getGenfitCompatible();
145 for (genfit::PlanarMeasurement& measurement : tempMeasurements) {
146 hitOutput.push_back({aSP.getType(), measurement.clone()});
150 for (
unsigned i = 0; i < hitOutput.size(); i++) {
151 track.insertMeasurement(hitOutput[i].second);
152 genfit::TrackPoint* point = track.getPointWithMeasurement(i);
153 genfit::AbsMeasurement* rawPoint = point->getRawMeasurement();
154 B2DEBUG(20,
" executing AbsMeasurement " << i <<
" with detectorID(PXD = 0,SVD=1,TEL=2,VXD=-1) : " << hitOutput[i].first <<
":\n");
156 B2DEBUG(20,
" converted absMeasurement is of detID: " << rawPoint->getDetId() <<
", hitID: " << rawPoint->getHitId());
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
void setDescription(const std::string &description)
Sets the description of the module.
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.
std::string m_svdClustersName
SVDCluster collection name.
std::string m_nameOfInstance
allows the user to set an identifier for this module.
void initialize() override
Init the module.
std::vector< StoreArray< SpacePoint > > m_allSpacePointStoreArrays
a vector full of StoreArray carrying spacePoints.
StoreArray< SVDCluster > m_svdClusters
the storeArray for svdClusters as member, is faster than recreating link for each event
void event() override
eventWise jobs (e.g.
SpacePointCreatorTestModule()
Constructor.
std::string m_pxdClustersName
PXDCluster collection name.
std::vector< std::string > m_containerSpacePointsName
intermediate storage for the names of the loaded storeArrays.
StoreArray< PXDCluster > m_pxdClusters
the storeArray for pxdClusters as member, is faster than recreating link for each event
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.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
Type-safe access to single objects in the data store.
Class to uniquely identify a any structure of the PXD and SVD.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#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.