Belle II Software development
AxialTrackCreatorMCTruth Class Referenceabstract

Findlet that generates tracks from wire hits using the mc truth information. More...

#include <AxialTrackCreatorMCTruth.h>

Inheritance diagram for AxialTrackCreatorMCTruth:
Findlet< const TrackingUtilities::CDCWireHit, TrackingUtilities::CDCTrack > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes
 Types that should be served to apply on invocation.
 
using IOTypes
 Types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 

Public Member Functions

void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the parameters to a module.
 
std::string getDescription () final
 Short description of the findlet.
 
void initialize () final
 Initialize the Module before event processing.
 
void beginEvent () final
 Start processing the current event.
 
void apply (const std::vector< TrackingUtilities::CDCWireHit > &inputWireHits, std::vector< TrackingUtilities::CDCTrack > &outputAxialTracks) final
 Main function of the track finding by the cellular automaton.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Types

using ToVector
 Short hand for ToRangeImpl.
 
using ToVector
 Short hand for ToRangeImpl.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = TrackingUtilities::Findlet<const TrackingUtilities::CDCWireHit, TrackingUtilities::CDCTrack>
 Type of the base class.
 

Private Attributes

bool m_param_reconstructedDriftLength = true
 Parameter : Setup the drift length as it can be estimated from two dimensional information.
 
bool m_param_reconstructedPositions = false
 Parameter : Switch to reconstruct the positions in the tracks imitating the Legendre finder.
 
bool m_param_fit = false
 Parameter : Fit the track instead of forwarding the MC truth information.
 
bool m_param_useOnlyBeforeTOP = false
 Parameter : Cut tracks after the last layer of the CDC has been reached, assuming the tracks left the CDC.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized = false
 Flag to keep track whether initialization happened before.
 
bool m_terminated = false
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Findlet that generates tracks from wire hits using the mc truth information.

Definition at line 30 of file AxialTrackCreatorMCTruth.h.

Member Typedef Documentation

◆ IOTypes [1/2]

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOTypes [2/2]

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors [1/2]

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ IOVectors [2/2]

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

Type of the base class.

Definition at line 35 of file AxialTrackCreatorMCTruth.h.

◆ ToVector [1/2]

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

◆ ToVector [2/2]

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 55 of file CompositeProcessingSignalListener.cc.

56{
58}
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
References to subordinary signal processing listener contained in this findlet.

◆ apply()

void apply ( const std::vector< TrackingUtilities::CDCWireHit > & inputWireHits,
std::vector< TrackingUtilities::CDCTrack > & outputAxialTracks )
final

Main function of the track finding by the cellular automaton.

Definition at line 88 of file AxialTrackCreatorMCTruth.cc.

90{
91 const CDCMCTrackStore& mcTrackStore = CDCMCTrackStore::getInstance();
92 const CDCSimHitLookUp& simHitLookUp = CDCSimHitLookUp::getInstance();
93
94 using CDCHitVector = CDCMCTrackStore::CDCHitVector;
95
96 const std::map<ITrackType, CDCHitVector>& mcTracksByMCParticleIdx =
97 mcTrackStore.getMCTracksByMCParticleIdx();
98
99 std::size_t nAxialTracks = mcTracksByMCParticleIdx.size();
100 outputAxialTracks.reserve(outputAxialTracks.size() + nAxialTracks);
101
102 for (const std::pair<ITrackType, CDCHitVector> mcTracksAndMCParticleIdx : mcTracksByMCParticleIdx) {
103
104 const CDCHitVector& mcTrack = mcTracksAndMCParticleIdx.second;
105
106 outputAxialTracks.push_back(CDCTrack());
107 CDCTrack& axialTrack = outputAxialTracks.back();
108 bool reachedOuterMostLayer = false;
109 for (const CDCHit* ptrHit : mcTrack) {
110
112 // Cut tracks after the outermost layer has been reached and
113 // the track starts to go inwards again.
114 // But let all hits in the outermost layer survive.
115 if (ptrHit->getISuperLayer() == 8 and ptrHit->getILayer() == 5) {
116 reachedOuterMostLayer = true;
117 }
118 if (reachedOuterMostLayer and ptrHit->getILayer() != 5) {
119 break;
120 }
121 }
122
123 const CDCWireHit* wireHit = simHitLookUp.getWireHit(ptrHit, inputWireHits);
124 if (not wireHit) continue;
125
126 CDCRecoHit2D recoHit2D = simHitLookUp.getClosestPrimaryRecoHit2D(ptrHit, inputWireHits);
127 if (not recoHit2D.isAxial()) continue;
128
129 CDCRecoHit3D recoHit3D(recoHit2D.getRLWireHit(), {recoHit2D.getRecoPos2D(), 0}, NAN);
130 axialTrack.push_back(recoHit3D);
131 }
132
133 // Discard short tracks
134 if (axialTrack.size() < 5) outputAxialTracks.pop_back();
135 }
136
137 CDC::RealisticTDCCountTranslator tdcCountTranslator;
138 for (CDCTrack& track : outputAxialTracks) {
139 for (CDCRecoHit3D& recoHit3D : track) {
140 Vector2D recoPos2D = recoHit3D.getRecoPos2D();
141 Vector2D flightDirection = recoHit3D.getFlightDirection2D();
142 double alpha = recoPos2D.angleWith(flightDirection);
143
144 const CDCWire& wire = recoHit3D.getWire();
145 const bool rl = recoHit3D.getRLInfo() == ERightLeft::c_Right;
146
147 double driftLength = std::fabs(recoHit3D.getSignedRecoDriftLength());
149 // Setup the drift length such that only information
150 // that would be present in two dimensional reconstruction is used
151 const double beta = 1;
152 FlightTimeEstimator::instance().getFlightTime2D(recoPos2D, alpha, beta);
153
154 //TODO: for now this seems to be unused, (see following comment)
155 /*
156 double flightTimeEstimate = 0;
157 const CDCHit* hit = recoHit3D.getWireHit().getHit();
158 driftLength =
159 tdcCountTranslator.getDriftLength(hit->getTDCCount(),
160 wire.getWireID(),
161 flightTimeEstimate,
162 rl,
163 wire.getRefZ(),
164 alpha);
165 */
166
167 // As the legendre finder does not reestimate the drift length
168 // We simply set it to the reference drift length for now.
169 // Use version above once the reestimation comes along.
170 driftLength = recoHit3D.getWireHit().getRefDriftLength();
171
172 } else {
173 // In case the true drift length should be kept at least smear it with its variance.
174 double driftLengthVariance = tdcCountTranslator.getDriftLengthResolution(driftLength,
175 wire.getWireID(),
176 rl,
177 wire.getRefZ(),
178 alpha);
179
180 driftLength += gRandom->Gaus(0, std::sqrt(driftLengthVariance));
181 }
182 bool snapRecoPos = true;
183 recoHit3D.setRecoDriftLength(driftLength, snapRecoPos);
184 }
185 }
186
187 if (m_param_fit) {
188 CDCKarimakiFitter fitter;
189 for (CDCTrack& track : outputAxialTracks) {
190 CDCTrajectory2D trajectory2D = fitter.fit(track);
191 trajectory2D.setLocalOrigin(Vector2D(0.0, 0.0));
192 track.setStartTrajectory3D({trajectory2D, CDCTrajectorySZ::basicAssumption()});
193 }
194 } else {
195 const CDCMCTrackLookUp& mcTrackLookUp = CDCMCTrackLookUp::getInstance();
196 for (CDCTrack& track : outputAxialTracks) {
197 CDCTrajectory3D trajectory3D = mcTrackLookUp.getTrajectory3D(&track);
198 CDCTrajectory2D trajectory2D = trajectory3D.getTrajectory2D();
199 track.setStartTrajectory3D({trajectory2D, CDCTrajectorySZ::basicAssumption()});
200 }
201 }
202
204 for (CDCTrack& track : outputAxialTracks) {
206 }
207 }
208}
const WireID & getWireID() const
Getter for the wire id.
Definition CDCWire.h:114
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
Definition CDCWire.h:228
double getDriftLengthResolution(double driftLength, const WireID &wireID=WireID(), bool leftRight=false, double z=0, double alpha=0, double=static_cast< double >(TMath::Pi()/2.)) override
Get position resolution^2 corresponding to the drift length from getDriftLength of this class.
bool m_param_reconstructedDriftLength
Parameter : Setup the drift length as it can be estimated from two dimensional information.
bool m_param_reconstructedPositions
Parameter : Switch to reconstruct the positions in the tracks imitating the Legendre finder.
bool m_param_fit
Parameter : Fit the track instead of forwarding the MC truth information.
bool m_param_useOnlyBeforeTOP
Parameter : Cut tracks after the last layer of the CDC has been reached, assuming the tracks left the...
TrackingUtilities::CDCTrajectory3D getTrajectory3D(const ACDCHitCollection *ptrHits) const
Returns the trajectory of the collection of hits.
static const CDCMCTrackLookUp & getInstance()
Getter for the singletone instance.
static const CDCMCTrackStore & getInstance()
Getter for the singletone instance.
std::vector< const CDCHit * > CDCHitVector
Type for an ordered sequence of pointers to the CDCHit.
const std::map< ITrackType, Belle2::TrackFindingCDC::CDCMCTrackStore::CDCHitVector > & getMCTracksByMCParticleIdx() const
Getter for the stored Monte Carlo tracks ordered by their Monte Carlo Id.
static const CDCSimHitLookUp & getInstance()
Getter for the singletone instance.
TrackingUtilities::CDCRecoHit2D getClosestPrimaryRecoHit2D(const CDCHit *ptrHit, const std::vector< TrackingUtilities::CDCWireHit > &wireHits) const
Construct an TrackingUtilities::CDCRecoHit2D from the closest primary CDCSimHit information related t...
const TrackingUtilities::CDCWireHit * getWireHit(const CDCHit *ptrHit, const std::vector< TrackingUtilities::CDCWireHit > &wireHits) const
Retrieve the wire hit the given CDCHit form the given wire hits.
virtual double getFlightTime2D(const TrackingUtilities::Vector2D &, double, double=1) const
Default estimator for the flight time.
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit associated with the reconstructed hit.
bool isAxial() const
Indicator if the underlying wire is axial.
double setLocalOrigin(const Vector2D &localOrigin)
Setter for the origin of the local coordinate system.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
static CDCTrajectorySZ basicAssumption()
Constructs a basic assumption, what the z0 start position and the sz slope are, including some broad ...
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition Vector2D.h:228
static void normalizeTrack(TrackingUtilities::CDCTrack &track)
Refit and resort the track. Unmask all hits.

