9#include <tracking/trackFindingCDC/hough/trees/BoxDivisionHoughTree.h>
10#include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit3D.h>
22 namespace TrackFindingCDC {
26 template<
class AHitPtr,
class AInBoxAlgorithm,
size_t divisionX,
size_t divisionY,
size_t divisionZ>
28 BoxDivisionHoughTree<AHitPtr, typename AInBoxAlgorithm::HoughBox, divisionX, divisionY, divisionZ> {
35 using HoughBox =
typename AInBoxAlgorithm::HoughBox;
70 std::vector<std::pair<HoughBox, std::vector<AHitPtr>>>
73 AInBoxAlgorithm inBoxAlgorithm;
74 auto skipLowWeightNode = [minWeight](
const typename Super::Node * node) {
75 return not(node->getWeight() >= minWeight);
79 std::vector<std::pair<HoughBox, std::vector<AHitPtr>>> result;
82 result.push_back(std::move(*found));
99 const std::vector<CDCRecoHit3D>& foundHits,
100 const typename AInBoxAlgorithm::HoughBox& node)
102 TGraph* allHitsGraph =
new TGraph();
103 allHitsGraph->SetLineWidth(2);
104 allHitsGraph->SetLineColor(9);
107 const Vector3D& recoPos3D = recoHit3D.getRecoPos3D();
108 const double R = std::sqrt(recoPos3D.
x() * recoPos3D.
x() + recoPos3D.
y() * recoPos3D.
y());
109 const double Z = recoPos3D.
z();
110 allHitsGraph->SetPoint(allHitsGraph->GetN(),
R, Z);
113 static int nevent(0);
114 TCanvas canv(
"trackCanvas",
"CDC stereo hits in an event", 0, 0, 1600, 1200);
116 allHitsGraph->Draw(
"APL*");
117 allHitsGraph->GetXaxis()->SetLimits(0, 120);
118 allHitsGraph->GetYaxis()->SetRangeUser(-180, 180);
120 TGraph* foundHitsGraph =
new TGraph();
121 foundHitsGraph->SetMarkerStyle(8);
122 foundHitsGraph->SetMarkerColor(2);
125 const Vector3D& recoPos3D = recoHit3D.getRecoPos3D();
126 const double R = std::sqrt(recoPos3D.
x() * recoPos3D.
x() + recoPos3D.
y() * recoPos3D.
y());
127 const double Z = recoPos3D.
z();
128 foundHitsGraph->SetPoint(foundHitsGraph->GetN(),
R, Z);
130 foundHitsGraph->Draw(
"P");
132 const double centerX = (AInBoxAlgorithm::BoxAlgorithm::centerX(node));
133 const double deltaX = (AInBoxAlgorithm::BoxAlgorithm::deltaX(node));
134 const double centerY = (AInBoxAlgorithm::BoxAlgorithm::centerY(node));
135 const double centerZ = (AInBoxAlgorithm::BoxAlgorithm::centerZ(node));
137 TF1* candidateL =
new TF1(
"candL", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
138 TF1* candidateH =
new TF1(
"candH", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
139 TF1* candidateMean =
new TF1(
"candMean", AInBoxAlgorithm::BoxAlgorithm::debugLine(), 0, 120);
141 candidateL->SetParameters(centerX - deltaX, centerY, centerZ - 100.0 * deltaX);
142 candidateH->SetParameters(centerX + deltaX, centerY, centerZ + 100.0 * deltaX);
143 candidateMean->SetParameters(centerX, centerY, centerZ);
145 candidateL->SetLineColor(9);
146 candidateH->SetLineColor(41);
147 candidateMean->SetLineColor(2);
149 candidateL->Draw(
"same");
150 candidateH->Draw(
"same");
151 candidateMean->Draw(
"same");
152 canv.SaveAs(Form(
"CDCRLHits_%i.png", nevent));
A fast hough algorithm with rectangular boxes, which are split linearly by a fixed number of division...
void initialize()
Initialise the algorithm by constructing the hough tree from the parameters.
typename HoughTree::Node Node
Type of the nodes used in the tree for the search.
int getMaxLevel() const
Getter for the currently set maximal level.
HoughTree * getTree() const
Getter for the tree used in the search in the hough plane.
Class representing a three dimensional reconstructed hit.
Convenience class for the typical usage-case: A box divisioned hough tree with maximum and minimum va...
SimpleBoxDivisionHoughTree3D(float maximumX, float maximumY, float maximumZ, Width< 0 > overlapX=0, Width< 1 > overlapY=0, Width< 2 > overlapZ=0)
Constructor using the given maximal level.
float getMaximumZ() const
Return the maximum value in Z direction.
void initialize()
Initialize the tree with the given values.
float getMaximumY() const
Return the maximum value in y direction.
Width< 0 > getOverlapX() const
Return the overlap in x direction.
float m_maximumZ
The maximum value in z direction.
Width< 1 > m_overlapY
The overlap in Y direction.
float m_maximumY
The maximum value in y direction.
float getMaximumX() const
Return the maximum value in x direction.
Width< 0 > m_overlapX
The overlap in X direction.
typename AInBoxAlgorithm::HoughBox HoughBox
The HoughBox we use.
void writeDebugInfoToFile(const std::string &filename)
Write debug information into a ROOT file; not implemented.
typename HoughBox::template Width< I > Width
Type of the width in coordinate I.
Width< 1 > getOverlapY() const
Return the overlap in y direction.
std::vector< std::pair< HoughBox, std::vector< AHitPtr > > > findSingleBest(const Weight &minWeight)
Find only the leaf with the highest weight (~= number of items)
Width< 2 > m_overlapZ
The overlap in Y direction.
float m_maximumX
The maximum value in X direction.
void drawDebugPlot(const std::vector< CDCRecoHit3D > &allHits, const std::vector< CDCRecoHit3D > &foundHits, const typename AInBoxAlgorithm::HoughBox &node)
Draws found hits and node boundaries FIXME this is a copy-paste from DebugableSimpleBoxDivisionHoughT...
Width< 2 > getOverlapZ() const
Return the overlap in y direction.
A three dimensional vector.
double x() const
Getter for the x coordinate.
double y() const
Getter for the y coordinate.
double z() const
Getter for the z coordinate.
std::unique_ptr< std::pair< ADomain, std::vector< T > > > findHeaviestLeafSingle(AItemInDomainMeasure &weightItemInDomain, int maxLevel, ASkipNodePredicate &skipNode)
Go through all children until the maxLevel is reached and find the leaf with the highest weight.
Abstract base class for different kinds of events.