New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fwd Track matching to FCS clusters #398
Conversation
I think StFwdTrack and StFwdTrackCollection to StEvent should be in asap (396 and 397). But don't we need a formal code review for the new StFwdTrackMaker & StFcsTrackMatchMaker? Or are we doing the code review at this PR right here now? Also StFcsTrackMatchMaker is sort of work in progress and I have not yet "cleaned up" for PR, thinking PR for it will come after all forward tracking code merged to STAR main git... I'll have closer look and will clean it up as needed here in the PR I guess. |
StFwdTrackMaker was initially reviewed more than two years ago. You can see the package under StRoot/
It can be reviewed in this PR if that is preferred. If you have someone in mind who you would like to see as a reviewer, the request can be done via the PR page. I'd also recommend to add the respective change in .github/CODEOWNERS directly on this PR branch (it would make it somewhat more formal). If there are no volunteers I can review but the first look reveals that the code needs more work indeed, the maker leaks memory like a sieve. I'd suggest to mark this PR as draft for now. |
Yes, of course. But don't hesitate to invite new members from the collaboration too (I thought you had a helper student/postdoc interested in the forward analysis). From the NPPS side I think Victor @perevbnlgov is back, in case you need a pair of experienced eyes |
Yes, we should try to get 2-3 reviewers to proceed with the official review for this new maker. Will follow on this asap. Thanks |
Added Zilong Chang as a reviewer for the new maker. |
Zilong and Victor are invited to review the new StFcsTrackMatchMaker in this PR. |
.github/CODEOWNERS has @fisyak who does not exist??? I guess this is nothing to do with line I've added... |
For some reason he does not want to join |
I do not know how speed is important there. If it is important then it could
//I removed debug here
|
Looking at this code I see a dependence on genfit objects which should not be stored in StEvent. This issues has already been noted in PR#397: |
|
||
//North or south from track | ||
int ns=0; | ||
if(trk->mProjections[0].XYZ.x()>0.0) ns=1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mProjections should not be public on StFwdTrack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is wrong in this case by making it public on StFwdTrack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe our coding standards require member variables to not be publicly accessible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The coding guidelines suggest to make data members private except in structs https://star-bnl.github.io/star-coding-guidelines/codingguide.xml#Access_Control
It also looks like Akio has fixed this in the followup commit. However, I don't see where the StFwdTrack::mProjections
are being set in the submitted code. There appears to be no setter.
|
||
class StFcsCluster; | ||
|
||
struct StFwdTrackProjection { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a class, rather than a struct, and should properly protect its data. Also, should follow STAR naming conventions. "cov" --> mCov. XYZ --> mXyz.
StPtrVecFwdTrack& tracks(); | ||
const StPtrVecFwdTrack& tracks() const; | ||
void addTrack(StFwdTrack* p); | ||
void sortTrackByPT(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to have sortTrackByPT() defined on StFcsCluster? If you need the tracks sorted in some order,
just sort them... you already have the reference to the track vector...
void inSomeAnalysis() {
auto& tracks = mCluster->tracks();
std::sort(tracks.begin(), tracks.end(), [](StFwdTrack* a, StFwdTrack* b) {
return b->momentum().perp() < a->momentum().perp();
});
}
} | ||
|
||
void StFcsCluster::sortTrackByPT() { | ||
std::sort(mTracks.begin(), mTracks.end(), [](StFwdTrack* a, StFwdTrack* b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::sort(mTracks.begin(), mTracks.end(), [](StFwdTrack* a, StFwdTrack* b) { | |
std::sort(mTracks.begin(), mTracks.end(), [](const StFwdTrack* a, const StFwdTrack* b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add const qualifier to the compare function
Speed is important. But speed gain from the suggested code seems minimal, and modified code seems bad to me. But I need dR for debug and histograms... Please suggest other solution if you agree with me that the modified code looks bad. StFcsTrackMatchMaker::Finish(){ I think other comments are implemented, besides having genFit track, which I leave it to Daniel and S&C meeting discussions. |
How do you use the private member |
Speed is important. But speed gain from the suggested code seems
minimal,
Akio, it depends. If number of candidates abbot 3 then 3*3=9, than gain
is not big.
If number is about 20, then 20*20=400 and gin is very big.
You should account, that 80% of cases will dropped on one line of code.
The test of 15% dropped after the second line line. So gain is big.
If number about of 50+ then it is better to use for instance Hungarian
algorithm
... and modified code seems bad to me.
Are you kidding?
But I need dR for debug and histograms...
In the case of debug, speed is not important. and in this case is
possible
to recalculate any variables what you need. Code should work fast only
for production,
not for debug.
... Please suggest other solution if you agree with me
that the modified code looks bad.
If my code is bad for you, how do I know that the new code
will not be bad for you again. Please explain why it is bad for you.
But anyway, you, as an author of code has right to accept of not any
proposal,
because it is your responsibility.
Victor
…On 2022-09-23 10:37, akioogawa wrote:
> (On dr calc in StFcsTrackMatchMaker.cxx) I do not know how speed is
> important there. If it is important then it could be optimized.
Speed is important. But speed gain from the suggested code seems
minimal, and modified code seems bad to me. But I need dR for debug
and histograms... Please suggest other solution if you agree with me
that the modified code looks bad.
StFcsTrackMatchMaker::Finish(){
if(mEpdgeo) delete mEpdgeo;
causes
warning: deleting object of polymorphic class type 'StEpdGeom' which
has non-virtual destructor might cause undefined behaviour
[-Wdelete-non-virtual-dtor]
I'm not sure what to do with this...
I think other comments are implemented, besides having gent track,
which I leave it to Daniel and S&C meeting discussions.
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you were mentioned.Message ID:
***@***.***>
Links:
------
[1]
#398 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/ANQUL7O5DEHO3ZIHC5JHOP3V7W6BLANCNFSM6AAAAAAQLX3U4M
|
No. But it is NOT your proposed code which looks bad to me. It is my modified code which looks bad to me.
No. Your code looks ok without debugging lines. It is my code with debug & histogram filling which looks bad. Please have a look at new commit and tell me if it looks ok for you. |
Which is better?
Or
Former is commit this morning. Later Is still in my private file... |
double dx = xyz.x() - proj[ehp]->x(); if(dx > mMaxDistance[ehp]) continue; | ||
double dy = xyz.y() - proj[ehp]->y(); if(dy > mMaxDistance[ehp]) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these two lines? The third line "dr" cut will automatically satisfy these cuts. If so, do we need to calculate dx = TMath::Abs(dx) and dy = TMath::Abs(dy) before comparing to the max distance?
Do we need these two lines? The third line "dr" cut will automatically
Yes, mathematically cut with dr only is equivalent with dx,dy,dr
together.
But timing is different.
Let say %90 rejected in dx test. No dy and dr is needed to test
The same with dy test. So practically time spend only for dx test, which
is faster.
Actually dr test could be omitted, there is no big differency between
square (dx,dy)
and round (dr).
And also, if you want to test dr it is better to test
dx*dx+dy*dy < mMaxDistance*mMaxDistance to avoid redundant calculation
of sqrt.
and dy = TMath::Abs(dy) before comparing to the max distance?
Yes, you are right, it MUST be fabs(dx)
Victor
… satisfy these cuts. If so, do we need to calculate dx = TMath::Abs(dx)
and dy = TMath::Abs(dy) before comparing to the max distance?
and dy = TMath::Abs(dy) before comparing to the max distance?
On 2022-10-21 13:43, Zilong Chang wrote:
@zlchang commented on this pull request.
-------------------------
In StRoot/StFcsTrackMatchMaker/StFcsTrackMatchMaker.cxx [1]:
> + double dx = xyz.x() - proj[ehp]->x(); if(dx >
mMaxDistance[ehp]) continue;
+ double dy = xyz.y() - proj[ehp]->y(); if(dy >
mMaxDistance[ehp]) continue;
Do we need these two lines? The third line "dr" cut will automatically
satisfy these cuts. If so, do we need to calculate dx = TMath::Abs(dx)
and dy = TMath::Abs(dy) before comparing to the max distance?
--
Reply to this email directly, view it on GitHub [2], or unsubscribe
[3].
You are receiving this because you were mentioned.Message ID:
***@***.***>
Links:
------
[1] #398 (comment)
[2]
#398 (review)
[3]
https://github.com/notifications/unsubscribe-auth/ANQUL7PHGFUGP7KJ6BPNACDWELI5XANCNFSM6AAAAAAQLX3U4M
|
46b594b
to
124e4c9
Compare
OK. Previously this branch depended #397 which used the StFwdTrack addition to StEvent with dependency on GenFit. The changes to THIS code (StFcsTrackMatchMaker) are very minimal - only a few variable name changes and the use of a helper function to access track projections instead of accessing them directly from the underlying vector. So based on the past review, this should be ready to merge as soon as its parent branch is merged in. |
The resolution of conflicts leaned towards the code present in the main branch. No significant changes left so, I think #398 can be closed
Merged in as part of #492 |
Akio's Fwd track match maker for FCS clusters
Depends on
#396
and
#397