◆ beginEvent()

void beginEvent ( )
finalvirtual

Start processing the current event.

Reimplemented from ProcessingSignalListener.

Definition at line 82 of file AxialTrackCreatorMCTruth.cc.

◆ beginRun()

void beginRun ( )
overridevirtualinherited

Receive and dispatch signal for the beginning of a new run.

Reimplemented from ProcessingSignalListener.

Reimplemented in DATCONSVDClusterizer, LayerPXDRelationFilter< AFilter, APrefilter >, LayerPXDRelationFilter< TrackingUtilities::ChooseableFilter< PXDPairFilterFactory > >, LayerPXDRelationFilter< TrackingUtilities::ChooseableFilter< PXDPairFilterFactory > >, LayerSVDRelationFilter< AFilter, APrefilter >, LayerSVDRelationFilter< TrackingUtilities::ChooseableFilter< SVDPairFilterFactory > >, LayerSVDRelationFilter< TrackingUtilities::ChooseableFilter< SVDPairFilterFactory > >, SectorMapBasedSVDPairFilter, SimplePXDStateFilter, SimpleSVDStateFilter, CutsFromDBWireHitFilter, WireHitCreator, MVA< Filter< AVarSet::Object > >, MVA< Filter< typename AVarSet::Object > >, MVA< Filter< typename AVarSet::Object > >, FourHitFilter, LayerRelationFilter< AFilter >, LayerRelationFilter< TrackingUtilities::ChooseableFilter< RelationFilterFactory > >, LayerRelationFilter< TrackingUtilities::ChooseableFilter< RelationFilterFactory > >, QualityIndicatorFilter, RecoTrackStorer, ROIFinder, SpacePointLoaderAndPreparer, ThreeHitFilter, TrackCandidateResultRefiner, TwoHitVirtualIPFilter, and TwoHitVirtualIPQIFilter.

