File indexing completed on 2021-02-14 14:28:53
0001 #ifndef PSimHit_H
0002 #define PSimHit_H
0003
0004 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0005 #include "DataFormats/GeometryVector/interface/LocalVector.h"
0006 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0007
0008 class TrackingSlaveSD;
0009
0010
0011
0012
0013
0014
0015 class PSimHit {
0016 public:
0017 PSimHit() : theDetUnitId(0) {}
0018
0019 PSimHit(const Local3DPoint& entry,
0020 const Local3DPoint& exit,
0021 float pabs,
0022 float tof,
0023 float eloss,
0024 int particleType,
0025 unsigned int detId,
0026 unsigned int trackId,
0027 float theta,
0028 float phi,
0029 unsigned short processType = 0)
0030 : theEntryPoint(entry),
0031 theSegment(exit - entry),
0032 thePabs(pabs),
0033 theEnergyLoss(eloss),
0034 theThetaAtEntry(theta),
0035 thePhiAtEntry(phi),
0036 theTof(tof),
0037 theParticleType(particleType),
0038 theProcessType(processType),
0039 theDetUnitId(detId),
0040 theTrackId(trackId) {}
0041
0042
0043 Local3DPoint entryPoint() const { return theEntryPoint; }
0044
0045
0046 Local3DPoint exitPoint() const { return theEntryPoint + theSegment; }
0047
0048
0049
0050
0051
0052 Local3DPoint localPosition() const { return theEntryPoint + 0.5 * theSegment; }
0053
0054
0055 LocalVector momentumAtEntry() const { return LocalVector(thetaAtEntry(), phiAtEntry(), pabs()); }
0056
0057
0058 LocalVector localDirection() const { return LocalVector(thetaAtEntry(), phiAtEntry(), 1.f); }
0059
0060
0061 Geom::Theta<float> thetaAtEntry() const { return Geom::Theta<float>(theThetaAtEntry); }
0062
0063
0064 Geom::Phi<float> phiAtEntry() const { return Geom::Phi<float>(thePhiAtEntry); }
0065
0066
0067 float pabs() const { return thePabs; }
0068
0069
0070
0071
0072
0073 float timeOfFlight() const { return tof(); }
0074
0075
0076 float tof() const { return theTof; }
0077
0078
0079 float energyLoss() const { return theEnergyLoss; }
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 int particleType() const { return theParticleType; }
0090
0091
0092
0093
0094
0095
0096
0097 unsigned int detUnitId() const { return theDetUnitId; }
0098
0099
0100
0101
0102
0103
0104
0105
0106 unsigned int trackId() const { return theTrackId; }
0107
0108 EncodedEventId eventId() const { return theEventId; }
0109
0110 void setEventId(EncodedEventId e) { theEventId = e; }
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120 unsigned short processType() const { return theProcessType; }
0121
0122 void setTof(float tof) { theTof = tof; }
0123
0124 protected:
0125
0126 Local3DPoint theEntryPoint;
0127 Local3DVector theSegment;
0128 float thePabs;
0129 float theEnergyLoss;
0130 float theThetaAtEntry;
0131 float thePhiAtEntry;
0132
0133 float theTof;
0134 int theParticleType;
0135 unsigned short theProcessType;
0136
0137
0138
0139 unsigned int theDetUnitId;
0140 unsigned int theTrackId;
0141 EncodedEventId theEventId;
0142
0143 friend class TrackingSlaveSD;
0144 };
0145
0146 std::ostream& operator<<(std::ostream& o, const PSimHit& hit);
0147
0148 #endif