00001 #ifndef PSimHit_H
00002 #define PSimHit_H
00003
00004 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00005 #include "DataFormats/GeometryVector/interface/LocalVector.h"
00006 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
00007
00008 class TrackingSlaveSD;
00009
00015 class PSimHit {
00016 public:
00017
00018 PSimHit() : theDetUnitId(0) {}
00019
00020 PSimHit( const Local3DPoint& entry, const Local3DPoint& exit,
00021 float pabs, float tof, float eloss, int particleType,
00022 unsigned int detId, unsigned int trackId,
00023 float theta, float phi, unsigned short processType=0) :
00024 theEntryPoint( entry),
00025 theSegment(exit-entry),
00026 thePabs(pabs),
00027 theEnergyLoss(eloss),
00028 theThetaAtEntry(theta), thePhiAtEntry(phi),
00029 theTof(tof),
00030 theParticleType(particleType), theProcessType(processType),
00031 theDetUnitId( detId), theTrackId( trackId)
00032 {}
00033
00035 Local3DPoint entryPoint() const {return theEntryPoint;}
00036
00038 Local3DPoint exitPoint() const {return theEntryPoint + theSegment;}
00039
00044 Local3DPoint localPosition() const {return theEntryPoint + 0.5*theSegment;}
00045
00047 LocalVector momentumAtEntry() const {
00048 return LocalVector( thetaAtEntry(), phiAtEntry(), pabs());
00049 }
00050
00052 LocalVector localDirection() const {
00053 return LocalVector( thetaAtEntry(), phiAtEntry(), 1.f);
00054 }
00055
00057 Geom::Theta<float> thetaAtEntry() const { return Geom::Theta<float>(theThetaAtEntry);}
00058
00060 Geom::Phi<float> phiAtEntry() const { return Geom::Phi<float>(thePhiAtEntry);}
00061
00063 float pabs() const {return thePabs;}
00064
00069 float timeOfFlight() const {return tof();}
00070
00072 float tof() const {return theTof;}
00073
00075 float energyLoss() const {return theEnergyLoss;}
00076
00085 int particleType() const {return theParticleType;}
00086
00093 unsigned int detUnitId() const {return theDetUnitId;}
00094
00102 unsigned int trackId() const {return theTrackId;}
00103
00104
00105 EncodedEventId eventId() const {return theEventId;}
00106
00107
00108 void setEventId(EncodedEventId e) { theEventId = e; }
00109
00118 unsigned short processType() const {return theProcessType;}
00119
00120 protected:
00121
00122
00123 Local3DPoint theEntryPoint;
00124 Local3DVector theSegment;
00125 float thePabs;
00126 float theEnergyLoss;
00127 float theThetaAtEntry;
00128 float thePhiAtEntry;
00129
00130 float theTof;
00131 int theParticleType;
00132 unsigned short theProcessType;
00133
00134
00135
00136 unsigned int theDetUnitId;
00137 unsigned int theTrackId;
00138 EncodedEventId theEventId;
00139
00140 friend class TrackingSlaveSD;
00141 };
00142
00143 #include <iostream>
00144 inline std::ostream & operator<<(std::ostream & o, const PSimHit & hit)
00145 { return o << hit.detUnitId() << " " << hit.entryPoint() << " " << hit.tof(); }
00146
00147 #endif // PSimHit_H