Definition at line 23 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
virtual void beginRun()
Receive signal for the beginning of a new run.
ProcessingSignalListener()
Allow default construction.

◆ endRun()

void endRun ( )
overridevirtualinherited

Receive and dispatch signal for the end of the run.

Reimplemented from ProcessingSignalListener.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
virtual void endRun()
Receive signal for the end of the run.

◆ exposeParameters()

void exposeParameters ( ModuleParamList * moduleParamList,
const std::string & prefix )
finalvirtual

Expose the parameters to a module.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 43 of file AxialTrackCreatorMCTruth.cc.

44{
45 moduleParamList->addParameter(prefixed(prefix, "reconstructedDriftLength"),
47 "Switch to assign the reconstructed drift length to each hit, "
48 "as it can be estimated from two dimensional information only.",
50
51 moduleParamList->addParameter(prefixed(prefix, "reconstructedPositions"),
53 "Switch to reconstruct the positions in the tracks "
54 "imitating the Legendre finder.",
56
57 moduleParamList->addParameter(prefixed(prefix, "fit"),
59 "Fit the track instead of forwarding the mc truth fit information",
61
62 moduleParamList->addParameter(prefixed(prefix, "useOnlyBeforeTOP"),
64 "Cut tracks after the last layer of the CDC has been reached, "
65 "assuming the tracks left the CDC.",
67}
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getDescription()

std::string getDescription ( )
finalvirtual

Short description of the findlet.

Reimplemented from Findlet< const TrackingUtilities::CDCWireHit, TrackingUtilities::CDCTrack >.

Definition at line 69 of file AxialTrackCreatorMCTruth.cc.

70{
71 return "Constructs tracks from wire hits using the MC truth information.";
72}

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
finalvirtual

◆ terminate()

Member Data Documentation

◆ m_initialized

bool m_initialized = false
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_param_fit

bool m_param_fit = false
private

Parameter : Fit the track instead of forwarding the MC truth information.

Definition at line 62 of file AxialTrackCreatorMCTruth.h.

◆ m_param_reconstructedDriftLength

bool m_param_reconstructedDriftLength = true
private

Parameter : Setup the drift length as it can be estimated from two dimensional information.

Definition at line 56 of file AxialTrackCreatorMCTruth.h.

◆ m_param_reconstructedPositions

bool m_param_reconstructedPositions = false
private

Parameter : Switch to reconstruct the positions in the tracks imitating the Legendre finder.

Definition at line 59 of file AxialTrackCreatorMCTruth.h.

◆ m_param_useOnlyBeforeTOP

bool m_param_useOnlyBeforeTOP = false
private

Parameter : Cut tracks after the last layer of the CDC has been reached, assuming the tracks left the CDC.

Definition at line 65 of file AxialTrackCreatorMCTruth.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 60 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated = false
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.


The documentation for this class was generated from the following files: