File indexing completed on 2025-01-12 23:42:11
0001 #ifndef SimTrack_H
0002 #define SimTrack_H
0003
0004 #include "SimDataFormats/Track/interface/CoreSimTrack.h"
0005 #include "DataFormats/Math/interface/Vector3D.h"
0006 #include "DataFormats/Math/interface/LorentzVector.h"
0007 #include "FWCore/Utilities/interface/Exception.h"
0008
0009 class SimTrack : public CoreSimTrack {
0010 public:
0011 typedef CoreSimTrack Core;
0012
0013
0014 SimTrack();
0015 SimTrack(int ipart, const math::XYZTLorentzVectorD& p);
0016
0017
0018
0019
0020 SimTrack(int ipart, const math::XYZTLorentzVectorD& p, int iv, int ig);
0021
0022 SimTrack(int ipart,
0023 const math::XYZTLorentzVectorD& p,
0024 int iv,
0025 int ig,
0026 const math::XYZVectorD& tkp,
0027 const math::XYZTLorentzVectorD& tkm);
0028
0029
0030 SimTrack(const CoreSimTrack& t, int iv, int ig);
0031
0032
0033 int vertIndex() const { return ivert; }
0034 bool noVertex() const { return ivert == -1; }
0035
0036
0037 bool isPrimary() const { return (trackInfo_ >> 1) & 1; }
0038 int genpartIndex() const { return isPrimary() ? igenpart : -1; }
0039 bool noGenpart() const { return isPrimary() ? igenpart == -1 : true; }
0040
0041 const math::XYZVectorD& trackerSurfacePosition() const { return tkposition; }
0042
0043 const math::XYZTLorentzVectorD& trackerSurfaceMomentum() const { return tkmomentum; }
0044
0045 inline void setTkPosition(const math::XYZVectorD& pos) { tkposition = pos; }
0046
0047 inline void setTkMomentum(const math::XYZTLorentzVectorD& mom) { tkmomentum = mom; }
0048
0049 inline void setVertexIndex(const int v) { ivert = v; }
0050
0051 void setCrossedBoundaryVars(bool crossedBoundary,
0052 int idAtBoundary,
0053 math::XYZTLorentzVectorF positionAtBoundary,
0054 math::XYZTLorentzVectorF momentumAtBoundary) {
0055 if (crossedBoundary)
0056 trackInfo_ |= (1 << 2);
0057 idAtBoundary_ = idAtBoundary;
0058 positionAtBoundary_ = positionAtBoundary;
0059 momentumAtBoundary_ = momentumAtBoundary;
0060 }
0061 bool crossedBoundary() const { return (trackInfo_ >> 2) & 1; }
0062 const math::XYZTLorentzVectorF& getPositionAtBoundary() const { return positionAtBoundary_; }
0063 const math::XYZTLorentzVectorF& getMomentumAtBoundary() const { return momentumAtBoundary_; }
0064 int getIDAtBoundary() const { return idAtBoundary_; }
0065
0066 bool isFromBackScattering() const { return trackInfo_ & 1; }
0067 void setFromBackScattering() { trackInfo_ |= 1; }
0068
0069 void setIsPrimary() { trackInfo_ |= (1 << 1); }
0070 void setGenParticleID(const int idx) { igenpart = idx; }
0071 int getPrimaryID() const { return igenpart; }
0072 uint8_t getTrackInfo() const { return trackInfo_; }
0073
0074 private:
0075 int ivert;
0076 int igenpart;
0077
0078 math::XYZVectorD tkposition;
0079 math::XYZTLorentzVectorD tkmomentum;
0080
0081 int idAtBoundary_;
0082 math::XYZTLorentzVectorF positionAtBoundary_;
0083 math::XYZTLorentzVectorF momentumAtBoundary_;
0084 uint8_t trackInfo_;
0085
0086
0087
0088
0089 };
0090
0091 #include <iosfwd>
0092 std::ostream& operator<<(std::ostream& o, const SimTrack& t);
0093
0094 #endif