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 CDCWireHit, CDCTrack > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes = std::tuple< AIOTypes... >
 Types that should be served to apply on invocation.
 
using IOVectors = std::tuple< std::vector< AIOTypes >... >
 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< CDCWireHit > &inputWireHits, std::vector< 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 = typename ToVectorImpl< T >::Type
 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 = Findlet< const CDCWireHit, 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 27 of file AxialTrackCreatorMCTruth.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes = std::tuple<AIOTypes...>
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors = std::tuple< std::vector<AIOTypes>... >
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

using Super = Findlet<const CDCWireHit, CDCTrack>
private

Type of the base class.

Definition at line 31 of file AxialTrackCreatorMCTruth.h.

◆ ToVector

using ToVector = typename ToVectorImpl<T>::Type
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< CDCWireHit > &  inputWireHits,
std::vector< CDCTrack > &  outputAxialTracks 
)
final

Main function of the track finding by the cellular automaton.

Definition at line 86 of file AxialTrackCreatorMCTruth.cc.

88{
89 const CDCMCTrackStore& mcTrackStore = CDCMCTrackStore::getInstance();
90 const CDCSimHitLookUp& simHitLookUp = CDCSimHitLookUp::getInstance();
91
92 using CDCHitVector = CDCMCTrackStore::CDCHitVector;
93
94 const std::map<ITrackType, CDCHitVector>& mcTracksByMCParticleIdx =
95 mcTrackStore.getMCTracksByMCParticleIdx();
96
97 std::size_t nAxialTracks = mcTracksByMCParticleIdx.size();
98 outputAxialTracks.reserve(outputAxialTracks.size() + nAxialTracks);
99
100 for (const std::pair<ITrackType, CDCHitVector> mcTracksAndMCParticleIdx : mcTracksByMCParticleIdx) {
101
102 const CDCHitVector& mcTrack = mcTracksAndMCParticleIdx.second;
103
104 outputAxialTracks.push_back(CDCTrack());
105 CDCTrack& axialTrack = outputAxialTracks.back();
106 bool reachedOuterMostLayer = false;
107 for (const CDCHit* ptrHit : mcTrack) {
108
110 // Cut tracks after the outermost layer has been reached and
111 // the track starts to go inwards again.
112 // But let all hits in the outermost layer survive.
113 if (ptrHit->getISuperLayer() == 8 and ptrHit->getILayer() == 5) {
114 reachedOuterMostLayer = true;
115 }
116 if (reachedOuterMostLayer and ptrHit->getILayer() != 5) {
117 break;
118 }
119 }
120
121 const CDCWireHit* wireHit = simHitLookUp.getWireHit(ptrHit, inputWireHits);
122 if (not wireHit) continue;
123
124 CDCRecoHit2D recoHit2D = simHitLookUp.getClosestPrimaryRecoHit2D(ptrHit, inputWireHits);
125 if (not recoHit2D.isAxial()) continue;
126
127 CDCRecoHit3D recoHit3D(recoHit2D.getRLWireHit(), {recoHit2D.getRecoPos2D(), 0}, NAN);
128 axialTrack.push_back(recoHit3D);
129 }
130
131 // Discard short tracks
132 if (axialTrack.size() < 5) outputAxialTracks.pop_back();
133 }
134
135 CDC::RealisticTDCCountTranslator tdcCountTranslator;
136 for (CDCTrack& track : outputAxialTracks) {
137 for (CDCRecoHit3D& recoHit3D : track) {
138 Vector2D recoPos2D = recoHit3D.getRecoPos2D();
139 Vector2D flightDirection = recoHit3D.getFlightDirection2D();
140 double alpha = recoPos2D.angleWith(flightDirection);
141
142 const CDCWire& wire = recoHit3D.getWire();
143 const bool rl = recoHit3D.getRLInfo() == ERightLeft::c_Right;
144
145 double driftLength = std::fabs(recoHit3D.getSignedRecoDriftLength());
147 // Setup the drift length such that only information
148 // that would be present in two dimensional reconstruction is used
149 const double beta = 1;
150 FlightTimeEstimator::instance().getFlightTime2D(recoPos2D, alpha, beta);
151
152 //TODO: for now this seems to be unused, (see following comment)
153 /*
154 double flightTimeEstimate = 0;
155 const CDCHit* hit = recoHit3D.getWireHit().getHit();
156 driftLength =
157 tdcCountTranslator.getDriftLength(hit->getTDCCount(),
158 wire.getWireID(),
159 flightTimeEstimate,
160 rl,
161 wire.getRefZ(),
162 alpha);
163 */
164
165 // As the legendre finder does not reestimate the drift length
166 // We simply set it to the reference drift length for now.
167 // Use version above once the reestimation comes along.
168 driftLength = recoHit3D.getWireHit().getRefDriftLength();
169
170 } else {
171 // In case the true drift length should be kept at least smear it with its variance.
172 double driftLengthVariance = tdcCountTranslator.getDriftLengthResolution(driftLength,
173 wire.getWireID(),
174 rl,
175 wire.getRefZ(),
176 alpha);
177
178 driftLength += gRandom->Gaus(0, std::sqrt(driftLengthVariance));
179 }
180 bool snapRecoPos = true;
181 recoHit3D.setRecoDriftLength(driftLength, snapRecoPos);
182 }
183 }
184
185 if (m_param_fit) {
186 CDCKarimakiFitter fitter;
187 for (CDCTrack& track : outputAxialTracks) {
188 CDCTrajectory2D trajectory2D = fitter.fit(track);
189 trajectory2D.setLocalOrigin(Vector2D(0.0, 0.0));
190 track.setStartTrajectory3D({trajectory2D, CDCTrajectorySZ::basicAssumption()});
191 }
192 } else {
193 const CDCMCTrackLookUp& mcTrackLookUp = CDCMCTrackLookUp::getInstance();
194 for (CDCTrack& track : outputAxialTracks) {
195 CDCTrajectory3D trajectory3D = mcTrackLookUp.getTrajectory3D(&track);
196 CDCTrajectory2D trajectory2D = trajectory3D.getTrajectory2D();
197 track.setStartTrajectory3D({trajectory2D, CDCTrajectorySZ::basicAssumption()});
198 }
199 }
200
202 for (CDCTrack& track : outputAxialTracks) {
204 }
205 }
206}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
Translator mirroring the realistic Digitization.
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...
Class implementing the fitter using Karimakis method.
CDCTrajectory3D getTrajectory3D(const ACDCHitCollection *ptrHits) const
Returns the trajectory of the collection of hits.
Specialisation of the lookup for the truth values of reconstructed tracks.
static const CDCMCTrackLookUp & 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.
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.
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit associated with the reconstructed hit.
Definition: CDCRecoHit2D.h:281
bool isAxial() const
Indicator if the underlying wire is axial.
Definition: CDCRecoHit2D.h:163
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52
Singletone class to gather local information about the hits.
static const CDCSimHitLookUp & getInstance()
Getter for the singletone instance.
const CDCWireHit * getWireHit(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Retrieve the wire hit the given CDCHit form the given wire hits.
CDCRecoHit2D getClosestPrimaryRecoHit2D(const CDCHit *ptrHit, const std::vector< CDCWireHit > &wireHits) const
Construct an CDCRecoHit2D from the closest primary CDCSimHit information related to the CDCHit.
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Particle trajectory as it is seen in xy projection represented as a circle.
double setLocalOrigin(const Vector2D &localOrigin)
Setter for the origin of the local coordinate system.
Particle full three dimensional trajectory.
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 ...
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:58
const WireID & getWireID() const
Getter for the wire id.
Definition: CDCWire.h:122
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
Definition: CDCWire.h:236
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
virtual double getFlightTime2D(const Vector2D &, double, double=1) const
Default estimator for the flight time.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition: Vector2D.h:32
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:197
static void normalizeTrack(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 80 of file AxialTrackCreatorMCTruth.cc.

81{
84}
void fill()
Fill Monte Carlo look up maps from the DataStore.
static CDCMCManager & getInstance()
Getter for the singleton instance.
Definition: CDCMCManager.cc:74
void beginEvent() override
Receive and dispatch signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overridevirtualinherited

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

Reimplemented from ProcessingSignalListener.

Reimplemented in LayerRelationFilter< AFilter >, FourHitFilter, QualityIndicatorFilter, ThreeHitFilter, TwoHitVirtualIPFilter, TwoHitVirtualIPQIFilter, RecoTrackStorer, ROIFinder, SpacePointLoaderAndPreparer, and TrackCandidateResultRefiner.

Definition at line 23 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
Interface for an algorithm part that needs to receive the module processing signals.
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ 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 Findlet< const CDCWireHit, CDCTrack >.

Definition at line 41 of file AxialTrackCreatorMCTruth.cc.

42{
43 moduleParamList->addParameter(prefixed(prefix, "reconstructedDriftLength"),
45 "Switch to assign the reconstructed drift length to each hit, "
46 "as it can be estimated from two dimensional information only.",
48
49 moduleParamList->addParameter(prefixed(prefix, "reconstructedPositions"),
51 "Switch to reconstruct the positions in the tracks "
52 "imitating the Legendre finder.",
54
55 moduleParamList->addParameter(prefixed(prefix, "fit"),
57 "Fit the track instead of forwarding the mc truth fit information",
59
60 moduleParamList->addParameter(prefixed(prefix, "useOnlyBeforeTOP"),
62 "Cut tracks after the last layer of the CDC has been reached, "
63 "assuming the tracks left the CDC.",
65}
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 CDCWireHit, CDCTrack >.

Definition at line 67 of file AxialTrackCreatorMCTruth.cc.

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

◆ 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

Initialize the Module before event processing.

Reimplemented from ProcessingSignalListener.

Definition at line 73 of file AxialTrackCreatorMCTruth.cc.

74{
77}
void requireTruthInformation()
Require the MC information store arrays.
void initialize() override
Receive and dispatch signal before the start of the event processing.

◆ terminate()

void terminate ( )
overridevirtualinherited

Receive and dispatch Signal for termination of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, and StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >.

Definition at line 47 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
virtual void terminate()
Receive Signal for termination of the event processing.

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 58 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 52 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 55 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 61 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 52 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: