CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/SimDataFormats/TrackingHit/interface/PSimHit.h

Go to the documentation of this file.
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; // for friend declaration only
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 
00121   void setTof(float tof) {theTof=tof;}
00122 
00123 protected:
00124   
00125   // properties
00126   Local3DPoint    theEntryPoint;    // position at entry
00127   Local3DVector   theSegment;       // exitPos - entryPos
00128   float           thePabs;          // momentum
00129   float           theEnergyLoss;    // Energy loss
00130   float           theThetaAtEntry;
00131   float           thePhiAtEntry;
00132 
00133   float           theTof;           // Time Of Flight 
00134   int             theParticleType;
00135   unsigned short  theProcessType;   // ID of the process which created the track
00136                                     // which created the PSimHit
00137 
00138   // association
00139   unsigned int    theDetUnitId;
00140   unsigned int    theTrackId;
00141   EncodedEventId  theEventId;
00142 
00143   friend class TrackingSlaveSD;
00144 };
00145 
00146 std::ostream & operator<<(std::ostream & o, const PSimHit & hit); 
00147 
00148 #endif // PSimHit_H