Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:26

0001 #ifndef SimG4Core_TmpSimTrack_H
0002 #define SimG4Core_TmpSimTrack_H
0003 
0004 #include "DataFormats/Math/interface/Vector3D.h"
0005 #include "DataFormats/Math/interface/LorentzVector.h"
0006 #include "SimG4Core/Notification/interface/TrackWithHistory.h"
0007 #include <cmath>
0008 
0009 class TmpSimTrack {
0010 public:
0011   TmpSimTrack(int iid, int ipart, const math::XYZVectorD& ip, double ie)
0012       : id_(iid), ipart_(ipart), ip_(ip), ie_(ie), ivert_(-1), igenpart_(-1), parentID_(-1) {}
0013 
0014   TmpSimTrack(int iid, int ipart, const math::XYZVectorD& ip, double ie, int iv, int ig, const math::XYZVectorD& ipmom)
0015       : id_(iid), ipart_(ipart), ip_(ip), ie_(ie), ivert_(iv), igenpart_(ig), parentMomentum_(ipmom) {}
0016 
0017   TmpSimTrack(int iid,
0018               int ipart,
0019               const math::XYZVectorD& ip,
0020               double ie,
0021               int iv,
0022               int ig,
0023               const math::XYZVectorD& ipmom,
0024               const math::XYZVectorD& tkpos,
0025               const math::XYZTLorentzVectorD& tkmom)
0026       : id_(iid),
0027         ipart_(ipart),
0028         ip_(ip),
0029         ie_(ie),
0030         ivert_(iv),
0031         igenpart_(ig),
0032         parentMomentum_(ipmom),
0033         tkSurfacePosition_(tkpos),
0034         tkSurfaceMomentum_(tkmom) {}
0035 
0036   ~TmpSimTrack() = default;
0037 
0038   int id() const { return id_; }
0039   int part() const { return ipart_; }
0040   const math::XYZVectorD& momentum() const { return ip_; }
0041   double energy() const { return ie_; }
0042   int ivert() const { return ivert_; }
0043   int igenpart() const { return igenpart_; }
0044   // parent momentum at interaction
0045   const math::XYZVectorD& parentMomentum() const { return parentMomentum_; }
0046   // Information at level of tracker surface
0047   const math::XYZVectorD& trackerSurfacePosition() const { return tkSurfacePosition_; }
0048   const math::XYZTLorentzVectorD& trackerSurfaceMomentum() const { return tkSurfaceMomentum_; }
0049   // parent track ID (only stored if parent momentum at interaction
0050   // is stored, else = -1)
0051   int parentID() const { return parentID_; }
0052 
0053   void copyCrossedBoundaryVars(const TrackWithHistory* track) {
0054     if (track->crossedBoundary()) {
0055       crossedBoundary_ = track->crossedBoundary();
0056       idAtBoundary_ = track->getIDAtBoundary();
0057       positionAtBoundary_ = track->getPositionAtBoundary();
0058       momentumAtBoundary_ = track->getMomentumAtBoundary();
0059     }
0060   }
0061   bool crossedBoundary() const { return crossedBoundary_; }
0062   const math::XYZTLorentzVectorF& getPositionAtBoundary() const { return positionAtBoundary_; }
0063   const math::XYZTLorentzVectorF& getMomentumAtBoundary() const { return momentumAtBoundary_; }
0064   int getIDAtBoundary() const { return idAtBoundary_; }
0065 
0066 private:
0067   int id_;
0068   int ipart_;
0069   math::XYZVectorD ip_;
0070   double ie_;
0071   int ivert_;
0072   int igenpart_;
0073   int parentID_;
0074   math::XYZVectorD parentMomentum_{math::XYZVectorD(0., 0., 0.)};
0075   math::XYZVectorD tkSurfacePosition_{math::XYZVectorD(0., 0., 0.)};
0076   math::XYZTLorentzVectorD tkSurfaceMomentum_{math::XYZTLorentzVectorD(0., 0., 0., 0.)};
0077   bool crossedBoundary_{false};
0078   int idAtBoundary_{-1};
0079   math::XYZTLorentzVectorF positionAtBoundary_{math::XYZTLorentzVectorF(0.f, 0.f, 0.f, 0.f)};
0080   math::XYZTLorentzVectorF momentumAtBoundary_{math::XYZTLorentzVectorF(0.f, 0.f, 0.f, 0.f)};
0081 };
0082 
0083 #endif