 |
Belle II Software
release-05-02-19
|
10 #ifndef CDCTrigger2DFinderModule_H
11 #define CDCTrigger2DFinderModule_H
13 #include <framework/core/Module.h>
20 #include <root/TVector2.h>
22 #include <framework/datastore/StoreArray.h>
23 #include <framework/datastore/StoreObjPtr.h>
24 #include <trg/cdc/dataobjects/CDCTriggerSegmentHit.h>
25 #include <trg/cdc/dataobjects/CDCTriggerTrack.h>
26 #include <trg/cdc/dataobjects/CDCTriggerHoughCluster.h>
34 typedef std::pair<unsigned short, TVector2>
cdcPair;
36 typedef std::map<int, cdcPair>
cdcMap;
46 class CDCTriggerHoughCand {
50 unsigned short _slcount,
unsigned _id):
62 unsigned getID()
const {
return id; }
78 return (a.getCoord().first.X() == b.getCoord().first.X() &&
79 a.getCoord().first.Y() == b.getCoord().first.Y());
86 class CDCTrigger2DFinderModule :
public Module {
94 virtual void event()
override;
105 double x1_s,
double x2_s,
double y1_s,
double y2_s,
107 unsigned ix_s,
unsigned iy_s);
132 const std::vector<CDCTriggerHoughCand>& candidates,
133 std::vector<CDCTriggerHoughCand>& merged,
134 std::vector<CDCTriggerHoughCand>& rejected,
135 unsigned short nSLmax)
const;
137 bool inList(
const CDCTriggerHoughCand& a,
const std::vector<CDCTriggerHoughCand>& list)
const;
139 bool connected(
const CDCTriggerHoughCand& a,
const CDCTriggerHoughCand& b)
const;
141 void mergeIdList(std::vector<unsigned>& merged, std::vector<unsigned>& a, std::vector<unsigned>& b);
147 bool connectedLR(
unsigned patternL,
unsigned patternR);
149 bool connectedUD(
unsigned patternD,
unsigned patternU);
172 double x1,
double x2,
double y1,
double y2,
178 void selectHits(std::vector<unsigned>& list, std::vector<unsigned>& selected,
179 std::vector<unsigned>& unselected);
263 std::vector<CDCTriggerHoughCand>
houghCand;
266 double radius[9][2] = {{0.}};
282 #endif // CDCTrigger2DFinderModule_H
bool m_suppressClone
switch to send only the first found track and suppress the subsequent clones
std::vector< CDCTriggerHoughCand > houghCand
Hough Candidates.
cdcMap hitMap
map of TS hits containing <iHit, <iSL, (x, y)>> with iHit: hit index in StoreArray iSL: super layer i...
std::vector< unsigned > hitList
list of hit indices contained in the Hough cell
bool connectedLR(unsigned patternL, unsigned patternR)
Check for left/right connection of patterns in 2 x 2 squares.
unsigned maxIterations
number of iterations for the fast peak finder, smallest n such that 2^(n+1) > max(nCellsPhi,...
int m_shiftPt
shift the Hough plane in 1/r to avoid curvature 0 tracks < 0: shift in negative direction (negative h...
StoreObjPtr< TMatrix > m_houghPlane
matrix containing the Hough plane
std::string m_hitCollectionName
Name of the StoreArray containing the input track segment hits.
CDCTrigger2DFinderModule()
Constructor.
double m_minPt
Hough plane limit in Pt [GeV].
bool operator==(const DecayNode &node1, const DecayNode &node2)
Compare two Decay Nodes: They are equal if All daughter decay nodes are equal or one of the daughter ...
unsigned getID() const
Get candidate number.
unsigned topRightCorner(unsigned pattern)
Find the top right corner within 2 x 2 square.
unsigned m_nCellsR
number of Hough cells in 1/r
std::string m_testFilename
filename for test output for firmware debugging
unsigned topRightSquare(std::vector< unsigned > &pattern)
Find the top right square within a cluster of 2 x 2 squares In case of ambiguity, top is favored over...
bool m_ignore2nd
switch to skip second priority hits
bool shortTrack(bool *)
check the short track condition (= hits in the inner super layers rather than any super layers)
unsigned m_minHitsShort
short tracks require hits in the first minHitsShort super layers to form a candidate
std::map< int, cdcPair > cdcMap
Map of <counter, cdcPair>, for hits with indices.
unsigned bottomLeftCorner(unsigned pattern)
Find the bottom left corner within 2 x 2 square.
bool m_onlyLocalMax
switch to ignore candidates connected to cells with higher super layer count
CDCTriggerHoughCand(std::vector< unsigned > &_list, coord2dPair _coord, unsigned short _slcount, unsigned _id)
Constructor for hough candidates.
int fastInterceptFinder(cdcMap &hits, double x1_s, double x2_s, double y1_s, double y2_s, unsigned iterations, unsigned ix_s, unsigned iy_s)
Fast intercept finder Divide Hough plane recursively to find cells with enough crossing lines.
unsigned m_connect
number of neighbors to check for connection (4: direct, 6: direct + upper right and lower left corner...
unsigned id
candidate number, for debugging.
bool m_requireSL0
switch to check separately for a hit in the innermost super layer
bool connectedUD(unsigned patternD, unsigned patternU)
Check for up/down connection of patterns in 2 x 2 squares.
coord2dPair coord
Coordinate of rectangle for this candidate.
bool inList(const CDCTriggerHoughCand &a, const std::vector< CDCTriggerHoughCand > &list) const
Check if candidate is in list.
StoreArray< CDCTriggerHoughCluster > m_clusters
list of clusters in the Hough map
bool connectedDiag(unsigned patternLD, unsigned patternRU)
Check for diagonal connected of patterns in 2 x 2 squares.
virtual void terminate() override
Clean up.
Abstract base class for different kinds of events.
virtual void event() override
Run tracking.
std::string m_outputCollectionName
Name of the StoreArray containing the tracks found by the Hough tracking.
unsigned m_minHits
minimum number of hits from different super layers in a Hough cell to form a candidate
std::pair< TVector2, TVector2 > coord2dPair
Typedef for the coord2dPair, which represents the DATCONHoughCand.
std::ofstream testFile
filestream for test output for firmware debugging
void patternClustering(const cdcMap &inputMap)
Combine Hough candidates to tracks by a fixed pattern algorithm.
unsigned short getSLcount() const
Get super layer count.
void addNeighbors(const CDCTriggerHoughCand ¢er, const std::vector< CDCTriggerHoughCand > &candidates, std::vector< CDCTriggerHoughCand > &merged, std::vector< CDCTriggerHoughCand > &rejected, unsigned short nSLmax) const
Recursive function to add combine connected cells.
virtual void initialize() override
Initialize the module and check module parameters.
unsigned m_clusterSizeX
maximum cluster size for pattern algorithm
bool m_clusterPattern
switch for clustering algorithm (if true use nested patterns)
std::vector< unsigned > getIdList() const
Get Index list.
double maxR
Hough plane limit in 1/r [1/cm].
unsigned short SLcount
Super layer count (number of hits from different super layers).
double shiftR
Hough plane shift in 1/r [1/cm].
bool connected(const CDCTriggerHoughCand &a, const CDCTriggerHoughCand &b) const
Check if candidates are connected.
std::pair< unsigned short, TVector2 > cdcPair
Pair of <iSuperLayer, (x, y)>, for hits in conformal space.
unsigned m_storePlane
switch to save the Hough plane in DataStore (0: don't save, 1: save only peaks, 2: save full plane)
double radius[9][2]
Radius of the CDC layers with priority wires (2 per super layer).
unsigned nCells
number of cells for the fast peak finder: 2^(maxIterations + 1).
bool m_hitRelationsFromCorners
switch for creating relations to hits in the pattern clustering algorithm.
void mergeIdList(std::vector< unsigned > &merged, std::vector< unsigned > &a, std::vector< unsigned > &b)
Merge lists a and b and put the result in merged.
void connectedRegions()
Combine Hough candidates to tracks by merging connected cells.
Accessor to arrays stored in the data store.
StoreArray< CDCTriggerTrack > m_tracks
list of found tracks
void selectHits(std::vector< unsigned > &list, std::vector< unsigned > &selected, std::vector< unsigned > &unselected)
Select one hit per super layer.
void findAllCrossingHits(std::vector< unsigned > &list, double x1, double x2, double y1, double y2, const cdcMap &inputMap)
Find all hits in inputMap whose Hough curve crosses the rectangle with corners (x1,...
unsigned m_clusterSizeY
maximum cluster size for pattern algorithm
bool m_usePriority
switch between priority position and center position of track segment
unsigned short countSL(bool *)
count the number of super layers with hits
unsigned TSoffset[10]
Number of track segments up to super layer.
StoreArray< CDCTriggerSegmentHit > m_segmentHits
list of track segment hits
std::string m_clusterCollectionName
Name of the StoreArray containing the clusters formed in the Hough plane.
coord2dPair getCoord() const
Get rectangle coordinates.
unsigned m_nCellsPhi
number of Hough cells in phi
unsigned m_minCells
minimum number of cells in a cluster to form a track