8#include <tracking/trackFindingCDC/filters/axialSegmentPair/TruthAxialSegmentPairVarSet.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/mclookup/CDCMCManager.h>
16#include <tracking/trackFindingCDC/eventdata/tracks/CDCAxialSegmentPair.h>
17#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
18#include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit2D.h>
19#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
20#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
22#include <tracking/trackFindingCDC/numerics/Angle.h>
24#include <cdc/dataobjects/CDCSimHit.h>
27using namespace TrackFindingCDC;
43 if (not ptrAxialSegmentPair)
return false;
56 const std::map<ITrackType, CDCMCTrackStore::CDCHitVector>& mcTracks =
70 if (fromSimHit and toSimHit) {
73 var<
named(
"truth_from_alpha")>() = truthFromAlpha;
74 var<
named(
"truth_to_alpha")>() = truthToAlpha;
77 var<
named(
"truth_from_alpha")>() = NAN;
78 var<
named(
"truth_to_alpha")>() = NAN;
79 var<
named(
"truth_delta_alpha")>() = NAN;
82 ITrackType fromTrackId = mcSegmentLookUp.
getMCTrackId(&fromSegment);
83 double fromMCTrackSize = 0;
84 if (mcTracks.count(fromTrackId)) {
85 fromMCTrackSize = mcTracks.find(fromTrackId)->second.size();
88 ITrackType toTrackId = mcSegmentLookUp.
getMCTrackId(&toSegment);
89 double toMCTrackSize = 0;
90 if (mcTracks.count(toTrackId)) {
91 toMCTrackSize = mcTracks.find(toTrackId)->second.size();
94 double trackFraction = fromSegment.size() / fromMCTrackSize + toSegment.size() / toMCTrackSize;
95 var<
named(
"truth_track_fraction")>() = trackFraction;
97 double fromRLPurity = mcSegmentLookUp.
getRLPurity(&fromSegment);
98 double toRLPurity = mcSegmentLookUp.
getRLPurity(&toSegment);
99 if (fromRLPurity < 0.5) fromRLPurity = 0;
100 if (toRLPurity < 0.5) toRLPurity = 0;
105 double weight = pairFBInfo != EForwardBackward::c_Invalid ? fromRLPurity * toRLPurity : 1;
106 var<
named(
"__weight__")>() = weight;
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.
Class representing a pair of reconstructed axial segments in adjacent superlayer.
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
ITrackType getMCTrackId(const ACDCHitCollection *ptrHits) const
Getter for the Monte Carlo track id matched to this collection of hits.
double getRLPurity(const ACDCHitCollection *ptrHits) const
Getter for the right left passge purity which respects the forward backward reconstruction.
CDCTrajectory3D getTrajectory3D(const ACDCHitCollection *ptrHits) const
Returns the trajectory of the collection of hits.
EForwardBackward areAlignedInMCTrack(const ACDCHitCollection *ptrFromHits, const ACDCHitCollection *ptrToHits) const
Returns if the second collection of hits follows the first collection of hits in their common Monte C...
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.
void requireTruthInformation()
Require the MC information store arrays.
void fill()
Fill Monte Carlo look up maps from the DataStore.
static CDCMCManager & getInstance()
Getter for the singleton 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.
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.
void initialize() override
Receive and dispatch signal before the start of the event processing.
void beginEvent() override
Receive and dispatch signal for the start of a new event.
void initialize() final
Require the Monte Carlo information before the event processing starts.
void beginEvent() final
Signal the begin of a new event.
bool extract(const CDCAxialSegmentPair *ptrAxialSegmentPair) 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.
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
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].