Skip to content
Snippets Groups Projects
Commit 2fd53652 authored by Andy Haas's avatar Andy Haas
Browse files

Actually checks for matching tracks

Former-commit-id: a880dfe6
parent 8914e95e
No related merge requests found
......@@ -32,6 +32,7 @@ class FTK_DuplicateTrackRemovalTool : public AthAlgTool, virtual public IFTK_Dup
FTK_RawTrackContainer* m_trks_nodups;
ToolHandle<IFTK_UncertaintyTool> m_uncertaintyTool;
bool match(const FTK_RawTrack* track, const FTK_RawTrack* oldtrack) const;
int m_HW_ndiff;
};
#endif
......@@ -12,10 +12,12 @@ FTK_DuplicateTrackRemovalTool::FTK_DuplicateTrackRemovalTool(const std::string&
const IInterface* p ):
AthAlgTool(t,n,p),
m_trks_nodups(NULL),
m_uncertaintyTool("FTK_UncertaintyTool",this)
m_uncertaintyTool("FTK_UncertaintyTool",this),
m_HW_ndiff(6)
{
declareInterface< IFTK_DuplicateTrackRemovalTool >( this );
declareProperty( "UncertaintyTool", m_uncertaintyTool);
declareProperty("HW_ndiff",m_HW_ndiff);
}
StatusCode FTK_DuplicateTrackRemovalTool::initialize() {
......@@ -37,7 +39,40 @@ StatusCode FTK_DuplicateTrackRemovalTool::finalize() {
}
bool FTK_DuplicateTrackRemovalTool::match(const FTK_RawTrack* track, const FTK_RawTrack* oldtrack) const {
return true; // TODO
const std::vector<FTK_RawPixelCluster>& pixclus = track->getPixelClusters();
const std::vector<FTK_RawSCT_Cluster>& sctclus = track->getSCTClusters();
const std::vector<FTK_RawPixelCluster>& oldpixclus = oldtrack->getPixelClusters();
const std::vector<FTK_RawSCT_Cluster>& oldsctclus = oldtrack->getSCTClusters();
int nmatchingpixclus=0;
for (auto clus : pixclus){
//is this pixel clus matched by any on the old track?
long int barcode = clus.getBarcode();
for (auto oldclus : oldpixclus){
if (oldclus.getBarcode()==barcode){
nmatchingpixclus++;
}
}
}
int nmatchingsctclus=0;
for (auto clus : sctclus){
//is this sct clus matched by any on the old track?
long int barcode = clus.getBarcode();
for (auto oldclus : oldsctclus){
if (oldclus.getBarcode()==barcode){
nmatchingsctclus++;
}
}
}
int nclus = pixclus.size() + sctclus.size();
int nmatchingclus = nmatchingpixclus+nmatchingsctclus;
//it matches if the number of unmatched clusters is <= 6 (or HW_diff)
if ( (nclus-nmatchingclus) <= m_HW_ndiff){//corresponding criteria in simulation
return true;
}
else return false;
}
FTK_RawTrackContainer* FTK_DuplicateTrackRemovalTool::removeDuplicates(const FTK_RawTrackContainer* trks){
......@@ -48,13 +83,14 @@ FTK_RawTrackContainer* FTK_DuplicateTrackRemovalTool::removeDuplicates(const FTK
const FTK_RawTrack *track = trks->at(i);
//now we should see whether this track overlaps with one (or more?) tracks already in the nodups container
std::vector<int> matching_oldtracks;
std::vector<const FTK_RawTrack *> matching_oldtracks;
for (unsigned int e = 0; e!=m_trks_nodups->size(); e++) {
const FTK_RawTrack *oldtrack = m_trks_nodups->at(e);
if (match(track,oldtrack)) {
matching_oldtracks.push_back(e);
matching_oldtracks.push_back(oldtrack);
}
}
ATH_MSG_INFO("Found "<<matching_oldtracks.size()<<" old tracks matching track "<<i);
//if it does, either replace the (worst?) matching track with this new track, or ignore this new track, depending on which track we like better
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment