Belle II Software development
TrackQualityAsserter Class Referenceabstract

This module applies configurable correction functions to all found tracks. More...

#include <TrackQualityAsserter.h>

Inheritance diagram for TrackQualityAsserter:
Findlet< CDCTrack & > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

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

Public Member Functions

 TrackQualityAsserter ()
 Constructor setting up the default parameters.
 
std::string getDescription () override
 Get the description of the findlet.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the parameters to a module.
 
void apply (std::vector< CDCTrack > &tracks) final
 Main function to clean up the tracks.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
void initialize () override
 Receive and dispatch signal before the start of the event processing.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
void beginEvent () override
 Receive and dispatch signal for the start of a new event.
 
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.
 

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<CDCTrack&>
 Type of the base class.
 

Private Attributes

std::vector< std::string > m_param_corrections
 Parameter : The corrections to use.
 
bool m_param_onlyNotFittedTracks = false
 Parameter : Flag to use the corrections only for not fitted tracks.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized
 Flag to keep track whether initialization happened before.
 
bool m_terminated
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

This module applies configurable correction functions to all found tracks.

Typical correction functions include:

  • Removal of hits after long breaks
  • Removal of hits on the wrong side of the detector
  • Splitting of curling tracks into two halves
  • etc.

See the TrackQualityTools for details on the specific functions.

Mainly the corrections are applied to remove fakes and to make the tracks fitable with genfit (which fails mainly for low-momentum tracks). WARNING: Not all of the correction functions work well and the finding efficiency may be reduced strongly even when applying the correctly working functions! Handle with care ;-)

Definition at line 41 of file TrackQualityAsserter.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

using Super = Findlet<CDCTrack&>
private

Type of the base class.

Definition at line 44 of file TrackQualityAsserter.h.

◆ ToVector

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ TrackQualityAsserter()

Constructor setting up the default parameters.

Definition at line 22 of file TrackQualityAsserter.cc.

23 : m_param_corrections({"LayerBreak", "LargeAngle", "OneSuperlayer", "Small"})
25{
26}
bool m_param_onlyNotFittedTracks
Parameter : Flag to use the corrections only for not fitted tracks.
std::vector< std::string > m_param_corrections
Parameter : The corrections to use.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 53 of file CompositeProcessingSignalListener.cc.

56{
58}
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition Findlet.h:26

◆ apply()

void apply ( std::vector< CDCTrack > & tracks)
final

Main function to clean up the tracks.

Definition at line 52 of file TrackQualityAsserter.cc.

53{
54 // Only use the not fitted tracks if set - was unused
55 /*
56 if (m_param_onlyNotFittedTracks) {
57 tracks.erase(std::remove_if(tracks.begin(), tracks.end(), [](const CDCTrack & track) {
58 const genfit::TrackCand* trackCand = track.getRelatedGenfitTrackCandidate();
59 if (trackCand == nullptr) {
60 B2WARNING("Can not decide whether to correct this track or not, as it has no related genfit::TrackCand. Skipping.");
61 return true;
62 }
63 RecoTrack* recoTrack = DataStore::Instance().getRelated<RecoTrack>(trackCand, "GF2Tracks");
64 if (recoTrack == nullptr) {
65 B2WARNING("Can not decide whether to correct this track or not, as it has no related RecoTrack. Skipping.");
66 return true;
67 }
68
69 return false;
70 }), tracks.end());
71 }
72 */
73
74 std::vector<CDCTrack> splittedTracks;
75
76 for (CDCTrack& track : tracks) {
77 // Reset all hits to not have a background hit (what they should not have anyway)
79
80 for (const std::string& correctorFunction : m_param_corrections) {
81 if (correctorFunction == "LayerBreak") {
82 // GOOD
84 } else if (correctorFunction == "LargeAngle") {
85 // GOOD
87 } else if (correctorFunction == "LargeBreak2") {
88 // GOOD
90 } else if (correctorFunction == "OneSuperlayer") {
91 // GOOD
93 } else if (correctorFunction == "Small") {
94 // GOOD
96 } else if (correctorFunction == "B2B") {
97 // GOOD
99 } else if (correctorFunction == "MoveToNextAxial") {
100 // GOOD
102 } else if (correctorFunction == "None") {
103 // GOOD :-)
104 ;
105 } else if (correctorFunction == "Split") {
106 // Working, but makes it not better
107 TrackQualityTools::splitSecondHalfOfTrack(track, splittedTracks);
108 } else if (correctorFunction == "ArcLength2D") {
109 // ???
111 } else if (correctorFunction == "CDCWall") {
112 // BAD
113 B2FATAL("Do not use this function as it is not working probably.");
115 } else {
116 B2FATAL("Do not know corrector function " << correctorFunction);
117 }
118
119 // Delete all hits that were marked
120 erase_remove_if(track, [](const CDCRecoHit3D & recoHit3D) -> bool {
121 AutomatonCell& automatonCell = recoHit3D.getWireHit().getAutomatonCell();
122 if (automatonCell.hasAssignedFlag())
123 {
124 automatonCell.unsetTakenFlag();
125 return true;
126 }
127 return false;
128 });
129
131 } // correctorFunction
132 } // track
133
134 erase_remove_if(tracks, [](const CDCTrack & track) -> bool { return track.size() < 3; });
135
136 for (const CDCTrack& splittedTrack : splittedTracks) {
137 tracks.push_back(splittedTrack);
138 }
139}
bool hasAssignedFlag() const
Gets the current state of the already assigned marker flag.
void unsetTakenFlag()
Resets the taken flag to false.
const CDCWireHit & getWireHit() const
Getter for the wire hit.
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
Definition CDCWireHit.h:286
static void removeArcLength2DHoles(CDCTrack &track, double m_maximumArcLength2DDistance=10)
Remove all hits that come after a large hole in the two dimensional arc length.
static void moveToNextAxialLayer(CDCTrack &track)
Delete hits of the first superlayer if it is a stereo one (fitting does not work very well when start...
static void removeHitsIfOnlyOneSuperLayer(CDCTrack &track)
Remove the whole track if it only consists of one superlayer.
static void normalizeHitsAndResetTrajectory(CDCTrack &track)
Update all hits to have a positive perpS, a taken flag and no background flag Also set the trajectory...
static void removeHitsInTheBeginningIfAngleLarge(CDCTrack &track, double maximalAngle=0.7)
If the angle between two following hits is larger than maximalAngle, delete all hits before (!...
static void removeHitsAfterCDCWall(CDCTrack &track, double outerCylindricalRFactor=1.1)
Remove all hits which can not belong to the track, as the particle can not exit and enter the CDC aga...
static void removeHitsIfSmall(CDCTrack &track, unsigned int minimalHits=7)
Delete a track fully of the number of hits is below minimalHits.
static void removeHitsOnTheWrongSide(CDCTrack &track)
Remove all hits that are on the wrong side of the detector (so to say: "beyond the IP").
static void splitSecondHalfOfTrack(CDCTrack &track, std::vector< CDCTrack > &tracks)
Trasan did output curlers in split two halves - this method can be used to mimic this.
static void removeHitsAfterLayerBreak(CDCTrack &track, double m_maximumArcLength2DDistance=10)
Delete all hits after a large layer break.
static void removeHitsAfterLayerBreak2(CDCTrack &track)
Delete all hits after a large layer break.

◆ beginEvent()

void beginEvent ( )
overrideinherited

Receive and dispatch signal for the start of a new event.

Definition at line 36 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
void beginEvent() override
Receive and dispatch signal for the start of a new event.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overrideinherited

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

Definition at line 33 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ endRun()

void endRun ( )
overrideinherited

Receive and dispatch signal for the end of the run.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
void endRun() override
Receive and dispatch signal for the end of the run.
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 34 of file TrackQualityAsserter.cc.

36{
37 moduleParamList->addParameter(prefixed(prefix, "corrections"),
39 "The list of corrections to apply. "
40 "Choose from LayerBreak, LargeAngle, "
41 "LargeBreak2, OneSuperlayer, Small, B2B, "
42 "MoveToNextAxial, None, Split, and "
43 "ArcLength2D.",
45
46 moduleParamList->addParameter(prefixed(prefix, "onlyNotFittedTracks"),
48 "Flag to apply the corrections only to not fitted tracks.",
50}
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 ( )
overridevirtual

Get the description of the findlet.

Reimplemented from Findlet< CDCTrack & >.

Definition at line 28 of file TrackQualityAsserter.cc.

29{
30 return "Many tracks in the CDC can not be fitted. For fitting them, we remove "
31 "parts of the hits or maybe the whole track.";
32}

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 56 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overrideinherited

Receive and dispatch signal before the start of the event processing.

Definition at line 30 of file CompositeProcessingSignalListener.cc.

16{
19 psl->initialize();
20 }
21}
void initialize() override
Receive and dispatch signal before the start of the event processing.
virtual void initialize()
Receive signal before the start of the event processing.

◆ terminate()

void terminate ( )
overrideinherited

Receive and dispatch Signal for termination of the event processing.

Definition at line 42 of file CompositeProcessingSignalListener.cc.

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

Member Data Documentation

◆ m_initialized

bool m_initialized
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_corrections

std::vector<std::string> m_param_corrections
private

Parameter : The corrections to use.

Definition at line 61 of file TrackQualityAsserter.h.

◆ m_param_onlyNotFittedTracks

bool m_param_onlyNotFittedTracks = false
private

Parameter : Flag to use the corrections only for not fitted tracks.

Definition at line 64 of file TrackQualityAsserter.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
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: