-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add additional information to the SimTrack
s
#46979
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,8 +34,9 @@ class SimTrack : public CoreSimTrack { | |
bool noVertex() const { return ivert == -1; } | ||
|
||
/// index of the corresponding Generator particle in the Event container (-1 if no Genpart) | ||
int genpartIndex() const { return igenpart; } | ||
bool noGenpart() const { return igenpart == -1; } | ||
bool isPrimary() const { return (trackInfo_ >> 1) & 1; } | ||
int genpartIndex() const { return isPrimary() ? igenpart : -1; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would guess that it is not a good solution. |
||
bool noGenpart() const { return isPrimary() ? igenpart == -1 : true; } | ||
|
||
const math::XYZVectorD& trackerSurfacePosition() const { return tkposition; } | ||
|
||
|
@@ -51,27 +52,40 @@ class SimTrack : public CoreSimTrack { | |
int idAtBoundary, | ||
math::XYZTLorentzVectorF positionAtBoundary, | ||
math::XYZTLorentzVectorF momentumAtBoundary) { | ||
crossedBoundary_ = crossedBoundary; | ||
if (crossedBoundary) | ||
trackInfo_ |= (1 << 2); | ||
idAtBoundary_ = idAtBoundary; | ||
positionAtBoundary_ = positionAtBoundary; | ||
momentumAtBoundary_ = momentumAtBoundary; | ||
} | ||
bool crossedBoundary() const { return crossedBoundary_; } | ||
bool crossedBoundary() const { return (trackInfo_ >> 2) & 1; } | ||
const math::XYZTLorentzVectorF& getPositionAtBoundary() const { return positionAtBoundary_; } | ||
const math::XYZTLorentzVectorF& getMomentumAtBoundary() const { return momentumAtBoundary_; } | ||
int getIDAtBoundary() const { return idAtBoundary_; } | ||
|
||
bool isFromBackScattering() const { return trackInfo_ & 1; } | ||
void setFromBackScattering() { trackInfo_ |= 1; } | ||
|
||
void setIsPrimary() { trackInfo_ |= (1 << 1); } | ||
void setGenParticleID(const int idx) { igenpart = idx; } | ||
int getPrimaryID() const { return igenpart; } | ||
uint8_t getTrackInfo() const { return trackInfo_; } | ||
|
||
private: | ||
int ivert; | ||
int igenpart; | ||
|
||
math::XYZVectorD tkposition; | ||
math::XYZTLorentzVectorD tkmomentum; | ||
|
||
bool crossedBoundary_; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AuroraPerego this changes a member of a persistent object, how do we ensure backward compatibility here? How are we correctly interpreting all the old files? I do not see a rule in the classes_def.xml |
||
int idAtBoundary_; | ||
math::XYZTLorentzVectorF positionAtBoundary_; | ||
math::XYZTLorentzVectorF momentumAtBoundary_; | ||
uint8_t trackInfo_; | ||
// explanation of trackInfo bits: | ||
// 00000001 = simTrack is from backscattering | ||
// 00000010 = simTrack is of a primary particle | ||
// 00000100 = simTrack crossed the boundary | ||
}; | ||
|
||
#include <iosfwd> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ class G4PrimaryParticle; | |
|
||
class TrackWithHistory { | ||
public: | ||
/** The constructor is called at time, | ||
/** The constructor is called at time, | ||
* when some of the information may not available yet. | ||
*/ | ||
TrackWithHistory(const G4Track *g4track, int pID); | ||
|
@@ -27,7 +27,7 @@ class TrackWithHistory { | |
int trackID() const { return trackID_; } | ||
int particleID() const { return pdgID_; } | ||
int parentID() const { return parentID_; } | ||
int genParticleID() const { return genParticleID_; } | ||
int genParticleID() const { return isPrimary_ ? genParticleID_ : -1; } | ||
int vertexID() const { return vertexID_; } | ||
int processType() const { return procType_; } | ||
int getIDAtBoundary() const { return idAtBoundary_; } | ||
|
@@ -67,6 +67,11 @@ class TrackWithHistory { | |
tkSurfacePosition_ = pos; | ||
tkSurfaceMomentum_ = mom; | ||
} | ||
bool isFromBackScattering() const { return isFromBackScattering_; } | ||
void setFromBackScattering() { isFromBackScattering_ = true; } | ||
bool isPrimary() const { return isPrimary_; } | ||
void setIsPrimary() { isPrimary_ = true; } | ||
int getPrimaryID() const { return genParticleID_; } | ||
|
||
private: | ||
int trackID_; | ||
|
@@ -88,6 +93,8 @@ class TrackWithHistory { | |
bool storeTrack_{false}; | ||
bool saved_{false}; | ||
bool crossedBoundary_{false}; | ||
bool isFromBackScattering_{false}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these additions seem to duplicate information already available in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. answering to myself, apparently the |
||
bool isPrimary_{false}; | ||
}; | ||
|
||
extern G4ThreadLocal G4Allocator<TrackWithHistory> *fpTrackWithHistoryAllocator; | ||
|
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.
@AuroraPerego , track info defined in all cases, when tracking of given particle is started. If it is not true to me it is a bug. Primary particle if defined at start tracking.