10#include <tracking/spacePointCreation/SpacePointTrackCand.h>
12#include <TDatabasePDG.h>
22 double charge,
int mcTrackID)
29 for (
const SpacePoint* spacePoint : spacePoints) {
40 const auto& lhsHits = this->
getHits();
41 const auto& rhsHits = rhs.
getHits();
44 if (lhsHits.size() == 0 || rhsHits.size() == 0) {
45 B2DEBUG(28,
"At least one of the SpacePointTrackCands does not contain any SpacePoints");
50 if (lhsHits.size() != rhsHits.size()) {
51 B2DEBUG(28,
"Numbers of SpacePoints in SpacePointTrackCands do not match");
56 for (
unsigned int iSP = 0; iSP < lhsHits.size(); ++iSP) {
57 if (lhsHits[iSP] != rhsHits[iSP]) {
58 B2DEBUG(28,
"SpacePoints " << iSP <<
" do not match");
68 if (lastIndex < firstIndex) {
70 firstIndex = lastIndex;
76 throw SPTCIndexOutOfBounds();
85 if (lastIndex < firstIndex) {
87 firstIndex = lastIndex;
93 throw SPTCIndexOutOfBounds();
102 std::vector<std::pair<const SpacePoint*, double>> sortVector;
108 std::sort(sortVector.begin(), sortVector.end(), [](
const std::pair<const SpacePoint*, double>& a,
109 const std::pair<const SpacePoint*, double>& b) {
110 return a.second < b.second;
114 std::vector<const SpacePoint*> sortedSpacePoints;
116 for (
auto pair : sortVector) {
117 sortedSpacePoints.push_back(pair.first);
120 return sortedSpacePoints;
127 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(
m_pdg);
128 m_q = part->Charge() / (3.);
135 throw SPTCSortingParameterSizeInvalid();
136 for (
size_t iSP = 0; iSP < sortParams.size(); ++iSP) {
145 if (uint(indexInTrackCand) >=
m_trackSpacePoints.size()) {
throw SPTCIndexOutOfBounds(); }
158 std::stringstream output;
159 output <<
" ======= SpacePointTrackCand::print() ======= \n";
160 output <<
"This track candidate has " <<
m_trackSpacePoints.size() <<
" SpacePoints\n";
162 output <<
"seed values for 6D state : \n";
163 B2DEBUG(debuglevel, output.str());
166 output.str(std::string(
""));
172 output <<
"estimates of Track Candidate: \n";
173 output <<
"q = " <<
m_q <<
"\n";
174 output <<
"pdgCode = " <<
m_pdg <<
"\n";
180 output <<
"SpacePoint " << nSP <<
" has Index " << spacePoint->getArrayIndex() <<
" in StoreArray " << spacePoint->getArrayName() <<
185 B2DEBUG(debuglevel, output.str());
188 output.str(std::string(
""));
191 output <<
"referee properties of this SPTC:\n";
202 B2DEBUG(debuglevel, output.str());
209 std::string statusString;
225 statusString.erase(statusString.end() - delimiter.size(),
@ c_Debug
Debug: for code development.
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Storage for (VXD) SpacePoint-based track candidates.
double m_q
charge of the particle in units of elementary charge
double m_qualityIndicator
An estimation for the quality of the track.
void setSortingParameters(const std::vector< double > &sortParams)
set the sorting parameters
void print(int debuglevel=25, const Option_t *="") const
print the Track Candidate in its "full beauty".
const std::vector< const Belle2::SpacePoint * > & getHits() const
get hits (space points) of track candidate
void removeSpacePoint(int indexInTrackCand)
remove a SpacePoint (and its sorting parameter) from the SpacePointTrackCand
unsigned short int getRefereeStatus(unsigned short int bitmask=USHRT_MAX) const
Return the referee status code of the SpacePointTrackCand.
bool m_flightDirection
direction of flight.
std::vector< const SpacePoint * > m_trackSpacePoints
pointers to SpacePoints in the datastore
bool checkedForCurling() const
check if the TrackCand has been checked for Curling.
@ c_curlingTrack
bit 8: SPTC is curling (resp.
@ c_checkedTrueHits
bit 5: All SpacePoints of the SPTC have a relation to at least one TrueHit.
@ c_removedHits
bit 4: SpacePoints were removed from this SPTC.
@ c_omittedClusters
bit 9: Not all Clusters of the genfit::TrackCand have been used to create this SPTC.
@ c_hitsLowDistance
bit 3: SPTC has two (or more) SpacePoints that are not far enough apart.
@ c_checkedClean
bit 1: SPTC shows no 'problematic' behaviour.
@ c_singleClustersSPs
bit 10: SPTC contains single Cluster SpacePoints.
@ c_checkedMinDistance
bit 7: It has been checked if two consecutive SpacePoints are far enough apart.
@ c_isActive
bit 11: SPTC is active (i.e.
@ c_checkedSameSensors
bit 6: It has been checked, if two consecutive SpacePoints are on the same sensor for this SPTC.
@ c_checkedByReferee
bit 0: SPTC has been checked by a Referee (all possible tests).
@ c_isReserved
bit 12: SPTC is reserved (i.e.
@ c_hitsOnSameSensor
bit 2: SPTC has two (or more) SpacePoints on same sensor.
int m_pdg
PDG code of particle.
bool isCurling() const
get if the TrackCand is curling.
std::vector< double > m_sortingParameters
sorting Parameters, can be used to sort the SpacePoints.
SpacePointTrackCand()=default
Empty constructor with default values, including it to be active.
bool isPartOfCurlingTrack() const
check if the TrackCand is part of a curling TrackCand.
int m_MCTrackID
track ID from MC simulation
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...
bool hasRefereeStatus(unsigned int short bitmask) const
Check if the SpacePointTrackCand has the status characterized by the bitmask.
const std::vector< double > getSortingParametersInRange(int firstIndex, int lastIndex) const
get the sorting parameters in range (indices of SpacePoints inside SpacePointTrackCand) including fir...
std::string getRefereeStatusString(std::string delimiter=" ") const
get the refereeStatus as a string (easier to read than an unsigned short int)
bool operator==(const SpacePointTrackCand &rhs) const
Checks the equality of the pointers to the contained SpacePoints (pdg-code and charge estimate are no...
TVectorD m_state6D
global momentum plus position state (seed) vector
void setPdgCode(int pdgCode)
set a hypothesis for the particle by setting a pdgcode (will also set the appropriate charge)
const std::vector< const Belle2::SpacePoint * > getSortedHits() const
get hits (space points) sorted by their respective sorting parameter
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Abstract base class for different kinds of events.