 |
Belle II Software
release-05-01-25
|
10 #include <tracking/modules/spacePointCreator/SPTCRefereeModule.h>
11 #include <tracking/dataobjects/RecoTrack.h>
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 #include <framework/dataobjects/EventMetaData.h>
17 #include <tracking/spacePointCreation/SpacePoint.h>
18 #include <pxd/dataobjects/PXDTrueHit.h>
19 #include <svd/dataobjects/SVDTrueHit.h>
20 #include <vxd/dataobjects/VxdID.h>
22 #include <framework/geometry/B2Vector3.h>
23 #include <boost/range/adaptor/reversed.hpp>
32 setDescription(
"Module that does some sanity checks on SpacePointTrackCands to prevent some problematic cases to be "
33 "forwarded to other modules that rely on 'unproblematic' cases (e.g. FilterCalculator). "
34 "Different checks can be enabled by setting the according flags. Using MC information for "
35 "the tests can also be switched on/off for tests where MC information can be helpful.");
39 addParam(
"sptcName", m_PARAMsptcName,
40 "Container name of the SpacePointTrackCands to be checked (input)",
42 addParam(
"newArrayName", m_PARAMnewArrayName,
43 "Container name of SpacePointTrackCands if 'storeNewArray' is set to true",
45 addParam(
"curlingSuffix", m_PARAMcurlingSuffix,
46 "Suffix that will be used to get a name for the StoreArray in which the trackStubs that are obtained by "
47 "splitting a curling SPTC get stored. NOTE: If 'storeNewArray' is set to true, "
48 "this will not be used and all output SPTCs will be in the same Array!",
49 m_PARAMcurlingSuffix);
52 addParam(
"checkSameSensor", m_PARAMcheckSameSensor,
53 "Check if two subsequent SpacePoints are on the same sensor",
54 m_PARAMcheckSameSensor);
55 addParam(
"checkMinDistance", m_PARAMcheckMinDistance,
56 "Check if two subsequent SpacePoints are seperated by more than 'minDistance'",
57 m_PARAMcheckMinDistance);
58 addParam(
"checkCurling", m_PARAMcheckCurling,
59 "Check the SpacePointTrackCand for curling behaviour and mark it as curling if it does",
61 addParam(
"splitCurlers", m_PARAMsplitCurlers,
62 "Split curling SpacePointTrackCands and save the TrackStubs in seperate StoreArrays",
64 addParam(
"keepOnlyFirstPart", m_PARAMkeepOnlyFirstPart,
65 "Keep only the first part of a curling SpacePointTrackCand (e.g. when only this is needed)",
66 m_PARAMkeepOnlyFirstPart);
67 addParam(
"useMCInfo", m_PARAMuseMCInfo,
68 "Set to true if the use of MC information (e.g. from underlying TrueHits) for the checks is wanted, "
69 "and to false if the checks should all be done with information that can be obtained from "
70 "SpacePoints directly. NOTE: the tests without MC information have to be developed first!",
72 addParam(
"kickSpacePoint", m_PARAMkickSpacePoint,
73 "Set to true if only the 'problematic' SpacePoint shall be kicked and not the whole SpacePointTrackCand",
74 m_PARAMkickSpacePoint);
75 addParam(
"storeNewArray", m_PARAMstoreNewArray,
76 "Set to true if the checked SpacePointTrackCands should be stored in a new StoreArray."
77 "WARNING: all previously registered relations get lost in this way!",
78 m_PARAMstoreNewArray);
81 addParam(
"minDistance", m_PARAMminDistance,
82 "Minimal Distance [cm] that two subsequent SpacePoints have to be seperated if 'checkMinDistance' is enabled",
84 addParam(
"setOrigin", m_PARAMsetOrigin,
"WARNING: still need to find out the units that are used internally! "
85 "Reset origin to given point. Used for determining the direction of flight of a particle for a "
86 "given hit. Needs to be reset for e.g. testbeam, where origin is not at (0,0,0)",
89 addParam(
"minNumSpacePoints", m_PARAMminNumSpacePoints,
90 "minimum number of space points that a track candidate has to "
91 "contain (added later, set to 0 to reproduce old behavior",
92 m_PARAMminNumSpacePoints);
94 addParam(
"checkIfFitted", m_PARAMcheckIfFitted,
95 "If true a flag is set in the SpacePointTrackCandidate if any related RecoTrack "
96 "with successful track fit is found",
97 m_PARAMcheckIfFitted);
100 initializeCounters();
106 B2INFO(
"SPTCReferee::initialize(): ------------------------------------------------ ");
128 ", Taking the absolute value and resetting 'minDistance' to that!");
133 B2DEBUG(20,
"Provided Parameters: checkSameSensor - " <<
m_PARAMcheckSameSensor <<
", checkMinDistance - " <<
138 B2WARNING(
"CurlingTrackCandSplitter::initialize: Provided origin is not a 3D point! Please provide 3 values (x,y,z). "
139 "Rejecting user input and setting origin to (0,0,0) for now!");
153 const int eventCtr = eventMetaDataPtr->getEvent();
154 B2DEBUG(20,
"Processing event " << eventCtr <<
" -----------------------");
161 B2DEBUG(20,
"Found " << nTCs <<
" SpacePointTrackCands in Array " << trackCands.getName() <<
" for this event");
163 for (
int iTC = 0; iTC < nTCs; ++iTC) {
165 B2DEBUG(20,
"Processing SpacePointTrackCand " << iTC <<
": It has " << trackCand->
getNHits() <<
" SpacePoints in it");
168 B2DEBUG(20,
"refereeStatus of TrackCand before tests: " << trackCand->
getRefereeStatus() <<
" -> " <<
177 bool allChecksClean =
true;
183 allChecksClean =
false;
191 if (relatedRecoTracks.
size() >= 1) {
193 if (relatedRecoTracks[0]->wasFitSuccessful()) {
196 allChecksClean =
false;
197 B2DEBUG(20,
"Found RecoTrack was not fitted! Will not use this track candidate for training.");
200 allChecksClean =
false;
201 B2DEBUG(20,
"No related RecoTrack found. Will not use that track candidate for training");
209 std::get<0>(prevChecksInfo) = sameSensorInds;
210 if (!sameSensorInds.empty()) {
212 allChecksClean =
false;
221 B2DEBUG(20,
"Found no two subsequent SpacePoints on the same sensor for this SpacePointTrackCand ("
222 << iTC <<
" in Array " << trackCands.getName() <<
")");
225 B2DEBUG(20,
"refereeStatus of TrackCand after checkSameSensor " << trackCand->
getRefereeStatus() <<
" -> " <<
233 std::get<1>(prevChecksInfo) = lowDistanceInds;
234 if (!lowDistanceInds.empty()) {
236 allChecksClean =
false;
245 B2DEBUG(20,
"Found no two subsequent SpacePoints that were closer than " <<
m_PARAMminDistance <<
246 " cm together for this SpacePointTrackCand (" << iTC <<
" in Array " << trackCands.getName() <<
")");
249 B2DEBUG(20,
"refereeStatus of TrackCand after checkMinDistance " << trackCand->
getRefereeStatus() <<
" -> " <<
254 std::vector<SpacePointTrackCand> curlingTrackStubs;
261 if (!curlingSplitInds.empty()) {
262 if (!(curlingSplitInds.at(0) == 0 && curlingSplitInds.size() == 1)) {
265 allChecksClean =
false;
268 if (curlingTrackStubs.empty()) {
269 B2ERROR(
"The vector returned by splitTrackCand is empty!");
275 B2DEBUG(20,
"The only entry in the return vector of checkCurling is 0! The direction of flight is inwards for the whole SPTC!");
280 B2DEBUG(20,
"SpacePointTrackCand " << trackCand->
getArrayIndex() <<
" is not curling!");
282 B2DEBUG(20,
"refereeStatus of TrackCand after checkCurling " << trackCand->
getRefereeStatus() <<
" -> " <<
289 B2DEBUG(20,
"referee Status of SPTC after referee module: " << trackCand->
getRefereeStatus() <<
" -> " <<
313 stringstream summary;
315 summary <<
"Checked for consecutive SpacePoints on same sensor and found "
319 summary <<
"Checked for minimal distance between two consecutive SpacePoints and found "
320 <<
m_minDistanceCtr <<
" TrackCands with SpacePoints not far enough apart.\n";
330 <<
m_allInwardsCtr <<
" SPTCs that had flight direction 'inward' for all SpacePoints in them";
333 B2INFO(
"SPTCRefere::terminate(): Module got " <<
m_totalTrackCandCtr <<
" SpacePointTrackCands. \n" << summary.str());
336 B2WARNING(
"The curling checking without MC Information is at the moment at a very crude and unsophisticated state. "
337 "If you have MC information available you should use it to do this check!");
344 B2DEBUG(20,
"Checking SpacePointTrackCand " << trackCand->
getArrayIndex() <<
" from Array " << trackCand->
getArrayName() <<
345 " for consecutive SpacePoints on the same sensor");
346 std::vector<int> sameSensorInds;
348 std::vector<const SpacePoint*> spacePoints = trackCand->
getHits();
351 if (spacePoints.size() == 0)
return sameSensorInds;
353 VxdID lastSensorId = spacePoints.at(0)->getVxdID();
355 for (
unsigned int iSp = 1; iSp < spacePoints.size(); ++iSp) {
356 VxdID sensorId = spacePoints.at(iSp)->getVxdID();
357 B2DEBUG(20,
"Checking SpacePoint " << iSp <<
". (ArrayIndex " << spacePoints.at(iSp)->getArrayIndex() <<
358 ") SensorId of this SpacePoint: " << sensorId <<
", SensorId of last SpacePoint: " << lastSensorId);
359 if (sensorId == lastSensorId) {
361 sameSensorInds.push_back(iSp - 1);
362 B2DEBUG(20,
"SpacePoint " << iSp <<
" and " << iSp - 1 <<
" are on the same sensor: " << sensorId);
364 lastSensorId = sensorId;
367 return sameSensorInds;
373 B2DEBUG(20,
"Checking the distances between consecutive SpacePoints for SpacePointTrackCand " << trackCand->
getArrayIndex() <<
375 std::vector<int> lowDistanceInds;
377 std::vector<const SpacePoint*> spacePoints = trackCand->
getHits();
380 if (spacePoints.size() == 0)
return lowDistanceInds;
382 B2Vector3F oldPosition = spacePoints.at(0)->getPosition();
384 for (
unsigned int iSp = 1; iSp < spacePoints.size(); ++iSp) {
385 B2Vector3F position = spacePoints.at(iSp)->getPosition();
387 B2DEBUG(20,
"Position of SpacePoint " << iSp <<
" (ArrayIndex " << spacePoints.at(iSp)->getArrayIndex() <<
"): (" << position.X() <<
388 "," << position.Y() <<
"," << position.Z() <<
"), Position of SpacePoint " << iSp - 1 <<
": (" << oldPosition.
X() <<
"," <<
389 oldPosition.
Y() <<
"," << oldPosition.
Z() <<
") --> old - new = (" << diffPos.
X() <<
"," << diffPos.
Y() <<
"," << diffPos.
Z() <<
392 if (diffPos.
Mag() <= minDistance) {
393 B2DEBUG(20,
"Position difference is " << diffPos.
Mag() <<
" but minDistance is set to " << minDistance <<
". SpacePoints: " << iSp
394 <<
" and " << iSp - 1);
396 lowDistanceInds.push_back(iSp);
398 oldPosition = position;
401 return lowDistanceInds;
405 const std::vector<int>
408 std::vector<int> removedInds;
410 unsigned int nInds = indsToRemove.size();
411 B2DEBUG(20,
"Got " << nInds <<
" indices to remove from SPTC " << trackCand->
getArrayIndex());
414 for (
int index : boost::adaptors::reverse(indsToRemove)) {
415 B2DEBUG(20,
"Removing " << nRemoved + 1 <<
" from " << nInds <<
". index = " << index);
419 B2DEBUG(20,
"Removed SpacePoint " << index <<
" from SPTC " << trackCand->
getArrayIndex());
421 removedInds.push_back(index - (nInds - nRemoved));
424 }
catch (SpacePointTrackCand::SPTCIndexOutOfBounds& anE) {
425 B2WARNING(
"Caught an Exception while trying to remove a SpacePoint from a SpacePointTrackCand: " << anE.what());
433 std::vector<int> splitInds;
436 if (trackCand->
getHits().size() == 0)
return splitInds;
441 std::string mcInfoStr = useMCInfo ? std::string(
"with") : std::string(
"without");
442 B2DEBUG(20,
"Checking SpacePointTrackCand " << trackCand->
getArrayIndex() <<
" from Array " << trackCand->
getArrayName() <<
443 " for curling behavior " << mcInfoStr <<
" MC Information");
446 const std::vector<const SpacePoint*>& tcSpacePoints = trackCand->
getHits();
447 B2DEBUG(20,
"SPTC has " << tcSpacePoints.size() <<
" SpacePoints");
455 if (!dirsOfFlight.at(0)) {
457 splitInds.push_back(0);
458 B2DEBUG(20,
"Direction of flight was inwards for first SpacePoint of this SPTC");
461 B2DEBUG(20,
"Direction of flight is " << dirsOfFlight.at(0) <<
" for SpacePoint " << 0 <<
" of this SPTC");
462 for (
unsigned int i = 1; i < dirsOfFlight.size(); ++i) {
463 B2DEBUG(20,
"Direction of flight is " << dirsOfFlight.at(i) <<
" for SpacePoint " << i <<
" of this SPTC");
464 if (dirsOfFlight.at(i) ^ dirsOfFlight.at(i - 1)) {
465 splitInds.push_back(i);
466 B2DEBUG(20,
"Direction of flight has changed from SpacePoint " << i - 1 <<
" to " << i <<
".");
470 B2ERROR(
"'useMCInfo' is set to true, but SpacePoints of SPTC have not been checked for relations to TrueHits! Not Checking this SPTC for curling!");
477 std::vector<Belle2::SpacePointTrackCand>
479 bool onlyFirstPart,
const CheckInfo& prevChecksInfo,
bool removedHits)
481 std::vector<SpacePointTrackCand> trackStubs;
483 B2DEBUG(20,
"Splitting SpacePointTrackCand " << trackCand->
getArrayIndex() <<
" from Array " << trackCand->
getArrayName() <<
484 ": number of entries in splitIndices " << splitIndices.size());
486 bool dirOfFlight = splitIndices.at(0) != 0;
488 B2DEBUG(20,
"first entry of passed vector<int> is " << splitIndices.at(0) <<
" --> direction of flight is " << dirOfFlight);
490 int firstLast = dirOfFlight ? splitIndices.at(0) : splitIndices.at(1);
491 std::vector<std::pair<int, int> >
493 rangeIndices.push_back(std::make_pair(0, firstLast));
495 if (!onlyFirstPart) {
496 unsigned int iStart = dirOfFlight ? 1 : 2;
497 for (
unsigned int i = iStart; i < splitIndices.size(); ++i) {
498 rangeIndices.push_back(std::make_pair(splitIndices.at(i - 1), splitIndices.at(i)));
501 rangeIndices.push_back(std::make_pair(splitIndices.at(splitIndices.size() - 1), trackCand->
getNHits()));
503 B2DEBUG(20,
"There will be " << rangeIndices.size() <<
" TrackStubs created for this TrackCand. (size of the passed splitIndices: "
504 << splitIndices.size() <<
", onlyFirstPart " << onlyFirstPart);
507 stringstream dbOutput;
508 dbOutput <<
"The indices that will be used for splitting the SPTC: ";
509 for (
auto entry : rangeIndices) { dbOutput <<
"[" << entry.first <<
"," << entry.second <<
") "; }
510 B2DEBUG(20, dbOutput.str());
514 for (
unsigned int iTs = 0; iTs < rangeIndices.size(); ++iTs) {
515 int firstInd = rangeIndices.at(iTs).first;
516 int lastInd = rangeIndices.at(iTs).second;
520 B2DEBUG(20,
"Trying to create TrackStub from SPTC " << trackCand->
getArrayIndex() <<
" with indices [" << firstInd <<
"," <<
524 const std::vector<const SpacePoint*> spacePoints = trackCand->
getHitsInRange(firstInd, lastInd);
539 dirOfFlight = !dirOfFlight;
545 const std::vector<int>& sameSensInds = std::get<0>(prevChecksInfo);
546 const std::vector<int>& lowDistInds = std::get<0>(prevChecksInfo);
554 B2DEBUG(20,
"Set TrackStubIndex " << iTs + 1 <<
" and refereeStatus " << trackStub.
getRefereeStatus() <<
557 trackStubs.push_back(trackStub);
559 }
catch (SpacePointTrackCand::SPTCIndexOutOfBounds& anE) {
560 B2WARNING(
"Caught an exception while trying to split a curling SpacePointTrackCand: " << anE.what() <<
561 " This trackStub will not be created!");
569 const std::vector<bool>
572 std::vector<bool> dirsOfFlight;
576 for (
const SpacePoint* spacePoint : spacePoints) {
578 dirsOfFlight.push_back(getDirOfFlightTrueHit<PXDTrueHit>(spacePoint,
m_origin));
580 dirsOfFlight.push_back(getDirOfFlightTrueHit<SVDTrueHit>(spacePoint,
m_origin));
582 SpacePointTrackCand::UnsupportedDetType();
584 }
catch (SpacePointTrackCand::UnsupportedDetType& anE) {
585 B2FATAL(
"Caught a fatal exception while checking if a SpacePointTrackCand curls: " <<
596 template <
typename TrueHitType>
599 TrueHitType* trueHit = spacePoint->template getRelatedTo<TrueHitType>(
"ALL");
601 if (trueHit == NULL) { B2ERROR(
"Found no TrueHit to SpacePoint " << spacePoint->
getArrayIndex() <<
" from Array " << spacePoint->
getArrayName()); }
604 VxdID vxdID = trueHit->getSensorID();
610 B2DEBUG(20,
"Getting the direction of flight for SpacePoint " << spacePoint->
getArrayIndex() <<
", related to TrueHit " <<
611 trueHit->getArrayIndex() <<
". Both are on Sensor " << vxdID <<
". (TrueHit) Position: (" << position.
x() <<
"," << position.
y() <<
612 "," << position.
z() <<
"), (TrueHit) Momentum: (" << momentum.x() <<
"," << momentum.y() <<
"," << momentum.z() <<
")");
621 std::vector<bool> dirsOfFlight;
624 for (
unsigned int iSP = 0; iSP < spacePoints.size(); ++iSP) {
625 B2Vector3F position = spacePoints.at(iSP)->getPosition();
627 B2Vector3F momentumEst = position - oldPosition;
628 B2DEBUG(20,
"Getting the direction of flight for SpacePoint " << spacePoints.at(iSP)->getArrayIndex() <<
". Position: (" <<
629 position.
x() <<
"," << position.
y() <<
"," << position.
z() <<
"), estimated momentum: (" << momentumEst.
x() <<
"," <<
630 momentumEst.
y() <<
"," << momentumEst.
z() <<
")");
632 oldPosition = position;
644 B2DEBUG(20,
"Position relative to origin: (" << originToHit.
x() <<
"," << originToHit.
y() <<
"," << originToHit.
z() <<
645 "). Momentum : (" << momentum.x() <<
"," << momentum.y() <<
"," <<
646 momentum.z() <<
").");
649 float dot_xy = originToHit.
x() * momentum.x() + originToHit.
y() * momentum.y();
651 B2DEBUG(20,
"result dot product xy component between postion and momentum: " << dot_xy);
654 B2DEBUG(20,
"Direction of flight is inwards for this hit");
657 B2DEBUG(20,
"Direction of flight is outwards for this hit");
668 B2DEBUG(20,
"Added new SPTC to StoreArray " << newStoreArray.getName() <<
" and registered relation to SPTC " <<
679 B2DEBUG(20,
"Added new SPTC to StoreArray " << storeArray.getName() <<
" and registered relation to SPTC " <<
T * appendNew()
Construct a new T object at the end of the array.
size_t size() const
Get number of relations.
std::vector< Belle2::SpacePointTrackCand > splitTrackCand(const Belle2::SpacePointTrackCand *trackCand, const std::vector< int > &splitIndices, bool onlyFirstPart, const CheckInfo &prevChecksInfo, bool removedHits)
split a curling SpacePointTrackCand into TrackStubs.
bool m_PARAMcheckIfFitted
if true it is looked for any related RecoTrack and if that RecoTrack has a valid fit.
unsigned int m_kickedSpacePointsCtr
counter of kicked SpacePoints
Class to uniquely identify a any structure of the PXD and SVD.
bool isCurling() const
get if the TrackCand is curling.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
const std::vector< const Belle2::SpacePoint * > getHitsInRange(int firstInd, int lastInd) const
get hits (SpacePoints) in range (indices of SpacePoint inside SpacePointTrackCand) including first in...
void setDescription(const std::string &description)
Sets the description of the module.
bool m_PARAMkeepOnlyFirstPart
parameter for keeping only the first part of a curling SpacePointTrackCand
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
void setRefereeStatus(unsigned short int bitmask)
set referee status (resets the complete to the passed status!)
DataType x() const
access variable X (= .at(0) without boundary check)
void initialize() override
initialize: check StoreArrays, initialize counters, ...
void addRefereeStatus(unsigned short int bitmask)
add a referee status
void setSortingParameters(const std::vector< double > &sortParams)
set the sorting parameters
B2Vector3F m_origin
origin used internally.
void initializeCounters()
initialize all counters to 0
TVector3 vectorToGlobal(const TVector3 &local, bool reco=false) const
Convert a vector from local to global coordinates.
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
Base class to provide Sensor Information for PXD and SVD.
bool getDirOfFlightTrueHit(const Belle2::SpacePoint *spacePoint, B2Vector3F origin)
get the direction of flight for a SpacePoint by using information from the underlying TrueHit NOTE: t...
@ c_checkedSameSensors
bit 6: It has been checked, if two consecutive SpacePoints are on the same sensor for this SPTC.
const std::vector< int > checkMinDistance(Belle2::SpacePointTrackCand *trackCand, double minDistance)
Check if two subsequent SpacePoints are seperated by at least the provided minDistance.
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
unsigned int m_allInwardsCtr
counter for the number of SPTCs which have direction of flight inward for all SpacePoints in them
void setCovSeed(const TMatrixDSym &cov)
set the covariance matrix seed
void event() override
event: check SpacePointTrackCands
std::string m_PARAMcurlingSuffix
Suffix that will be used to get a name for the StoreArray that holds the trackStubs that were obtaine...
DataType Z() const
access variable Z (= .at(2) without boundary check)
void print(int debuglevel=150, const Option_t *="") const
print the Track Candidate in its "full beauty".
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
const std::vector< int > removeSpacePoints(Belle2::SpacePointTrackCand *trackCand, const std::vector< int > &indsToRemove)
remove the SpacePoint passed to this function from the SpacePointTrackCand
void setTrackStubIndex(int trackStubInd)
set TrackStub index
const std::vector< bool > getDirectionsOfFlight(const std::vector< const Belle2::SpacePoint * > &spacePoints, bool useMCInfo)
get the directions of Flight for every SpacePoint in the passed vector.
@ c_checkedTrueHits
bit 5: All SpacePoints of the SPTC have a relation to at least one TrueHit.
unsigned int getNHits() const
get the number of hits (space points) in the track candidate
@ c_curlingTrack
bit 8: SPTC is curling (resp.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
const std::vector< double > getSortingParametersInRange(int firstIndex, int lastIndex) const
get the sorting parameters in range (indices of SpacePoints inside SpacePointTrackCand) including fir...
bool m_PARAMstoreNewArray
parameter for indicating if all checked SpacePointTrackCands should be stored in a new StoreArray NOT...
This is the Reconstruction Event-Data Model Track.
std::string getRefereeStatusString(std::string delimiter=" ") const
get the refereeStatus as a string (easier to read than an unsigned short int)
void set6DSeed(const TVectorD &state6D)
set the 6D state seed
void terminate() override
terminate: print some summary information
unsigned int m_curlingTracksCtr
counter for tracks that curl
Class for type safe access to objects that are referred to in relations.
void removeSpacePoint(int indexInTrackCand)
remove a SpacePoint (and its sorting parameter) from the SpacePointTrackCand
std::vector< double > m_PARAMsetOrigin
assumed interaction point from which the SpacePointTrackCands emerge.
bool getDirOfFlightPosMom(B2Vector3F position, B2Vector3F momentum, B2Vector3F origin)
get the direction of flight provided the global position and momentum of a SpacePoint/TrueHit for the...
int getPdgCode() const
get pdg code
const std::vector< const Belle2::SpacePoint * > & getHits() const
get hits (space points) of track candidate
static GeoCache & getInstance()
Return a reference to the singleton instance.
Abstract base class for different kinds of events.
Type-safe access to single objects in the data store.
void copyToNewStoreArray(const Belle2::SpacePointTrackCand *trackCand, Belle2::StoreArray< Belle2::SpacePointTrackCand > newStoreArray)
copy the SpacePointTrackCand to a new StoreArray and register a relation to the original trackCand
unsigned int m_SameSensorCtr
counter for TrackCands with SpacePoints on the same sensor
void setFlightDirection(bool direction)
set the direction of flight (true is outgoing, false is ingoing).
@ c_hitsOnSameSensor
bit 2: SPTC has two (or more) SpacePoints on same sensor.
bool m_PARAMcheckMinDistance
parameter for indicating if the check for the minimal distance between two subsequent SpacePoints sho...
bool m_PARAMuseMCInfo
parameter for indicating if MC information should be used or not
std::string m_PARAMnewArrayName
Name of the output container of SpacePointTrackCands if 'storeNewArray' is set to true.
std::string m_curlingArrayName
name of the StoreArray in which the trackStubs from a curling SPTC are stored
bool m_PARAMkickSpacePoint
parameter for indicating if only the 'problematic' SpacePoint shall be removed from the SPTC or if th...
std::tuple< std::vector< int >, std::vector< int > > CheckInfo
typedef for storing the outcome of previously done checks to have them available later.
void addToStoreArray(const Belle2::SpacePointTrackCand &trackCand, Belle2::StoreArray< Belle2::SpacePointTrackCand > storeArray, const Belle2::SpacePointTrackCand *origTrackCand)
register the SpacePointTrackCand (i.e.
bool hasRefereeStatus(unsigned int short bitmask) const
Check if the SpacePointTrackCand has the status characterized by the bitmask.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
double m_PARAMminDistance
minimal distance two subsequent SpacePoints have to be seperated
@ c_removedHits
bit 4: SpacePoints were removed from this SPTC.
TVector3 pointToGlobal(const TVector3 &local, bool reco=false) const
Convert a point from local to global coordinates.
double getChargeSeed() const
get charge
SPTCRefereeModule()
Constructor.
DataType y() const
access variable Y (= .at(1) without boundary check)
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
const std::vector< int > checkSameSensor(Belle2::SpacePointTrackCand *trackCand)
Check if two subsequent SpacePoints are on the same sensor.
unsigned int m_regTrackStubsCtr
counter for the number of track stubs that were registered by this module
bool vectorHasValueBetween(std::vector< T > V, std::pair< T, T > P)
function to determine if any of the values in vector V are between the values of P (i....
bool m_PARAMsplitCurlers
parameter for switching on/off the splitting of curling SpacePointTrackCands
unsigned short int getRefereeStatus(unsigned short int bitmask=USHRT_MAX) const
Return the refere status code of the SpacePointTrackCand.
std::string m_PARAMsptcName
Name of input container of SpacePointTrackCands.
@ c_checkedMinDistance
bit 7: It has been checked if two consecutive SpacePoints are far enough apart.
@ c_Debug
Debug: for code development.
DataType z() const
access variable Z (= .at(2) without boundary check)
const std::vector< int > checkCurling(Belle2::SpacePointTrackCand *trackCand, bool useMCInfo)
Check if the SpacePointTrackCand shows curling behavior.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
unsigned int m_totalTrackCandCtr
counter for the total number of TrackCands
const TVectorD & getStateSeed() const
get state seed as 6D vector
const TMatrixDSym & getCovSeed() const
get the covariance matrix seed (6D).
DataType X() const
access variable X (= .at(0) without boundary check)
@ c_checkedClean
bit 1: SPTC shows no 'problematic' behaviour.
bool m_PARAMcheckSameSensor
parameter for indicating if the check for subsequent SpacePoints being on the same sensor should be d...
B2Vector3< float > B2Vector3F
typedef for common usage with float
@ c_hasFittedRecoTrack
bit 13: SPTC is related to a RecoTrack which has a successful fit.
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
int getMcTrackID() const
get the MC Track ID
void SetXYZ(DataType x, DataType y, DataType z)
set all coordinates using data type
int m_PARAMminNumSpacePoints
only keep track candidates which have at least m_PARAMminNumSpacePoints space points
@ c_hitsLowDistance
bit 3: SPTC has two (or more) SpacePoints that are not far enough apart.
DataType Mag() const
The magnitude (rho in spherical coordinate system).
int getEntries() const
Get the number of objects in the array.
DataType Y() const
access variable Y (= .at(1) without boundary check)
@ c_checkedByReferee
bit 0: SPTC has been checked by a Referee (all possible tests).
Storage for (VXD) SpacePoint-based track candidates.
unsigned int m_minDistanceCtr
counter for TrackCands with SpacePoints not far enough apart
unsigned short int getCheckStatus(const Belle2::SpacePointTrackCand *trackCand)
get the checked referee status of a SPTC (i.e.
std::vector< bool > getDirsOfFlightSpacePoints(const std::vector< const Belle2::SpacePoint * > &spacePoints, B2Vector3F origin)
get the directions of flight for a vector of SpacePoints using only information from SpacePoints (i....
bool m_PARAMcheckCurling
parameter for indicating if the SpacePointTrackCand should be checked for curling