-
Notifications
You must be signed in to change notification settings - Fork 104
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
Why does R3BMCTrack not derived from FairMCTrack? #756
Comments
That class is 8 years old(or more!), so you could update it if you wish. Thanks in advance! |
Trigger warning: R3BMCStack contains methods which take 19 parameters. Have you tried:
This is of course a hack. Also, if we want to attach detector Ids to the tracks in a persistent way, the enum (why are there two?) should have explicit values. (Also, from grepping for kMUSIC and kCALIFA, these tags are write-only? Is all of this just for visualization?) |
No, but it's a solution in a very desperate time ;D enum DetectorId
{
kREF,
kFairRutherford,
kTutDet,
kSTOPHERE,
kTutProp,
kPixel
}; And in the R3BRoot, there are tons. I don't know which on comes first and for which reason they think six types of detector are enough for all cases.( giving that enum is hardly extensible in C++.) The purpose of DetectorId in the FairMCTrack (not virtual function!) is also confusing: Int_t FairMCTrack::GetNPoints(DetectorId detId) const
{
// TODO: Where does this come from
if (detId == kREF) {
return (fNPoints & 1);
} else if (detId == kTutDet) {
return ((fNPoints & (7 << 1)) >> 1);
} else if (detId == kFairRutherford) {
return ((fNPoints & (31 << 4)) >> 4);
} else {
LOG(error) << "Unknown detector ID " << detId;
return 0;
}
} while this function is totally different in R3BMCTrack. |
Recently I need the visualisation from the simulated tracks. In the R3B, we push the tracks to
R3BStack
, which is fine since there is noFairStack
in its standard libraries. But we also have thisR3BMCStack
which is directly derived fromTObject
:R3BRoot/r3bdata/R3BMCTrack.h
Lines 25 to 31 in de1bd47
And there is also FairMCTrack in FairRoot, which has almost the same member functions and variables. The only difference is the detector lists (enum) used in R3BMCTrack is different than in FairMCTrack. And surprisingly unfortunately, the two detector lists have exactly the same name (
DetectorId
), which makesinclude "FairMCTrack"
in R3BMCTrack.h not even possible. If someone knows the logic behind, please tell me.So my proposal is whether we can make R3BMCTrack inherited from FairMCTrack and delete all those duplicated codes. And of course before this, we need to change enum name
DetectorId
to something else.The advantage of this change is: if R3BMCTrack is inherited from FairMCTrack, we could also use
FairMCTracksDraw
in the event display.The text was updated successfully, but these errors were encountered: