Belle II Software  release-08-01-10
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 
11 using namespace std;
12 using namespace Belle2;
13 
14 REG_MODULE(CDCTriggerNDFinder);
15 
16 CDCTriggerNDFinderModule::CDCTriggerNDFinderModule() : Module()
17 {
18  setDescription("CDC Trigger NDFinder Module.\n"
19  "Implements a 3D Hough transformation for \n"
20  "3D track finding in omega, phi, theta. \n"
21  "Uses trained hit patterns for axial and \n"
22  "stereo TS and a density based clustering \n"
23  "algorithm.\n");
25  addParam("TrackSegmentHitsName", m_TrackSegmentHitsName,
26  "The name of the StoreArray of the CDCTriggerSegmentHits.",
27  string("CDCTriggerSegmentHits"));
28  addParam("NDFinderTracksName", m_NDFinderTracksName,
29  "The name of the StoreArray where the tracks found by this NDFinder Module are stored.",
30  string("CDCTrigger3DFinderTracks"));
31  addParam("minhits", m_minhits,
32  "Cluster pruning: Minimum number of hits related to a cluster "
33  "for the cluster to be considered as a track.",
34  4);
35  addParam("minhits_axial", m_minhits_axial,
36  "Cluster pruning: Minimum number of axial hits related to a cluster "
37  "for the cluster to be considered as a track.",
38  0);
39  addParam("minweight", m_minweight,
40  "Clustering: Minimum weight of a cell in Hough space "
41  "for the cell to be considered as a cluster member.",
42  24);
43  addParam("minpts", m_minpts,
44  "Clustering: Minimum number of neighbor cells with minweight "
45  "for a cell to be considered a core cell.",
46  1);
47  addParam("thresh", m_thresh,
48  "Track estimation: Minimum weight of a cluster member cell "
49  "relative to the peak weight of the cluster "
50  "for the cell to enter in the weighted mean "
51  "track parameter value estimation.",
52  0.85);
53  addParam("minassign", m_minassign,
54  "Hit to cluster assignment limit: "
55  "Minimum relatively larger weight contribution to the largest cluster.",
56  0.2);
57  addParam("diagonal", m_diagonal,
58  "Clustering: consider diagonal neighbors.",
59  true);
60  addParam("mincells", m_mincells,
61  "Clustering: minimum number of cells for a cluster.",
62  1);
63  addParam("verbose", m_verbose,
64  "Print Hough planes and verbose output. ",
65  false);
66  addParam("axialFile", m_axialFile,
67  "File name of the axial hit patterns. ",
68  string("data/trg/cdc/ndFinderAxialShallow.txt.gz"));
69  addParam("stereoFile", m_stereoFile,
70  "File name of the stereo hit patterns. ",
71  string("data/trg/cdc/ndFinderStereoShallow.txt.gz"));
72 }
73 
75 {
76 }
77 
79 {
80  B2DEBUG(11, "CDCTriggerNDFinderModule initialize, m_minweight=" << m_minweight <<
81  ", m_minpts=" << m_minpts << ", m_diagonal=" << m_diagonal <<
82  ", m_minhits=" << m_minhits << ", m_minhits_axial=" << m_minhits_axial <<
83  ", m_thresh= " << m_thresh <<
84  ", m_minassign=" << m_minassign <<
85  ", m_mincells=" << m_mincells <<
86  ", m_verbose= " << m_verbose);
95 }
96 
98 {
99 }
100 
102 {
103  m_NDFinder.reset();
105  m_NDFinder.addHit(hit.getSegmentID(), hit.getPriorityPosition());
106  }
108 
109  vector<NDFinderTrack>* resultTracks = m_NDFinder.getFinderTracks();
110  for (NDFinderTrack trackND : *resultTracks) {
112  m_NDFinderTracks.appendNew(trackND.getPhi0(), trackND.getOmega(),
113  0., 0., trackND.getCot(), 0.);
114  vector<unsigned short> relHits = trackND.get_relHits();
115  for (ulong i = 0; i < relHits.size(); i++) {
116  NDFinderTrack->addRelationTo(m_TrackSegmentHits[relHits[i]]);
117  }
118  }
119 }
120 
122 {
123 }
124 
126 {
128 }
int m_minhits_axial
Cluster pruning: Minimum number of axial hits related to a cluster for the cluster to be considered a...
double m_minassign
Hit to cluster assignment: Minimum relative weight contribution to the largest cluster.
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_minpts
Clustering: Minimum number of neighbor cells with minweight for a cell to be considered a core cell.
int m_minweight
Clustering: Minimum weight of a cell in Hough space for the cell to be considered as a cluster member...
virtual void endRun() override
This method is called if the current run ends.
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_mincells
Clustering: minimum number of cells for a cluster.
virtual void beginRun() override
Called when entering a new run.
bool m_diagonal
Clustering: consider diagonal neighbors.
std::string m_TrackSegmentHitsName
Name for TS hits.
StoreArray< CDCTriggerSegmentHit > m_TrackSegmentHits
StoreArray for TS hits.
StoreArray< CDCTriggerTrack > m_NDFinderTracks
StoreArray for 2D finder tracks from unpacker.
std::string m_stereoFile
File name of the stereo hit patterns.
int m_minhits
Cluster pruning: Minimum number of hits related to a cluster for the cluster to be considered as a tr...
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.
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:215
void printParams()
Debug: print configured parameters.
Definition: NDFinder.cc:672
void reset()
NDFinder reset data structure to process next event.
Definition: NDFinder.h:186
void findTracks()
main function for track finding
Definition: NDFinder.cc:388
void addHit(unsigned short hitId, unsigned short hitPrioPos)
fill hit info of the event
Definition: NDFinder.h:202
void init(int minweight, int minpts, bool diagonal, int minhits, int minhits_axial, double thresh, double minassign, int mincells, bool verbose, std::string &axialFile, std::string &stereoFile)
initialization
Definition: NDFinder.cc:25
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.