8#include <tracking/trackFindingCDC/filters/segmentPair/TruthSegmentPairVarSet.h>
10#include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
11#include <tracking/trackFindingCDC/mclookup/CDCMCSegment2DLookUp.h>
12#include <tracking/trackFindingCDC/mclookup/CDCMCTrackStore.h>
14#include <tracking/trackFindingCDC/eventdata/tracks/CDCSegmentPair.h>
15#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
16#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
18#include <tracking/trackFindingCDC/numerics/Angle.h>
20#include <cdc/dataobjects/CDCSimHit.h>
23using namespace TrackFindingCDC;
27 if (not ptrSegmentPair)
return false;
40 const std::map<ITrackType, CDCMCTrackStore::CDCHitVector>& mcTracks =
54 if (fromSimHit and toSimHit) {
57 var<
named(
"truth_from_alpha")>() = truthFromAlpha;
58 var<
named(
"truth_to_alpha")>() = truthToAlpha;
61 var<
named(
"truth_from_alpha")>() = NAN;
62 var<
named(
"truth_to_alpha")>() = NAN;
63 var<
named(
"truth_delta_alpha")>() = NAN;
66 ITrackType fromTrackId = mcSegmentLookUp.
getMCTrackId(&fromSegment);
67 double fromMCTrackSize = 0;
68 if (mcTracks.count(fromTrackId)) {
69 fromMCTrackSize = mcTracks.find(fromTrackId)->second.size();
72 ITrackType toTrackId = mcSegmentLookUp.
getMCTrackId(&toSegment);
73 double toMCTrackSize = 0;
74 if (mcTracks.count(toTrackId)) {
75 toMCTrackSize = mcTracks.find(toTrackId)->second.size();
78 double trackFraction = fromSegment.size() / fromMCTrackSize + toSegment.size() / toMCTrackSize;
79 var<
named(
"truth_track_fraction")>() = trackFraction;
80 var<
named(
"__weight__")>() = std::isfinite(trackFraction) ? trackFraction : 0;
DataType DeltaPhi(const B2Vector3< DataType > &v) const
returns phi in the interval [-PI,PI)
B2Vector3D getPosTrack() const
The method to get position on the track.
B2Vector3D getMomentum() const
The method to get momentum.
ITrackType getMCTrackId(const ACDCHitCollection *ptrHits) const
Getter for the Monte Carlo track id matched to this collection of hits.
CDCTrajectory3D getTrajectory3D(const ACDCHitCollection *ptrHits) const
Returns the trajectory of the collection of hits.
Interface class to the Monte Carlo information for individual hits.
const CDCSimHit * getClosestPrimarySimHit(const CDCHit *ptrHit) const
Getter for the closest simulated hit of a primary particle to the given hit - may return nullptr of n...
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
Specialisation of the lookup for the truth values of two dimensional segments.
static const CDCMCSegment2DLookUp & getInstance()
Getter for the singletone instance.
Class to organize and present the monte carlo hit information.
static const CDCMCTrackStore & getInstance()
Getter for the singletone instance.
const std::map< ITrackType, Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector > & getMCTracksByMCParticleIdx() const
Getter for the stored Monte Carlo tracks ordered by their Monte Carlo Id.
Class representing a two dimensional reconstructed hit in the central drift chamber.
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the reconstructed hit.
A reconstructed sequence of two dimensional hits in one super layer.
Class representing a pair of one reconstructed axial segment and one stereo segment in adjacent super...
const CDCSegment2D * getToSegment() const
Getter for the to segment.
const CDCSegment2D * getFromSegment() const
Getter for the from segment.
Particle full three dimensional trajectory.
double getCurvatureXY() const
Getter for the curvature as seen from the xy projection.
double getTanLambda() const
Getter for the slope of z over the transverse travel distance s.
Vector3D getSupport() const
Getter for the support point of the trajectory in global coordinates, where arcLength2D = 0.
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
bool extract(const CDCSegmentPair *ptrSegmentPair) final
Generate and assign the contained variables.
static constexpr int named(const char *name)
Getter for the index from the name.
Float_t & var()
Reference getter for the value of the ith variable. Static version.
double z() const
Getter for the z coordinate.
Abstract base class for different kinds of events.
static double normalised(const double angle)
Normalise an angle to lie in the range from [-pi, pi].