Belle II Software development
CDCTriggerNDFinderModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include "trg/cdc/modules/ndFinder/CDCTriggerNDFinderModule.h"
10
11using namespace Belle2;
12
13REG_MODULE(CDCTriggerNDFinder);
14
16{
17 setDescription("CDC Trigger NDFinder Module.\n"
18 "Implements a 3D Hough transformation for \n"
19 "3D track finding in omega, phi, theta. \n"
20 "Uses trained hit patterns for axial and \n"
21 "stereo TS and a density based clustering \n"
22 "algorithm.\n");
24 addParam("TrackSegmentHitsName", m_TrackSegmentHitsName,
25 "The name of the StoreArray of the CDCTriggerSegmentHits.",
26 std::string("CDCTriggerSegmentHits"));
27 addParam("NDFinderTracksName", m_NDFinderTracksName,
28 "The name of the StoreArray where the tracks found by this NDFinder Module are stored.",
29 std::string("CDCTrigger3DFinderTracks"));
30 addParam("minSuperAxial", m_minSuperAxial,
31 "Cluster pruning: Minimum number of axial super layer hits related to a cluster "
32 "for the cluster to be considered as a track.",
33 4);
34 addParam("minSuperStereo", m_minSuperStereo,
35 "Cluster pruning: Minimum number of stereo super layer hits related to a cluster "
36 "for the cluster to be considered as a track.",
37 3);
38 addParam("minWeight", m_minWeight,
39 "Clustering: Minimum weight of a cell in Hough space "
40 "for the cell to be considered as a cluster member.",
41 24);
42 addParam("minPts", m_minPts,
43 "Clustering: Minimum number of neighbor cells with minWeight "
44 "for a cell to be considered a core cell.",
45 1);
46 addParam("thresh", m_thresh,
47 "Track estimation: Minimum weight of a cluster member cell "
48 "relative to the peak weight of the cluster "
49 "for the cell to enter in the weighted mean "
50 "track parameter value estimation.",
51 0.85);
52 addParam("diagonal", m_diagonal,
53 "Clustering: consider diagonal neighbors.",
54 true);
55 addParam("minCells", m_minCells,
56 "Clustering: minimum number of cells for a cluster.",
57 1);
58 addParam("dbscanning", m_dbscanning,
59 ".Clustering method: When true: dbscan, when false: fixed 3d volume.",
60 false);
61 addParam("minTotalWeight", m_minTotalWeight,
62 "Clustering: minimum total weight of all cells in the 3d volume.",
63 450);
64 addParam("minPeakWeight", m_minPeakWeight,
65 "Clustering: minimum peak cell weight of a cluster.",
66 32);
67 addParam("iterations", m_iterations,
68 "Clustering: Number of iterations for the cluster finding in one Hough space.",
69 5);
70 addParam("omegaTrim", m_omegaTrim,
71 "Clustering: Number of deleted cells in each omega direction of the maximum.",
72 5);
73 addParam("phiTrim", m_phiTrim,
74 "Clustering: Number of deleted cells in each phi direction of the maximum.",
75 4);
76 addParam("thetaTrim", m_thetaTrim,
77 "Clustering: Number of deleted cells in each theta direction of the maximum.",
78 4);
79 addParam("verbose", m_verbose,
80 "Print Hough planes and verbose output. ",
81 false);
82 addParam("axialFile", m_axialFile,
83 "File name of the axial hit patterns. ",
84 std::string("data/trg/cdc/ndFinderAxialShallow.txt.gz"));
85 addParam("stereoFile", m_stereoFile,
86 "File name of the stereo hit patterns. ",
87 std::string("data/trg/cdc/ndFinderStereoShallow.txt.gz"));
88 addParam("NDFinderInfosName", m_NDFinderInfosName,
89 "The name of the StoreArray where the tracks clusters found by this NDFinder Module are stored.",
90 std::string("CDCTriggerClusterInfos"));
91}
92
94{
95}
96
98{
99 B2DEBUG(25, "CDCTriggerNDFinderModule initialize, m_minWeight=" << m_minWeight <<
100 ", m_minPts=" << m_minPts << ", m_diagonal=" << m_diagonal <<
101 ", m_minSuperAxial=" << m_minSuperAxial << ", m_minSuperStereo=" << m_minSuperStereo <<
102 ", m_thresh= " << m_thresh <<
103 ", m_minCells=" << m_minCells <<
104 ", m_dbscanning=" << m_dbscanning <<
105 ", m_minTotalWeight=" << m_minTotalWeight <<
106 ", m_minPeakWeight=" << m_minPeakWeight <<
107 ", m_iterations=" << m_iterations <<
108 ", m_omegaTrim=" << m_omegaTrim <<
109 ", m_phiTrim=" << m_phiTrim <<
110 ", m_thetaTrim=" << m_thetaTrim <<
111 ", m_verbose= " << m_verbose);
115 m_NDFinderInfos.registerInDataStore(m_NDFinderInfosName);
122}
123
125{
126}
127
129{
132 m_NDFinder.addHit(hit.getSegmentID(), hit.getISuperLayer(), hit.getPriorityPosition(), hit.priorityTime());
133 }
135
136 std::vector<NDFinderTrack>* resultTracks = m_NDFinder.getFinderTracks();
137 for (NDFinderTrack trackND : *resultTracks) {
139 m_NDFinderTracks.appendNew(trackND.getPhi0(), trackND.getOmega(),
140 0., 0., trackND.getCot(), 0.);
141 SimpleCluster Cluster = trackND.getCluster();
142 std::vector<ROOT::Math::XYZVector> houghspace = trackND.getHoughSpace();
143 std::vector<ROOT::Math::XYZVector> ndreadout = trackND.getNDReadout();
144 const CDCTrigger3DFinderInfo* NDFinderInfo =
145 m_NDFinderInfos.appendNew(houghspace, ndreadout);
146 NDFinderTrack->addRelationTo(NDFinderInfo);
147 std::vector<unsigned short> relHits = trackND.getRelHits();
148 for (ulong i = 0; i < relHits.size(); i++) {
149 NDFinderTrack->addRelationTo(m_TrackSegmentHits[relHits[i]]);
150 }
151 }
152}
153
155{
156}
157
159{
161}
Extra info created by the 3D finder of the CDC trigger.
int m_minSuperAxial
Cluster pruning: Minimum number of axial super layer hits related to a cluster for the cluster to be ...
std::string m_NDFinderTracksName
Name for NDFinder tracks.
virtual void initialize() override
Module functions.
virtual void event() override
This method is the core of the module.
double m_thresh
Track estimation: Minimum weight of a cluster member cell relative to the peak weight of the cluster ...
int m_thetaTrim
Clustering with 3d volume: Max deletion in theta (number of cells in each direction from max.
virtual void endRun() override
This method is called if the current run ends.
int m_minPeakWeight
Clustering with 3d volume: Cut on the peak cell weight.
int m_omegaTrim
Clustering with 3d volume: Max deletion in omega (number of cells in each direction from max.
NDFinder m_NDFinder
Instance of the 3D Track Finder.
virtual void terminate() override
This method is called at the end of the event processing.
std::string m_axialFile
File name of the axial hit patterns.
int m_minWeight
Clustering: Minimum weight of a cell in Hough space for the cell to be considered as a cluster member...
int m_minSuperStereo
Cluster pruning: Minimum number of stereo super layer hits related to a cluster for the cluster to be...
virtual void beginRun() override
Called when entering a new run.
bool m_diagonal
Clustering: consider diagonal neighbors.
int m_phiTrim
Clustering with 3d volume: Max deletion in phi (number of cells in each direction from max.
std::string m_TrackSegmentHitsName
Name for TS hits.
std::string m_NDFinderInfosName
Name for the NDFinder Cluster Data.
StoreArray< CDCTrigger3DFinderInfo > m_NDFinderInfos
StoreArray for NDFinder Cluster Data.
StoreArray< CDCTriggerSegmentHit > m_TrackSegmentHits
StoreArray for TS hits.
StoreArray< CDCTriggerTrack > m_NDFinderTracks
StoreArray for 2D finder tracks from unpacker.
int m_minTotalWeight
Clustering with 3d volume: Cut on the total weight in this volume.
std::string m_stereoFile
File name of the stereo hit patterns.
int m_minCells
Clustering: minimum number of cells for a cluster.
bool m_dbscanning
Clustering method: When true: dbscan, when false: fixed three dimensional volume.
int m_iterations
Clustering with 3d volume: Number of global maximum searches per Hough space.
int m_minPts
Clustering: Minimum number of neighbor cells with minWeight for a cell to be considered a core cell.
bool m_verbose
Print Hough planes and verbose output.
Combination of several CDCHits to a track segment hit for the trigger.
Track created by the CDC trigger.
Class to collect log likelihoods from Clusters from ECL and KLM aimed for output to mdst includes fun...
Definition: Cluster.h:26
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
Store track parameters of found tracks.
Definition: NDFinder.h:28
std::vector< NDFinderTrack > * getFinderTracks()
retreive the results
Definition: NDFinder.h:264
void addHit(unsigned short hitId, unsigned short hitSLId, unsigned short hitPrioPos, long hitPrioTime)
fill hit info of the event
Definition: NDFinder.h:249
void init(unsigned short minWeight, unsigned char minPts, bool diagonal, unsigned char minSuperAxial, unsigned char minSuperStereo, float thresh, unsigned char minCells, bool dbscanning, unsigned short minTotalWeight, unsigned short minPeakWeight, unsigned char iterations, unsigned char omegaTrim, unsigned char phiTrim, unsigned char thetaTrim, bool verbose, std::string &axialFile, std::string &stereoFile)
initialization
Definition: NDFinder.cc:24
void printParams()
Debug: print configured parameters.
Definition: NDFinder.cc:703
void reset()
NDFinder reset data structure to process next event.
Definition: NDFinder.h:231
void findTracks()
main function for track finding
Definition: NDFinder.cc:394
Type for found clusters.
Definition: Clusterizend.h:45
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Definition: StoreArray.h:140
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.