-
Notifications
You must be signed in to change notification settings - Fork 20
Tentative changes for new base class AtFittedTrack. #254
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
base: develop
Are you sure you want to change the base?
Conversation
a8c73ed to
ff9dec7
Compare
AtData/AtFitResult.h
Outdated
| // Vector to store the results for all different fits done to all tracks in the event. | ||
| ResultsMap fResults; |
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.
Needs better comment. What is the map? Like what is the integer? How does it connect to other ints? I don't remember already lol
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.
You are right, the comment could be better.
The integer in this map connects to the fTrackId for which the fits were performed, while the vector of AtFitTrackResult is the collection of fit results of all fits performed for the same track (for example, take one track, assume it could be either proton, deuterium or tritium, and check all 3 cases). Will update this comment.
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.
Done in 3rd commit after this one.
AtData/AtFittedTrack.h
Outdated
| struct Kinematics { | ||
| Double_t kineticEnergy{-1}; // Kinetic energy | ||
| Double_t theta{-1}; // Theta scattering angle | ||
| Double_t phi{-1}; // Phi scattering angle | ||
| Double_t kineticEnergyXtr{-1}; // Extrapolated kinetic energy | ||
| Double_t thetaXtr{-1}; // Extrapolated theta scattering angle | ||
| Double_t phiXtr{-1}; // Extrapolated phi scattering angle | ||
| }; |
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 think this should just be KE, theta, phi. Then we can store two coppies of it. Extr and non-extrap.
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.
Really, this could also just be momentum too. Or some equivalent vector if we don't want to have a new struct?
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.
In the end, we are interested in getting kinetic energy and angles, but I could also store a TLorentzVector.
Also, I initially saved 2 copies of Kinematics, one for extr and one for non-extr. I guess I will change it back to that.
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.
Separated the kinematics in 2 different members, one for non-extrap and one for extrap. This is in 4th commit after this one
| Float_t fEnergyXtr{0}; | ||
| Float_t fExcitationEnergyXtr{0}; | ||
| // Track properties. | ||
| TrackProperties fTrackProperties; |
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 is this not a vector but others are vectors?
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.
Others are vectors because we are considering that 1 AtTrack could contain multiple particles, thus multiple entries in the vectors. However, for track properties, these are properties of the track as a whole, so it should only be 1 entry.
Please check the definition of TrackProperties just in case you see a variable that should not live in there based on this.
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 think most of the track properties seem to be particle-track related rather than AtTrack related. Like the dedx would not make sense to talk about an entire event. Looking through the list I think I would say all of those parameters are probably particle specific so I would put this as a vector.
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.
Well, it depends. Maybe dEdx is not the best example, since it should be particle specific. But for example, the total charge is meant to be the total charge of the track, being it 1, 2 or 3 particles, same with number of hits, it's meant to be total hits in all the track. The extrapolated distance is meant to be the total distance that needed to be extrapolated from the first hit to the real vertex along the axis of the ATTPC, for the part of the track that comes out of the beam region in case we are talking about the fission pattern.
Meanwhile, real particle vertex would be stored in the fVertices vector, one for each particle.
The ony one that maybe feel out of place to me is the dEdx, but in a case where there is only 1 particle in the track, it can still make sense, and maybe it can simply be ignored in other cases. Maybe track lengths also do not make sense in case that there is more than 1 particle.
AtReconstruction/AtFitter/AtFitter.h
Outdated
| using TrackResultsSet = | ||
| std::set<TrackResultPtr, std::function<bool(const TrackResultPtr &, const TrackResultPtr &)>>; | ||
|
|
||
| protected: |
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 don't think it makes much sense to store temporary pointers that users have to remember to manage
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.
Yes, as in #257. Will work on this.
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.
Done in 5th commit after this one.
AtReconstruction/AtFitterTask.h
Outdated
| void SetRawEventBranch(TString branchName); | ||
| void SetEventBranch(TString branchName); | ||
|
|
||
| void SetFitResultBranch(TString branchName); |
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.
So is AtFitResult actually the equivalent of AtFittedTrack?
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.
No, it was a bad choice of name. It should be FitMetadata. This was already changed to the new naming.
| class Track; | ||
| } // namespace genfit | ||
|
|
||
| class AtFitterTask : public FairTask { |
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.
Probably needs a very robust doc string about the logic.
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.
Done in 6th commit after this one.
AtReconstruction/AtFitterTask.cxx
Outdated
| auto fitResult = dynamic_cast<AtFitResult *>(fFitResultArray.ConstructedAt(0)); | ||
|
|
||
| std::cout << " Event Counter " << fEventCnt << "\n"; | ||
| LOG(info) << " AtFitterTask::Exec() : Fitting event " << fEventCnt; |
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.
Remove hard coded function name
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.
Done in 5th commit after this one
AtReconstruction/AtFitterTask.cxx
Outdated
| std::cout << " AtFitterTask:Exec - Number of candidate tracks : " << tracks.size() << "\n"; | ||
| AtPatternEvent *patternEvent = dynamic_cast<AtPatternEvent *>(fPatternEventArray->At(0)); | ||
| std::vector<AtTrack> &tracks = patternEvent->GetTrackCand(); | ||
| LOG(info) << " AtFitterTask::Exec() : Number of candidate tracks : " << tracks.size(); |
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.
remove func name
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.
Done in 5th commit after this one
RealAurio
left a comment
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.
First changes I will work on. I added a couple of questions as to how I should approach this.
AtData/AtFitTrackResult.h
Outdated
| /** | ||
| * Class for storing the result of the fit of an AtTrack from an AtFitter class. | ||
| */ | ||
| class AtFitTrackResult : public TObject { |
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 think we wanted to name this AtFitMetadata, but for some reason I forgot about this. I can change the naming of the class. However, the now derived class AtMCResult has result in the naming, but I'm afraid of changing the naming in AtMCFitResult since it was an already existing class and would imply changing the convention in a lot of places.
For now, I will change the name of the base class and leave AtMCResult unchanged, but please let me know if you still want to change the naming of AtMCResult.
AtData/AtFittedTrack.h
Outdated
| struct Kinematics { | ||
| Double_t kineticEnergy{-1}; // Kinetic energy | ||
| Double_t theta{-1}; // Theta scattering angle | ||
| Double_t phi{-1}; // Phi scattering angle | ||
| Double_t kineticEnergyXtr{-1}; // Extrapolated kinetic energy | ||
| Double_t thetaXtr{-1}; // Extrapolated theta scattering angle | ||
| Double_t phiXtr{-1}; // Extrapolated phi scattering angle | ||
| }; |
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.
In the end, we are interested in getting kinetic energy and angles, but I could also store a TLorentzVector.
Also, I initially saved 2 copies of Kinematics, one for extr and one for non-extr. I guess I will change it back to that.
| Float_t fEnergyXtr{0}; | ||
| Float_t fExcitationEnergyXtr{0}; | ||
| // Track properties. | ||
| TrackProperties fTrackProperties; |
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.
Others are vectors because we are considering that 1 AtTrack could contain multiple particles, thus multiple entries in the vectors. However, for track properties, these are properties of the track as a whole, so it should only be 1 entry.
Please check the definition of TrackProperties just in case you see a variable that should not live in there based on this.
| inline void SetTrackID(Int_t trackid) { fTrackID = trackid; } | ||
| void SetTrackID(Int_t trackid) { fTrackID = trackid; } | ||
|
|
||
| inline void SetEnergyAngles(Float_t energy, Float_t energyxtr, Float_t theta, Float_t phi, Float_t energypra, |
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.
Okay.
| const std::tuple<Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t> GetEnergyAngles(); | ||
| const std::tuple<XYZVector, XYZVector, XYZVector> GetVertices(); | ||
| const std::tuple<Float_t, Float_t, Float_t, Float_t, Float_t, Bool_t> GetStats(); | ||
| const std::tuple<Int_t, Float_t, Float_t, Float_t, std::string, Int_t> GetTrackProperties(); | ||
| const std::tuple<Float_t, Float_t> GetIonChamber(); | ||
| const std::tuple<Float_t, Float_t> GetExcitationEnergy(); | ||
| const std::tuple<Float_t, Float_t, Float_t> GetDistances(); |
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.
Agreed, will bring these templates back and change the implementation so it adapts to the refactored class.
| class TClass; | ||
| class TMemberInspector; | ||
|
|
||
| class [[deprecated]] AtTrackingEventOld : public AtBaseEvent { |
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 think the new version did in fact not need any new changes, so it remained unchanged and thus it does not appear in this commit (the new AtFittedTrack is still named AtFittedTrack). As for the old one, I had to change AtFittedTrack to AtFittedTrackOld, and stuff like that, so this new class was needed with just that little change.
RealAurio
left a comment
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.
Some changes
AtData/AtFitTrackResult.h
Outdated
| /** | ||
| * Class for storing the result of the fit of an AtTrack from an AtFitter class. | ||
| */ | ||
| class AtFitTrackResult : public TObject { |
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.
Renaming from result to metadata done in next 2 commits.
AtData/AtFitResult.h
Outdated
| // Vector to store the results for all different fits done to all tracks in the event. | ||
| ResultsMap fResults; |
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.
Done in 3rd commit after this one.
b1ba376 to
4e393ef
Compare
anthoak13
left a comment
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 think this looks good? Is there anything else you would want to change before we try and merge?
| Float_t fEnergyXtr{0}; | ||
| Float_t fExcitationEnergyXtr{0}; | ||
| // Track properties. | ||
| TrackProperties fTrackProperties; |
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 think most of the track properties seem to be particle-track related rather than AtTrack related. Like the dedx would not make sense to talk about an entire event. Looking through the list I think I would say all of those parameters are probably particle specific so I would put this as a vector.
| const std::tuple<Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t> GetEnergyAngles(); | ||
| const std::tuple<XYZVector, XYZVector, XYZVector> GetVertices(); | ||
| const std::tuple<Float_t, Float_t, Float_t, Float_t, Float_t, Bool_t> GetStats(); | ||
| const std::tuple<Int_t, Float_t, Float_t, Float_t, std::string, Int_t> GetTrackProperties(); | ||
| const std::tuple<Float_t, Float_t> GetIonChamber(); | ||
| const std::tuple<Float_t, Float_t> GetExcitationEnergy(); | ||
| const std::tuple<Float_t, Float_t, Float_t> GetDistances(); |
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 am happy to keep it this way. Or for functions that partially set the removed member variables we mark them deprecated. Functions that only set removed members are removed?
I'm not sure what the best option is. I think we will break things regardless, but the less the better I suppose. Maybe we try to run some old codes to see how much a pain these different changes are to deal with?
| void EventFit::AtFitter::FitEvent(AtTrackingEvent *trackingEvent, AtPatternEvent *patternEvent, | ||
| AtFitMetadata *fitMetadata, AtRawEvent *rawEvent, AtEvent *event) | ||
| { | ||
| // Extract the candidate AtTracks. |
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.
Should we add checks for null pointer here?
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 would be something similar as the last change that you asked for in #257. I can add a quick check. If no pattern event, then return.
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.
Also for tracking event actually.
Raw event, event and fit metadata can be nullptr considering how GetFittedTrack is defined.
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.
Done in last commit.
e16a09f to
4b1fa7e
Compare
…ously AtFitResult).
… AtFITTER to EventFit.
4b1fa7e to
841e510
Compare
…make sense to keep in the base class. Also fixed some serious bugs that I found while actually implementing a fitter class in the braggCurveFitter feature branch.
No description provided.